Added permissions for container helper. Updated rebuild version selection to fetch the available versions from moonlights version api
This commit was merged in pull request #11.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
@using System.Text.RegularExpressions
|
||||
@using LucideBlazor
|
||||
@using Moonlight.Frontend.UI.Admin.Modals
|
||||
@using Moonlight.Shared.Http.Responses.Admin
|
||||
@@ -38,10 +37,12 @@
|
||||
<SelectValue/>
|
||||
</SelectTrigger>
|
||||
<SelectContent ClassName="w-64">
|
||||
<SelectItem Value="v2.1">v2.1</SelectItem>
|
||||
<SelectItem Value="v2.1.1">v2.1.1</SelectItem>
|
||||
<SelectItem Value="feat/ContainerHelper">feat/ContainerHelper
|
||||
</SelectItem>
|
||||
@foreach (var version in Versions)
|
||||
{
|
||||
<SelectItem Value="@version.Identifier">
|
||||
@version.Identifier
|
||||
</SelectItem>
|
||||
}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</FieldContent>
|
||||
@@ -49,7 +50,7 @@
|
||||
<Field>
|
||||
<FieldLabel>Bypass Build Cache</FieldLabel>
|
||||
<FieldContent>
|
||||
<Switch @bind-Value="NoBuildCache" />
|
||||
<Switch @bind-Value="NoBuildCache"/>
|
||||
</FieldContent>
|
||||
</Field>
|
||||
</FieldSet>
|
||||
@@ -118,9 +119,18 @@
|
||||
private string SelectedVersion = "v2.1";
|
||||
private bool NoBuildCache;
|
||||
|
||||
private VersionDto[] Versions;
|
||||
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
StatusDto = (await HttpClient.GetFromJsonAsync<ContainerHelperStatusDto>("api/admin/ch/status"))!;
|
||||
|
||||
var currentVersion = await HttpClient.GetFromJsonAsync<VersionDto>("api/admin/versions/instance");
|
||||
|
||||
if (currentVersion != null)
|
||||
SelectedVersion = currentVersion.Identifier;
|
||||
|
||||
Versions = (await HttpClient.GetFromJsonAsync<VersionDto[]>("api/admin/versions"))!;
|
||||
}
|
||||
|
||||
private async Task ApplyAsync()
|
||||
@@ -144,6 +154,8 @@
|
||||
if (string.IsNullOrWhiteSpace(SelectedVersion))
|
||||
return;
|
||||
|
||||
var version = Versions.First(x => x.Identifier == SelectedVersion);
|
||||
|
||||
var shouldContinue = await ConfirmRiskyVersionAsync(
|
||||
"Moonlight Rebuild",
|
||||
"If you continue the moonlight instance will become unavailable during the rebuild process. This will impact users on this instance"
|
||||
@@ -152,7 +164,7 @@
|
||||
if (!shouldContinue)
|
||||
return;
|
||||
|
||||
if (!Regex.IsMatch(SelectedVersion, @"^v\d+(\.\d+)*b?$"))
|
||||
if (version.IsDevelopment)
|
||||
{
|
||||
shouldContinue = await ConfirmRiskyVersionAsync(
|
||||
"Development Version",
|
||||
@@ -161,7 +173,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SelectedVersion.EndsWith('b'))
|
||||
if (version.IsPreRelease)
|
||||
{
|
||||
shouldContinue = await ConfirmRiskyVersionAsync(
|
||||
"Beta / Pre-Release Version",
|
||||
|
||||
Reference in New Issue
Block a user