Refactored css classes to match flyonui. Switched to postgres arrays for permissions. Migrated file manager. Adjusted everything to work with the latest mooncore version
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<div class="card card-body">
|
||||
<div class="flex justify-between">
|
||||
<p class="text-xl font-semibold text-slate-200">
|
||||
<p class="text-xl font-semibold text-base-content">
|
||||
@Text
|
||||
</p>
|
||||
<i class="@Icon text-4xl text-primary"></i>
|
||||
</div>
|
||||
<p class="text-base text-slate-300">@Title</p>
|
||||
<p class="text-base-content/80">@Title</p>
|
||||
</div>
|
||||
|
||||
@code
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<i class="icon-palette mix-blend-exclusion"></i>
|
||||
<span class="ms-2 mix-blend-exclusion">@(currentHex)</span>
|
||||
</label>
|
||||
<button @onclick="Reset" class="btn btn-danger">
|
||||
<button @onclick="Reset" class="btn btn-error">
|
||||
<i class="icon-rotate-ccw"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="animate-shimmer bg-gradient-to-r from-violet-400 via-sky-400 to-purple-400 bg-clip-text font-semibold text-transparent text-3xl" style="animation-duration: 5s; background-size: 200% 100%">
|
||||
Welcome, @(Username)
|
||||
</div>
|
||||
<div class="text-gray-200 text-2xl">What do you want to do today?</div>
|
||||
<div class="text-base-content/90 text-2xl">What do you want to do today?</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
@using Moonlight.Client.UI.Partials
|
||||
@using MoonCore.Blazor.FlyonUi.Files.Drop
|
||||
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<div class="relative isolate flex min-h-svh w-full h-screen max-lg:flex-col bg-gray-900 lg:bg-gray-950/80">
|
||||
<div class="relative isolate flex min-h-svh w-full h-screen max-lg:flex-col bg-background">
|
||||
<AppSidebar Layout="this"/>
|
||||
<AppHeader Layout="this" />
|
||||
|
||||
<main class="h-full flex flex-1 flex-col lg:pb-5 lg:min-w-0 lg:pt-5 lg:pr-3.5 lg:pl-64">
|
||||
<div class="h-full grow p-6 lg:rounded-lg lg:p-10 lg:ring-1 lg:shadow-xs lg:bg-gray-900/80 lg:ring-white/10">
|
||||
<div class="grow p-6 lg:rounded-lg lg:p-10 lg:ring-1 lg:shadow-xs lg:bg-base-100/20 lg:ring-base-content/10">
|
||||
<div class="h-full mx-auto max-w-7xl">
|
||||
<CascadingValue Value="this" IsFixed="true">
|
||||
@Body
|
||||
@@ -15,20 +16,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
||||
<ToastLauncher/>
|
||||
<ModalLauncher/>
|
||||
|
||||
<DropHandler />
|
||||
|
||||
<div id="blazor-error-ui" class="fixed bottom-0 left-0 w-full z-50">
|
||||
<div class="bg-error text-white p-4 flex flex-row justify-between items-center">
|
||||
<div class="bg-error text-base-content p-4 flex flex-row justify-between items-center">
|
||||
<div class="flex items-center">
|
||||
<i class="icon-bomb text-lg text-white me-2"></i>
|
||||
<i class="icon-bomb text-lg text-base-content me-2"></i>
|
||||
<span>An unhandled error has occurred.</span>
|
||||
</div>
|
||||
<div>
|
||||
<a href="#" class="reload text-white underline mr-4">Reload</a>
|
||||
<a href="#" class="reload text-base-content underline mr-4">Reload</a>
|
||||
<a href="#" class="dismiss hidden">🗙</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<header class="flex items-center px-4 lg:hidden border-b border-white/5">
|
||||
<header class="flex items-center px-4 lg:hidden border-b border-base-content/5">
|
||||
<div class="py-2.5">
|
||||
<span class="relative">
|
||||
<button @onclick="Layout.ToggleMobileNavigation" aria-label="Open navigation"
|
||||
class="relative flex min-w-0 items-center gap-3 rounded-lg p-2 text-left text-base/6 sm:text-sm/5 text-white"
|
||||
class="relative flex min-w-0 items-center gap-3 rounded-lg p-2 text-left text-base/6 sm:text-sm/5 text-base-content"
|
||||
type="button">
|
||||
<i class="icon-menu text-xl"></i>
|
||||
</button>
|
||||
@@ -18,12 +18,12 @@
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="relative">
|
||||
<div class="relative flex min-w-0 cursor-default items-center gap-3 rounded-lg p-2 text-left text-base/6 font-medium sm:text-sm/5 text-white">
|
||||
<div class="relative flex min-w-0 cursor-default items-center gap-3 rounded-lg p-2 text-left text-base/6 font-medium sm:text-sm/5 text-base-content">
|
||||
<div data-slot="avatar"
|
||||
class="inline-grid shrink-0 align-middle">
|
||||
<img
|
||||
class="h-8 rounded-full"
|
||||
src="/img/pfp_placeholder.png"
|
||||
src="/svg/logo.svg"
|
||||
alt=""/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -17,17 +17,17 @@
|
||||
|
||||
<div class="fixed inset-y-0 left-0 w-64 max-lg:hidden">
|
||||
<nav class="flex h-full min-h-0 flex-col">
|
||||
<div class="flex flex-col border-b p-4 border-white/5">
|
||||
<div class="flex flex-col border-b p-4 border-base-content/5">
|
||||
<span class="relative">
|
||||
<div type="button"
|
||||
class="flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left text-lg font-medium text-gray-100">
|
||||
class="flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left text-lg font-medium text-base-content">
|
||||
<span
|
||||
class="inline-grid shrink-0 align-middle">
|
||||
<img class="h-8 rounded-full"
|
||||
src="/svg/logo.svg"
|
||||
alt=""/>
|
||||
</span>
|
||||
<span class="truncate">Moonlight</span>
|
||||
<span class="truncate">Moonlight v2.1</span>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
@@ -37,7 +37,7 @@
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.Key))
|
||||
{
|
||||
<h3 class="mt-4 px-2 text-sm/5 font-medium text-gray-400">
|
||||
<h3 class="mt-4 px-2 text-sm/5 font-medium text-base-content/40">
|
||||
@item.Key
|
||||
</h3>
|
||||
}
|
||||
@@ -51,10 +51,10 @@
|
||||
@if (isMatch)
|
||||
{
|
||||
<div class="relative">
|
||||
<span class="absolute inset-y-2 -left-4 w-0.5 rounded-full bg-white"
|
||||
<span class="absolute inset-y-2 -left-4 w-0.5 rounded-full bg-primary"
|
||||
style="opacity: 1;">
|
||||
</span>
|
||||
<a class="flex w-full items-center gap-3 rounded-lg px-3 py-1.5 text-left text-base/6 font-normal bg-white/5 sm:py-2 sm:text-sm/5 text-white"
|
||||
<a class="flex w-full items-center gap-3 rounded-lg px-3 py-1.5 text-left text-base/6 font-normal bg-primary/5 sm:py-2 sm:text-sm/5 text-base-content"
|
||||
href="@sidebarItem.Path">
|
||||
<i class="@sidebarItem.Icon text-lg"></i>
|
||||
<span class="truncate">
|
||||
@@ -66,7 +66,7 @@
|
||||
else
|
||||
{
|
||||
<div class="relative">
|
||||
<a class="flex w-full items-center gap-3 rounded-lg px-3 py-1.5 text-left text-base/6 font-normal sm:py-2 sm:text-sm/5 text-white hover:bg-white/5"
|
||||
<a class="flex w-full items-center gap-3 rounded-lg px-3 py-1.5 text-left text-base/6 font-normal sm:py-2 sm:text-sm/5 text-base-content hover:bg-primary/5"
|
||||
href="@sidebarItem.Path">
|
||||
<i class="@sidebarItem.Icon text-lg"></i>
|
||||
<span class="truncate">
|
||||
@@ -79,9 +79,9 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col border-t p-4 max-lg:hidden border-white/5 mt-2.5">
|
||||
<div class="flex flex-col border-t p-4 max-lg:hidden border-base-content/5 mt-2.5">
|
||||
<div
|
||||
class="flex w-full items-center px-2 py-2.5 gap-6 rounded-lg text-left text-base/6 font-medium sm:py-2 sm:text-sm/5 text-white">
|
||||
class="flex w-full items-center px-2 py-2.5 gap-6 rounded-lg text-left text-base/6 font-medium sm:py-2 sm:text-sm/5 text-base-content">
|
||||
<div class="flex min-w-0 items-center gap-3">
|
||||
<span class="inline-grid shrink-0 align-middle">
|
||||
<img class="h-8 rounded-full"
|
||||
@@ -89,10 +89,10 @@
|
||||
alt=""/>
|
||||
</span>
|
||||
<div class="min-w-0">
|
||||
<div class="block truncate text-sm/5 font-medium text-white">
|
||||
<div class="block truncate text-sm/5 font-medium text-base-content">
|
||||
@Username
|
||||
</div>
|
||||
<div class="block truncate text-xs/5 font-normal text-gray-400">
|
||||
<div class="block truncate text-xs/5 font-normal text-base-content/40">
|
||||
@Email
|
||||
</div>
|
||||
</div>
|
||||
@@ -108,22 +108,23 @@
|
||||
<div
|
||||
class="lg:hidden z-50 transition-opacity ease-linear duration-300 @(Layout.ShowMobileNavigation ? "opacity-100" : "opacity-0 pointer-events-none")"
|
||||
role="dialog" tabindex="-1">
|
||||
<div class="fixed inset-0 bg-black/30"></div>
|
||||
<div class="fixed inset-0 bg-background/60"></div>
|
||||
<div class="fixed inset-y-0 w-full max-w-80 p-2">
|
||||
<div
|
||||
class="relative flex h-full flex-col rounded-lg shadow-xs ring-1 bg-gray-900 ring-white/10 transition ease-in-out duration-300 transform @(Layout.ShowMobileNavigation ? "translate-x-0" : "-translate-x-full")">
|
||||
<div class="border-b p-4 border-white/5 flex justify-between px-5 pt-3">
|
||||
<div class="flex items-center gap-3 rounded-lg px-2 py-2.5 text-left text-base/6 font-medium sm:py-2 sm:text-sm/5 text-white">
|
||||
class="relative flex h-full flex-col rounded-lg shadow-xs ring-1 bg-base-300 ring-white/10 transition ease-in-out duration-300 transform @(Layout.ShowMobileNavigation ? "translate-x-0" : "-translate-x-full")">
|
||||
<div class="border-b p-4 border-base-content/5 flex justify-between px-5 pt-3">
|
||||
<div
|
||||
class="flex items-center gap-3 rounded-lg px-2 py-2.5 text-left text-base/6 font-medium sm:py-2 sm:text-sm/5 text-base-content">
|
||||
<div data-slot="avatar"
|
||||
class="inline-grid shrink-0 align-middle">
|
||||
<img
|
||||
class="h-8 rounded-full" src="/svg/logo.svg" alt=""/>
|
||||
class="h-8 rounded-full" src="/placeholder.jpg" alt=""/>
|
||||
</div>
|
||||
<div class="truncate">Moonlight</div>
|
||||
<div class="truncate">Moonlight v2.1</div>
|
||||
</div>
|
||||
|
||||
<button @onclick="Layout.ToggleMobileNavigation" aria-label="Close navigation" type="button"
|
||||
class="relative flex min-w-0 items-center gap-3 rounded-lg p-2 text-left text-base/6 text-white">
|
||||
class="relative flex min-w-0 items-center gap-3 rounded-lg p-2 text-left text-base/6 text-base-content">
|
||||
<i class="icon-x text-lg"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -149,10 +150,10 @@
|
||||
@if (isMatch)
|
||||
{
|
||||
<div class="relative">
|
||||
<span class="absolute inset-y-2 -left-4 w-0.5 rounded-full bg-white"
|
||||
<span class="absolute inset-y-2 -left-4 w-0.5 rounded-full bg-primary"
|
||||
style="opacity: 1;">
|
||||
</span>
|
||||
<a class="flex w-full items-center gap-3 rounded-lg px-3 py-1.5 text-left text-base/6 font-normal bg-white/5 sm:py-2 sm:text-sm/5 text-white"
|
||||
<a class="flex w-full items-center gap-3 rounded-lg px-3 py-1.5 text-left text-base/6 font-normal bg-primary/5 sm:py-2 sm:text-sm/5 text-base-content"
|
||||
href="@sidebarItem.Path">
|
||||
<i class="@sidebarItem.Icon text-lg"></i>
|
||||
<span class="truncate">
|
||||
@@ -164,7 +165,7 @@
|
||||
else
|
||||
{
|
||||
<div class="relative">
|
||||
<a class="flex w-full items-center gap-3 rounded-lg px-3 py-1.5 text-left text-base/6 font-normal sm:py-2 sm:text-sm/5 text-white hover:bg-white/5"
|
||||
<a class="flex w-full items-center gap-3 rounded-lg px-3 py-1.5 text-left text-base/6 font-normal sm:py-2 sm:text-sm/5 text-base-content hover:bg-primary/5"
|
||||
href="@sidebarItem.Path">
|
||||
<i class="@sidebarItem.Icon text-lg"></i>
|
||||
<span class="truncate">
|
||||
@@ -180,8 +181,7 @@
|
||||
<div class="mt-8 flex-1"></div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<div class="relative">
|
||||
|
||||
<a class="flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left text-base/6 sm:py-2 sm:text-sm/5 text-white"
|
||||
<a class="flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left text-base/6 sm:py-2 sm:text-sm/5 text-base-content"
|
||||
href="#" @onclick:preventDefault @onclick="Logout">
|
||||
<i class="icon-log-out"></i>
|
||||
<span class="truncate">Logout</span>
|
||||
|
||||
@@ -4,22 +4,22 @@
|
||||
@using MoonCore.Helpers
|
||||
@using Moonlight.Shared.Http.Requests.Admin.ApiKeys
|
||||
@using Moonlight.Shared.Http.Responses.Admin.ApiKeys
|
||||
@using MoonCore.Blazor.Tailwind.Input2
|
||||
@using MoonCore.Blazor.FlyonUi.Forms
|
||||
@using MoonCore.Blazor.FlyonUi.Helpers
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
@inject NavigationManager Navigation
|
||||
@inject ToastService ToastService
|
||||
@inject AlertService AlertService
|
||||
|
||||
@* @inject DownloadService DownloadService *@
|
||||
@inject DownloadService DownloadService
|
||||
|
||||
<PageHeader Title="Create API Key">
|
||||
<a href="/admin/api" class="btn btn-secondary">
|
||||
<i class="icon-chevron-left mr-1"></i>
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<i class="icon-check mr-1"></i>
|
||||
<i class="icon-check"></i>
|
||||
Create
|
||||
</WButton>
|
||||
</PageHeader>
|
||||
@@ -28,21 +28,21 @@
|
||||
<HandleForm @ref="Form" Model="Request" OnValidSubmit="OnSubmit">
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Description</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Description</label>
|
||||
<div class="mt-2">
|
||||
<input @bind="Request.Description" type="text" autocomplete="off" class="form-input w-full">
|
||||
<input @bind="Request.Description" type="text" autocomplete="off" class="input w-full">
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Permissions</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Permissions</label>
|
||||
<div class="mt-2">
|
||||
<InputTags @bind-Value="Permissions" />
|
||||
<InputTags Value="Permissions" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Expires at</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Expires at</label>
|
||||
<div class="mt-2">
|
||||
<input @bind="Request.ExpiresAt" type="date" autocomplete="off" class="form-input w-full">
|
||||
<input @bind="Request.ExpiresAt" type="date" autocomplete="off" class="input w-full">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -54,7 +54,7 @@
|
||||
private HandleForm Form;
|
||||
private CreateApiKeyRequest Request;
|
||||
|
||||
private string[] Permissions = [];
|
||||
private List<string> Permissions = [];
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
@@ -63,12 +63,12 @@
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Request.PermissionsJson = JsonSerializer.Serialize(Permissions);
|
||||
Request.Permissions = Permissions.ToArray();
|
||||
Request.ExpiresAt = Request.ExpiresAt.ToUniversalTime();
|
||||
|
||||
var response = await ApiClient.PostJson<CreateApiKeyResponse>("api/admin/apikeys", Request);
|
||||
|
||||
await DownloadService.DownloadString(
|
||||
await DownloadService.Download(
|
||||
$"moonlight-key-{response.Id}.txt",
|
||||
response.Secret
|
||||
);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-span-1 card card-body border-l-4 border-tertiary">
|
||||
<p class="font-medium tracking-wide text-slate-100">
|
||||
<p class="font-medium tracking-wide text-base-content">
|
||||
Learn about the api usage
|
||||
</p>
|
||||
<a href="https://help.moonlightpanel.xyz" target="_blank" class="mt-2 flex items-center justify-between text-primary">
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-span-1 card card-body border-l-4 border-success">
|
||||
<p class="font-medium tracking-wide text-slate-100">
|
||||
<p class="font-medium tracking-wide text-base-content">
|
||||
Open API Specification
|
||||
</p>
|
||||
<a href="/api/swagger/main" target="_blank" class="mt-2 flex items-center justify-between text-primary">
|
||||
@@ -61,7 +61,7 @@
|
||||
<DataTableColumn TItem="ApiKeyResponse" Field="@(x => x.Description)" Name="Description"/>
|
||||
<DataTableColumn TItem="ApiKeyResponse" Field="@(x => x.ExpiresAt)" Name="Expires at">
|
||||
<ColumnTemplate>
|
||||
@(Formatter.FormatDate(context.ExpiresAt))
|
||||
@(Formatter.FormatDate(context.ExpiresAt.UtcDateTime))
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="ApiKeyResponse">
|
||||
@@ -72,7 +72,7 @@
|
||||
</a>
|
||||
|
||||
<a href="#" @onclick="() => Delete(context)" @onclick:preventDefault
|
||||
class="text-danger">
|
||||
class="text-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
<LazyLoader Load="Load">
|
||||
<PageHeader Title="Update API Key">
|
||||
<a href="/admin/api" class="btn btn-secondary">
|
||||
<i class="icon-chevron-left mr-1"></i>
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<i class="icon-check mr-1"></i>
|
||||
<i class="icon-check"></i>
|
||||
Update
|
||||
</WButton>
|
||||
</PageHeader>
|
||||
@@ -25,9 +25,9 @@
|
||||
<HandleForm @ref="Form" Model="Request" OnValidSubmit="OnSubmit">
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Description</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Description</label>
|
||||
<div class="mt-2">
|
||||
<input @bind="Request.Description" type="text" autocomplete="off" class="form-input w-full">
|
||||
<input @bind="Request.Description" type="text" autocomplete="off" class="input w-full">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@page "/admin/system/advanced"
|
||||
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using MoonCore.Blazor.FlyonUi.Helpers
|
||||
@using MoonCore.Helpers
|
||||
|
||||
@attribute [Authorize(Policy = "permissions:admin.system.advanced")]
|
||||
@@ -36,6 +37,6 @@
|
||||
{
|
||||
var stream = await ApiClient.GetStream("api/admin/system/advanced/frontend");
|
||||
|
||||
await DownloadService.DownloadStream("frontend.zip", stream);
|
||||
await DownloadService.Download("frontend.zip", stream);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@page "/admin/system/diagnose"
|
||||
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using MoonCore.Blazor.FlyonUi.Helpers
|
||||
@using MoonCore.Helpers
|
||||
@using Moonlight.Shared.Http.Requests.Admin.Sys
|
||||
@using Moonlight.Shared.Http.Responses.Admin.Sys
|
||||
@@ -47,7 +48,7 @@
|
||||
|
||||
<div class="@(DropdownOpen ? "" : "hidden")">
|
||||
<LazyLoader Load="Load">
|
||||
<div class="mb-2 py-2 border-b border-gray-700 flex items-center gap-3">
|
||||
<div class="mb-2 py-2 border-b border-base-content/70 flex items-center gap-3">
|
||||
<input id="selectall_checkbox" @bind="SelectAll" type="checkbox" class="form-checkbox">
|
||||
<label for="selectall_checkbox">Select all</label>
|
||||
</div>
|
||||
@@ -99,7 +100,7 @@
|
||||
|
||||
if (!SelectAll)
|
||||
{
|
||||
// filter the providers which have been selected if not all providers have been selected
|
||||
// Filter the providers which have been selected if not all providers have been selected
|
||||
request.Providers = AvailableProviders
|
||||
.Where(x => x.Value)
|
||||
.Select(x => x.Key.Type)
|
||||
@@ -108,7 +109,7 @@
|
||||
|
||||
var stream = await ApiClient.PostStream("api/admin/system/diagnose", request);
|
||||
|
||||
await DownloadService.DownloadStream("diagnose.zip", stream);
|
||||
await DownloadService.Download("diagnose.zip", stream);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,31 +3,28 @@
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using MoonCore.Blazor.Services
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Blazor.Tailwind.Fm
|
||||
@using Moonlight.Client.Implementations
|
||||
@using MoonCore.Blazor.FlyonUi.Files.Manager
|
||||
|
||||
@attribute [Authorize(Policy = "permissions:admin.system.overview")]
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
@inject DownloadService DownloadService
|
||||
@inject LocalStorageService LocalStorageService
|
||||
|
||||
<div class="mb-5">
|
||||
<NavTabs Index="2" Names="UiConstants.AdminNavNames" Links="UiConstants.AdminNavLinks"/>
|
||||
</div>
|
||||
|
||||
<FileManager FileSystemProvider="FileSystemProvider" MaxUploadSize="4096"/>
|
||||
<FileManager FsAccess="FsAccess" TransferChunkSize="TransferChunkSize" UploadLimit="UploadLimit"/>
|
||||
|
||||
@code
|
||||
{
|
||||
private IFileSystemProvider FileSystemProvider;
|
||||
private IFsAccess FsAccess;
|
||||
|
||||
private static readonly long TransferChunkSize = ByteConverter.FromMegaBytes(20).Bytes;
|
||||
private static readonly long UploadLimit = ByteConverter.FromGigaBytes(20).Bytes;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
FileSystemProvider = new SysFileSystemProvider(
|
||||
ApiClient,
|
||||
DownloadService,
|
||||
LocalStorageService
|
||||
);
|
||||
FsAccess = new SystemFsAccess(ApiClient);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
<div class="card card-body">
|
||||
<div class="flex justify-center">
|
||||
<WButton OnClick="Restart" CssClasses="btn btn-danger w-full">
|
||||
<i class="icon-repeat text-xl text-white me-2"></i>
|
||||
<WButton OnClick="Restart" CssClasses="btn btn-error w-full">
|
||||
<i class="icon-repeat text-xl text-base-content me-2"></i>
|
||||
Restart/Shutdown
|
||||
</WButton>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
@using System.Text.Json
|
||||
@using MoonCore.Helpers
|
||||
@using Moonlight.Shared.Http.Requests.Admin.Users
|
||||
@using MoonCore.Blazor.FlyonUi.Forms
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
@inject NavigationManager Navigation
|
||||
@@ -10,11 +11,11 @@
|
||||
|
||||
<PageHeader Title="Create User">
|
||||
<a href="/admin/users" class="btn btn-secondary">
|
||||
<i class="icon-chevron-left mr-1"></i>
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<i class="icon-check mr-1"></i>
|
||||
<i class="icon-check"></i>
|
||||
Create
|
||||
</WButton>
|
||||
</PageHeader>
|
||||
@@ -23,27 +24,27 @@
|
||||
<HandleForm @ref="Form" Model="Request" OnValidSubmit="OnSubmit">
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Username</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Username</label>
|
||||
<div class="mt-2">
|
||||
<input @bind="Request.Username" type="text" autocomplete="off" class="form-input w-full">
|
||||
<input @bind="Request.Username" type="text" autocomplete="off" class="input w-full">
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Email</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Email</label>
|
||||
<div class="mt-2">
|
||||
<input @bind="Request.Email" type="email" autocomplete="off" class="form-input w-full">
|
||||
<input @bind="Request.Email" type="email" autocomplete="off" class="input w-full">
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Permissions</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Permissions</label>
|
||||
<div class="mt-2">
|
||||
<InputTags @bind-Value="Permissions" />
|
||||
<InputTags Value="Permissions" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Password</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Password</label>
|
||||
<div class="mt-2">
|
||||
<input @bind="Request.Password" type="password" autocomplete="off" class="form-input w-full">
|
||||
<input @bind="Request.Password" type="password" autocomplete="off" class="input w-full">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -55,7 +56,7 @@
|
||||
private HandleForm Form;
|
||||
private CreateUserRequest Request;
|
||||
|
||||
private string[] Permissions = [];
|
||||
private List<string> Permissions = [];
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
@@ -64,7 +65,7 @@
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Request.PermissionsJson = JsonSerializer.Serialize(Permissions);
|
||||
Request.Permissions = Permissions.ToArray();
|
||||
|
||||
await ApiClient.Post("api/admin/users", Request);
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
</a>
|
||||
|
||||
<a href="#" @onclick="() => Delete(context)" @onclick:preventDefault
|
||||
class="text-danger">
|
||||
<i class="icon-trash text-base"></i>
|
||||
class="text-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</a>
|
||||
</div>
|
||||
</ColumnTemplate>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
@using MoonCore.Helpers
|
||||
@using Moonlight.Shared.Http.Requests.Admin.Users
|
||||
@using Moonlight.Shared.Http.Responses.Admin.Users
|
||||
@using MoonCore.Blazor.FlyonUi.Forms
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
@inject NavigationManager Navigation
|
||||
@@ -12,11 +13,11 @@
|
||||
<LazyLoader Load="Load">
|
||||
<PageHeader Title="Update User">
|
||||
<a href="/admin/users" class="btn btn-secondary">
|
||||
<i class="icon-chevron-left mr-1"></i>
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<i class="icon-check mr-1"></i>
|
||||
<i class="icon-check"></i>
|
||||
Update
|
||||
</WButton>
|
||||
</PageHeader>
|
||||
@@ -25,27 +26,27 @@
|
||||
<HandleForm @ref="Form" Model="Request" OnValidSubmit="OnSubmit">
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Username</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Username</label>
|
||||
<div class="mt-2">
|
||||
<input @bind="Request.Username" type="text" autocomplete="off" class="form-input w-full">
|
||||
<input @bind="Request.Username" type="text" autocomplete="off" class="input w-full">
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Email</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Email</label>
|
||||
<div class="mt-2">
|
||||
<input @bind="Request.Email" type="email" autocomplete="off" class="form-input w-full">
|
||||
<input @bind="Request.Email" type="email" autocomplete="off" class="input w-full">
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Permissions</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Permissions</label>
|
||||
<div class="mt-2">
|
||||
<InputTags @bind-Value="Permissions" />
|
||||
<InputTags Value="Permissions" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Password</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Password</label>
|
||||
<div class="mt-2">
|
||||
<input @bind="Request.Password" type="password" autocomplete="off" class="form-input w-full">
|
||||
<input @bind="Request.Password" type="password" autocomplete="off" class="input w-full">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,25 +61,25 @@
|
||||
private HandleForm Form;
|
||||
private UpdateUserRequest Request;
|
||||
|
||||
private string[] Permissions = [];
|
||||
private List<string> Permissions = [];
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
{
|
||||
var detail = await ApiClient.GetJson<UserResponse>($"api/admin/users/{Id}");
|
||||
|
||||
Permissions = JsonSerializer.Deserialize<string[]>(detail.PermissionsJson) ?? [];
|
||||
Permissions = detail.Permissions.ToList();
|
||||
|
||||
Request = new()
|
||||
{
|
||||
Email = detail.Email,
|
||||
PermissionsJson = detail.PermissionsJson,
|
||||
Permissions = detail.Permissions,
|
||||
Username = detail.Username
|
||||
};
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Request.PermissionsJson = JsonSerializer.Serialize(Permissions);
|
||||
Request.Permissions = Permissions.ToArray();
|
||||
|
||||
await ApiClient.Patch($"api/admin/users/{Id}", Request);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user