Added new node manager. Added new login/register screen. AuditLog. Permissions
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
@using Moonlight.Shared.Components.ErrorBoundaries
|
||||
@using Moonlight.Shared.Components.Partials
|
||||
@using Moonlight.Shared.Components.Alerts
|
||||
@using Moonlight.Shared.Components.Auth
|
||||
@using Moonlight.App.Database.Entities
|
||||
@using Moonlight.App.Extensions
|
||||
@using Moonlight.App.Models.Misc
|
||||
@using Moonlight.App.Services.Sessions
|
||||
|
||||
@@ -15,10 +17,30 @@
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<GlobalErrorBoundary>
|
||||
@{
|
||||
var uri = new Uri(NavigationManager.Uri);
|
||||
var pathParts = uri.LocalPath.Split("/").Reverse();
|
||||
|
||||
var title = "";
|
||||
|
||||
foreach (var pathPart in pathParts)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(pathPart))
|
||||
{
|
||||
if(pathPart == pathParts.Last())
|
||||
title += $"{pathPart.FirstCharToUpper()} ";
|
||||
else
|
||||
title += $"{pathPart.FirstCharToUpper()} - ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<PageTitle>@(string.IsNullOrEmpty(title) ? "Dashboard - " : title)Moonlight</PageTitle>
|
||||
|
||||
<div class="d-flex flex-column flex-root app-root" id="kt_app_root">
|
||||
<div class="app-page flex-column flex-column-fluid" id="kt_app_page">
|
||||
<canvas id="snow" class="snow-canvas"></canvas>
|
||||
|
||||
|
||||
@{
|
||||
//TODO: Add a way to disable the snow
|
||||
}
|
||||
@@ -32,23 +54,38 @@
|
||||
<div id="kt_app_content_container" class="app-container container-fluid">
|
||||
<div class="mt-10">
|
||||
<PageErrorBoundary>
|
||||
@if (User == null)
|
||||
@if (uri.LocalPath != "/login" &&
|
||||
uri.LocalPath != "/register")
|
||||
{
|
||||
@Body
|
||||
}
|
||||
else
|
||||
{
|
||||
if (User.Status == UserStatus.Banned)
|
||||
if (User == null)
|
||||
{
|
||||
<BannedAlert></BannedAlert>
|
||||
}
|
||||
else if (User.Status == UserStatus.Disabled)
|
||||
{
|
||||
<DisabledAlert></DisabledAlert>
|
||||
<Login></Login>
|
||||
}
|
||||
else
|
||||
{
|
||||
@Body
|
||||
if (User.Status == UserStatus.Banned)
|
||||
{
|
||||
<BannedAlert></BannedAlert>
|
||||
}
|
||||
else if (User.Status == UserStatus.Disabled)
|
||||
{
|
||||
<DisabledAlert></DisabledAlert>
|
||||
}
|
||||
else
|
||||
{
|
||||
@Body
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uri.LocalPath == "/login")
|
||||
{
|
||||
<Login></Login>
|
||||
}
|
||||
else if (uri.LocalPath == "/register")
|
||||
{
|
||||
<Register></Register>
|
||||
}
|
||||
}
|
||||
</PageErrorBoundary>
|
||||
@@ -66,7 +103,7 @@
|
||||
@code
|
||||
{
|
||||
private User? User;
|
||||
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
AddBodyAttribute("data-kt-app-page-loading", "on");
|
||||
@@ -74,7 +111,7 @@
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
//Initialize classes and attributes for layout with dark sidebar
|
||||
//Initialize classes and attributes for layout with dark sidebar
|
||||
AddBodyAttribute("data-kt-app-reset-transition", "true");
|
||||
|
||||
AddBodyAttribute("data-kt-app-layout", "dark-sidebar");
|
||||
@@ -104,7 +141,7 @@
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await Task.Delay(300);
|
||||
|
||||
|
||||
await JsRuntime.InvokeVoidAsync("document.body.removeAttribute", "data-kt-app-reset-transition");
|
||||
await JsRuntime.InvokeVoidAsync("document.body.removeAttribute", "data-kt-app-page-loading");
|
||||
await JsRuntime.InvokeVoidAsync("KTMenu.createInstances");
|
||||
@@ -117,7 +154,7 @@
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,9 +168,9 @@
|
||||
{
|
||||
JsRuntime.InvokeVoidAsync("document.body.setAttribute", attribute, value);
|
||||
}
|
||||
|
||||
|
||||
private void AddBodyClass(string className)
|
||||
{
|
||||
JsRuntime.InvokeVoidAsync("document.body.classList.add", className);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user