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

@@ -12,7 +12,7 @@
<DialogHeader> <DialogHeader>
<DialogTitle> <DialogTitle>
Updating instance... Updating instance to @Version...
</DialogTitle> </DialogTitle>
</DialogHeader> </DialogHeader>
@@ -75,6 +75,8 @@ else
@code @code
{ {
[Parameter] public string Version { get; set; }
private int Progress; private int Progress;
private int CurrentStep; private int CurrentStep;

View File

@@ -133,7 +133,11 @@
{ {
<CardTitle ClassName="text-lg text-primary">Update available</CardTitle> <CardTitle ClassName="text-lg text-primary">Update available</CardTitle>
<CardAction ClassName="self-center"> <CardAction ClassName="self-center">
<Button @onclick="LaunchUpdateModalAsync">Update</Button> <Button>
<Slot>
<a href="/admin/system?tab=instance" @attributes="context">Update</a>
</Slot>
</Button>
</CardAction> </CardAction>
} }
</CardHeader> </CardHeader>
@@ -156,10 +160,4 @@
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
} }
private async Task LaunchUpdateModalAsync() => await DialogService.LaunchAsync<UpdateInstanceModal>(onConfigure: model =>
{
model.ShowCloseButton = false;
model.ClassName = "sm:max-w-4xl!";
});
} }

View File

@@ -1,13 +1,18 @@
@using LucideBlazor @using LucideBlazor
@using Moonlight.Frontend.UI.Admin.Modals
@using Moonlight.Shared.Http.Responses.Admin @using Moonlight.Shared.Http.Responses.Admin
@using ShadcnBlazor.Cards @using ShadcnBlazor.Cards
@using ShadcnBlazor.Emptys @using ShadcnBlazor.Emptys
@using ShadcnBlazor.Buttons @using ShadcnBlazor.Buttons
@using ShadcnBlazor.Extras.AlertDialogs
@using ShadcnBlazor.Extras.Common @using ShadcnBlazor.Extras.Common
@using ShadcnBlazor.Extras.Dialogs
@using ShadcnBlazor.Fields @using ShadcnBlazor.Fields
@using ShadcnBlazor.Selects @using ShadcnBlazor.Selects
@inject HttpClient HttpClient @inject HttpClient HttpClient
@inject DialogService DialogService
@inject AlertDialogService AlertDialogService
<div class="mt-5"> <div class="mt-5">
<LazyLoader Load="LoadAsync"> <LazyLoader Load="LoadAsync">
@@ -31,18 +36,19 @@
<FieldLabel> <FieldLabel>
Version Version
</FieldLabel> </FieldLabel>
<Select DefaultValue="Testy"> <Select DefaultValue="@SelectedVersion" ValueChanged="x => SelectedVersion = x">
<SelectTrigger> <SelectTrigger>
<SelectValue/> <SelectValue/>
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem Value="Testy">Testy</SelectItem> <SelectItem Value="v2.1">v2.1</SelectItem>
<SelectItem Value="v2.1.1">v2.1.1</SelectItem>
</SelectContent> </SelectContent>
</Select> </Select>
</Field> </Field>
</FieldSet> </FieldSet>
<Field Orientation="FieldOrientation.Horizontal"> <Field Orientation="FieldOrientation.Horizontal">
<Button>Apply</Button> <Button @onclick="ApplyAsync">Apply</Button>
</Field> </Field>
</FieldGroup> </FieldGroup>
</CardContent> </CardContent>
@@ -103,9 +109,29 @@
@code @code
{ {
private ContainerHelperStatusDto StatusDto; private ContainerHelperStatusDto StatusDto;
private string SelectedVersion = "v2.1";
private async Task LoadAsync(LazyLoader _) private async Task LoadAsync(LazyLoader _)
{ {
StatusDto = (await HttpClient.GetFromJsonAsync<ContainerHelperStatusDto>("api/admin/ch/status"))!; 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!";
}
);
}
);
}
} }