[CHANGE] Channel & Account list to view models
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
@page "/Accounts"
|
||||
@using Manager.App.Controllers
|
||||
@using Manager.App.Models.Settings
|
||||
@using Manager.App.Services.System
|
||||
@using Microsoft.Extensions.Options
|
||||
@@ -26,14 +27,18 @@
|
||||
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"></MudTextField>
|
||||
</ToolBarContent>
|
||||
<HeaderContent>
|
||||
<MudTh></MudTh>
|
||||
<MudTh>Name</MudTh>
|
||||
<MudTh>Handle</MudTh>
|
||||
<MudTh>ID</MudTh>
|
||||
<MudTh>Cookies</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd>@context.Channel?.Name</MudTd>
|
||||
<MudTd>@context.Channel?.Handle</MudTd>
|
||||
<MudTd><MudImage Src="@(FileController.CreateProvideUrl(context.AvatarFileId))" Height="40"/></MudTd>
|
||||
<MudTd>@context.Name</MudTd>
|
||||
<MudTd>@context.Handle</MudTd>
|
||||
<MudTd>@context.Id</MudTd>
|
||||
<MudTd>@context.HasCookies</MudTd>
|
||||
</RowTemplate>
|
||||
<NoRecordsContent>
|
||||
<MudText>No channels found</MudText>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Manager.App.Components.Dialogs;
|
||||
using Manager.App.Models.Library;
|
||||
using Manager.Data.Entities.LibraryContext;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
@@ -8,14 +7,14 @@ namespace Manager.App.Components.Pages;
|
||||
|
||||
public partial class Accounts : ComponentBase
|
||||
{
|
||||
private MudTable<ClientAccountEntity>? _table;
|
||||
private MudTable<AccountListView>? _table;
|
||||
private readonly DialogOptions _dialogOptions = new() { BackdropClick = false, CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.ExtraLarge };
|
||||
private string _search = "";
|
||||
|
||||
private async Task<TableData<ClientAccountEntity>> ServerReload(TableState state, CancellationToken token)
|
||||
private async Task<TableData<AccountListView>> ServerReload(TableState state, CancellationToken token)
|
||||
{
|
||||
var results = await LibraryService.GetAccountsAsync(_search, state.Page * state.PageSize, state.PageSize, token);
|
||||
return !results.IsSuccess ? new TableData<ClientAccountEntity>() : new TableData<ClientAccountEntity>() { Items = results.Value, TotalItems = results.Total };
|
||||
return !results.IsSuccess ? new TableData<AccountListView>() : new TableData<AccountListView> { Items = results.Value, TotalItems = results.Total };
|
||||
}
|
||||
|
||||
private void OnSearch(string text)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@page "/Channels"
|
||||
@using Manager.App.Controllers
|
||||
|
||||
@inject ILibraryService LibraryService
|
||||
|
||||
@@ -13,11 +14,13 @@
|
||||
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"></MudTextField>
|
||||
</ToolBarContent>
|
||||
<HeaderContent>
|
||||
<MudTh></MudTh>
|
||||
<MudTh>Name</MudTh>
|
||||
<MudTh>Handle</MudTh>
|
||||
<MudTh>Channel id</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd><MudImage Src="@(FileController.CreateProvideUrl(context.AvatarFileId))" Height="40"/></MudTd>
|
||||
<MudTd>@context.Name</MudTd>
|
||||
<MudTd>@context.Handle</MudTd>
|
||||
<MudTd>@context.Id</MudTd>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Manager.Data.Entities.LibraryContext;
|
||||
using Manager.App.Models.Library;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
@@ -6,13 +6,13 @@ namespace Manager.App.Components.Pages;
|
||||
|
||||
public partial class Channels : ComponentBase
|
||||
{
|
||||
private MudTable<ChannelEntity>? _table;
|
||||
private MudTable<ChannelListView>? _table;
|
||||
private string _search = "";
|
||||
|
||||
private async Task<TableData<ChannelEntity>> ServerReload(TableState state, CancellationToken token)
|
||||
private async Task<TableData<ChannelListView>> ServerReload(TableState state, CancellationToken token)
|
||||
{
|
||||
var results = await LibraryService.GetChannelsAsync(_search, state.Page * state.PageSize, state.PageSize, token);
|
||||
return !results.IsSuccess ? new TableData<ChannelEntity>() : new TableData<ChannelEntity> { Items = results.Value, TotalItems = results.Total };
|
||||
return !results.IsSuccess ? new TableData<ChannelListView>() : new TableData<ChannelListView> { Items = results.Value, TotalItems = results.Total };
|
||||
}
|
||||
|
||||
private void OnSearch(string text)
|
||||
|
||||
Reference in New Issue
Block a user