Added vesrion to update instance dialog. Added apply functionality to instance page. Replaced dialog launch in overview to link to instance tab

This commit is contained in:
2026-01-28 16:43:29 +01:00
parent deb69e6014
commit 9b11360a0e
3 changed files with 38 additions and 12 deletions

View File

@@ -1,13 +1,18 @@
@using LucideBlazor
@using Moonlight.Frontend.UI.Admin.Modals
@using Moonlight.Shared.Http.Responses.Admin
@using ShadcnBlazor.Cards
@using ShadcnBlazor.Emptys
@using ShadcnBlazor.Buttons
@using ShadcnBlazor.Extras.AlertDialogs
@using ShadcnBlazor.Extras.Common
@using ShadcnBlazor.Extras.Dialogs
@using ShadcnBlazor.Fields
@using ShadcnBlazor.Selects
@inject HttpClient HttpClient
@inject DialogService DialogService
@inject AlertDialogService AlertDialogService
<div class="mt-5">
<LazyLoader Load="LoadAsync">
@@ -31,18 +36,19 @@
<FieldLabel>
Version
</FieldLabel>
<Select DefaultValue="Testy">
<Select DefaultValue="@SelectedVersion" ValueChanged="x => SelectedVersion = x">
<SelectTrigger>
<SelectValue/>
</SelectTrigger>
<SelectContent>
<SelectItem Value="Testy">Testy</SelectItem>
<SelectItem Value="v2.1">v2.1</SelectItem>
<SelectItem Value="v2.1.1">v2.1.1</SelectItem>
</SelectContent>
</Select>
</Field>
</FieldSet>
<Field Orientation="FieldOrientation.Horizontal">
<Button>Apply</Button>
<Button @onclick="ApplyAsync">Apply</Button>
</Field>
</FieldGroup>
</CardContent>
@@ -55,7 +61,7 @@
<Empty>
<EmptyHeader>
<EmptyMedia Variant="EmptyMediaVariant.Icon">
<SearchIcon />
<SearchIcon/>
</EmptyMedia>
<EmptyTitle>No Plugins found</EmptyTitle>
<EmptyDescription>
@@ -103,9 +109,29 @@
@code
{
private ContainerHelperStatusDto StatusDto;
private string SelectedVersion = "v2.1";
private async Task LoadAsync(LazyLoader _)
{
StatusDto = (await HttpClient.GetFromJsonAsync<ContainerHelperStatusDto>("api/admin/ch/status"))!;
}
private async Task ApplyAsync()
{
await AlertDialogService.ConfirmDangerAsync(
"Moonlight Rebuild",
"If you continue the moonlight instance will become unavailable during the rebuild process. This will impact users on this instance",
async () =>
{
await DialogService.LaunchAsync<UpdateInstanceModal>(
parameters => { parameters[nameof(UpdateInstanceModal.Version)] = SelectedVersion; },
onConfigure: model =>
{
model.ShowCloseButton = false;
model.ClassName = "sm:max-w-4xl!";
}
);
}
);
}
}