Upgraded mooncore. Done required refactoring to function with new version
This commit is contained in:
@@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.9" />
|
||||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.8"/>
|
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.9"/>
|
||||||
<PackageReference Include="MoonCore.PluginFramework.Generator" Version="1.0.2"/>
|
<PackageReference Include="MoonCore.PluginFramework.Generator" Version="1.0.3"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
|
using Moonlight.ApiServer.Configuration;
|
||||||
using Moonlight.ApiServer.Startup;
|
using Moonlight.ApiServer.Startup;
|
||||||
using MoonlightServers.ApiServer.Runtime;
|
using MoonlightServers.ApiServer.Runtime;
|
||||||
|
|
||||||
var pluginLoader = new DevPluginLoader();
|
var pluginLoader = new DevPluginLoader();
|
||||||
pluginLoader.Initialize();
|
pluginLoader.Initialize();
|
||||||
|
|
||||||
var cs = new Startup();
|
|
||||||
|
|
||||||
await cs.InitializeAsync(args, pluginLoader.Instances);
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
await cs.AddMoonlightAsync(builder);
|
builder.AddMoonlight(pluginLoader.Instances);
|
||||||
|
|
||||||
var app = builder.Build();
|
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
|
// Handle setup of wasm app hosting in the runtime
|
||||||
// so the Moonlight.ApiServer doesn't need the wasm package
|
// so the Moonlight.ApiServer doesn't need the wasm package
|
||||||
if (cs.Configuration.Frontend.EnableHosting)
|
if (configuration.Frontend.EnableHosting)
|
||||||
{
|
{
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
app.UseWebAssemblyDebugging();
|
app.UseWebAssemblyDebugging();
|
||||||
@@ -27,5 +28,7 @@ if (cs.Configuration.Frontend.EnableHosting)
|
|||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.MapMoonlight(pluginLoader.Instances);
|
||||||
|
|
||||||
|
|
||||||
await app.RunAsync();
|
await app.RunAsync();
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Extended.Abstractions;
|
using MoonCore.Extended.Abstractions;
|
||||||
using MoonCore.Models;
|
|
||||||
using MoonlightServers.ApiServer.Database.Entities;
|
using MoonlightServers.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Mappers;
|
using MoonlightServers.ApiServer.Mappers;
|
||||||
using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations;
|
using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using MoonCore.Extended.Abstractions;
|
using MoonCore.Extended.Abstractions;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Helpers;
|
using MoonCore.Helpers;
|
||||||
using MoonCore.Models;
|
|
||||||
using MoonlightServers.ApiServer.Database.Entities;
|
using MoonlightServers.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Mappers;
|
using MoonlightServers.ApiServer.Mappers;
|
||||||
using MoonlightServers.Shared.Http.Requests.Admin.Nodes;
|
using MoonlightServers.Shared.Http.Requests.Admin.Nodes;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Extended.Abstractions;
|
using MoonCore.Extended.Abstractions;
|
||||||
using MoonCore.Models;
|
|
||||||
using MoonlightServers.ApiServer.Database.Entities;
|
using MoonlightServers.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Mappers;
|
using MoonlightServers.ApiServer.Mappers;
|
||||||
using MoonlightServers.Shared.Http.Responses.Admin.ServerVariables;
|
using MoonlightServers.Shared.Http.Responses.Admin.ServerVariables;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Extended.Abstractions;
|
using MoonCore.Extended.Abstractions;
|
||||||
using MoonCore.Models;
|
|
||||||
using Moonlight.ApiServer.Database.Entities;
|
using Moonlight.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Database.Entities;
|
using MoonlightServers.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Mappers;
|
using MoonlightServers.ApiServer.Mappers;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using MoonCore.Extended.Abstractions;
|
using MoonCore.Extended.Abstractions;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using MoonCore.Models;
|
using MoonCore.Common;
|
||||||
using MoonlightServers.ApiServer.Database.Entities;
|
using MoonlightServers.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Mappers;
|
using MoonlightServers.ApiServer.Mappers;
|
||||||
using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages;
|
using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Exceptions;
|
using MoonCore.Exceptions;
|
||||||
using MoonCore.Extended.Abstractions;
|
using MoonCore.Extended.Abstractions;
|
||||||
using MoonCore.Models;
|
|
||||||
using MoonlightServers.ApiServer.Database.Entities;
|
using MoonlightServers.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Mappers;
|
using MoonlightServers.ApiServer.Mappers;
|
||||||
using MoonlightServers.Shared.Http.Requests.Admin.StarVariables;
|
using MoonlightServers.Shared.Http.Requests.Admin.StarVariables;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Extended.Abstractions;
|
using MoonCore.Extended.Abstractions;
|
||||||
using MoonCore.Models;
|
|
||||||
using MoonlightServers.ApiServer.Database.Entities;
|
using MoonlightServers.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Mappers;
|
using MoonlightServers.ApiServer.Mappers;
|
||||||
using MoonlightServers.Shared.Http.Requests.Admin.Stars;
|
using MoonlightServers.Shared.Http.Requests.Admin.Stars;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ using System.Security.Claims;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Extended.Abstractions;
|
using MoonCore.Extended.Abstractions;
|
||||||
using MoonCore.Models;
|
|
||||||
using Moonlight.ApiServer.Database.Entities;
|
using Moonlight.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Database.Entities;
|
using MoonlightServers.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Extensions;
|
using MoonlightServers.ApiServer.Extensions;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Extended.Abstractions;
|
using MoonCore.Extended.Abstractions;
|
||||||
using MoonCore.Models;
|
|
||||||
using Moonlight.ApiServer.Database.Entities;
|
using Moonlight.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Database.Entities;
|
using MoonlightServers.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Mappers;
|
using MoonlightServers.ApiServer.Mappers;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Exceptions;
|
using MoonCore.Exceptions;
|
||||||
using MoonCore.Extended.Abstractions;
|
using MoonCore.Extended.Abstractions;
|
||||||
using MoonCore.Models;
|
|
||||||
using MoonlightServers.ApiServer.Database.Entities;
|
using MoonlightServers.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.ApiServer.Services;
|
using MoonlightServers.ApiServer.Services;
|
||||||
using MoonlightServers.Shared.Constants;
|
using MoonlightServers.Shared.Constants;
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ using Microsoft.AspNetCore.Authorization;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Exceptions;
|
using MoonCore.Exceptions;
|
||||||
using MoonCore.Extended.Abstractions;
|
using MoonCore.Extended.Abstractions;
|
||||||
using MoonCore.Models;
|
|
||||||
using MoonlightServers.ApiServer.Database.Entities;
|
using MoonlightServers.ApiServer.Database.Entities;
|
||||||
using MoonlightServers.DaemonShared.PanelSide.Http.Responses;
|
using MoonlightServers.DaemonShared.PanelSide.Http.Responses;
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Database\Migrations\"/>
|
<Folder Include="Database\Migrations\"/>
|
||||||
<Folder Include="Http\Middleware\"/>
|
<Folder Include="Http\Middleware\"/>
|
||||||
|
<Folder Include="Startup\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Label="Build instruction for nuget package building">
|
<ItemGroup Label="Build instruction for nuget package building">
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using MoonCore.Extensions;
|
using MoonCore.Extensions;
|
||||||
using Moonlight.ApiServer.Configuration;
|
using Moonlight.ApiServer.Configuration;
|
||||||
using Moonlight.ApiServer.Models;
|
using Moonlight.ApiServer.Models;
|
||||||
@@ -11,11 +10,11 @@ using MoonlightServers.ApiServer.Helpers;
|
|||||||
using MoonlightServers.ApiServer.Implementations.ServerAuthFilters;
|
using MoonlightServers.ApiServer.Implementations.ServerAuthFilters;
|
||||||
using MoonlightServers.ApiServer.Interfaces;
|
using MoonlightServers.ApiServer.Interfaces;
|
||||||
|
|
||||||
namespace MoonlightServers.ApiServer.Startup;
|
namespace MoonlightServers.ApiServer;
|
||||||
|
|
||||||
public class PluginStartup : IPluginStartup
|
public class PluginStartup : IPluginStartup
|
||||||
{
|
{
|
||||||
public Task BuildApplicationAsync(IServiceProvider serviceProvider, IHostApplicationBuilder builder)
|
public void AddPlugin(WebApplicationBuilder builder)
|
||||||
{
|
{
|
||||||
// Scan the current plugin assembly for di services
|
// Scan the current plugin assembly for di services
|
||||||
builder.Services.AutoAddServices<PluginStartup>();
|
builder.Services.AutoAddServices<PluginStartup>();
|
||||||
@@ -27,7 +26,8 @@ public class PluginStartup : IPluginStartup
|
|||||||
.AddAuthentication()
|
.AddAuthentication()
|
||||||
.AddScheme<NodeAuthOptions, NodeAuthScheme>("nodeAuthentication", null);
|
.AddScheme<NodeAuthOptions, NodeAuthScheme>("nodeAuthentication", null);
|
||||||
|
|
||||||
var configuration = serviceProvider.GetRequiredService<AppConfiguration>();
|
var configuration = AppConfiguration.CreateEmpty();
|
||||||
|
builder.Configuration.Bind(configuration);
|
||||||
|
|
||||||
if (configuration.Frontend.EnableHosting)
|
if (configuration.Frontend.EnableHosting)
|
||||||
{
|
{
|
||||||
@@ -47,13 +47,13 @@ public class PluginStartup : IPluginStartup
|
|||||||
builder.Services.AddSingleton<IServerAuthorizationFilter, OwnerAuthFilter>();
|
builder.Services.AddSingleton<IServerAuthorizationFilter, OwnerAuthFilter>();
|
||||||
builder.Services.AddScoped<IServerAuthorizationFilter, AdminAuthFilter>();
|
builder.Services.AddScoped<IServerAuthorizationFilter, AdminAuthFilter>();
|
||||||
builder.Services.AddScoped<IServerAuthorizationFilter, ShareAuthFilter>();
|
builder.Services.AddScoped<IServerAuthorizationFilter, ShareAuthFilter>();
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task ConfigureApplicationAsync(IServiceProvider serviceProvider, IApplicationBuilder app)
|
public void UsePlugin(WebApplication app)
|
||||||
=> Task.CompletedTask;
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public Task ConfigureEndpointsAsync(IServiceProvider serviceProvider, IEndpointRouteBuilder routeBuilder)
|
public void MapPlugin(WebApplication app)
|
||||||
=> Task.CompletedTask;
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.9"/>
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.9"/>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.9" PrivateAssets="all"/>
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.9" PrivateAssets="all"/>
|
||||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.8" />
|
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.9" />
|
||||||
<PackageReference Include="MoonCore.PluginFramework.Generator" Version="1.0.2" />
|
<PackageReference Include="MoonCore.PluginFramework.Generator" Version="1.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -5,16 +5,12 @@ using MoonlightServers.Frontend.Runtime;
|
|||||||
var pluginLoader = new DevPluginLoader();
|
var pluginLoader = new DevPluginLoader();
|
||||||
pluginLoader.Initialize();
|
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 app.RunAsync();
|
||||||
|
|
||||||
await startup.AddMoonlightAsync(wasmApp);
|
|
||||||
|
|
||||||
await wasmApp.RunAsync();
|
|
||||||
@@ -35,4 +35,8 @@
|
|||||||
<None Include="MoonlightServers.Frontend.targets" Pack="true" PackagePath="build/MoonlightServers.Frontend.targets" />
|
<None Include="MoonlightServers.Frontend.targets" Pack="true" PackagePath="build/MoonlightServers.Frontend.targets" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Startup\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -6,23 +6,21 @@ using Moonlight.Client.Plugins;
|
|||||||
using MoonlightServers.Frontend.Implementations;
|
using MoonlightServers.Frontend.Implementations;
|
||||||
using MoonlightServers.Frontend.Interfaces;
|
using MoonlightServers.Frontend.Interfaces;
|
||||||
|
|
||||||
namespace MoonlightServers.Frontend.Startup;
|
namespace MoonlightServers.Frontend;
|
||||||
|
|
||||||
public class PluginStartup : IPluginStartup
|
public class PluginStartup : IPluginStartup
|
||||||
{
|
{
|
||||||
public Task BuildApplicationAsync(IServiceProvider serviceProvider, WebAssemblyHostBuilder builder)
|
public void AddPlugin(WebAssemblyHostBuilder builder)
|
||||||
{
|
{
|
||||||
builder.Services.AddSingleton<ISidebarItemProvider, SidebarImplementation>();
|
builder.Services.AddSingleton<ISidebarItemProvider, SidebarImplementation>();
|
||||||
builder.Services.AddSingleton<IServerTabProvider, DefaultServerTabProvider>();
|
builder.Services.AddSingleton<IServerTabProvider, DefaultServerTabProvider>();
|
||||||
builder.Services.AddSingleton<IServerPermissionProvider, DefaultPermissionProvider>();
|
builder.Services.AddSingleton<IServerPermissionProvider, DefaultPermissionProvider>();
|
||||||
|
|
||||||
builder.Services.AutoAddServices<PluginStartup>();
|
builder.Services.AutoAddServices<PluginStartup>();
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task ConfigureApplicationAsync(IServiceProvider serviceProvider, WebAssemblyHost app)
|
public void ConfigurePlugin(WebAssemblyHost app)
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using MoonCore.Attributes;
|
using MoonCore.Attributes;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Helpers;
|
using MoonCore.Helpers;
|
||||||
using MoonCore.Models;
|
|
||||||
using MoonlightServers.Shared.Http.Requests.Client.Servers;
|
using MoonlightServers.Shared.Http.Requests.Client.Servers;
|
||||||
using MoonlightServers.Shared.Http.Requests.Client.Servers.Variables;
|
using MoonlightServers.Shared.Http.Requests.Client.Servers.Variables;
|
||||||
using MoonlightServers.Shared.Http.Responses.Client.Servers;
|
using MoonlightServers.Shared.Http.Responses.Client.Servers;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using MoonCore.Attributes;
|
using MoonCore.Attributes;
|
||||||
|
using MoonCore.Common;
|
||||||
using MoonCore.Helpers;
|
using MoonCore.Helpers;
|
||||||
using MoonCore.Models;
|
|
||||||
using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares;
|
using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares;
|
||||||
using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares;
|
using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares;
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ badge-outline
|
|||||||
badge-primary
|
badge-primary
|
||||||
badge-soft
|
badge-soft
|
||||||
badge-success
|
badge-success
|
||||||
|
basis-full
|
||||||
bg-background
|
bg-background
|
||||||
bg-background/60
|
bg-background/60
|
||||||
bg-base-100
|
bg-base-100
|
||||||
@@ -71,6 +72,8 @@ bg-base-150
|
|||||||
bg-base-200
|
bg-base-200
|
||||||
bg-base-200!
|
bg-base-200!
|
||||||
bg-base-200/50
|
bg-base-200/50
|
||||||
|
bg-base-200/60
|
||||||
|
bg-base-250
|
||||||
bg-base-300
|
bg-base-300
|
||||||
bg-base-300/45
|
bg-base-300/45
|
||||||
bg-base-300/50
|
bg-base-300/50
|
||||||
@@ -183,12 +186,22 @@ contents
|
|||||||
cursor-default
|
cursor-default
|
||||||
cursor-not-allowed
|
cursor-not-allowed
|
||||||
cursor-pointer
|
cursor-pointer
|
||||||
|
cursor-progress
|
||||||
custom-option
|
custom-option
|
||||||
diff
|
diff
|
||||||
disabled
|
disabled
|
||||||
divide-base-150/60
|
divide-base-150/60
|
||||||
divide-y
|
divide-y
|
||||||
divider
|
divider
|
||||||
|
drawer
|
||||||
|
drawer-body
|
||||||
|
drawer-bottom
|
||||||
|
drawer-end
|
||||||
|
drawer-footer
|
||||||
|
drawer-header
|
||||||
|
drawer-start
|
||||||
|
drawer-title
|
||||||
|
drawer-top
|
||||||
drop-shadow
|
drop-shadow
|
||||||
dropdown
|
dropdown
|
||||||
dropdown-active
|
dropdown-active
|
||||||
@@ -275,6 +288,7 @@ h-14
|
|||||||
h-2
|
h-2
|
||||||
h-3
|
h-3
|
||||||
h-32
|
h-32
|
||||||
|
h-36
|
||||||
h-6
|
h-6
|
||||||
h-64
|
h-64
|
||||||
h-8
|
h-8
|
||||||
@@ -351,6 +365,7 @@ lg:ring-1
|
|||||||
lg:ring-base-content/10
|
lg:ring-base-content/10
|
||||||
lg:rounded-lg
|
lg:rounded-lg
|
||||||
lg:shadow-xs
|
lg:shadow-xs
|
||||||
|
lg:table-cell
|
||||||
link
|
link
|
||||||
link-animated
|
link-animated
|
||||||
link-hover
|
link-hover
|
||||||
@@ -372,7 +387,9 @@ max-lg:flex-col
|
|||||||
max-lg:hidden
|
max-lg:hidden
|
||||||
max-md:flex-wrap
|
max-md:flex-wrap
|
||||||
max-md:justify-center
|
max-md:justify-center
|
||||||
|
max-md:w-full
|
||||||
max-sm:hidden
|
max-sm:hidden
|
||||||
|
max-w-64
|
||||||
max-w-7xl
|
max-w-7xl
|
||||||
max-w-8
|
max-w-8
|
||||||
max-w-80
|
max-w-80
|
||||||
@@ -386,14 +403,20 @@ mb-1
|
|||||||
mb-1.5
|
mb-1.5
|
||||||
mb-2
|
mb-2
|
||||||
mb-2.5
|
mb-2.5
|
||||||
|
mb-25
|
||||||
mb-3
|
mb-3
|
||||||
mb-4
|
mb-4
|
||||||
mb-5
|
mb-5
|
||||||
mb-8
|
mb-8
|
||||||
md:col-span-1
|
md:col-span-1
|
||||||
md:col-span-6
|
md:col-span-6
|
||||||
|
md:flex
|
||||||
|
md:gap-2
|
||||||
md:grid-cols-2
|
md:grid-cols-2
|
||||||
|
md:hidden!
|
||||||
|
md:items-center
|
||||||
md:min-w-md
|
md:min-w-md
|
||||||
|
md:navbar-end
|
||||||
md:table-cell
|
md:table-cell
|
||||||
md:text-3xl
|
md:text-3xl
|
||||||
me-1
|
me-1
|
||||||
@@ -408,6 +431,7 @@ menu-dropdown
|
|||||||
menu-dropdown-show
|
menu-dropdown-show
|
||||||
menu-focus
|
menu-focus
|
||||||
menu-horizontal
|
menu-horizontal
|
||||||
|
menu-sm
|
||||||
menu-title
|
menu-title
|
||||||
min-h-0
|
min-h-0
|
||||||
min-h-full
|
min-h-full
|
||||||
@@ -452,10 +476,13 @@ mt-8
|
|||||||
mx-1
|
mx-1
|
||||||
mx-auto
|
mx-auto
|
||||||
my-2.5
|
my-2.5
|
||||||
|
my-20
|
||||||
my-3
|
my-3
|
||||||
my-5
|
my-5
|
||||||
my-8
|
my-8
|
||||||
my-auto
|
my-auto
|
||||||
|
navbar
|
||||||
|
navbar-start
|
||||||
object-cover
|
object-cover
|
||||||
opacity-0
|
opacity-0
|
||||||
opacity-100
|
opacity-100
|
||||||
@@ -470,9 +497,14 @@ overflow-x-hidden
|
|||||||
overflow-y-auto
|
overflow-y-auto
|
||||||
overlay-open:duration-50
|
overlay-open:duration-50
|
||||||
overlay-open:opacity-100
|
overlay-open:opacity-100
|
||||||
|
overlay-open:translate-x-0
|
||||||
|
overlay-open:translate-y-0
|
||||||
|
overscroll-contain
|
||||||
|
p-0
|
||||||
p-0.5
|
p-0.5
|
||||||
p-1
|
p-1
|
||||||
p-1.5
|
p-1.5
|
||||||
|
p-12
|
||||||
p-2
|
p-2
|
||||||
p-2.5
|
p-2.5
|
||||||
p-3
|
p-3
|
||||||
@@ -481,6 +513,7 @@ p-5
|
|||||||
p-6
|
p-6
|
||||||
p-8
|
p-8
|
||||||
pb-1
|
pb-1
|
||||||
|
pe-1
|
||||||
pe-1.5
|
pe-1.5
|
||||||
pin-input
|
pin-input
|
||||||
pin-input-underline
|
pin-input-underline
|
||||||
@@ -516,6 +549,7 @@ radio
|
|||||||
range
|
range
|
||||||
relative
|
relative
|
||||||
resize
|
resize
|
||||||
|
right-0
|
||||||
ring
|
ring
|
||||||
ring-0
|
ring-0
|
||||||
ring-1
|
ring-1
|
||||||
@@ -548,6 +582,7 @@ shadow
|
|||||||
shadow-base-300/20
|
shadow-base-300/20
|
||||||
shadow-lg
|
shadow-lg
|
||||||
shadow-md
|
shadow-md
|
||||||
|
shadow-none
|
||||||
shadow-sm
|
shadow-sm
|
||||||
shadow-xs
|
shadow-xs
|
||||||
shrink-0
|
shrink-0
|
||||||
@@ -557,6 +592,7 @@ size-4
|
|||||||
size-5
|
size-5
|
||||||
size-7
|
size-7
|
||||||
size-8
|
size-8
|
||||||
|
size-8.5
|
||||||
skeleton
|
skeleton
|
||||||
skeleton-animated
|
skeleton-animated
|
||||||
sm:auto-cols-max
|
sm:auto-cols-max
|
||||||
@@ -635,6 +671,7 @@ tabs-xs
|
|||||||
text-2xl
|
text-2xl
|
||||||
text-3xl
|
text-3xl
|
||||||
text-4xl
|
text-4xl
|
||||||
|
text-5xl
|
||||||
text-accent
|
text-accent
|
||||||
text-base
|
text-base
|
||||||
text-base-content
|
text-base-content
|
||||||
@@ -686,6 +723,7 @@ tooltip
|
|||||||
tooltip-content
|
tooltip-content
|
||||||
top-0
|
top-0
|
||||||
top-1/2
|
top-1/2
|
||||||
|
top-3
|
||||||
top-full
|
top-full
|
||||||
tracking-tight
|
tracking-tight
|
||||||
tracking-wide
|
tracking-wide
|
||||||
@@ -693,7 +731,9 @@ transform
|
|||||||
transition
|
transition
|
||||||
transition-all
|
transition-all
|
||||||
transition-opacity
|
transition-opacity
|
||||||
|
transition-transform
|
||||||
translate-x-0
|
translate-x-0
|
||||||
|
translate-x-full
|
||||||
truncate
|
truncate
|
||||||
underline
|
underline
|
||||||
uppercase
|
uppercase
|
||||||
@@ -703,18 +743,24 @@ w-0
|
|||||||
w-0.5
|
w-0.5
|
||||||
w-12
|
w-12
|
||||||
w-13
|
w-13
|
||||||
|
w-20
|
||||||
w-32
|
w-32
|
||||||
w-4
|
w-4
|
||||||
w-56
|
w-56
|
||||||
|
w-6
|
||||||
w-64
|
w-64
|
||||||
w-8
|
w-8
|
||||||
w-auto
|
w-auto
|
||||||
w-fit
|
w-fit
|
||||||
w-full
|
w-full
|
||||||
whitespace-nowrap
|
whitespace-nowrap
|
||||||
|
xl:flex
|
||||||
|
xl:grid-cols-2
|
||||||
xl:grid-cols-3
|
xl:grid-cols-3
|
||||||
xl:grid-cols-4
|
xl:grid-cols-4
|
||||||
z-1
|
z-1
|
||||||
z-10
|
z-10
|
||||||
z-40
|
z-40
|
||||||
z-50
|
z-50
|
||||||
|
z-69
|
||||||
|
z-70
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
@using Microsoft.Extensions.Logging
|
@using Microsoft.Extensions.Logging
|
||||||
@using XtermBlazor
|
@using XtermBlazor
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
@inject IJSRuntime JsRuntime
|
@inject IJSRuntime JsRuntime
|
||||||
@inject ILogger<FullScreenModal> Logger
|
@inject ILogger<FullScreenModal> Logger
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
||||||
|
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
||||||
|
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
||||||
|
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
@using MoonlightServers.Frontend.UI.Components.Forms
|
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.Nodes
|
@using MoonlightServers.Shared.Http.Requests.Admin.Nodes
|
||||||
|
|
||||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||||
|
@using MoonCore.Blazor.FlyonUi.Common
|
||||||
@using MoonCore.Blazor.FlyonUi.Grid
|
@using MoonCore.Blazor.FlyonUi.Grid
|
||||||
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
||||||
@using MoonCore.Blazor.FlyonUi.Modals
|
@using MoonCore.Blazor.FlyonUi.Modals
|
||||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||||
|
@using MoonCore.Common
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Frontend.UI.Components.Nodes.Modals
|
@using MoonlightServers.Frontend.UI.Components.Nodes.Modals
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
||||||
@@ -34,9 +35,8 @@
|
|||||||
<div class="col-span-1 md:col-span-2 -mb-3">
|
<div class="col-span-1 md:col-span-2 -mb-3">
|
||||||
<DataGrid @ref="Grid"
|
<DataGrid @ref="Grid"
|
||||||
TGridItem="NodeAllocationResponse"
|
TGridItem="NodeAllocationResponse"
|
||||||
EnablePagination="true"
|
ItemSource="ItemSource">
|
||||||
ItemsProvider="ItemsProviderAsync">
|
<PropertyColumn Field="x => x.IpAddress" Title="IP Address"/>
|
||||||
<PropertyColumn Field="x => x.IpAddress" Title="IP Address" />
|
|
||||||
<PropertyColumn Field="x => x.Port"/>
|
<PropertyColumn Field="x => x.Port"/>
|
||||||
<TemplateColumn>
|
<TemplateColumn>
|
||||||
<td>
|
<td>
|
||||||
@@ -64,21 +64,15 @@
|
|||||||
|
|
||||||
private DataGrid<NodeAllocationResponse> Grid;
|
private DataGrid<NodeAllocationResponse> Grid;
|
||||||
|
|
||||||
private async Task<DataGridItemResult<NodeAllocationResponse>> ItemsProviderAsync(
|
private ItemSource<NodeAllocationResponse> ItemSource => ItemSourceFactory.From(LoadAsync);
|
||||||
DataGridItemRequest request
|
|
||||||
)
|
|
||||||
{
|
|
||||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
|
||||||
|
|
||||||
var countedData = await ApiClient.GetJson<CountedData<NodeAllocationResponse>>(
|
private async Task<IEnumerable<NodeAllocationResponse>> LoadAsync(int startIndex, int count)
|
||||||
|
{
|
||||||
|
var query = $"?startIndex={startIndex}&count={count}";
|
||||||
|
|
||||||
|
return await ApiClient.GetJson<CountedData<NodeAllocationResponse>>(
|
||||||
$"api/admin/servers/nodes/{Node.Id}/allocations{query}"
|
$"api/admin/servers/nodes/{Node.Id}/allocations{query}"
|
||||||
);
|
);
|
||||||
|
|
||||||
return new()
|
|
||||||
{
|
|
||||||
TotalCount = countedData.TotalCount,
|
|
||||||
Items = countedData.Items
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddAllocationRangeAsync()
|
private async Task AddAllocationRangeAsync()
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
@using MoonCore.Blazor.FlyonUi.Common
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
||||||
@using MoonCore.Blazor.FlyonUi.Forms
|
@using MoonCore.Blazor.FlyonUi.Forms
|
||||||
|
@using MoonCore.Common
|
||||||
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
||||||
|
|
||||||
@inject HttpApiClient ApiClient
|
@inject HttpApiClient ApiClient
|
||||||
@@ -13,9 +14,8 @@
|
|||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<InputMultipleItem TItem="NodeAllocationResponse"
|
<InputMultipleItem TItem="NodeAllocationResponse"
|
||||||
DisplayField="@(x => $"{x.IpAddress}:{x.Port}")"
|
DisplayField="@(x => $"{x.IpAddress}:{x.Port}")"
|
||||||
SearchField="@(x => $"{x.IpAddress}:{x.Port}")"
|
|
||||||
Value="Parent.Allocations"
|
Value="Parent.Allocations"
|
||||||
ItemSource="ItemSourceAsync">
|
ItemSource="ItemSource">
|
||||||
</InputMultipleItem>
|
</InputMultipleItem>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -26,19 +26,17 @@
|
|||||||
[Parameter] public CreateServerRequest Request { get; set; }
|
[Parameter] public CreateServerRequest Request { get; set; }
|
||||||
[Parameter] public Create Parent { get; set; }
|
[Parameter] public Create Parent { get; set; }
|
||||||
|
|
||||||
private async Task<NodeAllocationResponse[]> ItemSourceAsync()
|
private ItemSource<NodeAllocationResponse> ItemSource => ItemSourceFactory.From(LoadAsync);
|
||||||
|
|
||||||
|
private async Task<IEnumerable<NodeAllocationResponse>> LoadAsync(int startIndex, int count)
|
||||||
{
|
{
|
||||||
// Handle unselected node
|
// Handle unselected node
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
||||||
if (Parent.Node == null)
|
if (Parent.Node == null)
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
var items = await CountedData<NodeAllocationResponse>.LoadAllAsync(async (startIndex, count) =>
|
return await ApiClient.GetJson<CountedData<NodeAllocationResponse>>(
|
||||||
await ApiClient.GetJson<CountedData<NodeAllocationResponse>>(
|
$"api/admin/servers/nodes/{Parent.Node.Id}/allocations/free?startIndex={startIndex}&count={count}"
|
||||||
$"api/admin/servers/nodes/{Parent.Node.Id}/allocations/free?startIndex={startIndex}&count={count}"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return items;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
|
@using MoonCore.Blazor.FlyonUi.Common
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
||||||
@using Moonlight.Shared.Http.Responses.Admin.Users
|
@using Moonlight.Shared.Http.Responses.Admin.Users
|
||||||
@using MoonCore.Blazor.FlyonUi.Forms
|
@using MoonCore.Blazor.FlyonUi.Forms
|
||||||
|
@using MoonCore.Common
|
||||||
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
||||||
|
|
||||||
@inject HttpApiClient ApiClient
|
@inject HttpApiClient ApiClient
|
||||||
@@ -22,8 +23,7 @@
|
|||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<InputItem TItem="UserResponse"
|
<InputItem TItem="UserResponse"
|
||||||
DisplayField="@(x => x.Username)"
|
DisplayField="@(x => x.Username)"
|
||||||
SearchField="@(x => x.Username)"
|
ItemSource="UsersItemSource"
|
||||||
ItemSource="LoadUsersAsync"
|
|
||||||
@bind-Value="Parent.Owner">
|
@bind-Value="Parent.Owner">
|
||||||
</InputItem>
|
</InputItem>
|
||||||
</div>
|
</div>
|
||||||
@@ -34,8 +34,7 @@
|
|||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<InputItem TItem="StarResponse"
|
<InputItem TItem="StarResponse"
|
||||||
DisplayField="@(x => x.Name)"
|
DisplayField="@(x => x.Name)"
|
||||||
SearchField="@(x => x.Name)"
|
ItemSource="StarsItemSource"
|
||||||
ItemSource="LoadStarsAsync"
|
|
||||||
@bind-Value="Parent.Star">
|
@bind-Value="Parent.Star">
|
||||||
</InputItem>
|
</InputItem>
|
||||||
</div>
|
</div>
|
||||||
@@ -46,8 +45,7 @@
|
|||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<InputItem TItem="NodeResponse"
|
<InputItem TItem="NodeResponse"
|
||||||
DisplayField="@(x => x.Name)"
|
DisplayField="@(x => x.Name)"
|
||||||
SearchField="@(x => x.Name)"
|
ItemSource="NodesItemSource"
|
||||||
ItemSource="LoadNodesAsync"
|
|
||||||
@bind-Value="Parent.Node">
|
@bind-Value="Parent.Node">
|
||||||
</InputItem>
|
</InputItem>
|
||||||
</div>
|
</div>
|
||||||
@@ -91,30 +89,28 @@
|
|||||||
[Parameter] public CreateServerRequest Request { get; set; }
|
[Parameter] public CreateServerRequest Request { get; set; }
|
||||||
[Parameter] public Create Parent { get; set; }
|
[Parameter] public Create Parent { get; set; }
|
||||||
|
|
||||||
private async Task<StarResponse[]> LoadStarsAsync()
|
private ItemSource<StarResponse> StarsItemSource => ItemSourceFactory.From(LoadStarsAsync);
|
||||||
|
private ItemSource<NodeResponse> NodesItemSource => ItemSourceFactory.From(LoadNodesAsync);
|
||||||
|
private ItemSource<UserResponse> UsersItemSource => ItemSourceFactory.From(LoadUsersAsync);
|
||||||
|
|
||||||
|
private async Task<IEnumerable<StarResponse>> LoadStarsAsync(int startIndex, int count)
|
||||||
{
|
{
|
||||||
return await CountedData<StarResponse>.LoadAllAsync(async (startIndex, count) =>
|
return await ApiClient.GetJson<CountedData<StarResponse>>(
|
||||||
await ApiClient.GetJson<CountedData<StarResponse>>(
|
$"api/admin/servers/stars?startIndex={startIndex}&count={count}"
|
||||||
$"api/admin/servers/stars?startIndex={startIndex}&count={count}"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<NodeResponse[]> LoadNodesAsync()
|
private async Task<IEnumerable<NodeResponse>> LoadNodesAsync(int startIndex, int count)
|
||||||
{
|
{
|
||||||
return await CountedData<NodeResponse>.LoadAllAsync(async (startIndex, count) =>
|
return await ApiClient.GetJson<CountedData<NodeResponse>>(
|
||||||
await ApiClient.GetJson<CountedData<NodeResponse>>(
|
$"api/admin/servers/nodes?startIndex={startIndex}&count={count}"
|
||||||
$"api/admin/servers/nodes?startIndex={startIndex}&count={count}"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<UserResponse[]> LoadUsersAsync()
|
private async Task<IEnumerable<UserResponse>> LoadUsersAsync(int startIndex, int count)
|
||||||
{
|
{
|
||||||
return await CountedData<UserResponse>.LoadAllAsync(async (startIndex, count) =>
|
return await ApiClient.GetJson<CountedData<UserResponse>>(
|
||||||
await ApiClient.GetJson<CountedData<UserResponse>>(
|
$"api/admin/users?startIndex={startIndex}&count={count}"
|
||||||
$"api/admin/users?startIndex={startIndex}&count={count}"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
|
@using MoonCore.Common
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.ServerVariables
|
@using MoonlightServers.Shared.Http.Requests.Admin.ServerVariables
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.StarVariables
|
@using MoonlightServers.Shared.Http.Responses.Admin.StarVariables
|
||||||
@@ -52,9 +52,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StarVariables = await CountedData<StarVariableResponse>.LoadAllAsync(async (startIndex, count) =>
|
StarVariables = await CountedData.AllAsync(async (index, count) =>
|
||||||
await ApiClient.GetJson<CountedData<StarVariableResponse>>(
|
await ApiClient.GetJson<CountedData<StarVariableResponse>>(
|
||||||
$"api/admin/servers/stars/{Parent.Star.Id}/variables?startIndex={startIndex}&count={count}"
|
$"api/admin/servers/stars/{Parent.Star.Id}/variables?startIndex={index}&count={count}"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
@using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares
|
@using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares
|
||||||
@using MoonlightServers.Shared.Http.Responses.Client.Servers
|
@using MoonlightServers.Shared.Http.Responses.Client.Servers
|
||||||
|
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
@using MoonCore.Blazor.FlyonUi.Modals
|
@using MoonCore.Blazor.FlyonUi.Modals
|
||||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||||
@using MoonCore.Models
|
@using MoonCore.Common
|
||||||
@using MoonlightServers.Frontend.Services
|
@using MoonlightServers.Frontend.Services
|
||||||
@using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares
|
@using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares
|
||||||
@using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares
|
@using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
private async Task LoadAsync(LazyLoader _)
|
private async Task LoadAsync(LazyLoader _)
|
||||||
{
|
{
|
||||||
Shares = await CountedData<ServerShareResponse>.LoadAllAsync(async (startIndex, count)
|
Shares = await CountedData.AllAsync<ServerShareResponse>(async (startIndex, count)
|
||||||
=> await ShareService.GetAsync(Server.Id, startIndex, count)
|
=> await ShareService.GetAsync(Server.Id, startIndex, count)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||||
@using MoonCore.Models
|
@using MoonCore.Common
|
||||||
@using MoonlightServers.Frontend.Services
|
@using MoonlightServers.Frontend.Services
|
||||||
@using MoonlightServers.Shared.Http.Responses.Client.Servers.Variables
|
@using MoonlightServers.Shared.Http.Responses.Client.Servers.Variables
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
private async Task LoadAsync(LazyLoader _)
|
private async Task LoadAsync(LazyLoader _)
|
||||||
{
|
{
|
||||||
Variables = await CountedData<ServerVariableDetailResponse>.LoadAllAsync(async (startIndex, count)
|
Variables = await CountedData.AllAsync<ServerVariableDetailResponse>(async (startIndex, count)
|
||||||
=> await ServerService.GetVariablesAsync(Server.Id, startIndex, count)
|
=> await ServerService.GetVariablesAsync(Server.Id, startIndex, count)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
@using MoonCore.Blazor.FlyonUi.Common
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Servers
|
@using MoonlightServers.Shared.Http.Responses.Admin.Servers
|
||||||
@using MoonCore.Blazor.FlyonUi.Forms
|
@using MoonCore.Blazor.FlyonUi.Forms
|
||||||
|
@using MoonCore.Common
|
||||||
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
||||||
|
|
||||||
@inject HttpApiClient ApiClient
|
@inject HttpApiClient ApiClient
|
||||||
@@ -15,8 +16,7 @@
|
|||||||
<InputMultipleItem TItem="NodeAllocationResponse"
|
<InputMultipleItem TItem="NodeAllocationResponse"
|
||||||
Value="Parent.Allocations"
|
Value="Parent.Allocations"
|
||||||
DisplayField="@(x => $"{x.IpAddress}:{x.Port}")"
|
DisplayField="@(x => $"{x.IpAddress}:{x.Port}")"
|
||||||
SearchField="@(x => $"{x.IpAddress}:{x.Port}")"
|
ItemSource="ItemSource">
|
||||||
ItemSource="LoaderAsync">
|
|
||||||
</InputMultipleItem>
|
</InputMultipleItem>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -28,12 +28,12 @@
|
|||||||
[Parameter] public ServerResponse Server { get; set; }
|
[Parameter] public ServerResponse Server { get; set; }
|
||||||
[Parameter] public Update Parent { get; set; }
|
[Parameter] public Update Parent { get; set; }
|
||||||
|
|
||||||
private async Task<NodeAllocationResponse[]> LoaderAsync()
|
private ItemSource<NodeAllocationResponse> ItemSource => ItemSourceFactory.From(LoadAsync);
|
||||||
|
|
||||||
|
private async Task<IEnumerable<NodeAllocationResponse>> LoadAsync(int startIndex, int count)
|
||||||
{
|
{
|
||||||
return await CountedData<NodeAllocationResponse>.LoadAllAsync(async (startIndex, count) =>
|
return await ApiClient.GetJson<CountedData<NodeAllocationResponse>>(
|
||||||
await ApiClient.GetJson<CountedData<NodeAllocationResponse>>(
|
$"api/admin/servers/nodes/{Server.NodeId}/allocations/free?startIndex={startIndex}&count={count}&serverId={Server.Id}"
|
||||||
$"api/admin/servers/nodes/{Server.NodeId}/allocations/free?startIndex={startIndex}&count={count}&serverId={Server.Id}"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
|
@using MoonCore.Blazor.FlyonUi.Common
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using Moonlight.Shared.Http.Responses.Admin.Users
|
@using Moonlight.Shared.Http.Responses.Admin.Users
|
||||||
@using MoonCore.Blazor.FlyonUi.Forms
|
@using MoonCore.Blazor.FlyonUi.Forms
|
||||||
|
@using MoonCore.Common
|
||||||
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
||||||
|
|
||||||
@inject HttpApiClient ApiClient
|
@inject HttpApiClient ApiClient
|
||||||
@@ -20,9 +21,8 @@
|
|||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<InputItem TItem="UserResponse"
|
<InputItem TItem="UserResponse"
|
||||||
DisplayField="@(x => x.Username)"
|
DisplayField="@(x => x.Username)"
|
||||||
SearchField="@(x => x.Username)"
|
|
||||||
@bind-Value="Parent.Owner"
|
@bind-Value="Parent.Owner"
|
||||||
ItemSource="LoaderAsync">
|
ItemSource="UserItemSource">
|
||||||
</InputItem>
|
</InputItem>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -64,12 +64,12 @@
|
|||||||
[Parameter] public UpdateServerRequest Request { get; set; }
|
[Parameter] public UpdateServerRequest Request { get; set; }
|
||||||
[Parameter] public Update Parent { get; set; }
|
[Parameter] public Update Parent { get; set; }
|
||||||
|
|
||||||
private async Task<UserResponse[]> LoaderAsync()
|
private ItemSource<UserResponse> UserItemSource => ItemSourceFactory.From(LoadAsync);
|
||||||
|
|
||||||
|
private async Task<IEnumerable<UserResponse>> LoadAsync(int startIndex, int count)
|
||||||
{
|
{
|
||||||
return await CountedData<UserResponse>.LoadAllAsync(async (startIndex, count) =>
|
return await ApiClient.GetJson<CountedData<UserResponse>>(
|
||||||
await ApiClient.GetJson<CountedData<UserResponse>>(
|
$"api/admin/users?startIndex={startIndex}&count={count}"
|
||||||
$"api/admin/users?startIndex={startIndex}&count={count}"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
|
@using MoonCore.Common
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.ServerVariables
|
@using MoonlightServers.Shared.Http.Requests.Admin.ServerVariables
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Servers
|
@using MoonlightServers.Shared.Http.Responses.Admin.Servers
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.ServerVariables
|
@using MoonlightServers.Shared.Http.Responses.Admin.ServerVariables
|
||||||
@@ -50,13 +50,13 @@
|
|||||||
|
|
||||||
private async Task LoadAsync(LazyLoader _)
|
private async Task LoadAsync(LazyLoader _)
|
||||||
{
|
{
|
||||||
StarVariables = await CountedData<StarVariableResponse>.LoadAllAsync(async (startIndex, count) =>
|
StarVariables = await CountedData.AllAsync<StarVariableResponse>(async (startIndex, count) =>
|
||||||
await ApiClient.GetJson<CountedData<StarVariableResponse>>(
|
await ApiClient.GetJson<CountedData<StarVariableResponse>>(
|
||||||
$"api/admin/servers/stars/{Server.StarId}/variables?startIndex={startIndex}&count={count}"
|
$"api/admin/servers/stars/{Server.StarId}/variables?startIndex={startIndex}&count={count}"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
ServerVariables = await CountedData<ServerVariableResponse>.LoadAllAsync(async (startIndex, count) =>
|
ServerVariables = await CountedData.AllAsync<ServerVariableResponse>(async (startIndex, count) =>
|
||||||
await ApiClient.GetJson<CountedData<ServerVariableResponse>>(
|
await ApiClient.GetJson<CountedData<ServerVariableResponse>>(
|
||||||
$"api/admin/servers/{Server.Id}/variables?startIndex={startIndex}&count={count}"
|
$"api/admin/servers/{Server.Id}/variables?startIndex={startIndex}&count={count}"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
@using MoonlightServers.Shared.Http.Responses.Client.Servers
|
@using MoonlightServers.Shared.Http.Responses.Client.Servers
|
||||||
@using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares
|
@using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares
|
||||||
|
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
@using MoonlightServers.Frontend.UI.Components.Forms
|
@using MoonlightServers.Frontend.UI.Components.Forms
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages
|
@using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages
|
||||||
|
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
@using MoonlightServers.Shared.Enums
|
@using MoonlightServers.Shared.Enums
|
||||||
@using MoonlightServers.Shared.Models
|
@using MoonlightServers.Shared.Models
|
||||||
|
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
@using MoonlightServers.Shared.Http.Requests.Admin.StarVariables
|
@using MoonlightServers.Shared.Http.Requests.Admin.StarVariables
|
||||||
@using MoonlightServers.Frontend.UI.Components.Forms
|
@using MoonlightServers.Frontend.UI.Components.Forms
|
||||||
|
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
@using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages
|
@using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages
|
@using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages
|
||||||
|
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
@using MoonlightServers.Shared.Enums
|
@using MoonlightServers.Shared.Enums
|
||||||
@using MoonlightServers.Shared.Models
|
@using MoonlightServers.Shared.Models
|
||||||
|
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
@using MoonlightServers.Frontend.UI.Components.Forms
|
@using MoonlightServers.Frontend.UI.Components.Forms
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.StarVariables
|
@using MoonlightServers.Shared.Http.Responses.Admin.StarVariables
|
||||||
|
|
||||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
@inherits MoonCore.Blazor.FlyonUi.Modals.BaseModal
|
||||||
|
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
@using MoonCore.Blazor.FlyonUi.Modals
|
@using MoonCore.Blazor.FlyonUi.Modals
|
||||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||||
|
@using MoonCore.Common
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Frontend.UI.Components.Stars.Modals
|
@using MoonlightServers.Frontend.UI.Components.Stars.Modals
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages
|
@using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages
|
@using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages
|
||||||
@@ -30,11 +30,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="gap-x-2">
|
<div class="gap-x-2">
|
||||||
<button type="button" @onclick="() => UpdateDockerImageAsync(dockerImage)" class="btn btn-primary">
|
<button type="button" @onclick="() => UpdateDockerImageAsync(dockerImage)"
|
||||||
|
class="btn btn-primary">
|
||||||
<i class="icon-settings text-base"></i>
|
<i class="icon-settings text-base"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button type="button" @onclick="() => DeleteDockerImageAsync(dockerImage)" class="btn btn-error">
|
<button type="button" @onclick="() => DeleteDockerImageAsync(dockerImage)"
|
||||||
|
class="btn btn-error">
|
||||||
<i class="icon-trash text-base"></i>
|
<i class="icon-trash text-base"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -53,13 +55,11 @@
|
|||||||
|
|
||||||
private async Task LoadAsync(LazyLoader _)
|
private async Task LoadAsync(LazyLoader _)
|
||||||
{
|
{
|
||||||
var pagedVariables = await ApiClient.GetJson<CountedData<StarDockerImageResponse>>(
|
DockerImages = await CountedData.AllAsync<StarDockerImageResponse>(async (startIndex, count) =>
|
||||||
$"api/admin/servers/stars/{Star.Id}/dockerImages?startIndex=0&count=100"
|
await ApiClient.GetJson<CountedData<StarDockerImageResponse>>(
|
||||||
|
$"api/admin/servers/stars/{Star.Id}/dockerImages?startIndex={startIndex}&count={count}"
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: Improve paged stuff
|
|
||||||
|
|
||||||
DockerImages = pagedVariables.Items;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddDockerImageAsync()
|
private async Task AddDockerImageAsync()
|
||||||
@@ -72,10 +72,7 @@
|
|||||||
await LazyLoader.ReloadAsync();
|
await LazyLoader.ReloadAsync();
|
||||||
};
|
};
|
||||||
|
|
||||||
await ModalService.LaunchAsync<CreateDockerImageModal>(parameters =>
|
await ModalService.LaunchAsync<CreateDockerImageModal>(parameters => { parameters.Add("OnSubmit", onSubmit); });
|
||||||
{
|
|
||||||
parameters.Add("OnSubmit", onSubmit);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateDockerImageAsync(StarDockerImageResponse dockerImage)
|
private async Task UpdateDockerImageAsync(StarDockerImageResponse dockerImage)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
|
@using MoonCore.Common
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.Stars
|
@using MoonlightServers.Shared.Http.Requests.Admin.Stars
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages
|
@using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
@using MoonCore.Blazor.FlyonUi.Modals
|
@using MoonCore.Blazor.FlyonUi.Modals
|
||||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||||
|
@using MoonCore.Common
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Frontend.UI.Components.Stars.Modals
|
@using MoonlightServers.Frontend.UI.Components.Stars.Modals
|
||||||
@using MoonlightServers.Shared.Http.Requests.Admin.StarVariables
|
@using MoonlightServers.Shared.Http.Requests.Admin.StarVariables
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
||||||
@@ -53,11 +53,11 @@
|
|||||||
|
|
||||||
private async Task LoadAsync(LazyLoader arg)
|
private async Task LoadAsync(LazyLoader arg)
|
||||||
{
|
{
|
||||||
var pagedVariables = await ApiClient.GetJson<CountedData<StarVariableResponse>>(
|
CurrentVariables = await CountedData.AllAsync<StarVariableResponse>(async (startIndex, count) =>
|
||||||
$"api/admin/servers/stars/{Star.Id}/variables?startIndex=0&count=100"
|
await ApiClient.GetJson<CountedData<StarVariableResponse>>(
|
||||||
|
$"api/admin/servers/stars/{Star.Id}/variables?startIndex={startIndex}&count={count}"
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
CurrentVariables = pagedVariables.Items;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddVariableAsync()
|
private async Task AddVariableAsync()
|
||||||
@@ -70,10 +70,7 @@
|
|||||||
await LazyLoader.ReloadAsync();
|
await LazyLoader.ReloadAsync();
|
||||||
};
|
};
|
||||||
|
|
||||||
await ModalService.LaunchAsync<CreateVariableModal>(parameters =>
|
await ModalService.LaunchAsync<CreateVariableModal>(parameters => { parameters.Add("OnSubmit", onSubmit); }, "max-w-xl");
|
||||||
{
|
|
||||||
parameters.Add("OnSubmit", onSubmit);
|
|
||||||
}, "max-w-xl");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateVariableAsync(StarVariableResponse variable)
|
private async Task UpdateVariableAsync(StarVariableResponse variable)
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
@page "/admin/servers/all"
|
@page "/admin/servers/all"
|
||||||
|
|
||||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||||
|
@using MoonCore.Blazor.FlyonUi.Common
|
||||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Servers
|
@using MoonlightServers.Shared.Http.Responses.Admin.Servers
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
@using MoonCore.Blazor.FlyonUi.Grid
|
@using MoonCore.Blazor.FlyonUi.Grid
|
||||||
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
||||||
|
@using MoonCore.Common
|
||||||
@using Moonlight.Shared.Http.Responses.Admin.Users
|
@using Moonlight.Shared.Http.Responses.Admin.Users
|
||||||
|
|
||||||
@inject HttpApiClient ApiClient
|
@inject HttpApiClient ApiClient
|
||||||
@@ -32,8 +33,7 @@
|
|||||||
|
|
||||||
<DataGrid @ref="Grid"
|
<DataGrid @ref="Grid"
|
||||||
TGridItem="ServerResponse"
|
TGridItem="ServerResponse"
|
||||||
EnablePagination="true"
|
ItemSource="ItemSource">
|
||||||
ItemsProvider="ItemsProviderAsync">
|
|
||||||
<PropertyColumn Field="x => x.Id"/>
|
<PropertyColumn Field="x => x.Id"/>
|
||||||
<TemplateColumn Title="Name">
|
<TemplateColumn Title="Name">
|
||||||
<td>
|
<td>
|
||||||
@@ -99,11 +99,11 @@
|
|||||||
private Dictionary<int, NodeResponse> Nodes = new();
|
private Dictionary<int, NodeResponse> Nodes = new();
|
||||||
private Dictionary<int, UserResponse> Users = new();
|
private Dictionary<int, UserResponse> Users = new();
|
||||||
|
|
||||||
private async Task<DataGridItemResult<ServerResponse>> ItemsProviderAsync(
|
private ItemSource<ServerResponse> ItemSource => ItemSourceFactory.From(LoadAsync);
|
||||||
DataGridItemRequest request
|
|
||||||
)
|
private async Task<IEnumerable<ServerResponse>> LoadAsync(int startIndex, int count)
|
||||||
{
|
{
|
||||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
var query = $"?startIndex={startIndex}&count={count}";
|
||||||
|
|
||||||
var countedData = await ApiClient.GetJson<CountedData<ServerResponse>>($"api/admin/servers{query}");
|
var countedData = await ApiClient.GetJson<CountedData<ServerResponse>>($"api/admin/servers{query}");
|
||||||
|
|
||||||
@@ -142,11 +142,7 @@
|
|||||||
Users[user.Id] = user;
|
Users[user.Id] = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new()
|
return countedData;
|
||||||
{
|
|
||||||
Items = countedData.Items,
|
|
||||||
TotalCount = countedData.TotalCount
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DeleteAsync(ServerResponse response)
|
private async Task DeleteAsync(ServerResponse response)
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
@using Microsoft.Extensions.Logging
|
@using Microsoft.Extensions.Logging
|
||||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||||
|
@using MoonCore.Blazor.FlyonUi.Common
|
||||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
||||||
@using MoonlightServers.Frontend.Services
|
@using MoonlightServers.Frontend.Services
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes.Statistics
|
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes.Statistics
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
@using MoonCore.Blazor.FlyonUi.Grid
|
@using MoonCore.Blazor.FlyonUi.Grid
|
||||||
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
||||||
|
@using MoonCore.Common
|
||||||
|
|
||||||
@inject HttpApiClient ApiClient
|
@inject HttpApiClient ApiClient
|
||||||
@inject NodeService NodeService
|
@inject NodeService NodeService
|
||||||
@@ -35,8 +36,7 @@
|
|||||||
|
|
||||||
<DataGrid @ref="Grid"
|
<DataGrid @ref="Grid"
|
||||||
TGridItem="NodeResponse"
|
TGridItem="NodeResponse"
|
||||||
EnablePagination="true"
|
ItemSource="ItemSource">
|
||||||
ItemsProvider="ItemsProviderAsync">
|
|
||||||
<PropertyColumn Field="x => x.Id"/>
|
<PropertyColumn Field="x => x.Id"/>
|
||||||
<TemplateColumn Title="Name">
|
<TemplateColumn Title="Name">
|
||||||
<td>
|
<td>
|
||||||
@@ -160,11 +160,11 @@
|
|||||||
private Dictionary<int, NodeSystemStatusResponse?> StatusResponses = new();
|
private Dictionary<int, NodeSystemStatusResponse?> StatusResponses = new();
|
||||||
private Dictionary<int, StatisticsResponse?> Statistics = new();
|
private Dictionary<int, StatisticsResponse?> Statistics = new();
|
||||||
|
|
||||||
private async Task<DataGridItemResult<NodeResponse>> ItemsProviderAsync(
|
private ItemSource<NodeResponse> ItemSource => ItemSourceFactory.From(LoadAsync);
|
||||||
DataGridItemRequest request
|
|
||||||
)
|
private async Task<IEnumerable<NodeResponse>> LoadAsync(int startIndex, int count)
|
||||||
{
|
{
|
||||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
var query = $"?startIndex={startIndex}&count={count}";
|
||||||
|
|
||||||
var countedData = await ApiClient.GetJson<CountedData<NodeResponse>>($"api/admin/servers/nodes{query}");
|
var countedData = await ApiClient.GetJson<CountedData<NodeResponse>>($"api/admin/servers/nodes{query}");
|
||||||
|
|
||||||
@@ -211,11 +211,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return new()
|
return countedData;
|
||||||
{
|
|
||||||
Items = countedData.Items,
|
|
||||||
TotalCount = countedData.TotalCount
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DeleteAsync(NodeResponse response)
|
private async Task DeleteAsync(NodeResponse response)
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
@page "/admin/servers/stars"
|
@page "/admin/servers/stars"
|
||||||
|
|
||||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||||
|
@using MoonCore.Blazor.FlyonUi.Common
|
||||||
@using MoonCore.Blazor.FlyonUi.Helpers
|
@using MoonCore.Blazor.FlyonUi.Helpers
|
||||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
||||||
@using MoonCore.Exceptions
|
@using MoonCore.Exceptions
|
||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
@using MoonCore.Blazor.FlyonUi.Grid
|
@using MoonCore.Blazor.FlyonUi.Grid
|
||||||
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
||||||
|
@using MoonCore.Common
|
||||||
|
|
||||||
@inject HttpApiClient ApiClient
|
@inject HttpApiClient ApiClient
|
||||||
@inject DownloadService DownloadService
|
@inject DownloadService DownloadService
|
||||||
@@ -38,8 +39,7 @@
|
|||||||
|
|
||||||
<DataGrid @ref="Grid"
|
<DataGrid @ref="Grid"
|
||||||
TGridItem="StarResponse"
|
TGridItem="StarResponse"
|
||||||
EnablePagination="true"
|
ItemSource="ItemSource">
|
||||||
ItemsProvider="ItemsProviderAsync">
|
|
||||||
<PropertyColumn Field="x => x.Id" />
|
<PropertyColumn Field="x => x.Id" />
|
||||||
<TemplateColumn Title="Name">
|
<TemplateColumn Title="Name">
|
||||||
<td>
|
<td>
|
||||||
@@ -91,19 +91,13 @@
|
|||||||
{
|
{
|
||||||
private DataGrid<StarResponse> Grid;
|
private DataGrid<StarResponse> Grid;
|
||||||
|
|
||||||
private async Task<DataGridItemResult<StarResponse>> ItemsProviderAsync(
|
private ItemSource<StarResponse> ItemSource => ItemSourceFactory.From(LoadAsync);
|
||||||
DataGridItemRequest request
|
|
||||||
)
|
private async Task<IEnumerable<StarResponse>> LoadAsync(int startIndex, int count)
|
||||||
{
|
{
|
||||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
var query = $"?startIndex={startIndex}&count={count}";
|
||||||
|
|
||||||
var countedData = await ApiClient.GetJson<CountedData<StarResponse>>($"api/admin/servers/stars{query}");
|
return await ApiClient.GetJson<CountedData<StarResponse>>($"api/admin/servers/stars{query}");
|
||||||
|
|
||||||
return new()
|
|
||||||
{
|
|
||||||
TotalCount = countedData.TotalCount,
|
|
||||||
Items = countedData.Items
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DeleteAsync(StarResponse response)
|
private async Task DeleteAsync(StarResponse response)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
@page "/servers"
|
@page "/servers"
|
||||||
|
|
||||||
@using MoonCore.Blazor.FlyonUi.Components
|
@using MoonCore.Blazor.FlyonUi.Components
|
||||||
|
@using MoonCore.Common
|
||||||
@using MoonlightServers.Frontend.UI.Components.Servers
|
@using MoonlightServers.Frontend.UI.Components.Servers
|
||||||
@using MoonCore.Models
|
|
||||||
@using MoonlightServers.Frontend.Services
|
@using MoonlightServers.Frontend.Services
|
||||||
@using MoonlightServers.Shared.Http.Responses.Client.Servers
|
@using MoonlightServers.Shared.Http.Responses.Client.Servers
|
||||||
|
|
||||||
@@ -74,14 +74,14 @@
|
|||||||
|
|
||||||
private async Task LoadOwnServersAsync(LazyLoader lazyLoader)
|
private async Task LoadOwnServersAsync(LazyLoader lazyLoader)
|
||||||
{
|
{
|
||||||
OwnServers = await CountedData<ServerDetailResponse>.LoadAllAsync(async (startIndex, count) =>
|
OwnServers = await CountedData.AllAsync<ServerDetailResponse>(async (startIndex, count) =>
|
||||||
await ServerService.GetServersAsync(startIndex, count)
|
await ServerService.GetServersAsync(startIndex, count)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadSharedServersAsync(LazyLoader lazyLoader)
|
private async Task LoadSharedServersAsync(LazyLoader lazyLoader)
|
||||||
{
|
{
|
||||||
SharedServers = await CountedData<ServerDetailResponse>.LoadAllAsync(async (startIndex, count) =>
|
SharedServers = await CountedData.AllAsync<ServerDetailResponse>(async (startIndex, count) =>
|
||||||
await ServerService.GetSharedServersAsync(startIndex, count)
|
await ServerService.GetSharedServersAsync(startIndex, count)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user