100 lines
3.0 KiB
Plaintext
100 lines
3.0 KiB
Plaintext
@page "/admin/system"
|
|
|
|
@using LucideBlazor
|
|
@using Microsoft.AspNetCore.Authorization
|
|
@using Microsoft.AspNetCore.Components.Authorization
|
|
@using Moonlight.Shared
|
|
@using ShadcnBlazor.Buttons
|
|
@using ShadcnBlazor.Cards
|
|
@using ShadcnBlazor.Inputs
|
|
@using ShadcnBlazor.Tab
|
|
@using ShadcnBlazor.Labels
|
|
|
|
@inject NavigationManager Navigation
|
|
@inject IAuthorizationService AuthorizationService
|
|
|
|
<Tabs DefaultValue="@(Tab ?? "settings")" OnValueChanged="OnTabChanged">
|
|
<TabsList ClassName="inline-flex w-full lg:w-fit justify-start overflow-x-auto overflow-y-hidden">
|
|
<TabsTrigger Value="settings">
|
|
<CogIcon />
|
|
Settings
|
|
</TabsTrigger>
|
|
<TabsTrigger Value="themes" Disabled="@(!ThemesAccess.Succeeded)">
|
|
<PaintRollerIcon/>
|
|
Themes
|
|
</TabsTrigger>
|
|
<TabsTrigger Value="apiKeys" Disabled="@(!ApiKeyAccess.Succeeded)">
|
|
<KeyIcon/>
|
|
API & API Keys
|
|
</TabsTrigger>
|
|
<TabsTrigger Value="diagnose">
|
|
<HeartPulseIcon/>
|
|
Diagnose
|
|
</TabsTrigger>
|
|
<TabsTrigger Value="instance">
|
|
<ContainerIcon/>
|
|
Instance
|
|
</TabsTrigger>
|
|
</TabsList>
|
|
<TabsContent Value="settings">
|
|
<Card ClassName="mt-5">
|
|
<CardContent>
|
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-5">
|
|
<div class="col-span-1 grid gap-3">
|
|
<Label for="instance-name">Instance Name</Label>
|
|
<TextInputField id="instance-name" />
|
|
</div>
|
|
</div>
|
|
</CardContent>
|
|
<CardFooter ClassName="justify-end">
|
|
<Button>
|
|
<SaveIcon />
|
|
Save changes
|
|
</Button>
|
|
</CardFooter>
|
|
</Card>
|
|
</TabsContent>
|
|
<TabsContent Value="diagnose">
|
|
<Diagnose />
|
|
</TabsContent>
|
|
@if (ApiKeyAccess.Succeeded)
|
|
{
|
|
<TabsContent Value="apiKeys">
|
|
<ApiKeys />
|
|
</TabsContent>
|
|
}
|
|
@if (ThemesAccess.Succeeded)
|
|
{
|
|
<TabsContent Value="themes">
|
|
<Moonlight.Frontend.UI.Admin.Views.Sys.Themes.Index />
|
|
</TabsContent>
|
|
}
|
|
<TabsContent Value="instance">
|
|
<Instance />
|
|
</TabsContent>
|
|
</Tabs>
|
|
|
|
@code
|
|
{
|
|
[SupplyParameterFromQuery(Name = "tab")]
|
|
[Parameter]
|
|
public string? Tab { get; set; }
|
|
|
|
[CascadingParameter] public Task<AuthenticationState> AuthState { get; set; }
|
|
|
|
private AuthorizationResult ApiKeyAccess;
|
|
private AuthorizationResult ThemesAccess;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
var authState = await AuthState;
|
|
|
|
ApiKeyAccess = await AuthorizationService.AuthorizeAsync(authState.User, Permissions.ApiKeys.View);
|
|
ThemesAccess = await AuthorizationService.AuthorizeAsync(authState.User, Permissions.Themes.View);
|
|
}
|
|
|
|
private void OnTabChanged(string name)
|
|
{
|
|
Navigation.NavigateTo($"/admin/system?tab={name}");
|
|
}
|
|
} |