Started refactoring to be compatible with the changed nuget packages and the mooncore changes
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System.IO.Enumeration;
|
||||
using MoonCore.Blazor.FlyonUi.Helpers;
|
||||
using MoonCore.Blazor.Tailwind.Fm;
|
||||
using MoonCore.Blazor.Tailwind.Fm.Models;
|
||||
using MoonCore.Blazor.Tailwind.Services;
|
||||
|
||||
@@ -16,10 +16,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.5"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.5" PrivateAssets="all"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.7"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.5" />
|
||||
<PackageReference Include="Moonlight.Client" Version="2.1.0"/>
|
||||
<PackageReference Include="Moonlight.Client" Version="2.1.3"/>
|
||||
<PackageReference Include="XtermBlazor" Version="2.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Moonlight.Client;
|
||||
using Moonlight.Client.Startup;
|
||||
using MoonlightServers.Frontend.Startup;
|
||||
|
||||
// Development Client Startup
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals.Components
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
||||
|
||||
@inherits BaseModal
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Add a new allocation</h1>
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals.Components
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
||||
|
||||
@inherits BaseModal
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Add a range of new allocations</h1>
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals.Components
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Helpers
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
||||
|
||||
@inherits BaseModal
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Update allocation</h1>
|
||||
|
||||
@@ -30,7 +31,7 @@
|
||||
@code
|
||||
{
|
||||
[Parameter] public Func<UpdateNodeAllocationRequest, Task> OnSubmit { get; set; }
|
||||
[Parameter] public NodeAllocationDetailResponse Allocation { get; set; }
|
||||
[Parameter] public NodeAllocationResponse Allocation { get; set; }
|
||||
|
||||
private UpdateNodeAllocationRequest Form;
|
||||
private HandleForm HandleForm;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.DataTables
|
||||
@using MoonCore.Blazor.FlyonUi.Modals
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Alerts
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
||||
@using MoonCore.Blazor.Tailwind.Dt
|
||||
@@ -31,13 +35,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-1 md:col-span-2 -mb-3">
|
||||
<DataTable @ref="Table" TItem="NodeAllocationDetailResponse">
|
||||
<DataTable @ref="Table" TItem="NodeAllocationResponse">
|
||||
<Configuration>
|
||||
<Pagination TItem="NodeAllocationDetailResponse" ItemSource="LoadData" />
|
||||
<Pagination TItem="NodeAllocationResponse" ItemSource="LoadData" />
|
||||
|
||||
<DataTableColumn TItem="NodeAllocationDetailResponse" Field="@(x => x.IpAddress)" Name="IP Address"/>
|
||||
<DataTableColumn TItem="NodeAllocationDetailResponse" Field="@(x => x.Port)" Name="Port"/>
|
||||
<DataTableColumn TItem="NodeAllocationDetailResponse">
|
||||
<DataTableColumn TItem="NodeAllocationResponse" Field="@(x => x.IpAddress)" Name="IP Address"/>
|
||||
<DataTableColumn TItem="NodeAllocationResponse" Field="@(x => x.Port)" Name="Port"/>
|
||||
<DataTableColumn TItem="NodeAllocationResponse">
|
||||
<ColumnTemplate>
|
||||
<div class="flex justify-end items-center">
|
||||
<a @onclick="() => UpdateAllocation(context)" @onclick:preventDefault href="#"
|
||||
@@ -58,13 +62,13 @@
|
||||
|
||||
@code
|
||||
{
|
||||
[Parameter] public NodeDetailResponse Node { get; set; }
|
||||
[Parameter] public NodeResponse Node { get; set; }
|
||||
|
||||
private DataTable<NodeAllocationDetailResponse> Table;
|
||||
private DataTable<NodeAllocationResponse> Table;
|
||||
|
||||
private async Task<IPagedData<NodeAllocationDetailResponse>> LoadData(PaginationOptions options)
|
||||
private async Task<IPagedData<NodeAllocationResponse>> LoadData(PaginationOptions options)
|
||||
{
|
||||
return await ApiClient.GetJson<PagedData<NodeAllocationDetailResponse>>(
|
||||
return await ApiClient.GetJson<PagedData<NodeAllocationResponse>>(
|
||||
$"api/admin/servers/nodes/{Node.Id}/allocations?page={options.Page}&pageSize={options.PerPage}"
|
||||
);
|
||||
}
|
||||
@@ -98,7 +102,7 @@
|
||||
await ModalService.Launch<CreateAllocationModal>(parameters => { parameters.Add("OnSubmit", onSubmit); });
|
||||
}
|
||||
|
||||
private async Task UpdateAllocation(NodeAllocationDetailResponse allocation)
|
||||
private async Task UpdateAllocation(NodeAllocationResponse allocation)
|
||||
{
|
||||
Func<UpdateNodeAllocationRequest, Task> onSubmit = async request =>
|
||||
{
|
||||
@@ -115,7 +119,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
private async Task DeleteAllocation(NodeAllocationDetailResponse allocation)
|
||||
private async Task DeleteAllocation(NodeAllocationResponse allocation)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
"Delete allocation",
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Blazor.Tailwind.Toasts
|
||||
@using MoonCore.Helpers
|
||||
@@ -170,7 +172,7 @@
|
||||
|
||||
@code
|
||||
{
|
||||
[Parameter] public NodeDetailResponse Node { get; set; }
|
||||
[Parameter] public NodeResponse Node { get; set; }
|
||||
|
||||
private StatisticsResponse Statistics;
|
||||
private DockerStatisticsResponse DockerStatistics;
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
{
|
||||
[Parameter] public CreateServerRequest Request { get; set; }
|
||||
|
||||
private async Task<NodeAllocationDetailResponse[]> Loader()
|
||||
private async Task<NodeAllocationResponse[]> Loader()
|
||||
{
|
||||
// Handle unselected node
|
||||
if (Request.NodeId <= 0)
|
||||
return [];
|
||||
|
||||
var items = await PagedData<NodeAllocationDetailResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<NodeAllocationDetailResponse>>(
|
||||
var items = await PagedData<NodeAllocationResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<NodeAllocationResponse>>(
|
||||
$"api/admin/servers/nodes/{Request.NodeId}/allocations/free?page={page}&pageSize={pageSize}"
|
||||
)
|
||||
);
|
||||
|
||||
@@ -102,10 +102,10 @@
|
||||
return items;
|
||||
}
|
||||
|
||||
private async Task<NodeDetailResponse[]> LoadNodes()
|
||||
private async Task<NodeResponse[]> LoadNodes()
|
||||
{
|
||||
var items = await PagedData<NodeDetailResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<NodeDetailResponse>>(
|
||||
var items = await PagedData<NodeResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<NodeResponse>>(
|
||||
$"api/admin/servers/nodes?page={page}&pageSize={pageSize}"
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonlightServers.Shared.Enums
|
||||
@using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Helpers
|
||||
@using MoonlightServers.Frontend.Services
|
||||
@using MoonCore.Blazor.Tailwind.Fm
|
||||
@using MoonCore.Blazor.Tailwind.Services
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Alerts
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Modals
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Alerts
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Blazor.Tailwind.Toasts
|
||||
@using MoonlightServers.Frontend.Services
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
@code
|
||||
{
|
||||
[Parameter] public UpdateServerRequest Request { get; set; }
|
||||
[Parameter] public ServerDetailResponse Server { get; set; }
|
||||
[Parameter] public ServerResponse Server { get; set; }
|
||||
|
||||
private async Task<NodeAllocationDetailResponse[]> Loader()
|
||||
private async Task<NodeAllocationResponse[]> Loader()
|
||||
{
|
||||
var items = await PagedData<NodeAllocationDetailResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<NodeAllocationDetailResponse>>(
|
||||
var items = await PagedData<NodeAllocationResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<NodeAllocationResponse>>(
|
||||
$"api/admin/servers/nodes/{Server.NodeId}/allocations/free?page={page}&pageSize={pageSize}&serverId={Server.Id}"
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@@ -43,10 +44,10 @@
|
||||
@code
|
||||
{
|
||||
[Parameter] public UpdateServerRequest Request { get; set; }
|
||||
[Parameter] public ServerDetailResponse Server { get; set; }
|
||||
[Parameter] public ServerResponse Server { get; set; }
|
||||
|
||||
private StarVariableDetailResponse[] StarVariables;
|
||||
private ServerVariableDetailResponse[] Variables;
|
||||
private ServerVariableResponse[] Variables;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
{
|
||||
@@ -56,14 +57,14 @@
|
||||
)
|
||||
);
|
||||
|
||||
Variables = await PagedData<ServerVariableDetailResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<ServerVariableDetailResponse>>(
|
||||
Variables = await PagedData<ServerVariableResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<ServerVariableResponse>>(
|
||||
$"api/admin/servers/{Server.Id}/variables?page={page}&pageSize={pageSize}"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private async Task UpdateValue(ServerVariableDetailResponse serverVariable, ChangeEventArgs args)
|
||||
private async Task UpdateValue(ServerVariableResponse serverVariable, ChangeEventArgs args)
|
||||
{
|
||||
var value = args.Value?.ToString() ?? "";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonlightServers.Shared.Enums
|
||||
@using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals.Components
|
||||
@using MoonlightServers.Shared.Enums
|
||||
@using MoonlightServers.Frontend.UI.Components.Forms
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages
|
||||
|
||||
@inherits BaseModal
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Add a new variable</h1>
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals.Components
|
||||
@using MoonlightServers.Shared.Enums
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonlightServers.Shared.Models
|
||||
|
||||
@inherits BaseModal
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Add a new parse configuration</h1>
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals.Components
|
||||
@using MoonlightServers.Shared.Enums
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.StarVariables
|
||||
@using MoonlightServers.Frontend.UI.Components.Forms
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
|
||||
@inherits BaseModal
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Add a new variable</h1>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals.Components
|
||||
@using MoonlightServers.Frontend.UI.Components.Forms
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@@ -5,7 +6,7 @@
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages
|
||||
|
||||
@inherits BaseModal
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Update variable</h1>
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals.Components
|
||||
@using MoonlightServers.Shared.Enums
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Helpers
|
||||
@using MoonlightServers.Shared.Models
|
||||
|
||||
@inherits BaseModal
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Update parse configuration</h1>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals.Components
|
||||
@using MoonlightServers.Shared.Enums
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.StarVariables
|
||||
@@ -6,7 +7,7 @@
|
||||
@using MoonCore.Helpers
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.StarVariables
|
||||
|
||||
@inherits BaseModal
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Update variable</h1>
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Modals
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Alerts
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Ace
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.Stars
|
||||
@using MoonCore.Blazor.Tailwind.Ace
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Models
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
@using System.Text.Json
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.Modals
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Alerts
|
||||
@using MoonCore.Blazor.Tailwind.Modals
|
||||
@using MoonCore.Blazor.Tailwind.Toasts
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Modals
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Alerts
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page "/admin/servers/all/create"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Blazor.Tailwind.Toasts
|
||||
@using MoonCore.Helpers
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
@page "/admin/servers/all"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.DataTables
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Alerts
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Models
|
||||
@@ -28,13 +31,13 @@
|
||||
</PageHeader>
|
||||
</div>
|
||||
|
||||
<DataTable @ref="Table" TItem="ServerDetailResponse">
|
||||
<DataTable @ref="Table" TItem="ServerResponse">
|
||||
<Configuration>
|
||||
<Pagination TItem="ServerDetailResponse" ItemSource="LoadData" />
|
||||
<Pagination TItem="ServerResponse" ItemSource="LoadData" />
|
||||
|
||||
<DataTableColumn TItem="ServerDetailResponse" Field="@(x => x.Id)" Name="Id"/>
|
||||
<DataTableColumn TItem="ServerDetailResponse" Field="@(x => x.Name)" Name="Name"/>
|
||||
<DataTableColumn TItem="ServerDetailResponse" Field="@(x => x.NodeId)" Name="Node">
|
||||
<DataTableColumn TItem="ServerResponse" Field="@(x => x.Id)" Name="Id"/>
|
||||
<DataTableColumn TItem="ServerResponse" Field="@(x => x.Name)" Name="Name"/>
|
||||
<DataTableColumn TItem="ServerResponse" Field="@(x => x.NodeId)" Name="Node">
|
||||
<ColumnTemplate>
|
||||
@{
|
||||
var node = Nodes.FirstOrDefault(x => x.Id == context.NodeId);
|
||||
@@ -45,7 +48,7 @@
|
||||
</span>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="ServerDetailResponse" Field="@(x => x.StarId)" Name="Star">
|
||||
<DataTableColumn TItem="ServerResponse" Field="@(x => x.StarId)" Name="Star">
|
||||
<ColumnTemplate>
|
||||
@{
|
||||
var star = Stars.FirstOrDefault(x => x.Id == context.StarId);
|
||||
@@ -56,7 +59,7 @@
|
||||
</span>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="ServerDetailResponse">
|
||||
<DataTableColumn TItem="ServerResponse">
|
||||
<ColumnTemplate>
|
||||
<div class="flex justify-end">
|
||||
<a href="/admin/servers/all/update/@(context.Id)" class="text-primary mr-2 sm:mr-3">
|
||||
@@ -75,21 +78,21 @@
|
||||
|
||||
@code
|
||||
{
|
||||
private DataTable<ServerDetailResponse> Table;
|
||||
private DataTable<ServerResponse> Table;
|
||||
|
||||
private List<StarDetailResponse> Stars = new();
|
||||
private List<NodeDetailResponse> Nodes = new();
|
||||
private List<NodeResponse> Nodes = new();
|
||||
|
||||
private async Task<IPagedData<ServerDetailResponse>> LoadData(PaginationOptions options)
|
||||
private async Task<IPagedData<ServerResponse>> LoadData(PaginationOptions options)
|
||||
{
|
||||
// Clear potential previous data
|
||||
var data = await ApiClient.GetJson<PagedData<ServerDetailResponse>>($"api/admin/servers?page={options.Page}&pageSize={options.PerPage}");
|
||||
var data = await ApiClient.GetJson<PagedData<ServerResponse>>($"api/admin/servers?page={options.Page}&pageSize={options.PerPage}");
|
||||
|
||||
foreach (var item in data.Items)
|
||||
{
|
||||
if (Nodes.All(x => x.Id != item.NodeId))
|
||||
{
|
||||
var node = await ApiClient.GetJson<NodeDetailResponse>($"api/admin/servers/nodes/{item.NodeId}");
|
||||
var node = await ApiClient.GetJson<NodeResponse>($"api/admin/servers/nodes/{item.NodeId}");
|
||||
Nodes.Add(node);
|
||||
}
|
||||
|
||||
@@ -103,14 +106,14 @@
|
||||
return data;
|
||||
}
|
||||
|
||||
private async Task Delete(ServerDetailResponse detailResponse)
|
||||
private async Task Delete(ServerResponse response)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
"Server deletion",
|
||||
$"Do you really want to delete the server '{detailResponse.Name}'",
|
||||
$"Do you really want to delete the server '{response.Name}'",
|
||||
async () =>
|
||||
{
|
||||
await ApiClient.Delete($"api/admin/servers/{detailResponse.Id}");
|
||||
await ApiClient.Delete($"api/admin/servers/{response.Id}");
|
||||
await ToastService.Success("Successfully deleted server");
|
||||
|
||||
await Table.Refresh();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page "/admin/servers/all/update/{Id:int}"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Blazor.Tailwind.Toasts
|
||||
@using MoonCore.Helpers
|
||||
@@ -51,11 +53,11 @@
|
||||
|
||||
private HandleForm Form;
|
||||
private UpdateServerRequest Request;
|
||||
private ServerDetailResponse Server;
|
||||
private ServerResponse Server;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
{
|
||||
Server = await ApiClient.GetJson<ServerDetailResponse>($"api/admin/servers/{Id}");
|
||||
Server = await ApiClient.GetJson<ServerResponse>($"api/admin/servers/{Id}");
|
||||
Request = Mapper.Map<UpdateServerRequest>(Server);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page "/admin/servers/nodes/create"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Blazor.Tailwind.Toasts
|
||||
@using MoonCore.Helpers
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
@page "/admin/servers/nodes"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.DataTables
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Alerts
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Models
|
||||
@@ -31,20 +34,20 @@
|
||||
</PageHeader>
|
||||
</div>
|
||||
|
||||
<DataTable TItem="NodeDetailResponse">
|
||||
<DataTable TItem="NodeResponse">
|
||||
<Configuration>
|
||||
<Pagination TItem="NodeDetailResponse" ItemSource="LoadData"/>
|
||||
<Pagination TItem="NodeResponse" ItemSource="LoadData"/>
|
||||
|
||||
<DataTableColumn TItem="NodeDetailResponse" Field="@(x => x.Id)" Name="Id"/>
|
||||
<DataTableColumn TItem="NodeDetailResponse" Field="@(x => x.Name)" Name="Name">
|
||||
<DataTableColumn TItem="NodeResponse" Field="@(x => x.Id)" Name="Id"/>
|
||||
<DataTableColumn TItem="NodeResponse" Field="@(x => x.Name)" Name="Name">
|
||||
<ColumnTemplate>
|
||||
<a class="text-primary" href="/admin/servers/nodes/update/@(context.Id)">
|
||||
@context.Name
|
||||
</a>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="NodeDetailResponse" Field="@(x => x.Fqdn)" Name="Fqdn"/>
|
||||
<DataTableColumn TItem="NodeDetailResponse" Field="@(x => x.Fqdn)" Name="Status">
|
||||
<DataTableColumn TItem="NodeResponse" Field="@(x => x.Fqdn)" Name="Fqdn"/>
|
||||
<DataTableColumn TItem="NodeResponse" Field="@(x => x.Fqdn)" Name="Status">
|
||||
<ColumnTemplate>
|
||||
@{
|
||||
var isFetched = StatusResponses.TryGetValue(context.Id, out var data);
|
||||
@@ -92,7 +95,7 @@
|
||||
}
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="NodeDetailResponse"
|
||||
<DataTableColumn TItem="NodeResponse"
|
||||
Name="Utilization"
|
||||
HeaderCss="p-2 font-semibold text-left hidden xl:table-cell"
|
||||
ColumnCss="p-2 text-left font-normal hidden xl:table-cell">
|
||||
@@ -138,7 +141,7 @@
|
||||
}
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="NodeDetailResponse">
|
||||
<DataTableColumn TItem="NodeResponse">
|
||||
<ColumnTemplate>
|
||||
<div class="flex justify-end">
|
||||
<a href="/admin/servers/nodes/update/@(context.Id)" class="text-primary mr-2 sm:mr-3">
|
||||
@@ -157,17 +160,17 @@
|
||||
|
||||
@code
|
||||
{
|
||||
private DataTable<NodeDetailResponse> Table;
|
||||
private DataTable<NodeResponse> Table;
|
||||
|
||||
private Dictionary<int, NodeSystemStatusResponse?> StatusResponses = new();
|
||||
private Dictionary<int, StatisticsResponse?> Statistics = new();
|
||||
|
||||
private async Task<IPagedData<NodeDetailResponse>> LoadData(PaginationOptions options)
|
||||
private async Task<IPagedData<NodeResponse>> LoadData(PaginationOptions options)
|
||||
{
|
||||
Statistics.Clear();
|
||||
StatusResponses.Clear();
|
||||
|
||||
var result = await ApiClient.GetJson<PagedData<NodeDetailResponse>>(
|
||||
var result = await ApiClient.GetJson<PagedData<NodeResponse>>(
|
||||
$"api/admin/servers/nodes?page={options.Page}&pageSize={options.PerPage}"
|
||||
);
|
||||
|
||||
@@ -214,14 +217,14 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task Delete(NodeDetailResponse detailResponse)
|
||||
private async Task Delete(NodeResponse response)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
"Node deletion",
|
||||
$"Do you really want to delete the node '{detailResponse.Name}'",
|
||||
$"Do you really want to delete the node '{response.Name}'",
|
||||
async () =>
|
||||
{
|
||||
await ApiClient.Delete($"api/admin/servers/nodes/{detailResponse.Id}");
|
||||
await ApiClient.Delete($"api/admin/servers/nodes/{response.Id}");
|
||||
await ToastService.Success("Successfully deleted node");
|
||||
|
||||
await Table.Refresh();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page "/admin/servers/nodes/update/{Id:int}"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Blazor.Tailwind.Toasts
|
||||
@using MoonCore.Helpers
|
||||
@@ -56,11 +58,11 @@
|
||||
|
||||
private HandleForm Form;
|
||||
private UpdateNodeRequest Request;
|
||||
private NodeDetailResponse Node;
|
||||
private NodeResponse Node;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
{
|
||||
Node = await ApiClient.GetJson<NodeDetailResponse>($"api/admin/servers/nodes/{Id}");
|
||||
Node = await ApiClient.GetJson<NodeResponse>($"api/admin/servers/nodes/{Id}");
|
||||
Request = Mapper.Map<UpdateNodeRequest>(Node);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
@page "/admin/servers/stars/create"
|
||||
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Blazor.Tailwind.Toasts
|
||||
@using MoonCore.Helpers
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
@page "/admin/servers/stars"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.DataTables
|
||||
@using MoonCore.Blazor.FlyonUi.Helpers
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Alerts
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Models
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page "/admin/servers/stars/update/{Id:int}"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Blazor.Tailwind.Toasts
|
||||
@using MoonCore.Helpers
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@page "/servers"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonlightServers.Frontend.UI.Components.Servers
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Models
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@page "/servers/{ServerId:int}/{TabPath:alpha}"
|
||||
|
||||
@using Microsoft.AspNetCore.SignalR.Client
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Exceptions
|
||||
@using MoonCore.Helpers
|
||||
|
||||
Reference in New Issue
Block a user