From f6b71f4de650caf75a81755ba88cabeaa0e12359 Mon Sep 17 00:00:00 2001 From: ChiaraBm Date: Mon, 20 Oct 2025 19:27:31 +0000 Subject: [PATCH] Upgraded mooncore. Done required refactoring to function with new version --- .../MoonlightServers.ApiServer.Runtime.csproj | 4 +- MoonlightServers.ApiServer.Runtime/Program.cs | 17 ++++--- .../Admin/Nodes/NodeAllocationsController.cs | 2 +- .../Admin/Nodes/NodesController.cs | 2 +- .../Servers/ServerVariablesController.cs | 2 +- .../Admin/Servers/ServersController.cs | 2 +- .../Admin/Stars/StarDockerImagesController.cs | 2 +- .../Admin/Stars/StarVariablesController.cs | 2 +- .../Admin/Stars/StarsController.cs | 2 +- .../Controllers/Client/ServersController.cs | 2 +- .../Controllers/Client/SharesController.cs | 2 +- .../Controllers/Client/VariablesController.cs | 2 +- .../Controllers/Remote/ServersController.cs | 2 +- .../MoonlightServers.ApiServer.csproj | 1 + .../{Startup => }/PluginStartup.cs | 24 +++++----- .../MoonlightServers.Frontend.Runtime.csproj | 4 +- MoonlightServers.Frontend.Runtime/Program.cs | 14 ++---- .../MoonlightServers.Frontend.csproj | 4 ++ .../{Startup => }/PluginStartup.cs | 10 ++-- .../Services/ServerService.cs | 2 +- .../Services/ServerShareService.cs | 2 +- .../Styles/Moonlight.Client/classes.map | 48 ++++++++++++++++++- .../UI/Components/FullScreenModal.razor | 2 +- .../Nodes/Modals/CreateAllocationModal.razor | 2 +- .../CreateMultipleAllocationModal.razor | 2 +- .../Nodes/Modals/UpdateAllocationModal.razor | 2 +- .../Nodes/UpdatePartials/Advanced.razor | 1 - .../Nodes/UpdatePartials/Allocations.razor | 28 +++++------ .../Servers/CreatePartials/Allocations.razor | 18 ++++--- .../Servers/CreatePartials/General.razor | 40 +++++++--------- .../Servers/CreatePartials/Variables.razor | 10 ++-- .../Components/Servers/CreateShareModal.razor | 2 +- .../Servers/ServerTabs/SharesTab.razor | 4 +- .../Servers/ServerTabs/VariablesTab.razor | 4 +- .../Servers/UpdatePartials/Allocations.razor | 16 +++---- .../Servers/UpdatePartials/General.razor | 16 +++---- .../Servers/UpdatePartials/Variables.razor | 6 +-- .../Components/Servers/UpdateShareModal.razor | 2 +- .../Stars/Modals/CreateDockerImageModal.razor | 2 +- .../Stars/Modals/CreateParseConfigModal.razor | 2 +- .../Stars/Modals/CreateVariableModal.razor | 2 +- .../Stars/Modals/UpdateDockerImageModal.razor | 2 +- .../Stars/Modals/UpdateParseConfigModal.razor | 2 +- .../Stars/Modals/UpdateVariableModal.razor | 2 +- .../Stars/UpdatePartials/DockerImage.razor | 41 ++++++++-------- .../Stars/UpdatePartials/Misc.razor | 2 +- .../Stars/UpdatePartials/Variables.razor | 31 ++++++------ .../UI/Views/Admin/All/Index.razor | 20 ++++---- .../UI/Views/Admin/Nodes/Index.razor | 22 ++++----- .../UI/Views/Admin/Stars/Index.razor | 22 ++++----- .../UI/Views/Client/Index.razor | 6 +-- 51 files changed, 239 insertions(+), 224 deletions(-) rename MoonlightServers.ApiServer/{Startup => }/PluginStartup.cs (73%) rename MoonlightServers.Frontend/{Startup => }/PluginStartup.cs (69%) diff --git a/MoonlightServers.ApiServer.Runtime/MoonlightServers.ApiServer.Runtime.csproj b/MoonlightServers.ApiServer.Runtime/MoonlightServers.ApiServer.Runtime.csproj index 002a910..aeea9e2 100644 --- a/MoonlightServers.ApiServer.Runtime/MoonlightServers.ApiServer.Runtime.csproj +++ b/MoonlightServers.ApiServer.Runtime/MoonlightServers.ApiServer.Runtime.csproj @@ -14,8 +14,8 @@ - - + + diff --git a/MoonlightServers.ApiServer.Runtime/Program.cs b/MoonlightServers.ApiServer.Runtime/Program.cs index 7ba1fd9..7de0a11 100644 --- a/MoonlightServers.ApiServer.Runtime/Program.cs +++ b/MoonlightServers.ApiServer.Runtime/Program.cs @@ -1,24 +1,25 @@ +using Moonlight.ApiServer.Configuration; using Moonlight.ApiServer.Startup; using MoonlightServers.ApiServer.Runtime; var pluginLoader = new DevPluginLoader(); pluginLoader.Initialize(); -var cs = new Startup(); - -await cs.InitializeAsync(args, pluginLoader.Instances); - var builder = WebApplication.CreateBuilder(args); -await cs.AddMoonlightAsync(builder); +builder.AddMoonlight(pluginLoader.Instances); var app = builder.Build(); -await cs.AddMoonlightAsync(app); +app.UseMoonlight(pluginLoader.Instances); + +// Add frontend +var configuration = AppConfiguration.CreateEmpty(); +builder.Configuration.Bind(configuration); // Handle setup of wasm app hosting in the runtime // so the Moonlight.ApiServer doesn't need the wasm package -if (cs.Configuration.Frontend.EnableHosting) +if (configuration.Frontend.EnableHosting) { if (app.Environment.IsDevelopment()) app.UseWebAssemblyDebugging(); @@ -27,5 +28,7 @@ if (cs.Configuration.Frontend.EnableHosting) app.UseStaticFiles(); } +app.MapMoonlight(pluginLoader.Instances); + await app.RunAsync(); \ No newline at end of file diff --git a/MoonlightServers.ApiServer/Http/Controllers/Admin/Nodes/NodeAllocationsController.cs b/MoonlightServers.ApiServer/Http/Controllers/Admin/Nodes/NodeAllocationsController.cs index 15f3287..800b4b6 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Admin/Nodes/NodeAllocationsController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Admin/Nodes/NodeAllocationsController.cs @@ -1,8 +1,8 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using MoonCore.Common; using MoonCore.Extended.Abstractions; -using MoonCore.Models; using MoonlightServers.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Mappers; using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations; diff --git a/MoonlightServers.ApiServer/Http/Controllers/Admin/Nodes/NodesController.cs b/MoonlightServers.ApiServer/Http/Controllers/Admin/Nodes/NodesController.cs index d80d6b4..5b2b5e2 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Admin/Nodes/NodesController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Admin/Nodes/NodesController.cs @@ -2,8 +2,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using MoonCore.Extended.Abstractions; using Microsoft.AspNetCore.Authorization; +using MoonCore.Common; using MoonCore.Helpers; -using MoonCore.Models; using MoonlightServers.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Mappers; using MoonlightServers.Shared.Http.Requests.Admin.Nodes; diff --git a/MoonlightServers.ApiServer/Http/Controllers/Admin/Servers/ServerVariablesController.cs b/MoonlightServers.ApiServer/Http/Controllers/Admin/Servers/ServerVariablesController.cs index 1bd0f40..4d7515e 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Admin/Servers/ServerVariablesController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Admin/Servers/ServerVariablesController.cs @@ -1,8 +1,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.AspNetCore.Authorization; +using MoonCore.Common; using MoonCore.Extended.Abstractions; -using MoonCore.Models; using MoonlightServers.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Mappers; using MoonlightServers.Shared.Http.Responses.Admin.ServerVariables; diff --git a/MoonlightServers.ApiServer/Http/Controllers/Admin/Servers/ServersController.cs b/MoonlightServers.ApiServer/Http/Controllers/Admin/Servers/ServersController.cs index b4a3c7c..6d5031d 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Admin/Servers/ServersController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Admin/Servers/ServersController.cs @@ -2,8 +2,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Logging; +using MoonCore.Common; using MoonCore.Extended.Abstractions; -using MoonCore.Models; using Moonlight.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Mappers; diff --git a/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarDockerImagesController.cs b/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarDockerImagesController.cs index a27f8e4..272dca3 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarDockerImagesController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarDockerImagesController.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using MoonCore.Extended.Abstractions; using Microsoft.AspNetCore.Authorization; -using MoonCore.Models; +using MoonCore.Common; using MoonlightServers.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Mappers; using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages; diff --git a/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarVariablesController.cs b/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarVariablesController.cs index bb20b34..42874b8 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarVariablesController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarVariablesController.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.AspNetCore.Authorization; +using MoonCore.Common; using MoonCore.Exceptions; using MoonCore.Extended.Abstractions; -using MoonCore.Models; using MoonlightServers.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Mappers; using MoonlightServers.Shared.Http.Requests.Admin.StarVariables; diff --git a/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarsController.cs b/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarsController.cs index 54f1afa..e4e5779 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarsController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Admin/Stars/StarsController.cs @@ -1,8 +1,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.AspNetCore.Authorization; +using MoonCore.Common; using MoonCore.Extended.Abstractions; -using MoonCore.Models; using MoonlightServers.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Mappers; using MoonlightServers.Shared.Http.Requests.Admin.Stars; diff --git a/MoonlightServers.ApiServer/Http/Controllers/Client/ServersController.cs b/MoonlightServers.ApiServer/Http/Controllers/Client/ServersController.cs index f616bbf..2950bbc 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Client/ServersController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Client/ServersController.cs @@ -2,8 +2,8 @@ using System.Security.Claims; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using MoonCore.Common; using MoonCore.Extended.Abstractions; -using MoonCore.Models; using Moonlight.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Extensions; diff --git a/MoonlightServers.ApiServer/Http/Controllers/Client/SharesController.cs b/MoonlightServers.ApiServer/Http/Controllers/Client/SharesController.cs index 2945b61..426b038 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Client/SharesController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Client/SharesController.cs @@ -1,8 +1,8 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using MoonCore.Common; using MoonCore.Extended.Abstractions; -using MoonCore.Models; using Moonlight.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Mappers; diff --git a/MoonlightServers.ApiServer/Http/Controllers/Client/VariablesController.cs b/MoonlightServers.ApiServer/Http/Controllers/Client/VariablesController.cs index 39d7968..096d48b 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Client/VariablesController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Client/VariablesController.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using MoonCore.Common; using MoonCore.Exceptions; using MoonCore.Extended.Abstractions; -using MoonCore.Models; using MoonlightServers.ApiServer.Database.Entities; using MoonlightServers.ApiServer.Services; using MoonlightServers.Shared.Constants; diff --git a/MoonlightServers.ApiServer/Http/Controllers/Remote/ServersController.cs b/MoonlightServers.ApiServer/Http/Controllers/Remote/ServersController.cs index 20befca..f47ef28 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Remote/ServersController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Remote/ServersController.cs @@ -2,9 +2,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; +using MoonCore.Common; using MoonCore.Exceptions; using MoonCore.Extended.Abstractions; -using MoonCore.Models; using MoonlightServers.ApiServer.Database.Entities; using MoonlightServers.DaemonShared.PanelSide.Http.Responses; diff --git a/MoonlightServers.ApiServer/MoonlightServers.ApiServer.csproj b/MoonlightServers.ApiServer/MoonlightServers.ApiServer.csproj index 9340a1c..cce6425 100644 --- a/MoonlightServers.ApiServer/MoonlightServers.ApiServer.csproj +++ b/MoonlightServers.ApiServer/MoonlightServers.ApiServer.csproj @@ -27,6 +27,7 @@ + diff --git a/MoonlightServers.ApiServer/Startup/PluginStartup.cs b/MoonlightServers.ApiServer/PluginStartup.cs similarity index 73% rename from MoonlightServers.ApiServer/Startup/PluginStartup.cs rename to MoonlightServers.ApiServer/PluginStartup.cs index 13470d7..98741f2 100644 --- a/MoonlightServers.ApiServer/Startup/PluginStartup.cs +++ b/MoonlightServers.ApiServer/PluginStartup.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; using MoonCore.Extensions; using Moonlight.ApiServer.Configuration; using Moonlight.ApiServer.Models; @@ -11,11 +10,11 @@ using MoonlightServers.ApiServer.Helpers; using MoonlightServers.ApiServer.Implementations.ServerAuthFilters; using MoonlightServers.ApiServer.Interfaces; -namespace MoonlightServers.ApiServer.Startup; +namespace MoonlightServers.ApiServer; public class PluginStartup : IPluginStartup { - public Task BuildApplicationAsync(IServiceProvider serviceProvider, IHostApplicationBuilder builder) + public void AddPlugin(WebApplicationBuilder builder) { // Scan the current plugin assembly for di services builder.Services.AutoAddServices(); @@ -27,7 +26,8 @@ public class PluginStartup : IPluginStartup .AddAuthentication() .AddScheme("nodeAuthentication", null); - var configuration = serviceProvider.GetRequiredService(); + var configuration = AppConfiguration.CreateEmpty(); + builder.Configuration.Bind(configuration); if (configuration.Frontend.EnableHosting) { @@ -42,18 +42,18 @@ public class PluginStartup : IPluginStartup Styles = ["/_content/MoonlightServers.Frontend/css/XtermBlazor.min.css"] }); } - + // Add server auth filters builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddScoped(); - - return Task.CompletedTask; } - public Task ConfigureApplicationAsync(IServiceProvider serviceProvider, IApplicationBuilder app) - => Task.CompletedTask; + public void UsePlugin(WebApplication app) + { + } - public Task ConfigureEndpointsAsync(IServiceProvider serviceProvider, IEndpointRouteBuilder routeBuilder) - => Task.CompletedTask; + public void MapPlugin(WebApplication app) + { + } } \ No newline at end of file diff --git a/MoonlightServers.Frontend.Runtime/MoonlightServers.Frontend.Runtime.csproj b/MoonlightServers.Frontend.Runtime/MoonlightServers.Frontend.Runtime.csproj index 3318612..e4eff98 100644 --- a/MoonlightServers.Frontend.Runtime/MoonlightServers.Frontend.Runtime.csproj +++ b/MoonlightServers.Frontend.Runtime/MoonlightServers.Frontend.Runtime.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/MoonlightServers.Frontend.Runtime/Program.cs b/MoonlightServers.Frontend.Runtime/Program.cs index ee4706f..26c422b 100644 --- a/MoonlightServers.Frontend.Runtime/Program.cs +++ b/MoonlightServers.Frontend.Runtime/Program.cs @@ -5,16 +5,12 @@ using MoonlightServers.Frontend.Runtime; var pluginLoader = new DevPluginLoader(); pluginLoader.Initialize(); -var startup = new Startup(); +var builder = WebAssemblyHostBuilder.CreateDefault(args); -await startup.InitializeAsync(pluginLoader.Instances); +builder.AddMoonlight(pluginLoader.Instances); -var wasmHostBuilder = WebAssemblyHostBuilder.CreateDefault(args); +var app = builder.Build(); -await startup.AddMoonlightAsync(wasmHostBuilder); +app.ConfigureMoonlight(pluginLoader.Instances); -var wasmApp = wasmHostBuilder.Build(); - -await startup.AddMoonlightAsync(wasmApp); - -await wasmApp.RunAsync(); \ No newline at end of file +await app.RunAsync(); \ No newline at end of file diff --git a/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj b/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj index 2919aa2..764684c 100644 --- a/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj +++ b/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj @@ -35,4 +35,8 @@ + + + + diff --git a/MoonlightServers.Frontend/Startup/PluginStartup.cs b/MoonlightServers.Frontend/PluginStartup.cs similarity index 69% rename from MoonlightServers.Frontend/Startup/PluginStartup.cs rename to MoonlightServers.Frontend/PluginStartup.cs index f18144b..7c2cf86 100644 --- a/MoonlightServers.Frontend/Startup/PluginStartup.cs +++ b/MoonlightServers.Frontend/PluginStartup.cs @@ -6,23 +6,21 @@ using Moonlight.Client.Plugins; using MoonlightServers.Frontend.Implementations; using MoonlightServers.Frontend.Interfaces; -namespace MoonlightServers.Frontend.Startup; +namespace MoonlightServers.Frontend; public class PluginStartup : IPluginStartup { - public Task BuildApplicationAsync(IServiceProvider serviceProvider, WebAssemblyHostBuilder builder) + public void AddPlugin(WebAssemblyHostBuilder builder) { builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AutoAddServices(); - - return Task.CompletedTask; } - public Task ConfigureApplicationAsync(IServiceProvider serviceProvider, WebAssemblyHost app) + public void ConfigurePlugin(WebAssemblyHost app) { - return Task.CompletedTask; + } } \ No newline at end of file diff --git a/MoonlightServers.Frontend/Services/ServerService.cs b/MoonlightServers.Frontend/Services/ServerService.cs index fa92dfd..3fe0cfa 100644 --- a/MoonlightServers.Frontend/Services/ServerService.cs +++ b/MoonlightServers.Frontend/Services/ServerService.cs @@ -1,6 +1,6 @@ using MoonCore.Attributes; +using MoonCore.Common; using MoonCore.Helpers; -using MoonCore.Models; using MoonlightServers.Shared.Http.Requests.Client.Servers; using MoonlightServers.Shared.Http.Requests.Client.Servers.Variables; using MoonlightServers.Shared.Http.Responses.Client.Servers; diff --git a/MoonlightServers.Frontend/Services/ServerShareService.cs b/MoonlightServers.Frontend/Services/ServerShareService.cs index f17a13c..05b5776 100644 --- a/MoonlightServers.Frontend/Services/ServerShareService.cs +++ b/MoonlightServers.Frontend/Services/ServerShareService.cs @@ -1,6 +1,6 @@ using MoonCore.Attributes; +using MoonCore.Common; using MoonCore.Helpers; -using MoonCore.Models; using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares; using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares; diff --git a/MoonlightServers.Frontend/Styles/Moonlight.Client/classes.map b/MoonlightServers.Frontend/Styles/Moonlight.Client/classes.map index 599f38f..338ace2 100755 --- a/MoonlightServers.Frontend/Styles/Moonlight.Client/classes.map +++ b/MoonlightServers.Frontend/Styles/Moonlight.Client/classes.map @@ -64,6 +64,7 @@ badge-outline badge-primary badge-soft badge-success +basis-full bg-background bg-background/60 bg-base-100 @@ -71,6 +72,8 @@ bg-base-150 bg-base-200 bg-base-200! bg-base-200/50 +bg-base-200/60 +bg-base-250 bg-base-300 bg-base-300/45 bg-base-300/50 @@ -183,12 +186,22 @@ contents cursor-default cursor-not-allowed cursor-pointer +cursor-progress custom-option diff disabled divide-base-150/60 divide-y divider +drawer +drawer-body +drawer-bottom +drawer-end +drawer-footer +drawer-header +drawer-start +drawer-title +drawer-top drop-shadow dropdown dropdown-active @@ -275,6 +288,7 @@ h-14 h-2 h-3 h-32 +h-36 h-6 h-64 h-8 @@ -351,6 +365,7 @@ lg:ring-1 lg:ring-base-content/10 lg:rounded-lg lg:shadow-xs +lg:table-cell link link-animated link-hover @@ -372,7 +387,9 @@ max-lg:flex-col max-lg:hidden max-md:flex-wrap max-md:justify-center +max-md:w-full max-sm:hidden +max-w-64 max-w-7xl max-w-8 max-w-80 @@ -386,14 +403,20 @@ mb-1 mb-1.5 mb-2 mb-2.5 +mb-25 mb-3 mb-4 mb-5 mb-8 md:col-span-1 md:col-span-6 +md:flex +md:gap-2 md:grid-cols-2 +md:hidden! +md:items-center md:min-w-md +md:navbar-end md:table-cell md:text-3xl me-1 @@ -408,6 +431,7 @@ menu-dropdown menu-dropdown-show menu-focus menu-horizontal +menu-sm menu-title min-h-0 min-h-full @@ -452,10 +476,13 @@ mt-8 mx-1 mx-auto my-2.5 +my-20 my-3 my-5 my-8 my-auto +navbar +navbar-start object-cover opacity-0 opacity-100 @@ -470,9 +497,14 @@ overflow-x-hidden overflow-y-auto overlay-open:duration-50 overlay-open:opacity-100 +overlay-open:translate-x-0 +overlay-open:translate-y-0 +overscroll-contain +p-0 p-0.5 p-1 p-1.5 +p-12 p-2 p-2.5 p-3 @@ -481,6 +513,7 @@ p-5 p-6 p-8 pb-1 +pe-1 pe-1.5 pin-input pin-input-underline @@ -516,6 +549,7 @@ radio range relative resize +right-0 ring ring-0 ring-1 @@ -548,6 +582,7 @@ shadow shadow-base-300/20 shadow-lg shadow-md +shadow-none shadow-sm shadow-xs shrink-0 @@ -557,6 +592,7 @@ size-4 size-5 size-7 size-8 +size-8.5 skeleton skeleton-animated sm:auto-cols-max @@ -635,6 +671,7 @@ tabs-xs text-2xl text-3xl text-4xl +text-5xl text-accent text-base text-base-content @@ -686,6 +723,7 @@ tooltip tooltip-content top-0 top-1/2 +top-3 top-full tracking-tight tracking-wide @@ -693,7 +731,9 @@ transform transition transition-all transition-opacity +transition-transform translate-x-0 +translate-x-full truncate underline uppercase @@ -703,18 +743,24 @@ w-0 w-0.5 w-12 w-13 +w-20 w-32 w-4 w-56 +w-6 w-64 w-8 w-auto w-fit w-full whitespace-nowrap +xl:flex +xl:grid-cols-2 xl:grid-cols-3 xl:grid-cols-4 z-1 z-10 z-40 -z-50 \ No newline at end of file +z-50 +z-69 +z-70 \ No newline at end of file diff --git a/MoonlightServers.Frontend/UI/Components/FullScreenModal.razor b/MoonlightServers.Frontend/UI/Components/FullScreenModal.razor index d782b07..54fd349 100644 --- a/MoonlightServers.Frontend/UI/Components/FullScreenModal.razor +++ b/MoonlightServers.Frontend/UI/Components/FullScreenModal.razor @@ -1,6 +1,6 @@ @using Microsoft.Extensions.Logging @using XtermBlazor -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal @inject IJSRuntime JsRuntime @inject ILogger Logger diff --git a/MoonlightServers.Frontend/UI/Components/Nodes/Modals/CreateAllocationModal.razor b/MoonlightServers.Frontend/UI/Components/Nodes/Modals/CreateAllocationModal.razor index dbbe69a..cf44bb7 100644 --- a/MoonlightServers.Frontend/UI/Components/Nodes/Modals/CreateAllocationModal.razor +++ b/MoonlightServers.Frontend/UI/Components/Nodes/Modals/CreateAllocationModal.razor @@ -1,7 +1,7 @@ @using MoonCore.Blazor.FlyonUi.Components @using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
diff --git a/MoonlightServers.Frontend/UI/Components/Nodes/Modals/CreateMultipleAllocationModal.razor b/MoonlightServers.Frontend/UI/Components/Nodes/Modals/CreateMultipleAllocationModal.razor index 1a06e51..09d6fef 100644 --- a/MoonlightServers.Frontend/UI/Components/Nodes/Modals/CreateMultipleAllocationModal.razor +++ b/MoonlightServers.Frontend/UI/Components/Nodes/Modals/CreateMultipleAllocationModal.razor @@ -1,7 +1,7 @@ @using MoonCore.Blazor.FlyonUi.Components @using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
diff --git a/MoonlightServers.Frontend/UI/Components/Nodes/Modals/UpdateAllocationModal.razor b/MoonlightServers.Frontend/UI/Components/Nodes/Modals/UpdateAllocationModal.razor index 1433b81..df2e610 100644 --- a/MoonlightServers.Frontend/UI/Components/Nodes/Modals/UpdateAllocationModal.razor +++ b/MoonlightServers.Frontend/UI/Components/Nodes/Modals/UpdateAllocationModal.razor @@ -2,7 +2,7 @@ @using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations @using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
diff --git a/MoonlightServers.Frontend/UI/Components/Nodes/UpdatePartials/Advanced.razor b/MoonlightServers.Frontend/UI/Components/Nodes/UpdatePartials/Advanced.razor index a2241ff..8defcd5 100644 --- a/MoonlightServers.Frontend/UI/Components/Nodes/UpdatePartials/Advanced.razor +++ b/MoonlightServers.Frontend/UI/Components/Nodes/UpdatePartials/Advanced.razor @@ -1,4 +1,3 @@ -@using MoonlightServers.Frontend.UI.Components.Forms @using MoonlightServers.Shared.Http.Requests.Admin.Nodes
diff --git a/MoonlightServers.Frontend/UI/Components/Nodes/UpdatePartials/Allocations.razor b/MoonlightServers.Frontend/UI/Components/Nodes/UpdatePartials/Allocations.razor index 6d549ee..0475f81 100644 --- a/MoonlightServers.Frontend/UI/Components/Nodes/UpdatePartials/Allocations.razor +++ b/MoonlightServers.Frontend/UI/Components/Nodes/UpdatePartials/Allocations.razor @@ -1,11 +1,12 @@ @using MoonCore.Blazor.FlyonUi.Alerts +@using MoonCore.Blazor.FlyonUi.Common @using MoonCore.Blazor.FlyonUi.Grid @using MoonCore.Blazor.FlyonUi.Grid.Columns @using MoonCore.Blazor.FlyonUi.Modals @using MoonCore.Blazor.FlyonUi.Toasts +@using MoonCore.Common @using MoonlightServers.Shared.Http.Responses.Admin.Nodes @using MoonCore.Helpers -@using MoonCore.Models @using MoonlightServers.Frontend.UI.Components.Nodes.Modals @using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations @using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations @@ -34,9 +35,8 @@
- + ItemSource="ItemSource"> + @@ -63,22 +63,16 @@ [Parameter] public NodeResponse Node { get; set; } private DataGrid Grid; - - private async Task> ItemsProviderAsync( - DataGridItemRequest request - ) - { - var query = $"?startIndex={request.StartIndex}&count={request.Count}"; - var countedData = await ApiClient.GetJson>( + private ItemSource ItemSource => ItemSourceFactory.From(LoadAsync); + + private async Task> LoadAsync(int startIndex, int count) + { + var query = $"?startIndex={startIndex}&count={count}"; + + return await ApiClient.GetJson>( $"api/admin/servers/nodes/{Node.Id}/allocations{query}" ); - - return new() - { - TotalCount = countedData.TotalCount, - Items = countedData.Items - }; } private async Task AddAllocationRangeAsync() diff --git a/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/Allocations.razor b/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/Allocations.razor index cb276ea..5e82390 100644 --- a/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/Allocations.razor +++ b/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/Allocations.razor @@ -1,8 +1,9 @@ +@using MoonCore.Blazor.FlyonUi.Common @using MoonlightServers.Shared.Http.Requests.Admin.Servers @using MoonCore.Helpers -@using MoonCore.Models @using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations @using MoonCore.Blazor.FlyonUi.Forms +@using MoonCore.Common @using MoonlightServers.Frontend.UI.Views.Admin.All @inject HttpApiClient ApiClient @@ -13,9 +14,8 @@
+ ItemSource="ItemSource">
@@ -26,19 +26,17 @@ [Parameter] public CreateServerRequest Request { get; set; } [Parameter] public Create Parent { get; set; } - private async Task ItemSourceAsync() + private ItemSource ItemSource => ItemSourceFactory.From(LoadAsync); + + private async Task> LoadAsync(int startIndex, int count) { // Handle unselected node // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract if (Parent.Node == null) return []; - var items = await CountedData.LoadAllAsync(async (startIndex, count) => - await ApiClient.GetJson>( - $"api/admin/servers/nodes/{Parent.Node.Id}/allocations/free?startIndex={startIndex}&count={count}" - ) + return await ApiClient.GetJson>( + $"api/admin/servers/nodes/{Parent.Node.Id}/allocations/free?startIndex={startIndex}&count={count}" ); - - return items; } } \ No newline at end of file diff --git a/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/General.razor b/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/General.razor index fd0121f..dddb6e6 100644 --- a/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/General.razor +++ b/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/General.razor @@ -1,10 +1,11 @@ +@using MoonCore.Blazor.FlyonUi.Common @using MoonlightServers.Shared.Http.Requests.Admin.Servers @using MoonCore.Helpers -@using MoonCore.Models @using MoonlightServers.Shared.Http.Responses.Admin.Nodes @using MoonlightServers.Shared.Http.Responses.Admin.Stars @using Moonlight.Shared.Http.Responses.Admin.Users @using MoonCore.Blazor.FlyonUi.Forms +@using MoonCore.Common @using MoonlightServers.Frontend.UI.Views.Admin.All @inject HttpApiClient ApiClient @@ -22,8 +23,7 @@
@@ -34,8 +34,7 @@
@@ -46,8 +45,7 @@
@@ -91,30 +89,28 @@ [Parameter] public CreateServerRequest Request { get; set; } [Parameter] public Create Parent { get; set; } - private async Task LoadStarsAsync() + private ItemSource StarsItemSource => ItemSourceFactory.From(LoadStarsAsync); + private ItemSource NodesItemSource => ItemSourceFactory.From(LoadNodesAsync); + private ItemSource UsersItemSource => ItemSourceFactory.From(LoadUsersAsync); + + private async Task> LoadStarsAsync(int startIndex, int count) { - return await CountedData.LoadAllAsync(async (startIndex, count) => - await ApiClient.GetJson>( - $"api/admin/servers/stars?startIndex={startIndex}&count={count}" - ) + return await ApiClient.GetJson>( + $"api/admin/servers/stars?startIndex={startIndex}&count={count}" ); } - private async Task LoadNodesAsync() + private async Task> LoadNodesAsync(int startIndex, int count) { - return await CountedData.LoadAllAsync(async (startIndex, count) => - await ApiClient.GetJson>( - $"api/admin/servers/nodes?startIndex={startIndex}&count={count}" - ) + return await ApiClient.GetJson>( + $"api/admin/servers/nodes?startIndex={startIndex}&count={count}" ); } - private async Task LoadUsersAsync() + private async Task> LoadUsersAsync(int startIndex, int count) { - return await CountedData.LoadAllAsync(async (startIndex, count) => - await ApiClient.GetJson>( - $"api/admin/users?startIndex={startIndex}&count={count}" - ) + return await ApiClient.GetJson>( + $"api/admin/users?startIndex={startIndex}&count={count}" ); } } \ No newline at end of file diff --git a/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/Variables.razor b/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/Variables.razor index ae34c01..77b5b2f 100644 --- a/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/Variables.razor +++ b/MoonlightServers.Frontend/UI/Components/Servers/CreatePartials/Variables.razor @@ -1,7 +1,7 @@ @using MoonCore.Blazor.FlyonUi.Components +@using MoonCore.Common @using MoonlightServers.Shared.Http.Requests.Admin.Servers @using MoonCore.Helpers -@using MoonCore.Models @using MoonlightServers.Frontend.UI.Views.Admin.All @using MoonlightServers.Shared.Http.Requests.Admin.ServerVariables @using MoonlightServers.Shared.Http.Responses.Admin.StarVariables @@ -51,10 +51,10 @@ StarVariables = []; return; } - - StarVariables = await CountedData.LoadAllAsync(async (startIndex, count) => + + StarVariables = await CountedData.AllAsync(async (index, count) => await ApiClient.GetJson>( - $"api/admin/servers/stars/{Parent.Star.Id}/variables?startIndex={startIndex}&count={count}" + $"api/admin/servers/stars/{Parent.Star.Id}/variables?startIndex={index}&count={count}" ) ); } @@ -77,7 +77,7 @@ { Key = starVariable.Key }; - + Request.Variables.Add(serverVar); } diff --git a/MoonlightServers.Frontend/UI/Components/Servers/CreateShareModal.razor b/MoonlightServers.Frontend/UI/Components/Servers/CreateShareModal.razor index be3051e..97a4227 100644 --- a/MoonlightServers.Frontend/UI/Components/Servers/CreateShareModal.razor +++ b/MoonlightServers.Frontend/UI/Components/Servers/CreateShareModal.razor @@ -3,7 +3,7 @@ @using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares @using MoonlightServers.Shared.Http.Responses.Client.Servers -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
diff --git a/MoonlightServers.Frontend/UI/Components/Servers/ServerTabs/SharesTab.razor b/MoonlightServers.Frontend/UI/Components/Servers/ServerTabs/SharesTab.razor index 08f995b..7b86a3a 100644 --- a/MoonlightServers.Frontend/UI/Components/Servers/ServerTabs/SharesTab.razor +++ b/MoonlightServers.Frontend/UI/Components/Servers/ServerTabs/SharesTab.razor @@ -2,7 +2,7 @@ @using MoonCore.Blazor.FlyonUi.Components @using MoonCore.Blazor.FlyonUi.Modals @using MoonCore.Blazor.FlyonUi.Toasts -@using MoonCore.Models +@using MoonCore.Common @using MoonlightServers.Frontend.Services @using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares @using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares @@ -65,7 +65,7 @@ private async Task LoadAsync(LazyLoader _) { - Shares = await CountedData.LoadAllAsync(async (startIndex, count) + Shares = await CountedData.AllAsync(async (startIndex, count) => await ShareService.GetAsync(Server.Id, startIndex, count) ); } diff --git a/MoonlightServers.Frontend/UI/Components/Servers/ServerTabs/VariablesTab.razor b/MoonlightServers.Frontend/UI/Components/Servers/ServerTabs/VariablesTab.razor index 06f0232..8cd6580 100644 --- a/MoonlightServers.Frontend/UI/Components/Servers/ServerTabs/VariablesTab.razor +++ b/MoonlightServers.Frontend/UI/Components/Servers/ServerTabs/VariablesTab.razor @@ -1,6 +1,6 @@ @using MoonCore.Blazor.FlyonUi.Components @using MoonCore.Blazor.FlyonUi.Toasts -@using MoonCore.Models +@using MoonCore.Common @using MoonlightServers.Frontend.Services @using MoonlightServers.Shared.Http.Responses.Client.Servers.Variables @@ -42,7 +42,7 @@ private async Task LoadAsync(LazyLoader _) { - Variables = await CountedData.LoadAllAsync(async (startIndex, count) + Variables = await CountedData.AllAsync(async (startIndex, count) => await ServerService.GetVariablesAsync(Server.Id, startIndex, count) ); } diff --git a/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/Allocations.razor b/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/Allocations.razor index 0ac3e92..d404d5f 100644 --- a/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/Allocations.razor +++ b/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/Allocations.razor @@ -1,9 +1,10 @@ +@using MoonCore.Blazor.FlyonUi.Common @using MoonlightServers.Shared.Http.Requests.Admin.Servers @using MoonCore.Helpers -@using MoonCore.Models @using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations @using MoonlightServers.Shared.Http.Responses.Admin.Servers @using MoonCore.Blazor.FlyonUi.Forms +@using MoonCore.Common @using MoonlightServers.Frontend.UI.Views.Admin.All @inject HttpApiClient ApiClient @@ -15,8 +16,7 @@ + ItemSource="ItemSource">
@@ -28,12 +28,12 @@ [Parameter] public ServerResponse Server { get; set; } [Parameter] public Update Parent { get; set; } - private async Task LoaderAsync() + private ItemSource ItemSource => ItemSourceFactory.From(LoadAsync); + + private async Task> LoadAsync(int startIndex, int count) { - return await CountedData.LoadAllAsync(async (startIndex, count) => - await ApiClient.GetJson>( - $"api/admin/servers/nodes/{Server.NodeId}/allocations/free?startIndex={startIndex}&count={count}&serverId={Server.Id}" - ) + return await ApiClient.GetJson>( + $"api/admin/servers/nodes/{Server.NodeId}/allocations/free?startIndex={startIndex}&count={count}&serverId={Server.Id}" ); } } \ No newline at end of file diff --git a/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/General.razor b/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/General.razor index 85393ee..7e6d3b3 100644 --- a/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/General.razor +++ b/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/General.razor @@ -1,8 +1,9 @@ +@using MoonCore.Blazor.FlyonUi.Common @using MoonlightServers.Shared.Http.Requests.Admin.Servers @using MoonCore.Helpers -@using MoonCore.Models @using Moonlight.Shared.Http.Responses.Admin.Users @using MoonCore.Blazor.FlyonUi.Forms +@using MoonCore.Common @using MoonlightServers.Frontend.UI.Views.Admin.All @inject HttpApiClient ApiClient @@ -20,9 +21,8 @@
+ ItemSource="UserItemSource">
@@ -64,12 +64,12 @@ [Parameter] public UpdateServerRequest Request { get; set; } [Parameter] public Update Parent { get; set; } - private async Task LoaderAsync() + private ItemSource UserItemSource => ItemSourceFactory.From(LoadAsync); + + private async Task> LoadAsync(int startIndex, int count) { - return await CountedData.LoadAllAsync(async (startIndex, count) => - await ApiClient.GetJson>( - $"api/admin/users?startIndex={startIndex}&count={count}" - ) + return await ApiClient.GetJson>( + $"api/admin/users?startIndex={startIndex}&count={count}" ); } } \ No newline at end of file diff --git a/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/Variables.razor b/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/Variables.razor index 6f45404..9b6dd73 100644 --- a/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/Variables.razor +++ b/MoonlightServers.Frontend/UI/Components/Servers/UpdatePartials/Variables.razor @@ -1,7 +1,7 @@ @using MoonCore.Blazor.FlyonUi.Components +@using MoonCore.Common @using MoonlightServers.Shared.Http.Requests.Admin.Servers @using MoonCore.Helpers -@using MoonCore.Models @using MoonlightServers.Shared.Http.Requests.Admin.ServerVariables @using MoonlightServers.Shared.Http.Responses.Admin.Servers @using MoonlightServers.Shared.Http.Responses.Admin.ServerVariables @@ -50,13 +50,13 @@ private async Task LoadAsync(LazyLoader _) { - StarVariables = await CountedData.LoadAllAsync(async (startIndex, count) => + StarVariables = await CountedData.AllAsync(async (startIndex, count) => await ApiClient.GetJson>( $"api/admin/servers/stars/{Server.StarId}/variables?startIndex={startIndex}&count={count}" ) ); - ServerVariables = await CountedData.LoadAllAsync(async (startIndex, count) => + ServerVariables = await CountedData.AllAsync(async (startIndex, count) => await ApiClient.GetJson>( $"api/admin/servers/{Server.Id}/variables?startIndex={startIndex}&count={count}" ) diff --git a/MoonlightServers.Frontend/UI/Components/Servers/UpdateShareModal.razor b/MoonlightServers.Frontend/UI/Components/Servers/UpdateShareModal.razor index baeecd2..064af66 100644 --- a/MoonlightServers.Frontend/UI/Components/Servers/UpdateShareModal.razor +++ b/MoonlightServers.Frontend/UI/Components/Servers/UpdateShareModal.razor @@ -4,7 +4,7 @@ @using MoonlightServers.Shared.Http.Responses.Client.Servers @using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
diff --git a/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateDockerImageModal.razor b/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateDockerImageModal.razor index 0b583fe..2730c80 100644 --- a/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateDockerImageModal.razor +++ b/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateDockerImageModal.razor @@ -2,7 +2,7 @@ @using MoonlightServers.Frontend.UI.Components.Forms @using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
diff --git a/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateParseConfigModal.razor b/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateParseConfigModal.razor index 55dcd63..ad460ff 100644 --- a/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateParseConfigModal.razor +++ b/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateParseConfigModal.razor @@ -2,7 +2,7 @@ @using MoonlightServers.Shared.Enums @using MoonlightServers.Shared.Models -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
diff --git a/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateVariableModal.razor b/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateVariableModal.razor index 132f0a0..4d137d0 100644 --- a/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateVariableModal.razor +++ b/MoonlightServers.Frontend/UI/Components/Stars/Modals/CreateVariableModal.razor @@ -3,7 +3,7 @@ @using MoonlightServers.Shared.Http.Requests.Admin.StarVariables @using MoonlightServers.Frontend.UI.Components.Forms -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
diff --git a/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateDockerImageModal.razor b/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateDockerImageModal.razor index a17e8f7..0a2d1d7 100644 --- a/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateDockerImageModal.razor +++ b/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateDockerImageModal.razor @@ -3,7 +3,7 @@ @using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages @using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
diff --git a/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateParseConfigModal.razor b/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateParseConfigModal.razor index f70e71c..6c29cf9 100644 --- a/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateParseConfigModal.razor +++ b/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateParseConfigModal.razor @@ -2,7 +2,7 @@ @using MoonlightServers.Shared.Enums @using MoonlightServers.Shared.Models -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
diff --git a/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateVariableModal.razor b/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateVariableModal.razor index 56ac0a2..20750b1 100644 --- a/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateVariableModal.razor +++ b/MoonlightServers.Frontend/UI/Components/Stars/Modals/UpdateVariableModal.razor @@ -4,7 +4,7 @@ @using MoonlightServers.Frontend.UI.Components.Forms @using MoonlightServers.Shared.Http.Responses.Admin.StarVariables -@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal +@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
diff --git a/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/DockerImage.razor b/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/DockerImage.razor index a617630..75febf5 100644 --- a/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/DockerImage.razor +++ b/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/DockerImage.razor @@ -2,8 +2,8 @@ @using MoonCore.Blazor.FlyonUi.Components @using MoonCore.Blazor.FlyonUi.Modals @using MoonCore.Blazor.FlyonUi.Toasts +@using MoonCore.Common @using MoonCore.Helpers -@using MoonCore.Models @using MoonlightServers.Frontend.UI.Components.Stars.Modals @using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages @using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages @@ -18,7 +18,7 @@
- +
@foreach (var dockerImage in DockerImages) { @@ -30,11 +30,13 @@
- -
@@ -47,19 +49,17 @@ @code { [Parameter] public StarResponse Star { get; set; } - + private StarDockerImageResponse[] DockerImages; private LazyLoader LazyLoader; private async Task LoadAsync(LazyLoader _) { - var pagedVariables = await ApiClient.GetJson>( - $"api/admin/servers/stars/{Star.Id}/dockerImages?startIndex=0&count=100" + DockerImages = await CountedData.AllAsync(async (startIndex, count) => + await ApiClient.GetJson>( + $"api/admin/servers/stars/{Star.Id}/dockerImages?startIndex={startIndex}&count={count}" + ) ); - - // TODO: Improve paged stuff - - DockerImages = pagedVariables.Items; } private async Task AddDockerImageAsync() @@ -67,34 +67,31 @@ Func onSubmit = async request => { await ApiClient.Post($"api/admin/servers/stars/{Star.Id}/dockerImages", request); - + await ToastService.SuccessAsync("Successfully created docker image"); await LazyLoader.ReloadAsync(); }; - - await ModalService.LaunchAsync(parameters => - { - parameters.Add("OnSubmit", onSubmit); - }); + + await ModalService.LaunchAsync(parameters => { parameters.Add("OnSubmit", onSubmit); }); } - + private async Task UpdateDockerImageAsync(StarDockerImageResponse dockerImage) { Func onSubmit = async request => { await ApiClient.Patch($"api/admin/servers/stars/{Star.Id}/dockerImages/{dockerImage.Id}", request); - + await ToastService.SuccessAsync("Successfully updated docker image"); await LazyLoader.ReloadAsync(); }; - + await ModalService.LaunchAsync(parameters => { parameters.Add("OnSubmit", onSubmit); parameters.Add("DockerImage", dockerImage); }); } - + private async Task DeleteDockerImageAsync(StarDockerImageResponse dockerImage) { await AlertService.ConfirmDangerAsync( @@ -103,7 +100,7 @@ async () => { await ApiClient.Delete($"api/admin/servers/stars/{Star.Id}/dockerImages/{dockerImage.Id}"); - + await ToastService.SuccessAsync("Successfully deleted docker image"); await LazyLoader.ReloadAsync(); } diff --git a/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/Misc.razor b/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/Misc.razor index 495598e..40b9c06 100644 --- a/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/Misc.razor +++ b/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/Misc.razor @@ -1,6 +1,6 @@ @using MoonCore.Blazor.FlyonUi.Components +@using MoonCore.Common @using MoonCore.Helpers -@using MoonCore.Models @using MoonlightServers.Shared.Http.Requests.Admin.Stars @using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages @using MoonlightServers.Shared.Http.Responses.Admin.Stars diff --git a/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/Variables.razor b/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/Variables.razor index 383898b..ce78720 100644 --- a/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/Variables.razor +++ b/MoonlightServers.Frontend/UI/Components/Stars/UpdatePartials/Variables.razor @@ -2,8 +2,8 @@ @using MoonCore.Blazor.FlyonUi.Components @using MoonCore.Blazor.FlyonUi.Modals @using MoonCore.Blazor.FlyonUi.Toasts +@using MoonCore.Common @using MoonCore.Helpers -@using MoonCore.Models @using MoonlightServers.Frontend.UI.Components.Stars.Modals @using MoonlightServers.Shared.Http.Requests.Admin.StarVariables @using MoonlightServers.Shared.Http.Responses.Admin.Stars @@ -28,7 +28,7 @@ @variable.Name
- +