Upgraded mooncore. Done required refactoring to function with new version
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
@page "/admin/servers/all"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.Common
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Models
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Servers
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Grid
|
||||
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
||||
@using MoonCore.Common
|
||||
@using Moonlight.Shared.Http.Responses.Admin.Users
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
@@ -32,8 +33,7 @@
|
||||
|
||||
<DataGrid @ref="Grid"
|
||||
TGridItem="ServerResponse"
|
||||
EnablePagination="true"
|
||||
ItemsProvider="ItemsProviderAsync">
|
||||
ItemSource="ItemSource">
|
||||
<PropertyColumn Field="x => x.Id"/>
|
||||
<TemplateColumn Title="Name">
|
||||
<td>
|
||||
@@ -99,11 +99,11 @@
|
||||
private Dictionary<int, NodeResponse> Nodes = new();
|
||||
private Dictionary<int, UserResponse> Users = new();
|
||||
|
||||
private async Task<DataGridItemResult<ServerResponse>> ItemsProviderAsync(
|
||||
DataGridItemRequest request
|
||||
)
|
||||
private ItemSource<ServerResponse> ItemSource => ItemSourceFactory.From(LoadAsync);
|
||||
|
||||
private async Task<IEnumerable<ServerResponse>> LoadAsync(int startIndex, int count)
|
||||
{
|
||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
||||
var query = $"?startIndex={startIndex}&count={count}";
|
||||
|
||||
var countedData = await ApiClient.GetJson<CountedData<ServerResponse>>($"api/admin/servers{query}");
|
||||
|
||||
@@ -142,11 +142,7 @@
|
||||
Users[user.Id] = user;
|
||||
}
|
||||
|
||||
return new()
|
||||
{
|
||||
Items = countedData.Items,
|
||||
TotalCount = countedData.TotalCount
|
||||
};
|
||||
return countedData;
|
||||
}
|
||||
|
||||
private async Task DeleteAsync(ServerResponse response)
|
||||
|
||||
Reference in New Issue
Block a user