Implemented node system statistics
This commit is contained in:
90
MoonlightServers.Frontend/Admin/Nodes/View.razor
Normal file
90
MoonlightServers.Frontend/Admin/Nodes/View.razor
Normal file
@@ -0,0 +1,90 @@
|
||||
@page "/admin/servers/nodes/{Id:int}"
|
||||
|
||||
@using LucideBlazor
|
||||
@using MoonlightServers.Shared
|
||||
@using MoonlightServers.Shared.Admin.Nodes
|
||||
@using ShadcnBlazor.Emptys
|
||||
@using ShadcnBlazor.Extras.Common
|
||||
@using ShadcnBlazor.Buttons
|
||||
@using ShadcnBlazor.Tab
|
||||
|
||||
@inject HttpClient HttpClient
|
||||
|
||||
@attribute [Authorize(Policy = Permissions.Nodes.View)]
|
||||
|
||||
<LazyLoader Load="LoadAsync">
|
||||
@if (Dto == null)
|
||||
{
|
||||
<Empty>
|
||||
<EmptyHeader>
|
||||
<EmptyMedia Variant="EmptyMediaVariant.Icon">
|
||||
<SearchIcon/>
|
||||
</EmptyMedia>
|
||||
<EmptyTitle>Node not found</EmptyTitle>
|
||||
<EmptyDescription>
|
||||
A node with this id cannot be found
|
||||
</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="flex flex-row justify-between">
|
||||
<div class="flex flex-col">
|
||||
<h1 class="text-xl font-semibold">@Dto.Name</h1>
|
||||
<div class="text-muted-foreground">
|
||||
View details for @Dto.Name
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row gap-x-1.5">
|
||||
<Button Variant="ButtonVariant.Secondary">
|
||||
<Slot>
|
||||
<a href="/admin/servers?tab=nodes" @attributes="context">
|
||||
<ChevronLeftIcon/>
|
||||
Back
|
||||
</a>
|
||||
</Slot>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-8">
|
||||
<Tabs DefaultValue="statistics">
|
||||
<TabsList ClassName="inline-flex w-full lg:w-fit justify-start overflow-x-auto overflow-y-hidden">
|
||||
<TabsTrigger Value="statistics">
|
||||
<ChartColumnBigIcon/>
|
||||
Statistics
|
||||
</TabsTrigger>
|
||||
<TabsTrigger Value="settings">
|
||||
<SettingsIcon/>
|
||||
Settings
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
<TabsContent Value="statistics">
|
||||
<StatisticsTab Node="Dto" />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent Value="settings">
|
||||
<SettingsTab Node="Dto" />
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
</div>
|
||||
}
|
||||
</LazyLoader>
|
||||
|
||||
@code
|
||||
{
|
||||
[Parameter] public int Id { get; set; }
|
||||
|
||||
private NodeDto? Dto;
|
||||
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
Dto = await HttpClient.GetFromJsonAsync<NodeDto>(
|
||||
$"api/admin/servers/nodes/{Id}",
|
||||
SerializationContext.Default.Options
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user