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:
@@ -12,7 +12,7 @@
|
||||
|
||||
<DialogHeader>
|
||||
<DialogTitle>
|
||||
Updating instance...
|
||||
Updating instance to @Version...
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -75,6 +75,8 @@ else
|
||||
|
||||
@code
|
||||
{
|
||||
[Parameter] public string Version { get; set; }
|
||||
|
||||
private int Progress;
|
||||
private int CurrentStep;
|
||||
|
||||
|
||||
@@ -133,7 +133,11 @@
|
||||
{
|
||||
<CardTitle ClassName="text-lg text-primary">Update available</CardTitle>
|
||||
<CardAction ClassName="self-center">
|
||||
<Button @onclick="LaunchUpdateModalAsync">Update</Button>
|
||||
<Button>
|
||||
<Slot>
|
||||
<a href="/admin/system?tab=instance" @attributes="context">Update</a>
|
||||
</Slot>
|
||||
</Button>
|
||||
</CardAction>
|
||||
}
|
||||
</CardHeader>
|
||||
@@ -156,10 +160,4 @@
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task LaunchUpdateModalAsync() => await DialogService.LaunchAsync<UpdateInstanceModal>(onConfigure: model =>
|
||||
{
|
||||
model.ShowCloseButton = false;
|
||||
model.ClassName = "sm:max-w-4xl!";
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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!";
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user