@page "/admin"
@using LucideBlazor
@using Moonlight.Frontend.UI.Admin.Modals
@using Moonlight.Shared.Http.Responses.Admin
@using ShadcnBlazor.Buttons
@using ShadcnBlazor.Cards
@using ShadcnBlazor.Extras.Dialogs
@using ShadcnBlazor.Spinners
@inject HttpClient HttpClient
@inject DialogService DialogService
Overview
Here you can see a quick overview of your moonlight instance
@if (IsInfoLoading || InfoResponse == null)
{
}
else
{
CPU Usage
@Math.Round(InfoResponse.CpuUsage, 2)%
}
@if (IsInfoLoading || InfoResponse == null)
{
}
else
{
Memory Usage
@Formatter.FormatSize(InfoResponse.MemoryUsage)
}
@if (IsInfoLoading || InfoResponse == null)
{
}
else
{
Operating System
@InfoResponse.OperatingSystem
}
@if (IsInfoLoading || InfoResponse == null)
{
}
else
{
Uptime
@Formatter.FormatDuration(InfoResponse.Uptime)
}
@if (IsInfoLoading || InfoResponse == null)
{
}
else
{
Version
@InfoResponse.VersionName
}
@if (IsInfoLoading || InfoResponse == null)
{
}
else
{
Update Status
@if (InfoResponse.IsUpToDate)
{
Up-to-date
}
else
{
Update available
}
}
@code
{
private bool IsInfoLoading = true;
private SystemInfoDto? InfoResponse;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if(!firstRender)
return;
InfoResponse = await HttpClient.GetFromJsonAsync("api/admin/system/info", Constants.SerializerOptions);
IsInfoLoading = false;
await InvokeAsync(StateHasChanged);
}
private async Task LaunchUpdateModalAsync() => await DialogService.LaunchAsync(onConfigure: model =>
{
model.ShowCloseButton = false;
});
}