Updated to latest moonlight and mooncore version. Done refactoring to async scheme and other changes. Recreated database migrations and cleaned models
This commit is contained in:
@@ -15,15 +15,15 @@ public class ServerFsAccess : IFsAccess
|
||||
FileSystemService = fileSystemService;
|
||||
}
|
||||
|
||||
public Task CreateFile(string path)
|
||||
=> FileSystemService.Touch(Id, path);
|
||||
public Task CreateFileAsync(string path)
|
||||
=> FileSystemService.TouchAsync(Id, path);
|
||||
|
||||
public Task CreateDirectory(string path)
|
||||
=> FileSystemService.Mkdir(Id, path);
|
||||
public Task CreateDirectoryAsync(string path)
|
||||
=> FileSystemService.MkdirAsync(Id, path);
|
||||
|
||||
public async Task<FsEntry[]> List(string path)
|
||||
public async Task<FsEntry[]> ListAsync(string path)
|
||||
{
|
||||
var entries = await FileSystemService.List(Id, path);
|
||||
var entries = await FileSystemService.ListAsync(Id, path);
|
||||
|
||||
return entries.Select(x => new FsEntry()
|
||||
{
|
||||
@@ -35,28 +35,28 @@ public class ServerFsAccess : IFsAccess
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
public Task Move(string oldPath, string newPath)
|
||||
=> FileSystemService.Move(Id, oldPath, newPath);
|
||||
public Task MoveAsync(string oldPath, string newPath)
|
||||
=> FileSystemService.MoveAsync(Id, oldPath, newPath);
|
||||
|
||||
public Task Read(string path, Func<Stream, Task> onHandleData)
|
||||
public Task ReadAsync(string path, Func<Stream, Task> onHandleData)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task Write(string path, Stream dataStream)
|
||||
public Task WriteAsync(string path, Stream dataStream)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task Delete(string path)
|
||||
=> FileSystemService.Delete(Id, path);
|
||||
public Task DeleteAsync(string path)
|
||||
=> FileSystemService.DeleteAsync(Id, path);
|
||||
|
||||
public Task UploadChunk(string path, int chunkId, long chunkSize, long totalSize, byte[] data)
|
||||
public Task UploadChunkAsync(string path, int chunkId, long chunkSize, long totalSize, byte[] data)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<byte[]> DownloadChunk(string path, int chunkId, long chunkSize)
|
||||
public Task<byte[]> DownloadChunkAsync(string path, int chunkId, long chunkSize)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace MoonlightServers.Frontend.Implementations;
|
||||
|
||||
public class DefaultPermissionProvider : IServerPermissionProvider
|
||||
{
|
||||
public Task<ServerPermission[]> GetPermissions(ServerDetailResponse server)
|
||||
public Task<ServerPermission[]> GetPermissionsAsync(ServerDetailResponse server)
|
||||
{
|
||||
ServerPermission[] permissions = [
|
||||
new()
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace MoonlightServers.Frontend.Implementations;
|
||||
|
||||
public class DefaultServerTabProvider : IServerTabProvider
|
||||
{
|
||||
public Task<ServerTab[]> GetTabs(ServerDetailResponse server)
|
||||
public Task<ServerTab[]> GetTabsAsync(ServerDetailResponse server)
|
||||
{
|
||||
ServerTab[] tabs =
|
||||
[
|
||||
|
||||
@@ -5,5 +5,5 @@ namespace MoonlightServers.Frontend.Interfaces;
|
||||
|
||||
public interface IServerPermissionProvider
|
||||
{
|
||||
public Task<ServerPermission[]> GetPermissions(ServerDetailResponse server);
|
||||
public Task<ServerPermission[]> GetPermissionsAsync(ServerDetailResponse server);
|
||||
}
|
||||
@@ -5,5 +5,5 @@ namespace MoonlightServers.Frontend.Interfaces;
|
||||
|
||||
public interface IServerTabProvider
|
||||
{
|
||||
public Task<ServerTab[]> GetTabs(ServerDetailResponse server);
|
||||
public Task<ServerTab[]> GetTabsAsync(ServerDetailResponse server);
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using MoonlightServers.Frontend.UI.Components.Servers.ServerTabs;
|
||||
using MoonlightServers.Shared.Enums;
|
||||
using MoonlightServers.Shared.Models;
|
||||
|
||||
namespace MoonlightServers.Frontend.Models;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.9" />
|
||||
<PackageReference Include="Moonlight.Client" Version="2.1.*"/>
|
||||
<PackageReference Include="XtermBlazor" Version="2.1.2" />
|
||||
</ItemGroup>
|
||||
@@ -31,7 +31,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Styles\" />
|
||||
<None Include="Styles/mappings/*.map" Pack="true" PackagePath="Styles/" />
|
||||
<None Include="MoonlightServers.Frontend.targets" Pack="true" PackagePath="build/MoonlightServers.Frontend.targets" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<Project>
|
||||
<ItemGroup>
|
||||
<StylesFilesToCopy Include="$(MSBuildThisFileDirectory)../Styles/**/*.*"/>
|
||||
</ItemGroup>
|
||||
<Target Name="CopyContent" BeforeTargets="Build">
|
||||
<Copy SourceFiles="@(StylesFilesToCopy)" DestinationFolder="$(ProjectDir)Styles/MoonlightServers.Frontend/%(RecursiveDir)" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -15,19 +15,19 @@ public class NodeService
|
||||
HttpApiClient = httpApiClient;
|
||||
}
|
||||
|
||||
public async Task<NodeSystemStatusResponse> GetSystemStatus(int nodeId)
|
||||
public async Task<NodeSystemStatusResponse> GetSystemStatusAsync(int nodeId)
|
||||
{
|
||||
return await HttpApiClient.GetJson<NodeSystemStatusResponse>($"api/admin/servers/nodes/{nodeId}/system/status");
|
||||
}
|
||||
|
||||
public async Task<StatisticsResponse> GetStatistics(int nodeId)
|
||||
public async Task<StatisticsResponse> GetStatisticsAsync(int nodeId)
|
||||
{
|
||||
return await HttpApiClient.GetJson<StatisticsResponse>(
|
||||
$"api/admin/servers/nodes/{nodeId}/statistics"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<DockerStatisticsResponse> GetDockerStatistics(int nodeId)
|
||||
public async Task<DockerStatisticsResponse> GetDockerStatisticsAsync(int nodeId)
|
||||
{
|
||||
return await HttpApiClient.GetJson<DockerStatisticsResponse>(
|
||||
$"api/admin/servers/nodes/{nodeId}/statistics/docker"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Net;
|
||||
using MoonCore.Attributes;
|
||||
using MoonCore.Helpers;
|
||||
using MoonlightServers.Shared.Http.Requests.Client.Servers.Files;
|
||||
@@ -16,56 +15,56 @@ public class ServerFileSystemService
|
||||
ApiClient = apiClient;
|
||||
}
|
||||
|
||||
public async Task<ServerFilesEntryResponse[]> List(int serverId, string path)
|
||||
public async Task<ServerFilesEntryResponse[]> ListAsync(int serverId, string path)
|
||||
{
|
||||
return await ApiClient.GetJson<ServerFilesEntryResponse[]>(
|
||||
$"api/client/servers/{serverId}/files/list?path={path}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Move(int serverId, string oldPath, string newPath)
|
||||
public async Task MoveAsync(int serverId, string oldPath, string newPath)
|
||||
{
|
||||
await ApiClient.Post(
|
||||
$"api/client/servers/{serverId}/files/move?oldPath={oldPath}&newPath={newPath}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Delete(int serverId, string path)
|
||||
public async Task DeleteAsync(int serverId, string path)
|
||||
{
|
||||
await ApiClient.Delete(
|
||||
$"api/client/servers/{serverId}/files/delete?path={path}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Mkdir(int serverId, string path)
|
||||
public async Task MkdirAsync(int serverId, string path)
|
||||
{
|
||||
await ApiClient.Post(
|
||||
$"api/client/servers/{serverId}/files/mkdir?path={path}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Touch(int serverId, string path)
|
||||
public async Task TouchAsync(int serverId, string path)
|
||||
{
|
||||
await ApiClient.Post(
|
||||
$"api/client/servers/{serverId}/files/touch?path={path}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<ServerFilesUploadResponse> Upload(int serverId)
|
||||
public async Task<ServerFilesUploadResponse> UploadAsync(int serverId)
|
||||
{
|
||||
return await ApiClient.GetJson<ServerFilesUploadResponse>(
|
||||
$"api/client/servers/{serverId}/files/upload"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<ServerFilesDownloadResponse> Download(int serverId, string path)
|
||||
public async Task<ServerFilesDownloadResponse> DownloadAsync(int serverId, string path)
|
||||
{
|
||||
return await ApiClient.GetJson<ServerFilesDownloadResponse>(
|
||||
$"api/client/servers/{serverId}/files/download?path={path}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Compress(int serverId, string type, string[] items, string destination)
|
||||
public async Task CompressAsync(int serverId, string type, string[] items, string destination)
|
||||
{
|
||||
await ApiClient.Post(
|
||||
$"api/client/servers/{serverId}/files/compress",
|
||||
@@ -78,7 +77,7 @@ public class ServerFileSystemService
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Decompress(int serverId, string type, string path, string destination)
|
||||
public async Task DecompressAsync(int serverId, string type, string path, string destination)
|
||||
{
|
||||
await ApiClient.Post(
|
||||
$"api/client/servers/{serverId}/files/decompress",
|
||||
|
||||
@@ -18,49 +18,49 @@ public class ServerService
|
||||
HttpApiClient = httpApiClient;
|
||||
}
|
||||
|
||||
public async Task<PagedData<ServerDetailResponse>> GetServers(int page, int perPage)
|
||||
public async Task<CountedData<ServerDetailResponse>> GetServersAsync(int startIndex, int count)
|
||||
{
|
||||
return await HttpApiClient.GetJson<PagedData<ServerDetailResponse>>(
|
||||
$"api/client/servers?page={page}&pageSize={perPage}"
|
||||
return await HttpApiClient.GetJson<CountedData<ServerDetailResponse>>(
|
||||
$"api/client/servers?startIndex={startIndex}&count={count}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<PagedData<ServerDetailResponse>> GetSharedServers(int page, int perPage)
|
||||
public async Task<CountedData<ServerDetailResponse>> GetSharedServersAsync(int startIndex, int count)
|
||||
{
|
||||
return await HttpApiClient.GetJson<PagedData<ServerDetailResponse>>(
|
||||
$"api/client/servers/shared?page={page}&pageSize={perPage}"
|
||||
return await HttpApiClient.GetJson<CountedData<ServerDetailResponse>>(
|
||||
$"api/client/servers/shared?startIndex={startIndex}&count={count}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<ServerDetailResponse> GetServer(int serverId)
|
||||
public async Task<ServerDetailResponse> GetServerAsync(int serverId)
|
||||
{
|
||||
return await HttpApiClient.GetJson<ServerDetailResponse>(
|
||||
$"api/client/servers/{serverId}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<ServerStatusResponse> GetStatus(int serverId)
|
||||
public async Task<ServerStatusResponse> GetStatusAsync(int serverId)
|
||||
{
|
||||
return await HttpApiClient.GetJson<ServerStatusResponse>(
|
||||
$"api/client/servers/{serverId}/status"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<ServerLogsResponse> GetLogs(int serverId)
|
||||
public async Task<ServerLogsResponse> GetLogsAsync(int serverId)
|
||||
{
|
||||
return await HttpApiClient.GetJson<ServerLogsResponse>(
|
||||
$"api/client/servers/{serverId}/logs"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<ServerStatsResponse> GetStats(int serverId)
|
||||
public async Task<ServerStatsResponse> GetStatsAsync(int serverId)
|
||||
{
|
||||
return await HttpApiClient.GetJson<ServerStatsResponse>(
|
||||
$"api/client/servers/{serverId}/stats"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task RunCommand(int serverId, string command)
|
||||
public async Task RunCommandAsync(int serverId, string command)
|
||||
{
|
||||
await HttpApiClient.Post(
|
||||
$"api/client/servers/{serverId}/command",
|
||||
@@ -71,14 +71,14 @@ public class ServerService
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<ServerWebSocketResponse> GetWebSocket(int serverId)
|
||||
public async Task<ServerWebSocketResponse> GetWebSocketAsync(int serverId)
|
||||
{
|
||||
return await HttpApiClient.GetJson<ServerWebSocketResponse>(
|
||||
$"api/client/servers/{serverId}/ws"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Install(int serverId)
|
||||
public async Task InstallAsync(int serverId)
|
||||
{
|
||||
await HttpApiClient.Post(
|
||||
$"api/client/servers/{serverId}/install"
|
||||
@@ -87,21 +87,21 @@ public class ServerService
|
||||
|
||||
#region Power actions
|
||||
|
||||
public async Task Start(int serverId)
|
||||
public async Task StartAsync(int serverId)
|
||||
{
|
||||
await HttpApiClient.Post(
|
||||
$"api/client/servers/{serverId}/start"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Stop(int serverId)
|
||||
public async Task StopAsync(int serverId)
|
||||
{
|
||||
await HttpApiClient.Post(
|
||||
$"api/client/servers/{serverId}/stop"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Kill(int serverId)
|
||||
public async Task KillAsync(int serverId)
|
||||
{
|
||||
await HttpApiClient.Post(
|
||||
$"api/client/servers/{serverId}/kill"
|
||||
@@ -112,14 +112,14 @@ public class ServerService
|
||||
|
||||
#region Variables
|
||||
|
||||
public async Task<PagedData<ServerVariableDetailResponse>> GetVariables(int serverId, int page, int pageSize)
|
||||
public async Task<CountedData<ServerVariableDetailResponse>> GetVariablesAsync(int serverId, int startIndex, int count)
|
||||
{
|
||||
return await HttpApiClient.GetJson<PagedData<ServerVariableDetailResponse>>(
|
||||
$"api/client/servers/{serverId}/variables?page={page}&pageSize={pageSize}"
|
||||
return await HttpApiClient.GetJson<CountedData<ServerVariableDetailResponse>>(
|
||||
$"api/client/servers/{serverId}/variables?startIndex={startIndex}&count={count}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task UpdateVariables(int serverId, UpdateServerVariableRangeRequest request)
|
||||
public async Task UpdateVariablesAsync(int serverId, UpdateServerVariableRangeRequest request)
|
||||
{
|
||||
await HttpApiClient.Patch(
|
||||
$"api/client/servers/{serverId}/variables",
|
||||
@@ -127,7 +127,7 @@ public class ServerService
|
||||
);
|
||||
}
|
||||
|
||||
public async Task UpdateVariable(int serverId, UpdateServerVariableRequest request)
|
||||
public async Task UpdateVariableAsync(int serverId, UpdateServerVariableRequest request)
|
||||
{
|
||||
await HttpApiClient.Put(
|
||||
$"api/client/servers/{serverId}/variables",
|
||||
|
||||
@@ -16,19 +16,19 @@ public class ServerShareService
|
||||
ApiClient = apiClient;
|
||||
}
|
||||
|
||||
public async Task<PagedData<ServerShareResponse>> Get(int id, int page, int pageSize)
|
||||
=> await ApiClient.GetJson<PagedData<ServerShareResponse>>(
|
||||
$"api/client/servers/{id}/shares?page={page}&pageSize={pageSize}");
|
||||
public async Task<CountedData<ServerShareResponse>> GetAsync(int id, int startIndex, int count)
|
||||
=> await ApiClient.GetJson<CountedData<ServerShareResponse>>(
|
||||
$"api/client/servers/{id}/shares?startIndex={startIndex}&count={count}");
|
||||
|
||||
public async Task<ServerShareResponse> Get(int id, int shareId)
|
||||
public async Task<ServerShareResponse> GetAsync(int id, int shareId)
|
||||
=> await ApiClient.GetJson<ServerShareResponse>($"api/client/servers/{id}/shares/{shareId}");
|
||||
|
||||
public async Task<ServerShareResponse> Create(int id, CreateShareRequest request)
|
||||
public async Task<ServerShareResponse> CreateAsync(int id, CreateShareRequest request)
|
||||
=> await ApiClient.PostJson<ServerShareResponse>($"api/client/servers/{id}/shares", request);
|
||||
|
||||
public async Task<ServerShareResponse> Update(int id, int shareId, UpdateShareRequest request)
|
||||
public async Task<ServerShareResponse> UpdateAsync(int id, int shareId, UpdateShareRequest request)
|
||||
=> await ApiClient.PatchJson<ServerShareResponse>($"api/client/servers/{id}/shares/{shareId}", request);
|
||||
|
||||
public async Task Delete(int id, int shareId)
|
||||
public async Task DeleteAsync(int id, int shareId)
|
||||
=> await ApiClient.Delete($"api/client/servers/{id}/shares/{shareId}");
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace MoonlightServers.Frontend.Startup;
|
||||
|
||||
public class PluginStartup : IPluginStartup
|
||||
{
|
||||
public Task BuildApplication(IServiceProvider serviceProvider, WebAssemblyHostBuilder builder)
|
||||
public Task BuildApplicationAsync(IServiceProvider serviceProvider, WebAssemblyHostBuilder builder)
|
||||
{
|
||||
builder.Services.AddSingleton<ISidebarItemProvider, SidebarImplementation>();
|
||||
builder.Services.AddSingleton<IServerTabProvider, DefaultServerTabProvider>();
|
||||
@@ -21,7 +21,7 @@ public class PluginStartup : IPluginStartup
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task ConfigureApplication(IServiceProvider serviceProvider, WebAssemblyHost app)
|
||||
public Task ConfigureApplicationAsync(IServiceProvider serviceProvider, WebAssemblyHost app)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
!me-1.5
|
||||
!ms-auto
|
||||
!px-2.5
|
||||
!py-0.5
|
||||
!rounded-full
|
||||
!rounded-xs
|
||||
!text-sm
|
||||
!w-2.5
|
||||
*:[grid-area:1/1]
|
||||
@@ -19,13 +21,17 @@
|
||||
-ml-4
|
||||
-translate-x-full
|
||||
-translate-y-1/2
|
||||
[animation-duration:0.8s]
|
||||
[animation-timing-function:ease]
|
||||
absolute
|
||||
accordion
|
||||
accordion-bordered
|
||||
accordion-toggle
|
||||
active
|
||||
active-tab:bg-primary
|
||||
active-tab:hover:text-primary-content
|
||||
active-tab:text-base-content
|
||||
active-tab:text-primary-content
|
||||
advance-select-menu
|
||||
advance-select-option
|
||||
advance-select-tag
|
||||
@@ -39,6 +45,7 @@ align-bottom
|
||||
align-middle
|
||||
animate-bounce
|
||||
animate-ping
|
||||
animate-spin
|
||||
aria-[current='page']:text-bg-soft-primary
|
||||
avatar
|
||||
avatar-away-bottom
|
||||
@@ -62,6 +69,7 @@ bg-background/60
|
||||
bg-base-100
|
||||
bg-base-150
|
||||
bg-base-200
|
||||
bg-base-200!
|
||||
bg-base-200/50
|
||||
bg-base-300
|
||||
bg-base-300/45
|
||||
@@ -85,9 +93,14 @@ block
|
||||
blur
|
||||
border
|
||||
border-0
|
||||
border-1
|
||||
border-2
|
||||
border-3
|
||||
border-accent
|
||||
border-b
|
||||
border-b-2
|
||||
border-b-base-content/20
|
||||
border-b-primary
|
||||
border-base-content
|
||||
border-base-content/20
|
||||
border-base-content/25
|
||||
@@ -96,15 +109,26 @@ border-base-content/5
|
||||
border-base-content/60
|
||||
border-base-content/70
|
||||
border-dashed
|
||||
border-dotted
|
||||
border-e-2
|
||||
border-error/30
|
||||
border-info/30
|
||||
border-l-4
|
||||
border-l-transparent
|
||||
border-primary
|
||||
border-r-transparent
|
||||
border-solid
|
||||
border-success
|
||||
border-success/30
|
||||
border-t
|
||||
border-t-2
|
||||
border-t-transparent
|
||||
border-transparent
|
||||
border-warning/30
|
||||
bottom-0
|
||||
bottom-full
|
||||
breadcrumbs
|
||||
breadcrumbs-separator
|
||||
break-words
|
||||
btn
|
||||
btn-accent
|
||||
@@ -164,8 +188,10 @@ diff
|
||||
disabled
|
||||
divide-base-150/60
|
||||
divide-y
|
||||
divider
|
||||
drop-shadow
|
||||
dropdown
|
||||
dropdown-active
|
||||
dropdown-disabled
|
||||
dropdown-item
|
||||
dropdown-menu
|
||||
@@ -179,7 +205,9 @@ ease-linear
|
||||
end-3
|
||||
error-message
|
||||
file-upload-complete:progress-success
|
||||
fill-base-content
|
||||
fill-black
|
||||
fill-gray-200
|
||||
filter
|
||||
filter-reset
|
||||
fixed
|
||||
@@ -210,6 +238,8 @@ font-inter
|
||||
font-medium
|
||||
font-normal
|
||||
font-semibold
|
||||
footer
|
||||
footer-center
|
||||
from-violet-400
|
||||
gap-0.5
|
||||
gap-1
|
||||
@@ -226,6 +256,7 @@ gap-x-6
|
||||
gap-y-1
|
||||
gap-y-1.5
|
||||
gap-y-2
|
||||
gap-y-2.5
|
||||
gap-y-3
|
||||
gap-y-8
|
||||
grid
|
||||
@@ -233,10 +264,12 @@ grid-cols-1
|
||||
grid-cols-12
|
||||
grid-cols-2
|
||||
grid-cols-3
|
||||
grid-cols-4
|
||||
grid-flow-col
|
||||
grow
|
||||
grow-0
|
||||
h-0
|
||||
h-10
|
||||
h-12
|
||||
h-14
|
||||
h-2
|
||||
@@ -253,11 +286,14 @@ hidden
|
||||
hover:bg-indigo-500
|
||||
hover:bg-primary/5
|
||||
hover:bg-transparent
|
||||
hover:cursor-pointer
|
||||
hover:text-base-content
|
||||
hover:text-base-content/60
|
||||
hover:text-indigo-500
|
||||
hover:text-primary
|
||||
image-full
|
||||
indicator
|
||||
indicator-item
|
||||
inline
|
||||
inline-block
|
||||
inline-flex
|
||||
@@ -294,6 +330,7 @@ leading-3.5
|
||||
leading-6
|
||||
leading-9
|
||||
leading-[1.1]
|
||||
leading-none
|
||||
left-0
|
||||
lg:bg-base-100/20
|
||||
lg:flex
|
||||
@@ -320,6 +357,7 @@ link-hover
|
||||
link-primary
|
||||
list-disc
|
||||
list-inside
|
||||
list-none
|
||||
loading
|
||||
loading-lg
|
||||
loading-sm
|
||||
@@ -332,7 +370,11 @@ mask
|
||||
max-h-52
|
||||
max-lg:flex-col
|
||||
max-lg:hidden
|
||||
max-md:flex-wrap
|
||||
max-md:justify-center
|
||||
max-sm:hidden
|
||||
max-w-7xl
|
||||
max-w-8
|
||||
max-w-80
|
||||
max-w-full
|
||||
max-w-lg
|
||||
@@ -376,6 +418,7 @@ min-w-28
|
||||
min-w-48
|
||||
min-w-60
|
||||
min-w-[100px]
|
||||
min-w-full
|
||||
min-w-sm
|
||||
mix-blend-exclusion
|
||||
ml-3
|
||||
@@ -387,10 +430,13 @@ modal-middle
|
||||
modal-title
|
||||
mr-2
|
||||
mr-4
|
||||
ms-0.5
|
||||
ms-1
|
||||
ms-1.5
|
||||
ms-2
|
||||
ms-2.5
|
||||
ms-3
|
||||
ms-auto
|
||||
mt-1
|
||||
mt-1.5
|
||||
mt-10
|
||||
@@ -398,6 +444,7 @@ mt-12
|
||||
mt-2
|
||||
mt-2.5
|
||||
mt-3
|
||||
mt-3.5
|
||||
mt-4
|
||||
mt-5
|
||||
mt-6
|
||||
@@ -407,9 +454,12 @@ mx-auto
|
||||
my-2.5
|
||||
my-3
|
||||
my-5
|
||||
my-8
|
||||
my-auto
|
||||
object-cover
|
||||
opacity-0
|
||||
opacity-100
|
||||
opacity-75
|
||||
open
|
||||
origin-top-left
|
||||
outline
|
||||
@@ -430,6 +480,7 @@ p-4
|
||||
p-5
|
||||
p-6
|
||||
p-8
|
||||
pb-1
|
||||
pe-1.5
|
||||
pin-input
|
||||
pin-input-underline
|
||||
@@ -444,6 +495,7 @@ progress-primary
|
||||
pt-0
|
||||
pt-0.5
|
||||
pt-1.5
|
||||
pt-2
|
||||
pt-3
|
||||
px-1.5
|
||||
px-2
|
||||
@@ -459,10 +511,12 @@ py-12
|
||||
py-2
|
||||
py-2.5
|
||||
py-6
|
||||
radial-progress
|
||||
radio
|
||||
range
|
||||
relative
|
||||
resize
|
||||
ring
|
||||
ring-0
|
||||
ring-1
|
||||
ring-gray-700
|
||||
@@ -543,10 +597,12 @@ sm:text-sm/5
|
||||
sm:w-1/2
|
||||
sm:w-full
|
||||
space-x-1
|
||||
space-x-2.5
|
||||
space-y-1
|
||||
space-y-4
|
||||
space-y-6
|
||||
sr-only
|
||||
stack
|
||||
stat
|
||||
stat-actions
|
||||
stat-desc
|
||||
@@ -602,6 +658,7 @@ text-left
|
||||
text-lg
|
||||
text-primary
|
||||
text-primary-content
|
||||
text-right
|
||||
text-slate-100
|
||||
text-sm
|
||||
text-sm/5
|
||||
@@ -645,6 +702,7 @@ via-sky-400
|
||||
w-0
|
||||
w-0.5
|
||||
w-12
|
||||
w-13
|
||||
w-32
|
||||
w-4
|
||||
w-56
|
||||
|
||||
790
MoonlightServers.Frontend/Styles/mappings/classes.map
Normal file
790
MoonlightServers.Frontend/Styles/mappings/classes.map
Normal file
@@ -0,0 +1,790 @@
|
||||
!bg-base-100
|
||||
!border-base-content/40
|
||||
!border-none
|
||||
!flex
|
||||
!font-medium
|
||||
!font-semibold
|
||||
!h-2.5
|
||||
!justify-between
|
||||
!me-1.5
|
||||
!ms-auto
|
||||
!px-2.5
|
||||
!py-0.5
|
||||
!rounded-full
|
||||
!rounded-xs
|
||||
!text-sm
|
||||
!w-2.5
|
||||
*:[grid-area:1/1]
|
||||
*:first:rounded-tl-lg
|
||||
*:last:rounded-tr-lg
|
||||
-left-4
|
||||
-mb-3
|
||||
-ml-4
|
||||
-translate-x-full
|
||||
-translate-y-1/2
|
||||
2xl:col-span-1
|
||||
2xl:col-span-2
|
||||
2xl:col-span-3
|
||||
2xl:flex
|
||||
[animation-duration:0.8s]
|
||||
[animation-timing-function:ease]
|
||||
absolute
|
||||
accordion
|
||||
accordion-bordered
|
||||
accordion-toggle
|
||||
active
|
||||
active-tab:bg-primary
|
||||
active-tab:hover:text-primary-content
|
||||
active-tab:text-base-content
|
||||
active-tab:text-primary-content
|
||||
advance-select-menu
|
||||
advance-select-option
|
||||
advance-select-tag
|
||||
advance-select-toggle
|
||||
alert
|
||||
alert-error
|
||||
alert-outline
|
||||
alert-primary
|
||||
alert-soft
|
||||
align-bottom
|
||||
align-middle
|
||||
animate-bounce
|
||||
animate-ping
|
||||
animate-spin
|
||||
aria-[current='page']:text-bg-soft-primary
|
||||
avatar
|
||||
avatar-away-bottom
|
||||
avatar-away-top
|
||||
avatar-busy-bottom
|
||||
avatar-busy-top
|
||||
avatar-offline-bottom
|
||||
avatar-offline-top
|
||||
avatar-online-bottom
|
||||
avatar-online-top
|
||||
avatar-placeholder
|
||||
badge
|
||||
badge-error
|
||||
badge-info
|
||||
badge-outline
|
||||
badge-primary
|
||||
badge-soft
|
||||
badge-success
|
||||
bg-background
|
||||
bg-background/60
|
||||
bg-base-100
|
||||
bg-base-150
|
||||
bg-base-200
|
||||
bg-base-200!
|
||||
bg-base-200/50
|
||||
bg-base-200/75
|
||||
bg-base-300
|
||||
bg-base-300/45
|
||||
bg-base-300/50
|
||||
bg-base-300/60
|
||||
bg-base-content/10
|
||||
bg-black
|
||||
bg-clip-text
|
||||
bg-error
|
||||
bg-gradient-to-r
|
||||
bg-gray-800
|
||||
bg-gray-900
|
||||
bg-indigo-600
|
||||
bg-info
|
||||
bg-primary
|
||||
bg-primary/5
|
||||
bg-red-500
|
||||
bg-success
|
||||
bg-transparent
|
||||
bg-warning
|
||||
bg-white/5
|
||||
block
|
||||
blur
|
||||
border
|
||||
border-0
|
||||
border-1
|
||||
border-2
|
||||
border-3
|
||||
border-accent
|
||||
border-b
|
||||
border-b-2
|
||||
border-b-base-content/20
|
||||
border-b-primary
|
||||
border-base-content
|
||||
border-base-content/10
|
||||
border-base-content/20
|
||||
border-base-content/25
|
||||
border-base-content/40
|
||||
border-base-content/5
|
||||
border-base-content/60
|
||||
border-base-content/70
|
||||
border-base-content/80
|
||||
border-dashed
|
||||
border-dotted
|
||||
border-e-2
|
||||
border-error
|
||||
border-error/30
|
||||
border-gray-600
|
||||
border-info/30
|
||||
border-l-4
|
||||
border-l-8
|
||||
border-l-transparent
|
||||
border-primary
|
||||
border-r-transparent
|
||||
border-solid
|
||||
border-success
|
||||
border-success/30
|
||||
border-t
|
||||
border-t-2
|
||||
border-t-transparent
|
||||
border-transparent
|
||||
border-warning
|
||||
border-warning/30
|
||||
bottom-0
|
||||
bottom-full
|
||||
breadcrumbs
|
||||
breadcrumbs-separator
|
||||
break-words
|
||||
btn
|
||||
btn-accent
|
||||
btn-active
|
||||
btn-block
|
||||
btn-circle
|
||||
btn-disabled
|
||||
btn-error
|
||||
btn-gradient
|
||||
btn-info
|
||||
btn-lg
|
||||
btn-outline
|
||||
btn-primary
|
||||
btn-secondary
|
||||
btn-sm
|
||||
btn-soft
|
||||
btn-square
|
||||
btn-success
|
||||
btn-text
|
||||
btn-warning
|
||||
card
|
||||
card-alert
|
||||
card-body
|
||||
card-border
|
||||
card-footer
|
||||
card-header
|
||||
card-sm
|
||||
card-title
|
||||
carousel
|
||||
carousel-body
|
||||
carousel-next
|
||||
carousel-prev
|
||||
carousel-slide
|
||||
chat
|
||||
chat-avatar
|
||||
chat-bubble
|
||||
chat-footer
|
||||
chat-header
|
||||
chat-receiver
|
||||
chat-sender
|
||||
checkbox
|
||||
checkbox-primary
|
||||
checkbox-xs
|
||||
col-span-1
|
||||
col-span-12
|
||||
col-span-2
|
||||
col-span-6
|
||||
collapse
|
||||
combo-box-selected:block
|
||||
combo-box-selected:dropdown-active
|
||||
complete
|
||||
container
|
||||
contents
|
||||
cursor-default
|
||||
cursor-not-allowed
|
||||
cursor-pointer
|
||||
custom-option
|
||||
diff
|
||||
disabled
|
||||
divide-base-150/60
|
||||
divide-y
|
||||
divider
|
||||
drop-shadow
|
||||
dropdown
|
||||
dropdown-active
|
||||
dropdown-disabled
|
||||
dropdown-item
|
||||
dropdown-menu
|
||||
dropdown-open:opacity-100
|
||||
dropdown-open:rotate-180
|
||||
dropdown-toggle
|
||||
duration-300
|
||||
duration-500
|
||||
ease-in-out
|
||||
ease-linear
|
||||
end-3
|
||||
error-message
|
||||
file-upload-complete:progress-success
|
||||
fill-base-content
|
||||
fill-black
|
||||
fill-gray-200
|
||||
filter
|
||||
filter-reset
|
||||
fixed
|
||||
flex
|
||||
flex-1
|
||||
flex-col
|
||||
flex-grow
|
||||
flex-nowrap
|
||||
flex-row
|
||||
flex-shrink-0
|
||||
flex-wrap
|
||||
focus-visible:outline
|
||||
focus-visible:outline-2
|
||||
focus-visible:outline-indigo-600
|
||||
focus-visible:outline-none
|
||||
focus-visible:outline-offset-2
|
||||
focus-within:border-primary
|
||||
focus:border-primary
|
||||
focus:outline-1
|
||||
focus:outline-none
|
||||
focus:outline-primary
|
||||
focus:ring-0
|
||||
focus:ring-2
|
||||
focus:ring-indigo-600
|
||||
focus:ring-inset
|
||||
font-bold
|
||||
font-inter
|
||||
font-medium
|
||||
font-normal
|
||||
font-semibold
|
||||
footer
|
||||
footer-center
|
||||
from-base-100
|
||||
from-base-100/20
|
||||
from-error/20
|
||||
from-gray-600/20
|
||||
from-primary/20
|
||||
from-success/20
|
||||
from-violet-400
|
||||
from-warning/20
|
||||
gap-0.5
|
||||
gap-1
|
||||
gap-1.5
|
||||
gap-2
|
||||
gap-3
|
||||
gap-4
|
||||
gap-5
|
||||
gap-6
|
||||
gap-x-1
|
||||
gap-x-1.5
|
||||
gap-x-2
|
||||
gap-x-3
|
||||
gap-x-5
|
||||
gap-x-6
|
||||
gap-y-1
|
||||
gap-y-1.5
|
||||
gap-y-2
|
||||
gap-y-2.5
|
||||
gap-y-3
|
||||
gap-y-4
|
||||
gap-y-5
|
||||
gap-y-8
|
||||
grid
|
||||
grid-cols-1
|
||||
grid-cols-12
|
||||
grid-cols-2
|
||||
grid-cols-3
|
||||
grid-cols-4
|
||||
grid-cols-6
|
||||
grid-flow-col
|
||||
grow
|
||||
grow-0
|
||||
h-0
|
||||
h-10
|
||||
h-12
|
||||
h-14
|
||||
h-2
|
||||
h-3
|
||||
h-32
|
||||
h-44
|
||||
h-6
|
||||
h-64
|
||||
h-8
|
||||
h-[90vh]
|
||||
h-auto
|
||||
h-full
|
||||
h-screen
|
||||
helper-text
|
||||
hidden
|
||||
hover:bg-indigo-500
|
||||
hover:bg-primary/20
|
||||
hover:bg-primary/5
|
||||
hover:bg-transparent
|
||||
hover:cursor-pointer
|
||||
hover:text-base-content
|
||||
hover:text-base-content/60
|
||||
hover:text-indigo-500
|
||||
hover:text-primary
|
||||
image-full
|
||||
indicator
|
||||
indicator-item
|
||||
inline
|
||||
inline-block
|
||||
inline-flex
|
||||
inline-grid
|
||||
input
|
||||
input-floating
|
||||
input-floating-label
|
||||
input-lg
|
||||
input-md
|
||||
input-sm
|
||||
input-xl
|
||||
input-xs
|
||||
inset-0
|
||||
inset-y-0
|
||||
inset-y-2
|
||||
invisible
|
||||
is-invalid
|
||||
is-valid
|
||||
isolate
|
||||
italic
|
||||
items-center
|
||||
items-end
|
||||
items-start
|
||||
join
|
||||
join-item
|
||||
justify-between
|
||||
justify-center
|
||||
justify-end
|
||||
justify-start
|
||||
justify-stretch
|
||||
label-text
|
||||
leading-3
|
||||
leading-3.5
|
||||
leading-6
|
||||
leading-7
|
||||
leading-9
|
||||
leading-[1.1]
|
||||
leading-none
|
||||
left-0
|
||||
lg:bg-base-100/20
|
||||
lg:flex
|
||||
lg:gap-y-0
|
||||
lg:grid-cols-2
|
||||
lg:grid-cols-3
|
||||
lg:hidden
|
||||
lg:justify-end
|
||||
lg:justify-start
|
||||
lg:mb-0
|
||||
lg:min-w-0
|
||||
lg:p-10
|
||||
lg:p-8
|
||||
lg:pb-5
|
||||
lg:pl-64
|
||||
lg:pr-3.5
|
||||
lg:pt-5
|
||||
lg:px-8
|
||||
lg:ring-1
|
||||
lg:ring-base-content/10
|
||||
lg:rounded-lg
|
||||
lg:shadow-xs
|
||||
link
|
||||
link-animated
|
||||
link-hover
|
||||
link-primary
|
||||
list-disc
|
||||
list-inside
|
||||
list-none
|
||||
loading
|
||||
loading-lg
|
||||
loading-sm
|
||||
loading-spinner
|
||||
loading-xl
|
||||
loading-xs
|
||||
lowercase
|
||||
m-10
|
||||
mask
|
||||
max-h-52
|
||||
max-lg:flex-col
|
||||
max-lg:hidden
|
||||
max-md:flex-wrap
|
||||
max-md:justify-center
|
||||
max-sm:hidden
|
||||
max-w-2xl
|
||||
max-w-7xl
|
||||
max-w-8
|
||||
max-w-80
|
||||
max-w-full
|
||||
max-w-lg
|
||||
max-w-md
|
||||
max-w-none
|
||||
max-w-sm
|
||||
max-w-xl
|
||||
mb-0.5
|
||||
mb-1
|
||||
mb-1.5
|
||||
mb-2
|
||||
mb-2.5
|
||||
mb-3
|
||||
mb-4
|
||||
mb-5
|
||||
mb-8
|
||||
md:col-span-1
|
||||
md:col-span-2
|
||||
md:col-span-6
|
||||
md:flex
|
||||
md:gap-x-5
|
||||
md:grid-cols-2
|
||||
md:grid-cols-3
|
||||
md:min-w-md
|
||||
md:table-cell
|
||||
md:text-3xl
|
||||
me-0.5
|
||||
me-1
|
||||
me-1.5
|
||||
me-2
|
||||
me-2.5
|
||||
me-3
|
||||
me-4
|
||||
me-5
|
||||
menu
|
||||
menu-active
|
||||
menu-disabled
|
||||
menu-dropdown
|
||||
menu-dropdown-show
|
||||
menu-focus
|
||||
menu-horizontal
|
||||
menu-title
|
||||
min-h-0
|
||||
min-h-full
|
||||
min-h-screen
|
||||
min-h-svh
|
||||
min-w-0
|
||||
min-w-28
|
||||
min-w-48
|
||||
min-w-60
|
||||
min-w-[100px]
|
||||
min-w-full
|
||||
min-w-sm
|
||||
mix-blend-exclusion
|
||||
ml-3
|
||||
ml-4
|
||||
modal
|
||||
modal-content
|
||||
modal-dialog
|
||||
modal-middle
|
||||
modal-title
|
||||
mr-2
|
||||
mr-3
|
||||
mr-4
|
||||
ms-0.5
|
||||
ms-1
|
||||
ms-1.5
|
||||
ms-2
|
||||
ms-2.5
|
||||
ms-3
|
||||
ms-5
|
||||
ms-auto
|
||||
mt-1
|
||||
mt-1.5
|
||||
mt-10
|
||||
mt-12
|
||||
mt-2
|
||||
mt-2.5
|
||||
mt-3
|
||||
mt-3.5
|
||||
mt-4
|
||||
mt-5
|
||||
mt-6
|
||||
mt-8
|
||||
mt-auto
|
||||
mx-1
|
||||
mx-auto
|
||||
my-2.5
|
||||
my-3
|
||||
my-5
|
||||
my-8
|
||||
my-auto
|
||||
object-cover
|
||||
opacity-0
|
||||
opacity-100
|
||||
opacity-75
|
||||
open
|
||||
origin-top-left
|
||||
outline
|
||||
outline-0
|
||||
overflow-hidden
|
||||
overflow-x-auto
|
||||
overflow-x-hidden
|
||||
overflow-y-auto
|
||||
overlay-open:duration-50
|
||||
overlay-open:opacity-100
|
||||
p-0.5
|
||||
p-1
|
||||
p-1.5
|
||||
p-2
|
||||
p-2.5
|
||||
p-3
|
||||
p-4
|
||||
p-5
|
||||
p-6
|
||||
p-8
|
||||
pb-1
|
||||
pe-1.5
|
||||
pin-input
|
||||
pin-input-underline
|
||||
placeholder-base-content/50
|
||||
placeholder-base-content/60
|
||||
placeholder:text-gray-600
|
||||
pointer-events-auto
|
||||
pointer-events-none
|
||||
progress
|
||||
progress-bar
|
||||
progress-indeterminate
|
||||
progress-primary
|
||||
pt-0
|
||||
pt-0.5
|
||||
pt-1.5
|
||||
pt-2
|
||||
pt-3
|
||||
pt-6
|
||||
px-1.5
|
||||
px-2
|
||||
px-2.5
|
||||
px-3
|
||||
px-4
|
||||
px-5
|
||||
px-6
|
||||
py-0.5
|
||||
py-1
|
||||
py-1.5
|
||||
py-10
|
||||
py-12
|
||||
py-2
|
||||
py-2.5
|
||||
py-3
|
||||
py-3.5
|
||||
py-6
|
||||
radial-progress
|
||||
radio
|
||||
range
|
||||
relative
|
||||
resize
|
||||
right-4
|
||||
ring
|
||||
ring-0
|
||||
ring-1
|
||||
ring-gray-700
|
||||
ring-inset
|
||||
ring-white/10
|
||||
rounded-box
|
||||
rounded-field
|
||||
rounded-full
|
||||
rounded-l-none
|
||||
rounded-lg
|
||||
rounded-md
|
||||
rounded-none
|
||||
rounded-r-none
|
||||
rounded-t-lg
|
||||
rounded-xl
|
||||
row-active
|
||||
row-hover
|
||||
rtl:!mr-0
|
||||
select
|
||||
select-disabled:opacity-40
|
||||
select-disabled:pointer-events-none
|
||||
select-floating
|
||||
select-floating-label
|
||||
select-lg
|
||||
select-md
|
||||
select-sm
|
||||
select-xl
|
||||
select-xs
|
||||
selected
|
||||
selected:select-active
|
||||
shadow
|
||||
shadow-base-300/20
|
||||
shadow-lg
|
||||
shadow-md
|
||||
shadow-sm
|
||||
shadow-xs
|
||||
shrink-0
|
||||
size-10
|
||||
size-12
|
||||
size-4
|
||||
size-5
|
||||
size-7
|
||||
size-8
|
||||
skeleton
|
||||
skeleton-animated
|
||||
sm:auto-cols-max
|
||||
sm:col-span-2
|
||||
sm:col-span-3
|
||||
sm:col-span-4
|
||||
sm:col-span-6
|
||||
sm:flex
|
||||
sm:flex-nowrap
|
||||
sm:gap-y-0
|
||||
sm:grid-cols-2
|
||||
sm:grid-cols-3
|
||||
sm:grid-cols-6
|
||||
sm:items-center
|
||||
sm:items-end
|
||||
sm:justify-between
|
||||
sm:justify-end
|
||||
sm:leading-6
|
||||
sm:max-w-2xl
|
||||
sm:max-w-3xl
|
||||
sm:max-w-4xl
|
||||
sm:max-w-5xl
|
||||
sm:max-w-6xl
|
||||
sm:max-w-7xl
|
||||
sm:max-w-[480px]
|
||||
sm:max-w-lg
|
||||
sm:max-w-md
|
||||
sm:max-w-xl
|
||||
sm:mb-0
|
||||
sm:min-w-md
|
||||
sm:mr-3
|
||||
sm:mt-5
|
||||
sm:mt-6
|
||||
sm:mx-auto
|
||||
sm:p-6
|
||||
sm:px-12
|
||||
sm:px-6
|
||||
sm:py-2
|
||||
sm:rounded-lg
|
||||
sm:text-sm
|
||||
sm:text-sm/5
|
||||
sm:w-1/2
|
||||
sm:w-full
|
||||
space-x-1
|
||||
space-x-2
|
||||
space-x-2.5
|
||||
space-y-1
|
||||
space-y-4
|
||||
space-y-6
|
||||
sr-only
|
||||
stack
|
||||
stat
|
||||
stat-actions
|
||||
stat-desc
|
||||
stat-figure
|
||||
stat-title
|
||||
stat-value
|
||||
static
|
||||
stats
|
||||
stats-border
|
||||
status
|
||||
status-error
|
||||
status-primary
|
||||
status-secondary
|
||||
status-success
|
||||
status-warning
|
||||
status-xl
|
||||
sticky
|
||||
success-message
|
||||
switch
|
||||
switch-primary
|
||||
tab
|
||||
tab-active
|
||||
tab-content
|
||||
table
|
||||
table-pin-cols
|
||||
table-pin-rows
|
||||
tabs
|
||||
tabs-bordered
|
||||
tabs-lg
|
||||
tabs-lifted
|
||||
tabs-md
|
||||
tabs-sm
|
||||
tabs-vertical
|
||||
tabs-xl
|
||||
tabs-xs
|
||||
text-2xl
|
||||
text-3xl
|
||||
text-4xl
|
||||
text-accent
|
||||
text-base
|
||||
text-base-content
|
||||
text-base-content/40
|
||||
text-base-content/50
|
||||
text-base-content/60
|
||||
text-base-content/70
|
||||
text-base-content/80
|
||||
text-base-content/90
|
||||
text-base/6
|
||||
text-center
|
||||
text-error
|
||||
text-error-content
|
||||
text-gray-100
|
||||
text-gray-400
|
||||
text-gray-500
|
||||
text-gray-700
|
||||
text-indigo-600
|
||||
text-info
|
||||
text-info-content
|
||||
text-left
|
||||
text-lg
|
||||
text-primary
|
||||
text-primary-content
|
||||
text-right
|
||||
text-slate-100
|
||||
text-sm
|
||||
text-sm/5
|
||||
text-success
|
||||
text-success-content
|
||||
text-transparent
|
||||
text-warning
|
||||
text-warning-content
|
||||
text-white
|
||||
text-xl
|
||||
text-xl!
|
||||
text-xs
|
||||
text-xs/5
|
||||
textarea
|
||||
textarea-floating
|
||||
textarea-floating-label
|
||||
textarea-lg
|
||||
textarea-md
|
||||
textarea-sm
|
||||
textarea-xl
|
||||
textarea-xs
|
||||
theme-controller
|
||||
to-25%
|
||||
to-base-100/75
|
||||
to-purple-400
|
||||
tooltip
|
||||
tooltip-content
|
||||
top-0
|
||||
top-1/2
|
||||
top-4
|
||||
top-full
|
||||
tracking-tight
|
||||
tracking-wide
|
||||
transform
|
||||
transition
|
||||
transition-all
|
||||
transition-opacity
|
||||
translate-x-0
|
||||
truncate
|
||||
underline
|
||||
uppercase
|
||||
validate
|
||||
via-sky-400
|
||||
w-0
|
||||
w-0.5
|
||||
w-12
|
||||
w-13
|
||||
w-32
|
||||
w-4
|
||||
w-56
|
||||
w-64
|
||||
w-8
|
||||
w-auto
|
||||
w-fit
|
||||
w-full
|
||||
whitespace-nowrap
|
||||
xl:grid-cols-3
|
||||
xl:grid-cols-4
|
||||
z-1
|
||||
z-10
|
||||
z-40
|
||||
z-50
|
||||
@@ -1,5 +1,4 @@
|
||||
@using System.Diagnostics.CodeAnalysis
|
||||
@using Microsoft.AspNetCore.Components
|
||||
|
||||
@* TODO: Extract to mooncore? *@
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
@using System.Text.Json.Serialization
|
||||
@using Microsoft.Extensions.Logging
|
||||
@using XtermBlazor
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
@@ -15,11 +14,11 @@
|
||||
Addons="Parent.Addons"
|
||||
Options="Parent.Options"
|
||||
Class="h-full w-full"
|
||||
OnFirstRender="HandleFirstRender"/>
|
||||
OnFirstRender="HandleFirstRenderAsync"/>
|
||||
}
|
||||
|
||||
<div class="absolute top-4 right-4">
|
||||
<button @onclick="Hide" class="btn btn-error btn-square">
|
||||
<button @onclick="HideAsync" class="btn btn-error btn-square">
|
||||
<i class="icon-x text-lg"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -50,13 +49,13 @@
|
||||
}
|
||||
|
||||
// Subscribe to parent events
|
||||
Parent.OnWrite += HandleWrite;
|
||||
Parent.OnWrite += HandleWriteAsync;
|
||||
|
||||
IsInitialized = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task HandleFirstRender()
|
||||
private async Task HandleFirstRenderAsync()
|
||||
{
|
||||
IsReadyToWrite = true;
|
||||
|
||||
@@ -73,7 +72,7 @@
|
||||
await Terminal.Write(outputToWrite);
|
||||
}
|
||||
|
||||
private async Task HandleWrite(string content)
|
||||
private async Task HandleWriteAsync(string content)
|
||||
{
|
||||
if (!IsReadyToWrite)
|
||||
return;
|
||||
@@ -83,7 +82,7 @@
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
Parent.OnWrite -= HandleWrite;
|
||||
Parent.OnWrite -= HandleWriteAsync;
|
||||
await Terminal.DisposeAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,25 +3,38 @@
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Add a new allocation</h1>
|
||||
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-1 gap-2">
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">IP Address</label>
|
||||
<input @bind="Form.IpAddress" type="text" class="input w-full"/>
|
||||
<div class="p-5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="avatar avatar-placeholder max-sm:hidden">
|
||||
<div class="border-base-content/20 rounded-box w-13 border-1">
|
||||
<span class="icon-ethernet-port text-xl"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Port</label>
|
||||
<input @bind="Form.Port" type="text" class="input w-full"/>
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-base-content text-2xl font-semibold">Add a new allocation</h3>
|
||||
<p class="text-base-content/80">Add a new allocation to the selected node</p>
|
||||
</div>
|
||||
</div>
|
||||
</HandleForm>
|
||||
|
||||
<div class="mt-5 flex space-x-2">
|
||||
<WButton OnClick="_ => Hide()" CssClasses="btn btn-secondary grow">Cancel</WButton>
|
||||
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Create</WButton>
|
||||
<div class="mt-5">
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="mt-2">
|
||||
<label class="label-text">IP Address</label>
|
||||
<input class="input" @bind="Form.IpAddress" type="text"/>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Port</label>
|
||||
<input class="input" @bind="Form.Port" type="number"/>
|
||||
</div>
|
||||
</HandleForm>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-end">
|
||||
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
||||
Cancel
|
||||
</button>
|
||||
<WButton OnClick="SubmitAsync">
|
||||
Create
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -42,8 +55,8 @@
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
await OnSubmit.Invoke(Form);
|
||||
await Hide();
|
||||
await HideAsync();
|
||||
}
|
||||
|
||||
private Task Submit() => HandleForm.Submit();
|
||||
private Task SubmitAsync() => HandleForm.SubmitAsync();
|
||||
}
|
||||
|
||||
@@ -3,30 +3,42 @@
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Add a range of new allocations</h1>
|
||||
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-1 gap-2">
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">IP Address</label>
|
||||
<input @bind="Form.IpAddress" type="text" class="input w-full"/>
|
||||
<div class="p-5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="avatar avatar-placeholder max-sm:hidden">
|
||||
<div class="border-base-content/20 rounded-box w-13 border-1">
|
||||
<span class="icon-ethernet-port text-xl"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Start Port</label>
|
||||
<input @bind="Form.Start" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">End Port</label>
|
||||
<input @bind="Form.End" type="text" class="input w-full"/>
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-base-content text-2xl font-semibold">Add multiple allocations</h3>
|
||||
<p class="text-base-content/80">Add a range of new allocations to the selected node</p>
|
||||
</div>
|
||||
</div>
|
||||
</HandleForm>
|
||||
|
||||
<div class="mt-5 flex space-x-2">
|
||||
<WButton OnClick="_ => Hide()" CssClasses="btn btn-secondary grow">Cancel</WButton>
|
||||
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Create</WButton>
|
||||
<div class="mt-5">
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="mt-2">
|
||||
<label class="label-text">IP Address</label>
|
||||
<input class="input" @bind="Form.IpAddress" type="text"/>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Start Port</label>
|
||||
<input class="input" @bind="Form.Start" type="number"/>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="label-text">End Port</label>
|
||||
<input class="input" @bind="Form.End" type="number"/>
|
||||
</div>
|
||||
</HandleForm>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-end">
|
||||
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
||||
Cancel
|
||||
</button>
|
||||
<WButton OnClick="SubmitAsync">
|
||||
Create
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -49,8 +61,8 @@
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
await OnSubmit.Invoke(Form);
|
||||
await Hide();
|
||||
await HideAsync();
|
||||
}
|
||||
|
||||
private Task Submit() => HandleForm.Submit();
|
||||
private Task SubmitAsync() => HandleForm.SubmitAsync();
|
||||
}
|
||||
@@ -4,25 +4,38 @@
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Update allocation</h1>
|
||||
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-1 gap-2">
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">IP Address</label>
|
||||
<input @bind="Form.IpAddress" type="text" class="input w-full"/>
|
||||
<div class="p-5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="avatar avatar-placeholder max-sm:hidden">
|
||||
<div class="border-base-content/20 rounded-box w-13 border-1">
|
||||
<span class="icon-ethernet-port text-xl"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Port</label>
|
||||
<input @bind="Form.Port" type="text" class="input w-full"/>
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-base-content text-2xl font-semibold">Update allocation</h3>
|
||||
<p class="text-base-content/80">Update an existing allocation</p>
|
||||
</div>
|
||||
</div>
|
||||
</HandleForm>
|
||||
|
||||
<div class="mt-5 flex space-x-2">
|
||||
<WButton OnClick="_ => Hide()" CssClasses="btn btn-secondary grow">Cancel</WButton>
|
||||
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Update</WButton>
|
||||
<div class="mt-5">
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="mt-2">
|
||||
<label class="label-text">IP Address</label>
|
||||
<input class="input" @bind="Form.IpAddress" type="text"/>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Port</label>
|
||||
<input class="input" @bind="Form.Port" type="number"/>
|
||||
</div>
|
||||
</HandleForm>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-end">
|
||||
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
||||
Cancel
|
||||
</button>
|
||||
<WButton OnClick="SubmitAsync">
|
||||
Update
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -45,8 +58,8 @@
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
await OnSubmit.Invoke(Form);
|
||||
await Hide();
|
||||
await HideAsync();
|
||||
}
|
||||
|
||||
private Task Submit() => HandleForm.Submit();
|
||||
private Task SubmitAsync() => HandleForm.SubmitAsync();
|
||||
}
|
||||
@@ -2,26 +2,7 @@
|
||||
@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="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Enable Transparent
|
||||
Mode
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<div class="flex items-center">
|
||||
<Switch @bind-Value="Request.EnableTransparentMode"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">
|
||||
Enable Dynamic Firewall
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<div class="flex items-center">
|
||||
<Switch @bind-Value="Request.EnableDynamicFirewall"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@code
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.DataTables
|
||||
@using MoonCore.Blazor.FlyonUi.Grid
|
||||
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
||||
@using MoonCore.Blazor.FlyonUi.Modals
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
||||
@@ -22,38 +23,38 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="flex flex-col gap-y-3">
|
||||
<button type="button" @onclick="AddAllocation" class="btn btn-primary">Create</button>
|
||||
<button type="button" @onclick="AddAllocationRange" class="btn btn-accent">Create multiple</button>
|
||||
<button type="button" @onclick="DeleteAllAllocations" class="btn btn-error">Delete all</button>
|
||||
<button type="button" @onclick="AddAllocationAsync" class="btn btn-primary">Create</button>
|
||||
<button type="button" @onclick="AddAllocationRangeAsync" class="btn btn-accent">Create multiple
|
||||
</button>
|
||||
<button type="button" @onclick="DeleteAllAllocationsAsync" class="btn btn-error">Delete all</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-1 md:col-span-2 -mb-3">
|
||||
<DataTable @ref="Table" TItem="NodeAllocationResponse">
|
||||
<Configuration>
|
||||
<Pagination TItem="NodeAllocationResponse" ItemSource="LoadData"/>
|
||||
|
||||
<DataTableColumn TItem="NodeAllocationResponse" Field="@(x => x.IpAddress)" Name="IP Address"/>
|
||||
<DataTableColumn TItem="NodeAllocationResponse" Field="@(x => x.Port)" Name="Port"/>
|
||||
<DataTableColumn TItem="NodeAllocationResponse">
|
||||
<ColumnTemplate>
|
||||
<div class="flex justify-end items-center">
|
||||
<a @onclick="() => UpdateAllocation(context)"
|
||||
@onclick:preventDefault href="#"
|
||||
class="text-primary mr-2 sm:mr-3">
|
||||
<i class="icon-pencil text-base"></i>
|
||||
</a>
|
||||
<a @onclick="() => DeleteAllocation(context)"
|
||||
@onclick:preventDefault href="#"
|
||||
class="text-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</a>
|
||||
</div>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
</Configuration>
|
||||
</DataTable>
|
||||
<DataGrid @ref="Grid"
|
||||
TGridItem="NodeAllocationResponse"
|
||||
EnablePagination="true"
|
||||
ItemsProvider="ItemsProviderAsync">
|
||||
<PropertyColumn Field="x => x.IpAddress" Title="IP Address" />
|
||||
<PropertyColumn Field="x => x.Port"/>
|
||||
<TemplateColumn>
|
||||
<td>
|
||||
<div class="flex justify-end items-center">
|
||||
<a @onclick="() => UpdateAllocationAsync(context)"
|
||||
@onclick:preventDefault href="#"
|
||||
class="text-primary mr-2 sm:mr-3">
|
||||
<i class="icon-pencil text-base"></i>
|
||||
</a>
|
||||
<a @onclick="() => DeleteAllocationAsync(context)"
|
||||
@onclick:preventDefault href="#"
|
||||
class="text-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
</DataGrid>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -61,84 +62,94 @@
|
||||
{
|
||||
[Parameter] public NodeResponse Node { get; set; }
|
||||
|
||||
private DataTable<NodeAllocationResponse> Table;
|
||||
|
||||
private async Task<IPagedData<NodeAllocationResponse>> LoadData(PaginationOptions options)
|
||||
private DataGrid<NodeAllocationResponse> Grid;
|
||||
|
||||
private async Task<DataGridItemResult<NodeAllocationResponse>> ItemsProviderAsync(
|
||||
DataGridItemRequest request
|
||||
)
|
||||
{
|
||||
return await ApiClient.GetJson<PagedData<NodeAllocationResponse>>(
|
||||
$"api/admin/servers/nodes/{Node.Id}/allocations?page={options.Page}&pageSize={options.PerPage}"
|
||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
||||
|
||||
var countedData = await ApiClient.GetJson<CountedData<NodeAllocationResponse>>(
|
||||
$"api/admin/servers/nodes/{Node.Id}/allocations{query}"
|
||||
);
|
||||
|
||||
return new()
|
||||
{
|
||||
TotalCount = countedData.TotalCount,
|
||||
Items = countedData.Items
|
||||
};
|
||||
}
|
||||
|
||||
private async Task AddAllocationRange()
|
||||
private async Task AddAllocationRangeAsync()
|
||||
{
|
||||
Func<CreateNodeAllocationRangeRequest, Task> onSubmit = async request =>
|
||||
{
|
||||
await ApiClient.Post($"api/admin/servers/nodes/{Node.Id}/allocations/range", request);
|
||||
|
||||
await ToastService.Success("Successfully created allocations");
|
||||
await Table.Refresh();
|
||||
await ToastService.SuccessAsync("Successfully created allocations");
|
||||
await Grid.RefreshAsync();
|
||||
};
|
||||
|
||||
await ModalService.Launch<CreateMultipleAllocationModal>(parameters => { parameters.Add("OnSubmit", onSubmit); });
|
||||
await ModalService.LaunchAsync<CreateMultipleAllocationModal>(parameters => { parameters.Add("OnSubmit", onSubmit); });
|
||||
}
|
||||
|
||||
private async Task AddAllocation()
|
||||
private async Task AddAllocationAsync()
|
||||
{
|
||||
Func<CreateNodeAllocationRequest, Task> onSubmit = async request =>
|
||||
{
|
||||
await ApiClient.Post($"api/admin/servers/nodes/{Node.Id}/allocations", request);
|
||||
|
||||
await ToastService.Success("Successfully created allocation");
|
||||
await Table.Refresh();
|
||||
await ToastService.SuccessAsync("Successfully created allocation");
|
||||
await Grid.RefreshAsync();
|
||||
};
|
||||
|
||||
await ModalService.Launch<CreateAllocationModal>(parameters => { parameters.Add("OnSubmit", onSubmit); });
|
||||
await ModalService.LaunchAsync<CreateAllocationModal>(parameters => { parameters.Add("OnSubmit", onSubmit); });
|
||||
}
|
||||
|
||||
private async Task UpdateAllocation(NodeAllocationResponse allocation)
|
||||
private async Task UpdateAllocationAsync(NodeAllocationResponse allocation)
|
||||
{
|
||||
Func<UpdateNodeAllocationRequest, Task> onSubmit = async request =>
|
||||
{
|
||||
await ApiClient.Patch($"api/admin/servers/nodes/{Node.Id}/allocations/{allocation.Id}", request);
|
||||
|
||||
await ToastService.Success("Successfully updated allocation");
|
||||
await Table.Refresh();
|
||||
await ToastService.SuccessAsync("Successfully updated allocation");
|
||||
await Grid.RefreshAsync();
|
||||
};
|
||||
|
||||
await ModalService.Launch<UpdateAllocationModal>(parameters =>
|
||||
await ModalService.LaunchAsync<UpdateAllocationModal>(parameters =>
|
||||
{
|
||||
parameters.Add("OnSubmit", onSubmit);
|
||||
parameters.Add("Allocation", allocation);
|
||||
});
|
||||
}
|
||||
|
||||
private async Task DeleteAllocation(NodeAllocationResponse allocation)
|
||||
private async Task DeleteAllocationAsync(NodeAllocationResponse allocation)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"Delete allocation",
|
||||
"Do you really want to delete the selected allocation? This cannot be undone",
|
||||
async () =>
|
||||
{
|
||||
await ApiClient.Delete($"api/admin/servers/nodes/{Node.Id}/allocations/{allocation.Id}");
|
||||
|
||||
await ToastService.Success("Successfully deleted allocation");
|
||||
await Table.Refresh();
|
||||
await ToastService.SuccessAsync("Successfully deleted allocation");
|
||||
await Grid.RefreshAsync();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private async Task DeleteAllAllocations()
|
||||
private async Task DeleteAllAllocationsAsync()
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"Delete all allocations",
|
||||
"Do you really want to delete all allocations? This cannot be undone",
|
||||
async () =>
|
||||
{
|
||||
await ApiClient.Delete($"api/admin/servers/nodes/{Node.Id}/allocations/all");
|
||||
|
||||
await ToastService.Success("Successfully deleted allocations");
|
||||
await Table.Refresh();
|
||||
await ToastService.SuccessAsync("Successfully deleted allocations");
|
||||
await Grid.RefreshAsync();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
@implements IDisposable
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
|
||||
<div class="mb-3 mt-5 text-xl font-semibold">
|
||||
Overview
|
||||
@@ -176,27 +176,27 @@
|
||||
|
||||
private Timer? UpdateTimer;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
Statistics = await NodeService.GetStatistics(Node.Id);
|
||||
DockerStatistics = await NodeService.GetDockerStatistics(Node.Id);
|
||||
Statistics = await NodeService.GetStatisticsAsync(Node.Id);
|
||||
DockerStatistics = await NodeService.GetDockerStatisticsAsync(Node.Id);
|
||||
|
||||
UpdateTimer = new Timer(HandleUpdate, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3));
|
||||
UpdateTimer = new Timer(HandleUpdateAsync, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3));
|
||||
}
|
||||
|
||||
private async void HandleUpdate(object? _)
|
||||
private async void HandleUpdateAsync(object? _)
|
||||
{
|
||||
try
|
||||
{
|
||||
Statistics = await NodeService.GetStatistics(Node.Id);
|
||||
DockerStatistics = await NodeService.GetDockerStatistics(Node.Id);
|
||||
Statistics = await NodeService.GetStatisticsAsync(Node.Id);
|
||||
DockerStatistics = await NodeService.GetDockerStatisticsAsync(Node.Id);
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogWarning("An error occured while fetching status update: {e}", e);
|
||||
await ToastService.Error("Unable to fetch status update", e.Message);
|
||||
await ToastService.ErrorAsync("Unable to fetch status update", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,7 @@
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Storage</label>
|
||||
<div class="mt-2">
|
||||
<div class="select">
|
||||
<span class="icon-hard-drive text-base-content/80 my-auto"></span>
|
||||
<label class="sr-only" for="virtual-disk">Select the storage provider</label>
|
||||
<select @bind="Request.UseVirtualDisk" id="virtual-disk">
|
||||
<option value="false">Volume</option>
|
||||
<option value="true">Virtual Disk</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Bandwidth</label>
|
||||
<div class="mt-2">
|
||||
<input @bind="Request.Bandwidth" type="number" autocomplete="off" class="input w-full">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@code
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
||||
@using MoonCore.Blazor.FlyonUi.Forms
|
||||
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
|
||||
@@ -16,7 +15,7 @@
|
||||
DisplayField="@(x => $"{x.IpAddress}:{x.Port}")"
|
||||
SearchField="@(x => $"{x.IpAddress}:{x.Port}")"
|
||||
Value="Parent.Allocations"
|
||||
ItemSource="ItemSource">
|
||||
ItemSource="ItemSourceAsync">
|
||||
</InputMultipleItem>
|
||||
</div>
|
||||
</div>
|
||||
@@ -27,16 +26,16 @@
|
||||
[Parameter] public CreateServerRequest Request { get; set; }
|
||||
[Parameter] public Create Parent { get; set; }
|
||||
|
||||
private async Task<NodeAllocationResponse[]> ItemSource()
|
||||
private async Task<NodeAllocationResponse[]> ItemSourceAsync()
|
||||
{
|
||||
// Handle unselected node
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
||||
if (Parent.Node == null)
|
||||
return [];
|
||||
|
||||
var items = await PagedData<NodeAllocationResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<NodeAllocationResponse>>(
|
||||
$"api/admin/servers/nodes/{Parent.Node.Id}/allocations/free?page={page}&pageSize={pageSize}"
|
||||
var items = await CountedData<NodeAllocationResponse>.LoadAllAsync(async (startIndex, count) =>
|
||||
await ApiClient.GetJson<CountedData<NodeAllocationResponse>>(
|
||||
$"api/admin/servers/nodes/{Parent.Node.Id}/allocations/free?startIndex={startIndex}&count={count}"
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<InputItem TItem="UserResponse"
|
||||
DisplayField="@(x => x.Username)"
|
||||
SearchField="@(x => x.Username)"
|
||||
ItemSource="LoadUsers"
|
||||
ItemSource="LoadUsersAsync"
|
||||
@bind-Value="Parent.Owner">
|
||||
</InputItem>
|
||||
</div>
|
||||
@@ -35,7 +35,7 @@
|
||||
<InputItem TItem="StarResponse"
|
||||
DisplayField="@(x => x.Name)"
|
||||
SearchField="@(x => x.Name)"
|
||||
ItemSource="LoadStars"
|
||||
ItemSource="LoadStarsAsync"
|
||||
@bind-Value="Parent.Star">
|
||||
</InputItem>
|
||||
</div>
|
||||
@@ -47,7 +47,7 @@
|
||||
<InputItem TItem="NodeResponse"
|
||||
DisplayField="@(x => x.Name)"
|
||||
SearchField="@(x => x.Name)"
|
||||
ItemSource="LoadNodes"
|
||||
ItemSource="LoadNodesAsync"
|
||||
@bind-Value="Parent.Node">
|
||||
</InputItem>
|
||||
</div>
|
||||
@@ -91,29 +91,29 @@
|
||||
[Parameter] public CreateServerRequest Request { get; set; }
|
||||
[Parameter] public Create Parent { get; set; }
|
||||
|
||||
private async Task<StarResponse[]> LoadStars()
|
||||
private async Task<StarResponse[]> LoadStarsAsync()
|
||||
{
|
||||
return await PagedData<StarResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<StarResponse>>(
|
||||
$"api/admin/servers/stars?page={page}&pageSize={pageSize}"
|
||||
return await CountedData<StarResponse>.LoadAllAsync(async (startIndex, count) =>
|
||||
await ApiClient.GetJson<CountedData<StarResponse>>(
|
||||
$"api/admin/servers/stars?startIndex={startIndex}&count={count}"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private async Task<NodeResponse[]> LoadNodes()
|
||||
private async Task<NodeResponse[]> LoadNodesAsync()
|
||||
{
|
||||
return await PagedData<NodeResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<NodeResponse>>(
|
||||
$"api/admin/servers/nodes?page={page}&pageSize={pageSize}"
|
||||
return await CountedData<NodeResponse>.LoadAllAsync(async (startIndex, count) =>
|
||||
await ApiClient.GetJson<CountedData<NodeResponse>>(
|
||||
$"api/admin/servers/nodes?startIndex={startIndex}&count={count}"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private async Task<UserResponse[]> LoadUsers()
|
||||
private async Task<UserResponse[]> LoadUsersAsync()
|
||||
{
|
||||
return await PagedData<UserResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<UserResponse>>(
|
||||
$"api/admin/users?page={page}&pageSize={pageSize}"
|
||||
return await CountedData<UserResponse>.LoadAllAsync(async (startIndex, count) =>
|
||||
await ApiClient.GetJson<CountedData<UserResponse>>(
|
||||
$"api/admin/users?startIndex={startIndex}&count={count}"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
@using MoonCore.Models
|
||||
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.ServerVariables
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.StarVariables
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
@foreach (var variable in StarVariables)
|
||||
{
|
||||
@@ -28,7 +27,7 @@
|
||||
class="input placeholder-base-content/50 w-full"
|
||||
value="@value"
|
||||
placeholder="@variable.DefaultValue"
|
||||
@onchange="@(args => UpdateValue(variable, args))"/>
|
||||
@onchange="@(args => UpdateValueAsync(variable, args))"/>
|
||||
</div>
|
||||
<p class="mt-1 text-sm leading-6 text-base-content/60">
|
||||
@variable.Description
|
||||
@@ -45,7 +44,7 @@
|
||||
|
||||
private StarVariableResponse[] StarVariables;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
if (Parent.Star == null)
|
||||
{
|
||||
@@ -53,14 +52,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
StarVariables = await PagedData<StarVariableResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<StarVariableResponse>>(
|
||||
$"api/admin/servers/stars/{Parent.Star.Id}/variables?page={page}&pageSize={pageSize}"
|
||||
StarVariables = await CountedData<StarVariableResponse>.LoadAllAsync(async (startIndex, count) =>
|
||||
await ApiClient.GetJson<CountedData<StarVariableResponse>>(
|
||||
$"api/admin/servers/stars/{Parent.Star.Id}/variables?startIndex={startIndex}&count={count}"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private async Task UpdateValue(StarVariableResponse starVariable, ChangeEventArgs args)
|
||||
private async Task UpdateValueAsync(StarVariableResponse starVariable, ChangeEventArgs args)
|
||||
{
|
||||
var value = args.Value?.ToString() ?? "";
|
||||
|
||||
|
||||
@@ -5,21 +5,37 @@
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<div class="text-lg font-semibold mb-5">
|
||||
Create a new share
|
||||
</div>
|
||||
|
||||
<HandleForm @ref="HandleForm" Model="Request" OnValidSubmit="OnValidSubmit">
|
||||
<div class="mb-8">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Username</label>
|
||||
<input @bind="Request.Username" type="text" class="input w-full"/>
|
||||
<div class="p-5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="avatar avatar-placeholder max-sm:hidden">
|
||||
<div class="border-base-content/20 rounded-box w-13 border-1">
|
||||
<span class="icon-share-2 text-xl"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-base-content text-2xl font-semibold">Create a new share</h3>
|
||||
<p class="text-base-content/80">Grant access to this server to other users</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<HandleForm @ref="HandleForm" Model="Request" OnValidSubmit="OnValidSubmit">
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Username</label>
|
||||
<input class="input" @bind="Request.Username" type="text"/>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<PermissionEditor Server="Server" PermissionLevels="Permissions" />
|
||||
</div>
|
||||
</HandleForm>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-end">
|
||||
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
||||
Cancel
|
||||
</button>
|
||||
<WButton OnClick="SubmitAsync">
|
||||
Create
|
||||
</WButton>
|
||||
</div>
|
||||
<PermissionEditor Server="Server" PermissionLevels="Permissions" />
|
||||
</HandleForm>
|
||||
|
||||
<div class="mt-8 flex space-x-2">
|
||||
<WButton OnClick="_ => Hide()" CssClasses="btn btn-secondary grow">Cancel</WButton>
|
||||
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Create</WButton>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -33,16 +49,6 @@
|
||||
|
||||
private Dictionary<string, ServerPermissionLevel> Permissions = new();
|
||||
|
||||
private string[] Names =
|
||||
[
|
||||
"console",
|
||||
"power",
|
||||
"shares",
|
||||
"files",
|
||||
"variables",
|
||||
"settings"
|
||||
];
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Request = new()
|
||||
@@ -51,20 +57,20 @@
|
||||
};
|
||||
}
|
||||
|
||||
private async Task Set(string name, ServerPermissionLevel level)
|
||||
private async Task SetAsync(string name, ServerPermissionLevel level)
|
||||
{
|
||||
Permissions[name] = level;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task Submit()
|
||||
=> await HandleForm.Submit();
|
||||
private async Task SubmitAsync()
|
||||
=> await HandleForm.SubmitAsync();
|
||||
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
Request.Permissions = Permissions;
|
||||
|
||||
await OnSubmit.Invoke(Request);
|
||||
await Hide();
|
||||
await HideAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
@inject IEnumerable<IServerPermissionProvider> PermissionProviders
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-y-3">
|
||||
@foreach (var permission in AvailablePermissions)
|
||||
{
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<input @onclick="() => Set(permission.Identifier, ServerPermissionLevel.None)"
|
||||
<input @onclick="() => SetAsync(permission.Identifier, ServerPermissionLevel.None)"
|
||||
class="join-item btn btn-soft"
|
||||
type="radio" name="share-@permission.Identifier" aria-label="None"/>
|
||||
}
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<input @onclick="() => Set(permission.Identifier, ServerPermissionLevel.Read)"
|
||||
<input @onclick="() => SetAsync(permission.Identifier, ServerPermissionLevel.Read)"
|
||||
class="join-item btn btn-soft"
|
||||
type="radio" name="share-@permission.Identifier" aria-label="Read"/>
|
||||
}
|
||||
@@ -56,7 +56,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<input @onclick="() => Set(permission.Identifier, ServerPermissionLevel.ReadWrite)"
|
||||
<input @onclick="() => SetAsync(permission.Identifier, ServerPermissionLevel.ReadWrite)"
|
||||
class="join-item btn btn-soft"
|
||||
type="radio" name="share-@permission.Identifier" aria-label="Read & Write"/>
|
||||
}
|
||||
@@ -73,21 +73,21 @@
|
||||
|
||||
private ServerPermission[] AvailablePermissions;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
var permissions = new List<ServerPermission>();
|
||||
|
||||
foreach (var provider in PermissionProviders)
|
||||
{
|
||||
permissions.AddRange(
|
||||
await provider.GetPermissions(Server)
|
||||
await provider.GetPermissionsAsync(Server)
|
||||
);
|
||||
}
|
||||
|
||||
AvailablePermissions = permissions.ToArray();
|
||||
}
|
||||
|
||||
private async Task Set(string name, ServerPermissionLevel level)
|
||||
private async Task SetAsync(string name, ServerPermissionLevel level)
|
||||
{
|
||||
PermissionLevels[name] = level;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
@@ -174,8 +174,8 @@
|
||||
|
||||
try
|
||||
{
|
||||
Status = await ServerService.GetStatus(Server.Id);
|
||||
Stats = await ServerService.GetStats(Server.Id);
|
||||
Status = await ServerService.GetStatusAsync(Server.Id);
|
||||
Stats = await ServerService.GetStatsAsync(Server.Id);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
HubConnection.On<string>("ConsoleOutput", async content =>
|
||||
{
|
||||
if (XtermConsole != null)
|
||||
await XtermConsole.Write(content);
|
||||
await XtermConsole.WriteAsync(content);
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
@@ -31,9 +31,9 @@
|
||||
|
||||
private async Task OnAfterConsoleInitialized()
|
||||
{
|
||||
await XtermConsole!.Write(InitialConsoleMessage);
|
||||
await XtermConsole!.WriteAsync(InitialConsoleMessage);
|
||||
}
|
||||
|
||||
private async Task OnCommand(string command)
|
||||
=> await ServerService.RunCommand(Server.Id, command + "\n");
|
||||
=> await ServerService.RunCommandAsync(Server.Id, command + "\n");
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<WButton CssClasses="btn btn-primary" OnClick="Reinstall">
|
||||
<WButton CssClasses="btn btn-primary" OnClick="ReinstallAsync">
|
||||
<i class="align-middle icon-hammer"></i>
|
||||
<span class="align-middle">Reinstall</span>
|
||||
</WButton>
|
||||
@@ -29,12 +29,12 @@
|
||||
|
||||
@code
|
||||
{
|
||||
private async Task Reinstall(WButton _)
|
||||
private async Task ReinstallAsync(WButton _)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"Server installation",
|
||||
"Do you really want to reinstall the server? This can potentially lead to loss of data",
|
||||
() => ServerService.Install(Server.Id)
|
||||
() => ServerService.InstallAsync(Server.Id)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
<div class="flex flex-row mb-5">
|
||||
<input @bind="UsernameInput" class="input grow placeholder-base-content/50 me-1.5" autocomplete="none" placeholder="Enter a username"/>
|
||||
<button @onclick="OpenCreateModal" class="btn btn-primary">
|
||||
<button @onclick="OpenCreateModalAsync" class="btn btn-primary">
|
||||
<i class="icon-send me-1"></i>
|
||||
<span>Invite</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<LazyLoader @ref="LazyLoader" Load="Load">
|
||||
<LazyLoader @ref="LazyLoader" Load="LoadAsync">
|
||||
@if (Shares.Length == 0)
|
||||
{
|
||||
<IconAlert Title="No shares found" Color="text-primary" Icon="icon-search">
|
||||
@@ -40,11 +40,11 @@
|
||||
<span>@share.Username</span>
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<WButton OnClick="_ => OpenUpdateModal(share)" CssClasses="btn btn-primary me-1.5">
|
||||
<WButton OnClick="_ => OpenUpdateModalAsync(share)" CssClasses="btn btn-primary me-1.5">
|
||||
<i class="icon-settings-2 me-1"></i>
|
||||
<span>Edit</span>
|
||||
</WButton>
|
||||
<WButton OnClick="_ => Delete(share)" CssClasses="btn btn-error">
|
||||
<WButton OnClick="_ => DeleteAsync(share)" CssClasses="btn btn-error">
|
||||
<i class="icon-trash-2 me-1"></i>
|
||||
<span>Delete</span>
|
||||
</WButton>
|
||||
@@ -63,60 +63,60 @@
|
||||
|
||||
private LazyLoader LazyLoader;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
Shares = await PagedData<ServerShareResponse>.All(async (page, pageSize)
|
||||
=> await ShareService.Get(Server.Id, page, pageSize)
|
||||
Shares = await CountedData<ServerShareResponse>.LoadAllAsync(async (startIndex, count)
|
||||
=> await ShareService.GetAsync(Server.Id, startIndex, count)
|
||||
);
|
||||
}
|
||||
|
||||
private async Task OpenCreateModal()
|
||||
private async Task OpenCreateModalAsync()
|
||||
{
|
||||
await ModalService.Launch<CreateShareModal>(parameters =>
|
||||
await ModalService.LaunchAsync<CreateShareModal>(parameters =>
|
||||
{
|
||||
parameters["Username"] = UsernameInput;
|
||||
parameters["Server"] = Server;
|
||||
parameters["OnSubmit"] = SubmitCreate;
|
||||
parameters["OnSubmit"] = SubmitCreateAsync;
|
||||
}, size: "max-w-2xl");
|
||||
}
|
||||
|
||||
private async Task SubmitCreate(CreateShareRequest request)
|
||||
private async Task SubmitCreateAsync(CreateShareRequest request)
|
||||
{
|
||||
await ShareService.Create(Server.Id, request);
|
||||
await ShareService.CreateAsync(Server.Id, request);
|
||||
|
||||
await ToastService.Success("Share successfully created");
|
||||
await LazyLoader.Reload();
|
||||
await ToastService.SuccessAsync("Share successfully created");
|
||||
await LazyLoader.ReloadAsync();
|
||||
}
|
||||
|
||||
private async Task OpenUpdateModal(ServerShareResponse share)
|
||||
private async Task OpenUpdateModalAsync(ServerShareResponse share)
|
||||
{
|
||||
await ModalService.Launch<UpdateShareModal>(parameters =>
|
||||
await ModalService.LaunchAsync<UpdateShareModal>(parameters =>
|
||||
{
|
||||
parameters["Share"] = share;
|
||||
parameters["Server"] = Server;
|
||||
parameters["OnSubmit"] = (UpdateShareRequest request) => SubmitUpdate(share.Id, request);
|
||||
parameters["OnSubmit"] = (UpdateShareRequest request) => SubmitUpdateAsync(share.Id, request);
|
||||
}, size: "max-w-2xl");
|
||||
}
|
||||
|
||||
private async Task SubmitUpdate(int shareId, UpdateShareRequest request)
|
||||
private async Task SubmitUpdateAsync(int shareId, UpdateShareRequest request)
|
||||
{
|
||||
await ShareService.Update(Server.Id, shareId, request);
|
||||
await ShareService.UpdateAsync(Server.Id, shareId, request);
|
||||
|
||||
await ToastService.Success("Share successfully updated");
|
||||
await LazyLoader.Reload();
|
||||
await ToastService.SuccessAsync("Share successfully updated");
|
||||
await LazyLoader.ReloadAsync();
|
||||
}
|
||||
|
||||
private async Task Delete(ServerShareResponse share)
|
||||
private async Task DeleteAsync(ServerShareResponse share)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"Share deletion",
|
||||
$"Do you really want to delete the share for the user '{share.Username}'? This cannot be undone",
|
||||
async () =>
|
||||
{
|
||||
await ShareService.Delete(Server.Id, share.Id);
|
||||
await ShareService.DeleteAsync(Server.Id, share.Id);
|
||||
|
||||
await ToastService.Success("Successfully deleted share");
|
||||
await LazyLoader.Reload();
|
||||
await ToastService.SuccessAsync("Successfully deleted share");
|
||||
await LazyLoader.ReloadAsync();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
@inject ServerService ServerService
|
||||
@inject ToastService ToastService
|
||||
|
||||
<LazyLoader @ref="LazyLoader" Load="Load">
|
||||
<LazyLoader @ref="LazyLoader" Load="LoadAsync">
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
@foreach (var variable in Variables)
|
||||
{
|
||||
@@ -24,7 +24,7 @@
|
||||
@variable.Description
|
||||
</p>
|
||||
<div class="mt-auto">
|
||||
<input @onchange="e => UpdateVariable(variable, e)"
|
||||
<input @onchange="e => UpdateVariableAsync(variable, e)"
|
||||
value="@variable.Value"
|
||||
type="text"
|
||||
class="input w-full">
|
||||
@@ -40,26 +40,26 @@
|
||||
private ServerVariableDetailResponse[] Variables;
|
||||
private LazyLoader LazyLoader;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
Variables = await PagedData<ServerVariableDetailResponse>.All(async (page, pageSize)
|
||||
=> await ServerService.GetVariables(Server.Id, page, pageSize)
|
||||
Variables = await CountedData<ServerVariableDetailResponse>.LoadAllAsync(async (startIndex, count)
|
||||
=> await ServerService.GetVariablesAsync(Server.Id, startIndex, count)
|
||||
);
|
||||
}
|
||||
|
||||
private async Task UpdateVariable(ServerVariableDetailResponse variable, ChangeEventArgs args)
|
||||
private async Task UpdateVariableAsync(ServerVariableDetailResponse variable, ChangeEventArgs args)
|
||||
{
|
||||
var value = args.Value?.ToString() ?? "";
|
||||
|
||||
await ServerService.UpdateVariable(Server.Id, new()
|
||||
await ServerService.UpdateVariableAsync(Server.Id, new()
|
||||
{
|
||||
Key = variable.Key,
|
||||
Value = value
|
||||
});
|
||||
|
||||
// Fetch the current data to make sure the user sees the latest data
|
||||
await LazyLoader.Reload();
|
||||
await LazyLoader.ReloadAsync();
|
||||
|
||||
await ToastService.Success("Successfully updated variable");
|
||||
await ToastService.SuccessAsync("Successfully updated variable");
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,6 @@
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
|
||||
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Bandwidth</label>
|
||||
<div class="mt-2">
|
||||
<input @bind="Request.Bandwidth" type="number" autocomplete="off" class="input w-full">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
Value="Parent.Allocations"
|
||||
DisplayField="@(x => $"{x.IpAddress}:{x.Port}")"
|
||||
SearchField="@(x => $"{x.IpAddress}:{x.Port}")"
|
||||
ItemSource="Loader">
|
||||
ItemSource="LoaderAsync">
|
||||
</InputMultipleItem>
|
||||
</div>
|
||||
</div>
|
||||
@@ -28,11 +28,11 @@
|
||||
[Parameter] public ServerResponse Server { get; set; }
|
||||
[Parameter] public Update Parent { get; set; }
|
||||
|
||||
private async Task<NodeAllocationResponse[]> Loader()
|
||||
private async Task<NodeAllocationResponse[]> LoaderAsync()
|
||||
{
|
||||
return await PagedData<NodeAllocationResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<NodeAllocationResponse>>(
|
||||
$"api/admin/servers/nodes/{Server.NodeId}/allocations/free?page={page}&pageSize={pageSize}&serverId={Server.Id}"
|
||||
return await CountedData<NodeAllocationResponse>.LoadAllAsync(async (startIndex, count) =>
|
||||
await ApiClient.GetJson<CountedData<NodeAllocationResponse>>(
|
||||
$"api/admin/servers/nodes/{Server.NodeId}/allocations/free?startIndex={startIndex}&count={count}&serverId={Server.Id}"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
DisplayField="@(x => x.Username)"
|
||||
SearchField="@(x => x.Username)"
|
||||
@bind-Value="Parent.Owner"
|
||||
ItemSource="Loader">
|
||||
ItemSource="LoaderAsync">
|
||||
</InputItem>
|
||||
|
||||
</div>
|
||||
@@ -64,11 +64,11 @@
|
||||
[Parameter] public UpdateServerRequest Request { get; set; }
|
||||
[Parameter] public Update Parent { get; set; }
|
||||
|
||||
private async Task<UserResponse[]> Loader()
|
||||
private async Task<UserResponse[]> LoaderAsync()
|
||||
{
|
||||
return await PagedData<UserResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<UserResponse>>(
|
||||
$"api/admin/users?page={page}&pageSize={pageSize}"
|
||||
return await CountedData<UserResponse>.LoadAllAsync(async (startIndex, count) =>
|
||||
await ApiClient.GetJson<CountedData<UserResponse>>(
|
||||
$"api/admin/users?startIndex={startIndex}&count={count}"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
@foreach (var variable in ServerVariables)
|
||||
{
|
||||
@@ -30,7 +30,7 @@
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<input type="text" class="input w-full" value="@value"
|
||||
@onchange="@(args => UpdateValue(variable, args))"/>
|
||||
@onchange="@(args => UpdateValueAsync(variable, args))"/>
|
||||
</div>
|
||||
<p class="mt-1 text-sm leading-6 text-base-content/60">
|
||||
@starVariable.Description
|
||||
@@ -48,22 +48,22 @@
|
||||
private StarVariableResponse[] StarVariables;
|
||||
private ServerVariableResponse[] ServerVariables;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
StarVariables = await PagedData<StarVariableResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<StarVariableResponse>>(
|
||||
$"api/admin/servers/stars/{Server.StarId}/variables?page={page}&pageSize={pageSize}"
|
||||
StarVariables = await CountedData<StarVariableResponse>.LoadAllAsync(async (startIndex, count) =>
|
||||
await ApiClient.GetJson<CountedData<StarVariableResponse>>(
|
||||
$"api/admin/servers/stars/{Server.StarId}/variables?startIndex={startIndex}&count={count}"
|
||||
)
|
||||
);
|
||||
|
||||
ServerVariables = await PagedData<ServerVariableResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<ServerVariableResponse>>(
|
||||
$"api/admin/servers/{Server.Id}/variables?page={page}&pageSize={pageSize}"
|
||||
ServerVariables = await CountedData<ServerVariableResponse>.LoadAllAsync(async (startIndex, count) =>
|
||||
await ApiClient.GetJson<CountedData<ServerVariableResponse>>(
|
||||
$"api/admin/servers/{Server.Id}/variables?startIndex={startIndex}&count={count}"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private async Task UpdateValue(ServerVariableResponse serverVariable, ChangeEventArgs args)
|
||||
private async Task UpdateValueAsync(ServerVariableResponse serverVariable, ChangeEventArgs args)
|
||||
{
|
||||
var value = args.Value?.ToString() ?? "";
|
||||
|
||||
|
||||
@@ -3,21 +3,34 @@
|
||||
@using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares
|
||||
@using MoonlightServers.Shared.Http.Responses.Client.Servers
|
||||
@using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares
|
||||
@using MoonlightServers.Shared.Models
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<div class="text-lg font-semibold mb-5">
|
||||
Update share for @Share.Username
|
||||
</div>
|
||||
|
||||
<HandleForm @ref="HandleForm" Model="Request" OnValidSubmit="OnValidSubmit">
|
||||
<PermissionEditor Server="Server" PermissionLevels="Permissions" />
|
||||
</HandleForm>
|
||||
|
||||
<div class="mt-8 flex space-x-2">
|
||||
<WButton OnClick="_ => Hide()" CssClasses="btn btn-secondary grow">Cancel</WButton>
|
||||
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Update</WButton>
|
||||
<div class="p-5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="avatar avatar-placeholder max-sm:hidden">
|
||||
<div class="border-base-content/20 rounded-box w-13 border-1">
|
||||
<span class="icon-share-2 text-xl"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-base-content text-2xl font-semibold">Update share for @Share.Username</h3>
|
||||
<p class="text-base-content/80">Grant access to this server to other users</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<HandleForm @ref="HandleForm" Model="Request" OnValidSubmit="OnValidSubmit">
|
||||
<PermissionEditor Server="Server" PermissionLevels="Permissions" />
|
||||
</HandleForm>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-end">
|
||||
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
||||
Cancel
|
||||
</button>
|
||||
<WButton OnClick="SubmitAsync">
|
||||
Create
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -31,16 +44,6 @@
|
||||
|
||||
private Dictionary<string, ServerPermissionLevel> Permissions = new();
|
||||
|
||||
private string[] Names =
|
||||
[
|
||||
"console",
|
||||
"power",
|
||||
"shares",
|
||||
"files",
|
||||
"variables",
|
||||
"settings"
|
||||
];
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Request = new();
|
||||
@@ -48,20 +51,20 @@
|
||||
Permissions = Share.Permissions;
|
||||
}
|
||||
|
||||
private async Task Set(string name, ServerPermissionLevel level)
|
||||
private async Task SetAsync(string name, ServerPermissionLevel level)
|
||||
{
|
||||
Permissions[name] = level;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task Submit()
|
||||
=> await HandleForm.Submit();
|
||||
private async Task SubmitAsync()
|
||||
=> await HandleForm.SubmitAsync();
|
||||
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
Request.Permissions = Permissions;
|
||||
|
||||
await OnSubmit.Invoke(Request);
|
||||
await Hide();
|
||||
await HideAsync();
|
||||
}
|
||||
}
|
||||
@@ -4,30 +4,42 @@
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Add a new variable</h1>
|
||||
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Display Name</label>
|
||||
<input @bind="Form.DisplayName" type="text" class="input w-full"/>
|
||||
<div class="p-5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="avatar avatar-placeholder max-sm:hidden">
|
||||
<div class="border-base-content/20 rounded-box w-13 border-1">
|
||||
<span class="icon-container text-xl"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Identifier</label>
|
||||
<input @bind="Form.Identifier" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Automatic pulling</label>
|
||||
<Switch @bind-Value="Form.AutoPulling"/>
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-base-content text-2xl font-semibold">Add a new docker image</h3>
|
||||
<p class="text-base-content/80">Add a new docker image to the star</p>
|
||||
</div>
|
||||
</div>
|
||||
</HandleForm>
|
||||
|
||||
<div class="mt-5 flex space-x-2">
|
||||
<WButton OnClick="_ => Hide()" CssClasses="btn btn-secondary grow">Cancel</WButton>
|
||||
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Create</WButton>
|
||||
<div class="mt-5">
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Display Name</label>
|
||||
<input class="input" @bind="Form.DisplayName" type="text"/>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Identifier</label>
|
||||
<input class="input" @bind="Form.Identifier" type="text"/>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Automatic pulling</label>
|
||||
<Switch @bind-Value="Form.AutoPulling"/>
|
||||
</div>
|
||||
</HandleForm>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-end">
|
||||
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
||||
Cancel
|
||||
</button>
|
||||
<WButton OnClick="SubmitAsync">
|
||||
Create
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -49,8 +61,8 @@
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
await OnSubmit.Invoke(Form);
|
||||
await Hide();
|
||||
await HideAsync();
|
||||
}
|
||||
|
||||
private Task Submit() => HandleForm.Submit();
|
||||
private Task SubmitAsync() => HandleForm.SubmitAsync();
|
||||
}
|
||||
@@ -4,47 +4,57 @@
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Add a new parse configuration</h1>
|
||||
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-2 gap-x-2 gap-y-4">
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">File</label>
|
||||
<input @bind="Form.File" type="text" class="input w-full"/>
|
||||
<div class="p-5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="avatar avatar-placeholder max-sm:hidden">
|
||||
<div class="border-base-content/20 rounded-box w-13 border-1">
|
||||
<span class="icon-braces text-xl"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Type</label>
|
||||
<select @bind="Form.Parser" class="select w-full">
|
||||
@foreach (var val in Enum.GetValues<FileParsers>())
|
||||
{
|
||||
<option value="@val">@val</option>
|
||||
}
|
||||
</select>
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-base-content text-2xl font-semibold">Add a parse configuration</h3>
|
||||
<p class="text-base-content/80">Add a new parse configuration to the star</p>
|
||||
</div>
|
||||
|
||||
<div class="col-span-2">
|
||||
<button type="button" @onclick="AddEntry" class="btn btn-primary w-full">Add entry</button>
|
||||
</div>
|
||||
|
||||
@foreach (var entry in Form.Entries)
|
||||
{
|
||||
<div class="col-span-2">
|
||||
<div class="flex flex-row">
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="mt-2">
|
||||
<label class="label-text">File</label>
|
||||
<input class="input" @bind="Form.File" type="text"/>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Parser</label>
|
||||
<select @bind="Form.Parser" class="select w-full">
|
||||
@foreach (var val in Enum.GetValues<FileParsers>())
|
||||
{
|
||||
<option value="@val">@val</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<button type="button" @onclick="AddEntryAsync" class="btn btn-primary w-full">Add entry</button>
|
||||
</div>
|
||||
|
||||
@foreach (var entry in Form.Entries)
|
||||
{
|
||||
<div class="flex flex-row mt-2">
|
||||
<input @bind="entry.Key" placeholder="Key" class="input placeholder-base-content/50 grow rounded-r-none"/>
|
||||
<input @bind="entry.Value" placeholder="Value" class="input placeholder-base-content/50 grow rounded-none"/>
|
||||
<button type="button" @onclick="() => RemoveEntry(entry)" class="btn btn-error grow-0 rounded-l-none">
|
||||
<button type="button" @onclick="() => RemoveEntryAsync(entry)" class="btn btn-error grow-0 rounded-l-none">
|
||||
<i class="icon-x"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</HandleForm>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-end">
|
||||
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
||||
Cancel
|
||||
</button>
|
||||
<WButton OnClick="SubmitAsync">
|
||||
Create
|
||||
</WButton>
|
||||
</div>
|
||||
</HandleForm>
|
||||
|
||||
<div class="mt-5 flex space-x-2">
|
||||
<WButton OnClick="_ => Hide()" CssClasses="btn btn-secondary grow">Cancel</WButton>
|
||||
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Create</WButton>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -57,20 +67,20 @@
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
await OnSubmit.Invoke(Form);
|
||||
await Hide();
|
||||
await HideAsync();
|
||||
}
|
||||
|
||||
private Task Submit() => HandleForm.Submit();
|
||||
private Task SubmitAsync() => HandleForm.SubmitAsync();
|
||||
|
||||
private async Task AddEntry()
|
||||
private async Task AddEntryAsync()
|
||||
{
|
||||
Form.Entries.Add(new());
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task RemoveEntry(ParseConfiguration.ParseConfigurationEntry entry)
|
||||
private async Task RemoveEntryAsync(ParseConfiguration.ParseConfigurationEntry entry)
|
||||
{
|
||||
Form.Entries.Remove(entry);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,60 +5,76 @@
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Add a new variable</h1>
|
||||
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Name</label>
|
||||
<input @bind="Form.Name" type="text" class="input w-full"/>
|
||||
<div class="p-5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="avatar avatar-placeholder max-sm:hidden">
|
||||
<div class="border-base-content/20 rounded-box w-13 border-1">
|
||||
<span class="icon-variable text-xl"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Description</label>
|
||||
<input @bind="Form.Description" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Key</label>
|
||||
<input @bind="Form.Key" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Default Value</label>
|
||||
<input @bind="Form.DefaultValue" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Allow Viewing</label>
|
||||
<Switch @bind-Value="Form.AllowViewing"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Allow Editing</label>
|
||||
<Switch @bind-Value="Form.AllowEditing"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Type</label>
|
||||
<select @bind="Form.Type" class="select w-full">
|
||||
@foreach (var val in Enum.GetValues<StarVariableType>())
|
||||
{
|
||||
<option value="@val">@val</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Filter</label>
|
||||
<input @bind="Form.Filter" type="text" class="input w-full"/>
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-base-content text-2xl font-semibold">Add a new variable</h3>
|
||||
<p class="text-base-content/80">Add a new variable to the star</p>
|
||||
</div>
|
||||
</div>
|
||||
</HandleForm>
|
||||
<div class="mt-5">
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Name</label>
|
||||
<input @bind="Form.Name" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 flex space-x-2">
|
||||
<WButton OnClick="_ => Hide()" CssClasses="btn btn-secondary grow">Cancel</WButton>
|
||||
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Create</WButton>
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Description</label>
|
||||
<input @bind="Form.Description" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Key</label>
|
||||
<input @bind="Form.Key" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Default Value</label>
|
||||
<input @bind="Form.DefaultValue" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Allow Viewing</label>
|
||||
<Switch @bind-Value="Form.AllowViewing"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Allow Editing</label>
|
||||
<Switch @bind-Value="Form.AllowEditing"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Type</label>
|
||||
<select @bind="Form.Type" class="select w-full">
|
||||
@foreach (var val in Enum.GetValues<StarVariableType>())
|
||||
{
|
||||
<option value="@val">@val</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Filter</label>
|
||||
<input @bind="Form.Filter" type="text" class="input w-full"/>
|
||||
</div>
|
||||
</div>
|
||||
</HandleForm>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-end">
|
||||
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
||||
Cancel
|
||||
</button>
|
||||
<WButton OnClick="SubmitAsync">
|
||||
Create
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -71,8 +87,8 @@
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
await OnSubmit.Invoke(Form);
|
||||
await Hide();
|
||||
await HideAsync();
|
||||
}
|
||||
|
||||
private Task Submit() => HandleForm.Submit();
|
||||
private Task SubmitAsync() => HandleForm.SubmitAsync();
|
||||
}
|
||||
|
||||
@@ -5,30 +5,42 @@
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Update variable</h1>
|
||||
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Display Name</label>
|
||||
<input @bind="Form.DisplayName" type="text" class="input w-full"/>
|
||||
<div class="p-5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="avatar avatar-placeholder max-sm:hidden">
|
||||
<div class="border-base-content/20 rounded-box w-13 border-1">
|
||||
<span class="icon-container text-xl"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Identifier</label>
|
||||
<input @bind="Form.Identifier" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-2">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Automatic pulling</label>
|
||||
<Switch @bind-Value="Form.AutoPulling"/>
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-base-content text-2xl font-semibold">Update docker image</h3>
|
||||
<p class="text-base-content/80">Update docker image properties</p>
|
||||
</div>
|
||||
</div>
|
||||
</HandleForm>
|
||||
|
||||
<div class="mt-5 flex space-x-2">
|
||||
<WButton OnClick="_ => Hide()" CssClasses="btn btn-secondary grow">Cancel</WButton>
|
||||
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Update</WButton>
|
||||
<div class="mt-5">
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Display Name</label>
|
||||
<input class="input" @bind="Form.DisplayName" type="text"/>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Identifier</label>
|
||||
<input class="input" @bind="Form.Identifier" type="text"/>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Automatic pulling</label>
|
||||
<Switch @bind-Value="Form.AutoPulling"/>
|
||||
</div>
|
||||
</HandleForm>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-end">
|
||||
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
||||
Cancel
|
||||
</button>
|
||||
<WButton OnClick="SubmitAsync">
|
||||
Update
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -52,8 +64,8 @@
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
await OnSubmit.Invoke(Form);
|
||||
await Hide();
|
||||
await HideAsync();
|
||||
}
|
||||
|
||||
private Task Submit() => HandleForm.Submit();
|
||||
private Task SubmitAsync() => HandleForm.SubmitAsync();
|
||||
}
|
||||
@@ -4,46 +4,57 @@
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Update parse configuration</h1>
|
||||
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-2 gap-x-2 gap-y-4">
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">File</label>
|
||||
<input @bind="Form.File" type="text" class="input w-full"/>
|
||||
<div class="p-5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="avatar avatar-placeholder max-sm:hidden">
|
||||
<div class="border-base-content/20 rounded-box w-13 border-1">
|
||||
<span class="icon-braces text-xl"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Type</label>
|
||||
<select @bind="Form.Parser" class="select w-full">
|
||||
@foreach (var val in Enum.GetValues<FileParsers>())
|
||||
{
|
||||
<option value="@val">@val</option>
|
||||
}
|
||||
</select>
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-base-content text-2xl font-semibold">Update parse configuration</h3>
|
||||
<p class="text-base-content/80">Update parse configuration properties</p>
|
||||
</div>
|
||||
|
||||
<div class="col-span-2">
|
||||
<button type="button" @onclick="AddEntry" class="btn btn-primary w-full">Add entry</button>
|
||||
</div>
|
||||
|
||||
@foreach (var entry in Form.Entries)
|
||||
{
|
||||
<div class="col-span-2">
|
||||
<div class="flex flex-row">
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="mt-2">
|
||||
<label class="label-text">File</label>
|
||||
<input class="input" @bind="Form.File" type="text"/>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="label-text">Parser</label>
|
||||
<select @bind="Form.Parser" class="select w-full">
|
||||
@foreach (var val in Enum.GetValues<FileParsers>())
|
||||
{
|
||||
<option value="@val">@val</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<button type="button" @onclick="AddEntryAsync" class="btn btn-primary w-full">Add entry</button>
|
||||
</div>
|
||||
|
||||
@foreach (var entry in Form.Entries)
|
||||
{
|
||||
<div class="flex flex-row mt-2">
|
||||
<input @bind="entry.Key" placeholder="Key" class="input placeholder-base-content/50 grow rounded-r-none"/>
|
||||
<input @bind="entry.Value" placeholder="Value" class="input placeholder-base-content/50 grow rounded-none"/>
|
||||
<button type="button" @onclick="() => RemoveEntry(entry)" class="btn btn-error grow-0 rounded-l-none">
|
||||
<button type="button" @onclick="() => RemoveEntryAsync(entry)" class="btn btn-error grow-0 rounded-l-none">
|
||||
<i class="icon-x"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</HandleForm>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-end">
|
||||
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
||||
Cancel
|
||||
</button>
|
||||
<WButton OnClick="SubmitAsync">
|
||||
Update
|
||||
</WButton>
|
||||
</div>
|
||||
</HandleForm>
|
||||
|
||||
<div class="mt-5 flex space-x-2">
|
||||
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Save changes</WButton>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -63,18 +74,18 @@
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
await OnSubmit.Invoke(Form);
|
||||
await Hide();
|
||||
await HideAsync();
|
||||
}
|
||||
|
||||
private Task Submit() => HandleForm.Submit();
|
||||
private Task SubmitAsync() => HandleForm.SubmitAsync();
|
||||
|
||||
private async Task AddEntry()
|
||||
private async Task AddEntryAsync()
|
||||
{
|
||||
Form.Entries.Add(new());
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task RemoveEntry(ParseConfiguration.ParseConfigurationEntry entry)
|
||||
private async Task RemoveEntryAsync(ParseConfiguration.ParseConfigurationEntry entry)
|
||||
{
|
||||
Form.Entries.Remove(entry);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
@@ -6,60 +6,76 @@
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
|
||||
<h1 class="mb-5 font-semibold text-xl">Update variable</h1>
|
||||
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Name</label>
|
||||
<input @bind="Form.Name" type="text" class="input w-full"/>
|
||||
<div class="p-5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="avatar avatar-placeholder max-sm:hidden">
|
||||
<div class="border-base-content/20 rounded-box w-13 border-1">
|
||||
<span class="icon-variable text-xl"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Description</label>
|
||||
<input @bind="Form.Description" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Key</label>
|
||||
<input @bind="Form.Key" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Default Value</label>
|
||||
<input @bind="Form.DefaultValue" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Allow Viewing</label>
|
||||
<Switch @bind-Value="Form.AllowViewing"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Allow Editing</label>
|
||||
<Switch @bind-Value="Form.AllowEditing"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Type</label>
|
||||
<select @bind="Form.Type" class="select w-full">
|
||||
@foreach (var val in Enum.GetValues<StarVariableType>())
|
||||
{
|
||||
<option value="@val">@val</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Filter</label>
|
||||
<input @bind="Form.Filter" type="text" class="input w-full"/>
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-base-content text-2xl font-semibold">Update variable</h3>
|
||||
<p class="text-base-content/80">Update variable properties</p>
|
||||
</div>
|
||||
</div>
|
||||
</HandleForm>
|
||||
<div class="mt-5">
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Name</label>
|
||||
<input @bind="Form.Name" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 flex space-x-2">
|
||||
<WButton OnClick="_ => Hide()" CssClasses="btn btn-secondary grow">Cancel</WButton>
|
||||
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Update</WButton>
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Description</label>
|
||||
<input @bind="Form.Description" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Key</label>
|
||||
<input @bind="Form.Key" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Default Value</label>
|
||||
<input @bind="Form.DefaultValue" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Allow Viewing</label>
|
||||
<Switch @bind-Value="Form.AllowViewing"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Allow Editing</label>
|
||||
<Switch @bind-Value="Form.AllowEditing"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Type</label>
|
||||
<select @bind="Form.Type" class="select w-full">
|
||||
@foreach (var val in Enum.GetValues<StarVariableType>())
|
||||
{
|
||||
<option value="@val">@val</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="label-text">Filter</label>
|
||||
<input @bind="Form.Filter" type="text" class="input w-full"/>
|
||||
</div>
|
||||
</div>
|
||||
</HandleForm>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-end">
|
||||
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
||||
Cancel
|
||||
</button>
|
||||
<WButton OnClick="SubmitAsync">
|
||||
Update
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -88,8 +104,8 @@
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
await OnSubmit.Invoke(Form);
|
||||
await Hide();
|
||||
await HideAsync();
|
||||
}
|
||||
|
||||
private Task Submit() => HandleForm.Submit();
|
||||
private Task SubmitAsync() => HandleForm.SubmitAsync();
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
@inject ToastService ToastService
|
||||
@inject AlertService AlertService
|
||||
|
||||
<LazyLoader @ref="LazyLoader" Load="Load">
|
||||
<LazyLoader @ref="LazyLoader" Load="LoadAsync">
|
||||
<div class="flex justify-end">
|
||||
<button type="button" @onclick="AddDockerImage" class="btn btn-primary">Add docker image</button>
|
||||
<button type="button" @onclick="AddDockerImageAsync" class="btn btn-primary">Add docker image</button>
|
||||
</div>
|
||||
|
||||
<div class="grid sm:grid-cols-2 xl:grid-cols-3 gap-4 mt-5">
|
||||
@@ -30,11 +30,11 @@
|
||||
</div>
|
||||
|
||||
<div class="gap-x-2">
|
||||
<button type="button" @onclick="() => UpdateDockerImage(dockerImage)" class="btn btn-primary">
|
||||
<button type="button" @onclick="() => UpdateDockerImageAsync(dockerImage)" class="btn btn-primary">
|
||||
<i class="icon-settings text-base"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" @onclick="() => DeleteDockerImage(dockerImage)" class="btn btn-error">
|
||||
<button type="button" @onclick="() => DeleteDockerImageAsync(dockerImage)" class="btn btn-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -51,59 +51,61 @@
|
||||
private StarDockerImageResponse[] DockerImages;
|
||||
private LazyLoader LazyLoader;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
var pagedVariables = await ApiClient.GetJson<PagedData<StarDockerImageResponse>>(
|
||||
$"api/admin/servers/stars/{Star.Id}/dockerImages?page=0&pageSize=50"
|
||||
var pagedVariables = await ApiClient.GetJson<CountedData<StarDockerImageResponse>>(
|
||||
$"api/admin/servers/stars/{Star.Id}/dockerImages?startIndex=0&count=100"
|
||||
);
|
||||
|
||||
// TODO: Improve paged stuff
|
||||
|
||||
DockerImages = pagedVariables.Items;
|
||||
}
|
||||
|
||||
private async Task AddDockerImage()
|
||||
private async Task AddDockerImageAsync()
|
||||
{
|
||||
Func<CreateStarDockerImageRequest, Task> onSubmit = async request =>
|
||||
{
|
||||
await ApiClient.Post($"api/admin/servers/stars/{Star.Id}/dockerImages", request);
|
||||
|
||||
await ToastService.Success("Successfully created docker image");
|
||||
await LazyLoader.Reload();
|
||||
await ToastService.SuccessAsync("Successfully created docker image");
|
||||
await LazyLoader.ReloadAsync();
|
||||
};
|
||||
|
||||
await ModalService.Launch<CreateDockerImageModal>(parameters =>
|
||||
await ModalService.LaunchAsync<CreateDockerImageModal>(parameters =>
|
||||
{
|
||||
parameters.Add("OnSubmit", onSubmit);
|
||||
});
|
||||
}
|
||||
|
||||
private async Task UpdateDockerImage(StarDockerImageResponse dockerImage)
|
||||
private async Task UpdateDockerImageAsync(StarDockerImageResponse dockerImage)
|
||||
{
|
||||
Func<UpdateStarDockerImageRequest, Task> onSubmit = async request =>
|
||||
{
|
||||
await ApiClient.Patch($"api/admin/servers/stars/{Star.Id}/dockerImages/{dockerImage.Id}", request);
|
||||
|
||||
await ToastService.Success("Successfully updated docker image");
|
||||
await LazyLoader.Reload();
|
||||
await ToastService.SuccessAsync("Successfully updated docker image");
|
||||
await LazyLoader.ReloadAsync();
|
||||
};
|
||||
|
||||
await ModalService.Launch<UpdateDockerImageModal>(parameters =>
|
||||
await ModalService.LaunchAsync<UpdateDockerImageModal>(parameters =>
|
||||
{
|
||||
parameters.Add("OnSubmit", onSubmit);
|
||||
parameters.Add("DockerImage", dockerImage);
|
||||
});
|
||||
}
|
||||
|
||||
private async Task DeleteDockerImage(StarDockerImageResponse dockerImage)
|
||||
private async Task DeleteDockerImageAsync(StarDockerImageResponse dockerImage)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"Delete docker image",
|
||||
"Do you really want to delete the selected docker image? This cannot be undone",
|
||||
async () =>
|
||||
{
|
||||
await ApiClient.Delete($"api/admin/servers/stars/{Star.Id}/dockerImages/{dockerImage.Id}");
|
||||
|
||||
await ToastService.Success("Successfully deleted docker image");
|
||||
await LazyLoader.Reload();
|
||||
await ToastService.SuccessAsync("Successfully deleted docker image");
|
||||
await LazyLoader.ReloadAsync();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,6 @@
|
||||
|
||||
private async Task OnFocusOut()
|
||||
{
|
||||
Request.InstallScript = await CodeEditor.GetValue();
|
||||
Request.InstallScript = await CodeEditor.GetValueAsync();
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<div>
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
<div class="sm:col-span-2">
|
||||
@@ -53,11 +53,13 @@
|
||||
|
||||
private List<StarDockerImageResponse> DockerImages;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
var pagedVariables = await ApiClient.GetJson<PagedData<StarDockerImageResponse>>(
|
||||
$"api/admin/servers/stars/{Star.Id}/dockerImages?page=0&pageSize=50"
|
||||
var pagedVariables = await ApiClient.GetJson<CountedData<StarDockerImageResponse>>(
|
||||
$"api/admin/servers/stars/{Star.Id}/dockerImages?startIndex=0&count=100"
|
||||
);
|
||||
|
||||
// TODO: Fix this
|
||||
|
||||
DockerImages = pagedVariables
|
||||
.Items
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
@inject ToastService ToastService
|
||||
|
||||
<div class="flex justify-end mb-5">
|
||||
<button type="button" @onclick="AddConfig" class="btn btn-primary">Add parse configuration</button>
|
||||
<button type="button" @onclick="AddConfigAsync" class="btn btn-primary">Add parse configuration</button>
|
||||
</div>
|
||||
|
||||
@if (HasParseError)
|
||||
@@ -33,11 +33,11 @@ else
|
||||
</div>
|
||||
|
||||
<div class="gap-x-2">
|
||||
<button type="button" @onclick="() => UpdateConfig(configuration)" class="btn btn-primary">
|
||||
<button type="button" @onclick="() => UpdateConfigAsync(configuration)" class="btn btn-primary">
|
||||
<i class="icon-settings text-base"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" @onclick="() => DeleteConfig(configuration)" class="btn btn-error">
|
||||
<button type="button" @onclick="() => DeleteConfigAsync(configuration)" class="btn btn-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -60,7 +60,7 @@ else
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task AddConfig()
|
||||
private async Task AddConfigAsync()
|
||||
{
|
||||
Func<ParseConfiguration, Task> onSubmit = async configuration =>
|
||||
{
|
||||
@@ -68,35 +68,35 @@ else
|
||||
SaveChanges();
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ToastService.Success("Successfully created parse configuration");
|
||||
await ToastService.SuccessAsync("Successfully created parse configuration");
|
||||
};
|
||||
|
||||
await ModalService.Launch<CreateParseConfigModal>(parameters =>
|
||||
await ModalService.LaunchAsync<CreateParseConfigModal>(parameters =>
|
||||
{
|
||||
parameters.Add("OnSubmit", onSubmit);
|
||||
}, "max-w-xl");
|
||||
}
|
||||
|
||||
private async Task UpdateConfig(ParseConfiguration configuration)
|
||||
private async Task UpdateConfigAsync(ParseConfiguration configuration)
|
||||
{
|
||||
Func<ParseConfiguration, Task> onSubmit = async _ =>
|
||||
{
|
||||
SaveChanges();
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ToastService.Success("Successfully updated parse configuration");
|
||||
await ToastService.SuccessAsync("Successfully updated parse configuration");
|
||||
};
|
||||
|
||||
await ModalService.Launch<UpdateParseConfigModal>(parameters =>
|
||||
await ModalService.LaunchAsync<UpdateParseConfigModal>(parameters =>
|
||||
{
|
||||
parameters.Add("OnSubmit", onSubmit);
|
||||
parameters.Add("Configuration", configuration);
|
||||
}, "max-w-xl");
|
||||
}
|
||||
|
||||
private async Task DeleteConfig(ParseConfiguration configuration)
|
||||
private async Task DeleteConfigAsync(ParseConfiguration configuration)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"Parse configuration deletion",
|
||||
"Do you really want to delete the selected parse configuration",
|
||||
async () =>
|
||||
@@ -105,7 +105,7 @@ else
|
||||
SaveChanges();
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ToastService.Success("Successfully deleted parse configuration");
|
||||
await ToastService.SuccessAsync("Successfully deleted parse configuration");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
@inject ToastService ToastService
|
||||
|
||||
<div class="flex justify-end mb-5">
|
||||
<button type="button" @onclick="AddVariable" class="btn btn-primary">Add variable</button>
|
||||
<button type="button" @onclick="AddVariableAsync" class="btn btn-primary">Add variable</button>
|
||||
</div>
|
||||
|
||||
<LazyLoader @ref="LazyLoader" Load="Load">
|
||||
<LazyLoader @ref="LazyLoader" Load="LoadAsync">
|
||||
<div class="grid sm:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
@foreach (var variable in CurrentVariables)
|
||||
{
|
||||
@@ -30,11 +30,11 @@
|
||||
</div>
|
||||
|
||||
<div class="gap-x-2">
|
||||
<button type="button" @onclick="() => UpdateVariable(variable)" class="btn btn-primary">
|
||||
<button type="button" @onclick="() => UpdateVariableAsync(variable)" class="btn btn-primary">
|
||||
<i class="icon-settings text-base"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" @onclick="() => DeleteVariable(variable)" class="btn btn-error">
|
||||
<button type="button" @onclick="() => DeleteVariableAsync(variable)" class="btn btn-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -51,59 +51,59 @@
|
||||
private StarVariableResponse[] CurrentVariables;
|
||||
private LazyLoader LazyLoader;
|
||||
|
||||
private async Task Load(LazyLoader arg)
|
||||
private async Task LoadAsync(LazyLoader arg)
|
||||
{
|
||||
var pagedVariables = await ApiClient.GetJson<PagedData<StarVariableResponse>>(
|
||||
$"api/admin/servers/stars/{Star.Id}/variables?page=0&pageSize=50"
|
||||
var pagedVariables = await ApiClient.GetJson<CountedData<StarVariableResponse>>(
|
||||
$"api/admin/servers/stars/{Star.Id}/variables?startIndex=0&count=100"
|
||||
);
|
||||
|
||||
CurrentVariables = pagedVariables.Items;
|
||||
}
|
||||
|
||||
private async Task AddVariable()
|
||||
private async Task AddVariableAsync()
|
||||
{
|
||||
Func<CreateStarVariableRequest, Task> onSubmit = async request =>
|
||||
{
|
||||
await ApiClient.Post($"api/admin/servers/stars/{Star.Id}/variables", request);
|
||||
|
||||
await ToastService.Success("Successfully created variable");
|
||||
await LazyLoader.Reload();
|
||||
await ToastService.SuccessAsync("Successfully created variable");
|
||||
await LazyLoader.ReloadAsync();
|
||||
};
|
||||
|
||||
await ModalService.Launch<CreateVariableModal>(parameters =>
|
||||
await ModalService.LaunchAsync<CreateVariableModal>(parameters =>
|
||||
{
|
||||
parameters.Add("OnSubmit", onSubmit);
|
||||
}, "max-w-xl");
|
||||
}
|
||||
|
||||
private async Task UpdateVariable(StarVariableResponse variable)
|
||||
private async Task UpdateVariableAsync(StarVariableResponse variable)
|
||||
{
|
||||
Func<UpdateStarVariableRequest, Task> onSubmit = async request =>
|
||||
{
|
||||
await ApiClient.Patch($"api/admin/servers/stars/{Star.Id}/variables/{variable.Id}", request);
|
||||
|
||||
await ToastService.Success("Successfully updated variable");
|
||||
await LazyLoader.Reload();
|
||||
await ToastService.SuccessAsync("Successfully updated variable");
|
||||
await LazyLoader.ReloadAsync();
|
||||
};
|
||||
|
||||
await ModalService.Launch<UpdateVariableModal>(parameters =>
|
||||
await ModalService.LaunchAsync<UpdateVariableModal>(parameters =>
|
||||
{
|
||||
parameters.Add("OnSubmit", onSubmit);
|
||||
parameters.Add("Variable", variable);
|
||||
}, "max-w-xl");
|
||||
}
|
||||
|
||||
private async Task DeleteVariable(StarVariableResponse variable)
|
||||
private async Task DeleteVariableAsync(StarVariableResponse variable)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"Delete variable",
|
||||
"Do you really want to delete the selected variable? This cannot be undone",
|
||||
async () =>
|
||||
{
|
||||
await ApiClient.Delete($"api/admin/servers/stars/{Star.Id}/variables/{variable.Id}");
|
||||
|
||||
await ToastService.Success("Successfully deleted variable");
|
||||
await LazyLoader.Reload();
|
||||
await ToastService.SuccessAsync("Successfully deleted variable");
|
||||
await LazyLoader.ReloadAsync();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
@using System.Collections.Concurrent
|
||||
@using Microsoft.Extensions.Logging
|
||||
@using MoonCore.Blazor.FlyonUi.Modals
|
||||
@using MoonCore.Helpers
|
||||
@@ -18,12 +17,12 @@
|
||||
Addons="Addons"
|
||||
Options="Options"
|
||||
Class="h-full w-full"
|
||||
OnFirstRender="HandleFirstRender"/>
|
||||
OnFirstRender="HandleFirstRenderAsync"/>
|
||||
}
|
||||
|
||||
<div class="flex flex-row w-full mt-1.5">
|
||||
<input @bind="CommandInput" @onkeyup="HandleKey" type="text" placeholder="Type here..." class="input grow"/>
|
||||
<WButton OnClick="_ => SubmitCommand()" CssClasses="btn btn-square btn-primary grow-0 ms-1.5">
|
||||
<input @bind="CommandInput" @onkeyup="HandleKeyAsync" type="text" placeholder="Type here..." class="input grow"/>
|
||||
<WButton OnClick="_ => SubmitCommandAsync()" CssClasses="btn btn-square btn-primary grow-0 ms-1.5">
|
||||
<i class="icon-send-horizontal text-lg"></i>
|
||||
</WButton>
|
||||
</div>
|
||||
@@ -32,18 +31,18 @@
|
||||
<div class="flex flex-col gap-y-1.5">
|
||||
@if (IsPaused)
|
||||
{
|
||||
<button @onclick="TogglePause" class="btn btn-primary btn-square">
|
||||
<button @onclick="TogglePauseAsync" class="btn btn-primary btn-square">
|
||||
<i class="icon-play text-lg"></i>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button @onclick="TogglePause" class="btn btn-secondary btn-square">
|
||||
<button @onclick="TogglePauseAsync" class="btn btn-secondary btn-square">
|
||||
<i class="icon-pause text-lg"></i>
|
||||
</button>
|
||||
}
|
||||
|
||||
<button @onclick="OpenFullscreen" class="btn btn-secondary btn-square">
|
||||
<button @onclick="OpenFullscreenAsync" class="btn btn-secondary btn-square">
|
||||
<i class="icon-maximize text-lg"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -110,7 +109,7 @@
|
||||
await OnAfterInitialized.Invoke();
|
||||
}
|
||||
|
||||
private async Task HandleFirstRender()
|
||||
private async Task HandleFirstRenderAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -133,17 +132,17 @@
|
||||
await OnFirstRender.Invoke();
|
||||
}
|
||||
|
||||
public async Task Write(string content)
|
||||
public async Task WriteAsync(string content)
|
||||
{
|
||||
// We cache messages here as there is the chance that the console isn't ready for input while receiving write tasks
|
||||
|
||||
if (IsReadyToWrite && !IsPaused)
|
||||
await HandleWrite(content);
|
||||
await HandleWriteAsync(content);
|
||||
else
|
||||
WriteQueue.Add(content);
|
||||
}
|
||||
|
||||
private async Task HandleWrite(string content)
|
||||
private async Task HandleWriteAsync(string content)
|
||||
{
|
||||
// Update output cache and prune it if required
|
||||
if (OutputCache.Count > MaxOutputCacheSize)
|
||||
@@ -162,12 +161,12 @@
|
||||
await Terminal.Write(content);
|
||||
}
|
||||
|
||||
private async Task OpenFullscreen()
|
||||
private async Task OpenFullscreenAsync()
|
||||
{
|
||||
await ModalService.Launch<FullScreenModal>(parameters => { parameters["Parent"] = this; }, size: "max-w-none");
|
||||
await ModalService.LaunchAsync<FullScreenModal>(parameters => { parameters["Parent"] = this; }, size: "max-w-none");
|
||||
}
|
||||
|
||||
private async Task TogglePause()
|
||||
private async Task TogglePauseAsync()
|
||||
{
|
||||
IsPaused = !IsPaused;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
@@ -178,10 +177,10 @@
|
||||
var queueContent = string.Concat(WriteQueue);
|
||||
WriteQueue.Clear();
|
||||
|
||||
await HandleWrite(queueContent);
|
||||
await HandleWriteAsync(queueContent);
|
||||
}
|
||||
|
||||
private async Task SubmitCommand()
|
||||
private async Task SubmitCommandAsync()
|
||||
{
|
||||
CommandHistory.Add(CommandInput);
|
||||
|
||||
@@ -194,12 +193,12 @@
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task HandleKey(KeyboardEventArgs keyboard)
|
||||
private async Task HandleKeyAsync(KeyboardEventArgs keyboard)
|
||||
{
|
||||
switch (keyboard.Code)
|
||||
{
|
||||
case "Enter":
|
||||
await SubmitCommand();
|
||||
await SubmitCommandAsync();
|
||||
break;
|
||||
|
||||
case "ArrowUp" or "ArrowDown":
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Create
|
||||
</WButton>
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
await ApiClient.Post("api/admin/servers", Request);
|
||||
|
||||
await ToastService.Success("Successfully created Server");
|
||||
await ToastService.SuccessAsync("Successfully created Server");
|
||||
Navigation.NavigateTo("/admin/servers/all");
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
@page "/admin/servers/all"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.DataTables
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Models
|
||||
@@ -9,6 +8,9 @@
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Servers
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Grid
|
||||
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
||||
@using Moonlight.Shared.Http.Responses.Admin.Users
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
@inject AlertService AlertService
|
||||
@@ -28,98 +30,136 @@
|
||||
</PageHeader>
|
||||
</div>
|
||||
|
||||
<DataTable @ref="Table" TItem="ServerResponse">
|
||||
<Configuration>
|
||||
<Pagination TItem="ServerResponse" ItemSource="LoadData" />
|
||||
|
||||
<DataTableColumn TItem="ServerResponse" Field="@(x => x.Id)" Name="Id"/>
|
||||
<DataTableColumn TItem="ServerResponse" Field="@(x => x.Name)" Name="Name">
|
||||
<ColumnTemplate>
|
||||
<a class="text-primary" href="/admin/servers/all/update/@context.Id">
|
||||
@context.Name
|
||||
<DataGrid @ref="Grid"
|
||||
TGridItem="ServerResponse"
|
||||
EnablePagination="true"
|
||||
ItemsProvider="ItemsProviderAsync">
|
||||
<PropertyColumn Field="x => x.Id"/>
|
||||
<TemplateColumn Title="Name">
|
||||
<td>
|
||||
<a class="text-primary" href="/admin/servers/all/update/@context.Id">
|
||||
@context.Name
|
||||
</a>
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn Title="Owner">
|
||||
<td>
|
||||
@{
|
||||
var owner = Users.GetValueOrDefault(context.OwnerId);
|
||||
}
|
||||
|
||||
<span>
|
||||
@(owner?.Username ?? "N/A")
|
||||
</span>
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn Title="Node">
|
||||
<td>
|
||||
@{
|
||||
var node = Nodes.GetValueOrDefault(context.NodeId);
|
||||
}
|
||||
|
||||
<span>
|
||||
@(node?.Name ?? "N/A")
|
||||
</span>
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn Title="Star">
|
||||
<td>
|
||||
@{
|
||||
var star = Stars.GetValueOrDefault(context.StarId);
|
||||
}
|
||||
|
||||
<span>
|
||||
@(star?.Name ?? "N/A")
|
||||
</span>
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn Title="Actions">
|
||||
<td>
|
||||
<div class="flex justify-end">
|
||||
<a href="/admin/servers/all/update/@(context.Id)" class="text-primary mr-2 sm:mr-3">
|
||||
<i class="icon-pencil text-base"></i>
|
||||
</a>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="ServerResponse" Field="@(x => x.NodeId)" Name="Node">
|
||||
<ColumnTemplate>
|
||||
@{
|
||||
var node = Nodes.FirstOrDefault(x => x.Id == context.NodeId);
|
||||
}
|
||||
|
||||
<span>
|
||||
@(node?.Name ?? "N/A")
|
||||
</span>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="ServerResponse" Field="@(x => x.StarId)" Name="Star">
|
||||
<ColumnTemplate>
|
||||
@{
|
||||
var star = Stars.FirstOrDefault(x => x.Id == context.StarId);
|
||||
}
|
||||
|
||||
<span>
|
||||
@(star?.Name ?? "N/A")
|
||||
</span>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="ServerResponse">
|
||||
<ColumnTemplate>
|
||||
<div class="flex justify-end">
|
||||
<a href="/admin/servers/all/update/@(context.Id)" class="text-primary mr-2 sm:mr-3">
|
||||
<i class="icon-pencil text-base"></i>
|
||||
</a>
|
||||
|
||||
<a href="#" @onclick="() => Delete(context)" @onclick:preventDefault
|
||||
class="text-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</a>
|
||||
</div>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
</Configuration>
|
||||
</DataTable>
|
||||
<a href="#" @onclick="() => DeleteAsync(context)" @onclick:preventDefault
|
||||
class="text-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
</DataGrid>
|
||||
|
||||
@code
|
||||
{
|
||||
private DataTable<ServerResponse> Table;
|
||||
|
||||
private List<StarResponse> Stars = new();
|
||||
private List<NodeResponse> Nodes = new();
|
||||
private DataGrid<ServerResponse> Grid;
|
||||
|
||||
private async Task<IPagedData<ServerResponse>> LoadData(PaginationOptions options)
|
||||
private Dictionary<int, StarResponse> Stars = new();
|
||||
private Dictionary<int, NodeResponse> Nodes = new();
|
||||
private Dictionary<int, UserResponse> Users = new();
|
||||
|
||||
private async Task<DataGridItemResult<ServerResponse>> ItemsProviderAsync(
|
||||
DataGridItemRequest request
|
||||
)
|
||||
{
|
||||
// Clear potential previous data
|
||||
var data = await ApiClient.GetJson<PagedData<ServerResponse>>($"api/admin/servers?page={options.Page}&pageSize={options.PerPage}");
|
||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
||||
|
||||
foreach (var item in data.Items)
|
||||
var countedData = await ApiClient.GetJson<CountedData<ServerResponse>>($"api/admin/servers{query}");
|
||||
|
||||
// Fetch relations
|
||||
|
||||
var nodesToFetch = countedData.Items
|
||||
.Where(x => !Nodes.ContainsKey(x.Id))
|
||||
.Select(x => x.Id)
|
||||
.Distinct();
|
||||
|
||||
foreach (var id in nodesToFetch)
|
||||
{
|
||||
if (Nodes.All(x => x.Id != item.NodeId))
|
||||
{
|
||||
var node = await ApiClient.GetJson<NodeResponse>($"api/admin/servers/nodes/{item.NodeId}");
|
||||
Nodes.Add(node);
|
||||
}
|
||||
|
||||
if (Stars.All(x => x.Id != item.StarId))
|
||||
{
|
||||
var star = await ApiClient.GetJson<StarResponse>($"api/admin/servers/stars/{item.StarId}");
|
||||
Stars.Add(star);
|
||||
}
|
||||
var node = await ApiClient.GetJson<NodeResponse>($"api/admin/servers/nodes/{id}");
|
||||
Nodes[node.Id] = node;
|
||||
}
|
||||
|
||||
return data;
|
||||
var starsToFetch = countedData.Items
|
||||
.Where(x => !Stars.ContainsKey(x.Id))
|
||||
.Select(x => x.Id)
|
||||
.Distinct();
|
||||
|
||||
foreach (var id in starsToFetch)
|
||||
{
|
||||
var star = await ApiClient.GetJson<StarResponse>($"api/admin/servers/stars/{id}");
|
||||
Stars[star.Id] = star;
|
||||
}
|
||||
|
||||
var usersToFetch = countedData.Items
|
||||
.Where(x => !Users.ContainsKey(x.Id))
|
||||
.Select(x => x.Id)
|
||||
.Distinct();
|
||||
|
||||
foreach (var id in usersToFetch)
|
||||
{
|
||||
var user = await ApiClient.GetJson<UserResponse>($"api/admin/users/{id}");
|
||||
Users[user.Id] = user;
|
||||
}
|
||||
|
||||
return new()
|
||||
{
|
||||
Items = countedData.Items,
|
||||
TotalCount = countedData.TotalCount
|
||||
};
|
||||
}
|
||||
|
||||
private async Task Delete(ServerResponse response)
|
||||
|
||||
private async Task DeleteAsync(ServerResponse response)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"Server deletion",
|
||||
$"Do you really want to delete the server '{response.Name}'",
|
||||
async () =>
|
||||
{
|
||||
await ApiClient.Delete($"api/admin/servers/{response.Id}");
|
||||
await ToastService.Success("Successfully deleted server");
|
||||
await ToastService.SuccessAsync("Successfully deleted server");
|
||||
|
||||
await Table.Refresh();
|
||||
await Grid.RefreshAsync();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
|
||||
@attribute [Authorize(Policy = "permissions:admin.servers.update")]
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<PageHeader Title="Update Server">
|
||||
<a href="/admin/servers/all" class="btn btn-secondary">
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Update
|
||||
</WButton>
|
||||
@@ -58,7 +58,7 @@
|
||||
public List<NodeAllocationResponse> Allocations = new();
|
||||
public UserResponse Owner;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
Server = await ApiClient.GetJson<ServerResponse>($"api/admin/servers/{Id}");
|
||||
|
||||
@@ -67,7 +67,6 @@
|
||||
Name = Server.Name,
|
||||
AllocationIds = Server.AllocationIds,
|
||||
OwnerId = Server.OwnerId,
|
||||
Bandwidth = Server.Bandwidth,
|
||||
Cpu = Server.Cpu,
|
||||
Disk = Server.Disk,
|
||||
DockerImageIndex = Server.DockerImageIndex,
|
||||
@@ -96,7 +95,7 @@
|
||||
|
||||
await ApiClient.Patch($"api/admin/servers/{Id}", Request);
|
||||
|
||||
await ToastService.Success("Successfully updated server");
|
||||
await ToastService.SuccessAsync("Successfully updated server");
|
||||
Navigation.NavigateTo("/admin/servers/all");
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Create
|
||||
</WButton>
|
||||
@@ -71,7 +71,7 @@ TODO: EnableTransparentMode, EnableDynamicFirewall
|
||||
{
|
||||
await ApiClient.Post("api/admin/servers/nodes", Request);
|
||||
|
||||
await ToastService.Success("Successfully created node");
|
||||
await ToastService.SuccessAsync("Successfully created node");
|
||||
Navigation.NavigateTo("/admin/servers/nodes");
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
@using Microsoft.Extensions.Logging
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.DataTables
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Models
|
||||
@@ -11,6 +10,8 @@
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes.Statistics
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes.Sys
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Grid
|
||||
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
@inject NodeService NodeService
|
||||
@@ -32,153 +33,151 @@
|
||||
</PageHeader>
|
||||
</div>
|
||||
|
||||
<DataTable TItem="NodeResponse">
|
||||
<Configuration>
|
||||
<Pagination TItem="NodeResponse" ItemSource="LoadData"/>
|
||||
<DataGrid @ref="Grid"
|
||||
TGridItem="NodeResponse"
|
||||
EnablePagination="true"
|
||||
ItemsProvider="ItemsProviderAsync">
|
||||
<PropertyColumn Field="x => x.Id"/>
|
||||
<TemplateColumn Title="Name">
|
||||
<td>
|
||||
<a class="text-primary" href="/admin/servers/nodes/update/@(context.Id)">
|
||||
@context.Name
|
||||
</a>
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
<PropertyColumn Field="x => x.Fqdn"/>
|
||||
<TemplateColumn Title="Status">
|
||||
<td>
|
||||
@{
|
||||
var isFetched = StatusResponses.TryGetValue(context.Id, out var data);
|
||||
}
|
||||
|
||||
<DataTableColumn TItem="NodeResponse" Field="@(x => x.Id)" Name="Id"/>
|
||||
<DataTableColumn TItem="NodeResponse" Field="@(x => x.Name)" Name="Name">
|
||||
<ColumnTemplate>
|
||||
<a class="text-primary" href="/admin/servers/nodes/update/@(context.Id)">
|
||||
@context.Name
|
||||
</a>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="NodeResponse" Field="@(x => x.Fqdn)" Name="Fqdn"/>
|
||||
<DataTableColumn TItem="NodeResponse" Field="@(x => x.Fqdn)" Name="Status">
|
||||
<ColumnTemplate>
|
||||
@{
|
||||
var isFetched = StatusResponses.TryGetValue(context.Id, out var data);
|
||||
}
|
||||
|
||||
@if (isFetched)
|
||||
@if (isFetched)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
if (data == null)
|
||||
<div class="text-error flex items-center">
|
||||
<i class="icon-server-off text-base me-1"></i>
|
||||
<span>
|
||||
API Error
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data.RoundtripSuccess)
|
||||
{
|
||||
<div class="text-success flex items-center">
|
||||
<i class="icon-check text-base me-1"></i>
|
||||
<span>Online (@(data.Version))</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="text-error flex items-center">
|
||||
<i class="icon-server-off text-base me-1"></i>
|
||||
<span>
|
||||
API Error
|
||||
<span class="me-2">
|
||||
Error
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data.RoundtripSuccess)
|
||||
{
|
||||
<div class="text-success flex items-center">
|
||||
<i class="icon-check text-base me-1"></i>
|
||||
<span>Online (@(data.Version))</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="text-error flex items-center">
|
||||
<i class="icon-server-off text-base me-1"></i>
|
||||
<span class="me-2">
|
||||
Error
|
||||
</span>
|
||||
<a @onclick="() => ShowErrorDetails(context.Id)" @onclick:preventDefault
|
||||
href="#" class="ms-1 text-base-content/40">Details</a>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="text-gray-500">
|
||||
<i class="icon-loader text-base me-1 align-middle"></i>
|
||||
<span class="align-middle">Loading</span>
|
||||
</div>
|
||||
}
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="NodeResponse"
|
||||
Name="Utilization"
|
||||
HeaderCss="p-2 font-semibold text-left hidden xl:table-cell"
|
||||
ColumnCss="p-2 text-left font-normal hidden xl:table-cell">
|
||||
<ColumnTemplate>
|
||||
@{
|
||||
var isFetched = Statistics.TryGetValue(context.Id, out var data);
|
||||
}
|
||||
|
||||
@if (isFetched)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
<div class="flex items-center text-error">
|
||||
<i class="icon-server-off text-base me-1"></i>
|
||||
<span>
|
||||
API Error
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="flex flex-row">
|
||||
<div class="flex items-center">
|
||||
<i class="text-primary text-base me-2 icon-cpu"></i>
|
||||
<span>@(Math.Round(data.Cpu.Usage))%</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center ms-5">
|
||||
<i class="text-primary text-base me-2 icon-memory-stick"></i>
|
||||
<span>
|
||||
@(Math.Round((data.Memory.Total - data.Memory.Free - data.Memory.Cached) / (double)data.Memory.Total * 100))%
|
||||
</span>
|
||||
</div>
|
||||
<a @onclick="() => ShowErrorDetailsAsync(context.Id)" @onclick:preventDefault
|
||||
href="#" class="ms-1 text-base-content/40">Details</a>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="flex items-center text-gray-500">
|
||||
<i class="icon-loader text-base me-1"></i>
|
||||
<span>Loading</span>
|
||||
</div>
|
||||
}
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="NodeResponse">
|
||||
<ColumnTemplate>
|
||||
<div class="flex justify-end">
|
||||
<a href="/admin/servers/nodes/update/@(context.Id)" class="text-primary mr-2 sm:mr-3">
|
||||
<i class="icon-pencil text-base"></i>
|
||||
</a>
|
||||
|
||||
<a href="#" @onclick="() => Delete(context)" @onclick:preventDefault
|
||||
class="text-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="text-gray-500">
|
||||
<i class="icon-loader text-base me-1 align-middle"></i>
|
||||
<span class="align-middle">Loading</span>
|
||||
</div>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
</Configuration>
|
||||
</DataTable>
|
||||
}
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn Title="Utilization">
|
||||
<td>
|
||||
@{
|
||||
var isFetched = Statistics.TryGetValue(context.Id, out var data);
|
||||
}
|
||||
|
||||
@if (isFetched)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
<div class="flex items-center text-error">
|
||||
<i class="icon-server-off text-base me-1"></i>
|
||||
<span>
|
||||
API Error
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="flex flex-row">
|
||||
<div class="flex items-center">
|
||||
<i class="text-primary text-base me-2 icon-cpu"></i>
|
||||
<span>@(Math.Round(data.Cpu.Usage))%</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center ms-5">
|
||||
<i class="text-primary text-base me-2 icon-memory-stick"></i>
|
||||
<span>
|
||||
@(Math.Round((data.Memory.Total - data.Memory.Free - data.Memory.Cached) / (double)data.Memory.Total * 100))%
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="flex items-center text-gray-500">
|
||||
<i class="icon-loader text-base me-1"></i>
|
||||
<span>Loading</span>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn Title="Actions">
|
||||
<td>
|
||||
<div class="flex justify-end">
|
||||
<a href="/admin/servers/nodes/update/@(context.Id)" class="text-primary mr-2 sm:mr-3">
|
||||
<i class="icon-pencil text-base"></i>
|
||||
</a>
|
||||
|
||||
<a href="#" @onclick="() => DeleteAsync(context)" @onclick:preventDefault
|
||||
class="text-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
</DataGrid>
|
||||
|
||||
@code
|
||||
{
|
||||
private DataTable<NodeResponse> Table;
|
||||
private DataGrid<NodeResponse> Grid;
|
||||
|
||||
private Dictionary<int, NodeSystemStatusResponse?> StatusResponses = new();
|
||||
private Dictionary<int, StatisticsResponse?> Statistics = new();
|
||||
|
||||
private async Task<IPagedData<NodeResponse>> LoadData(PaginationOptions options)
|
||||
|
||||
private async Task<DataGridItemResult<NodeResponse>> ItemsProviderAsync(
|
||||
DataGridItemRequest request
|
||||
)
|
||||
{
|
||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
||||
|
||||
var countedData = await ApiClient.GetJson<CountedData<NodeResponse>>($"api/admin/servers/nodes{query}");
|
||||
|
||||
Statistics.Clear();
|
||||
StatusResponses.Clear();
|
||||
|
||||
var result = await ApiClient.GetJson<PagedData<NodeResponse>>(
|
||||
$"api/admin/servers/nodes?page={options.Page}&pageSize={options.PerPage}"
|
||||
);
|
||||
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
foreach (var item in result.Items)
|
||||
foreach (var item in countedData.Items)
|
||||
{
|
||||
try
|
||||
{
|
||||
Statistics[item.Id] = await NodeService.GetStatistics(item.Id);
|
||||
Statistics[item.Id] = await NodeService.GetStatisticsAsync(item.Id);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -192,10 +191,10 @@
|
||||
}
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
StatusResponses[item.Id] = await NodeService.GetSystemStatus(item.Id);
|
||||
StatusResponses[item.Id] = await NodeService.GetSystemStatusAsync(item.Id);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -207,30 +206,34 @@
|
||||
|
||||
StatusResponses[item.Id] = null;
|
||||
}
|
||||
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
return new()
|
||||
{
|
||||
Items = countedData.Items,
|
||||
TotalCount = countedData.TotalCount
|
||||
};
|
||||
}
|
||||
|
||||
private async Task Delete(NodeResponse response)
|
||||
private async Task DeleteAsync(NodeResponse response)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"Node deletion",
|
||||
$"Do you really want to delete the node '{response.Name}'",
|
||||
async () =>
|
||||
{
|
||||
await ApiClient.Delete($"api/admin/servers/nodes/{response.Id}");
|
||||
await ToastService.Success("Successfully deleted node");
|
||||
await ToastService.SuccessAsync("Successfully deleted node");
|
||||
|
||||
await Table.Refresh();
|
||||
await Grid.RefreshAsync();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private async Task ShowErrorDetails(int id)
|
||||
private async Task ShowErrorDetailsAsync(int id)
|
||||
{
|
||||
var data = StatusResponses.GetValueOrDefault(id);
|
||||
|
||||
@@ -241,6 +244,6 @@
|
||||
(data.RoundtripRemoteFailure ? "(Failed at node)" : "(Failed at api server)") +
|
||||
$" {data.RoundtripError}";
|
||||
|
||||
await AlertService.Error("Node error details", message);
|
||||
await AlertService.ErrorAsync("Node error details", message);
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,13 @@
|
||||
|
||||
@attribute [Authorize(Policy = "permissions:admin.servers.nodes.update")]
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<PageHeader Title="@Node.Name">
|
||||
<a href="/admin/servers/nodes" class="btn btn-secondary">
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Update
|
||||
</WButton>
|
||||
@@ -58,15 +58,13 @@
|
||||
private UpdateNodeRequest Request;
|
||||
private NodeResponse Node;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
Node = await ApiClient.GetJson<NodeResponse>($"api/admin/servers/nodes/{Id}");
|
||||
|
||||
Request = new UpdateNodeRequest()
|
||||
{
|
||||
Name = Node.Name,
|
||||
EnableDynamicFirewall = Node.EnableDynamicFirewall,
|
||||
EnableTransparentMode = Node.EnableTransparentMode,
|
||||
Fqdn = Node.Fqdn,
|
||||
FtpPort = Node.FtpPort,
|
||||
HttpPort = Node.HttpPort
|
||||
@@ -77,7 +75,7 @@
|
||||
{
|
||||
await ApiClient.Patch($"api/admin/servers/nodes/{Id}", Request);
|
||||
|
||||
await ToastService.Success("Successfully updated Node");
|
||||
await ToastService.SuccessAsync("Successfully updated Node");
|
||||
Navigation.NavigateTo("/admin/servers/nodes");
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Create
|
||||
</WButton>
|
||||
@@ -61,7 +61,7 @@
|
||||
{
|
||||
await ApiClient.Post("api/admin/servers/stars", Request);
|
||||
|
||||
await ToastService.Success("Successfully created star");
|
||||
await ToastService.SuccessAsync("Successfully created star");
|
||||
Navigation.NavigateTo("/admin/servers/stars");
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
@page "/admin/servers/stars"
|
||||
|
||||
@using MoonCore.Blazor.FlyonUi.Alerts
|
||||
@using MoonCore.Blazor.FlyonUi.DataTables
|
||||
@using MoonCore.Blazor.FlyonUi.Helpers
|
||||
@using MoonCore.Blazor.FlyonUi.Toasts
|
||||
@using MoonCore.Helpers
|
||||
@@ -9,6 +8,8 @@
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
||||
@using MoonCore.Exceptions
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.FlyonUi.Grid
|
||||
@using MoonCore.Blazor.FlyonUi.Grid.Columns
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
@inject DownloadService DownloadService
|
||||
@@ -35,88 +36,99 @@
|
||||
</PageHeader>
|
||||
</div>
|
||||
|
||||
<DataTable @ref="Table" TItem="StarResponse">
|
||||
<Configuration>
|
||||
<Pagination TItem="StarResponse" ItemSource="LoadData" />
|
||||
|
||||
<DataTableColumn TItem="StarResponse" Field="@(x => x.Id)" Name="Id"/>
|
||||
<DataTableColumn TItem="StarResponse" Field="@(x => x.Name)" Name="Name">
|
||||
<ColumnTemplate>
|
||||
<a class="text-primary" href="/admin/servers/stars/update/@(context.Id)">
|
||||
@context.Name
|
||||
<DataGrid @ref="Grid"
|
||||
TGridItem="StarResponse"
|
||||
EnablePagination="true"
|
||||
ItemsProvider="ItemsProviderAsync">
|
||||
<PropertyColumn Field="x => x.Id" />
|
||||
<TemplateColumn Title="Name">
|
||||
<td>
|
||||
<a class="text-primary" href="/admin/servers/stars/update/@(context.Id)">
|
||||
@context.Name
|
||||
</a>
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
<PropertyColumn Field="x => x.Version" />
|
||||
<PropertyColumn Field="x => x.Author" />
|
||||
<TemplateColumn>
|
||||
<td>
|
||||
<div class="flex justify-end">
|
||||
@if (!string.IsNullOrEmpty(context.DonateUrl))
|
||||
{
|
||||
<a href="@context.DonateUrl" target="_blank" class="text-accent mr-3">
|
||||
<i class="icon-heart align-middle"></i>
|
||||
<span class="align-middle">Donate</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (!string.IsNullOrEmpty(context.UpdateUrl))
|
||||
{
|
||||
<a href="#" @onclick:preventDefault class="text-accent mr-3">
|
||||
<i class="icon-refresh-cw align-middle"></i>
|
||||
<span class="align-middle">Update</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
<a href="#" @onclick="() => ExportAsync(context)" @onclick:preventDefault class="text-success mr-3">
|
||||
<i class="icon-download align-middle"></i>
|
||||
<span class="align-middle">Export</span>
|
||||
</a>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
<DataTableColumn TItem="StarResponse" Field="@(x => x.Version)" Name="Version"/>
|
||||
<DataTableColumn TItem="StarResponse" Field="@(x => x.Author)" Name="Author"/>
|
||||
<DataTableColumn TItem="StarResponse">
|
||||
<ColumnTemplate>
|
||||
<div class="flex justify-end">
|
||||
@if (!string.IsNullOrEmpty(context.DonateUrl))
|
||||
{
|
||||
<a href="@context.DonateUrl" target="_blank" class="text-accent mr-3">
|
||||
<i class="icon-heart align-middle"></i>
|
||||
<span class="align-middle">Donate</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (!string.IsNullOrEmpty(context.UpdateUrl))
|
||||
{
|
||||
<a href="#" @onclick:preventDefault class="text-accent mr-3">
|
||||
<i class="icon-refresh-cw align-middle"></i>
|
||||
<span class="align-middle">Update</span>
|
||||
</a>
|
||||
}
|
||||
<a href="/admin/servers/stars/update/@(context.Id)" class="text-primary mr-2 sm:mr-3">
|
||||
<i class="icon-pencil text-base"></i>
|
||||
</a>
|
||||
|
||||
<a href="#" @onclick="() => Export(context)" @onclick:preventDefault class="text-success mr-3">
|
||||
<i class="icon-download align-middle"></i>
|
||||
<span class="align-middle">Export</span>
|
||||
</a>
|
||||
|
||||
<a href="/admin/servers/stars/update/@(context.Id)" class="text-primary mr-2 sm:mr-3">
|
||||
<i class="icon-pencil text-base"></i>
|
||||
</a>
|
||||
|
||||
<a href="#" @onclick="() => Delete(context)" @onclick:preventDefault
|
||||
class="text-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</a>
|
||||
</div>
|
||||
</ColumnTemplate>
|
||||
</DataTableColumn>
|
||||
</Configuration>
|
||||
</DataTable>
|
||||
<a href="#" @onclick="() => DeleteAsync(context)" @onclick:preventDefault
|
||||
class="text-error">
|
||||
<i class="icon-trash text-base"></i>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</TemplateColumn>
|
||||
</DataGrid>
|
||||
|
||||
@code
|
||||
{
|
||||
private DataTable<StarResponse> Table;
|
||||
private DataGrid<StarResponse> Grid;
|
||||
|
||||
private async Task<IPagedData<StarResponse>> LoadData(PaginationOptions options)
|
||||
=> await ApiClient.GetJson<PagedData<StarResponse>>($"api/admin/servers/stars?page={options.Page}&pageSize={options.PerPage}");
|
||||
|
||||
private async Task Delete(StarResponse response)
|
||||
private async Task<DataGridItemResult<StarResponse>> ItemsProviderAsync(
|
||||
DataGridItemRequest request
|
||||
)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
||||
|
||||
var countedData = await ApiClient.GetJson<CountedData<StarResponse>>($"api/admin/servers/stars{query}");
|
||||
|
||||
return new()
|
||||
{
|
||||
TotalCount = countedData.TotalCount,
|
||||
Items = countedData.Items
|
||||
};
|
||||
}
|
||||
|
||||
private async Task DeleteAsync(StarResponse response)
|
||||
{
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"Star deletion",
|
||||
$"Do you really want to delete the star '{response.Name}'",
|
||||
async () =>
|
||||
{
|
||||
await ApiClient.Delete($"api/admin/servers/stars/{response.Id}");
|
||||
await ToastService.Success("Successfully deleted star");
|
||||
await ToastService.SuccessAsync("Successfully deleted star");
|
||||
|
||||
await Table.Refresh();
|
||||
await Grid.RefreshAsync();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private async Task Export(StarResponse star)
|
||||
private async Task ExportAsync(StarResponse star)
|
||||
{
|
||||
var json = await ApiClient.GetString($"api/admin/servers/stars/{star.Id}/export");
|
||||
|
||||
var formattedFileName = star.Name.Replace(" ", "_") + ".json";
|
||||
|
||||
await DownloadService.Download(formattedFileName, json);
|
||||
await ToastService.Success($"Successfully exported '{star.Name}'");
|
||||
await DownloadService.DownloadAsync(formattedFileName, json);
|
||||
await ToastService.SuccessAsync($"Successfully exported '{star.Name}'");
|
||||
}
|
||||
|
||||
private async Task OnImportFiles(InputFileChangeEventArgs eventArgs)
|
||||
@@ -137,7 +149,7 @@
|
||||
{
|
||||
if (!file.Name.EndsWith(".json"))
|
||||
{
|
||||
await ToastService.Error($"Failed to import '{file.Name}': Only json files are supported");
|
||||
await ToastService.ErrorAsync($"Failed to import '{file.Name}': Only json files are supported");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -147,14 +159,14 @@
|
||||
|
||||
var star = await ApiClient.PostJson<StarResponse>("api/admin/servers/stars/import", content);
|
||||
|
||||
await ToastService.Success($"Successfully imported '{star.Name}'");
|
||||
await ToastService.SuccessAsync($"Successfully imported '{star.Name}'");
|
||||
}
|
||||
catch (HttpApiException e)
|
||||
{
|
||||
await ToastService.Error($"Failed to import '{file.Name}': {e.Title}");
|
||||
await ToastService.ErrorAsync($"Failed to import '{file.Name}': {e.Title}");
|
||||
}
|
||||
}
|
||||
|
||||
await Table.Refresh();
|
||||
await Grid.RefreshAsync();
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,13 @@
|
||||
|
||||
@attribute [Authorize(Policy = "permissions:admin.servers.stars.update")]
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<PageHeader Title="Update Star">
|
||||
<a href="/admin/servers/stars" class="btn btn-secondary">
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Update
|
||||
</WButton>
|
||||
@@ -70,7 +70,7 @@
|
||||
private UpdateStarRequest Request;
|
||||
private StarResponse Detail;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
Detail = await ApiClient.GetJson<StarResponse>($"api/admin/servers/stars/{Id}");
|
||||
Request = new()
|
||||
@@ -97,7 +97,7 @@
|
||||
{
|
||||
await ApiClient.Patch($"api/admin/servers/stars/{Id}", Request);
|
||||
|
||||
await ToastService.Success("Successfully updated Star");
|
||||
await ToastService.SuccessAsync("Successfully updated Star");
|
||||
Navigation.NavigateTo("/admin/servers/stars");
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
<Tabs>
|
||||
<Tab Name="Your servers">
|
||||
<LazyLoader Load="LoadOwnServers">
|
||||
<LazyLoader Load="LoadOwnServersAsync">
|
||||
@if (OwnServers.Length == 0)
|
||||
{
|
||||
<IconAlert Title="No servers found" Color="text-primary" Icon="icon-search">
|
||||
@@ -47,7 +47,7 @@
|
||||
</LazyLoader>
|
||||
</Tab>
|
||||
<Tab Name="Shared servers">
|
||||
<LazyLoader Load="LoadSharedServers">
|
||||
<LazyLoader Load="LoadSharedServersAsync">
|
||||
@if (SharedServers.Length == 0)
|
||||
{
|
||||
<IconAlert Title="No shared servers found" Color="text-primary" Icon="icon-share-2">
|
||||
@@ -72,17 +72,17 @@
|
||||
private ServerDetailResponse[] OwnServers;
|
||||
private ServerDetailResponse[] SharedServers;
|
||||
|
||||
private async Task LoadOwnServers(LazyLoader lazyLoader)
|
||||
private async Task LoadOwnServersAsync(LazyLoader lazyLoader)
|
||||
{
|
||||
OwnServers = await PagedData<ServerDetailResponse>.All(async (page, pageSize) =>
|
||||
await ServerService.GetServers(page, pageSize)
|
||||
OwnServers = await CountedData<ServerDetailResponse>.LoadAllAsync(async (startIndex, count) =>
|
||||
await ServerService.GetServersAsync(startIndex, count)
|
||||
);
|
||||
}
|
||||
|
||||
private async Task LoadSharedServers(LazyLoader lazyLoader)
|
||||
private async Task LoadSharedServersAsync(LazyLoader lazyLoader)
|
||||
{
|
||||
SharedServers = await PagedData<ServerDetailResponse>.All(async (page, pageSize) =>
|
||||
await ServerService.GetSharedServers(page, pageSize)
|
||||
SharedServers = await CountedData<ServerDetailResponse>.LoadAllAsync(async (startIndex, count) =>
|
||||
await ServerService.GetSharedServersAsync(startIndex, count)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
@implements IAsyncDisposable
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
@if (NotFound)
|
||||
{
|
||||
<IconAlert Title="Server not found" Icon="icon-search" Color="text-primary">
|
||||
@@ -69,7 +69,7 @@
|
||||
{
|
||||
@if (State == ServerState.Offline)
|
||||
{
|
||||
<WButton CssClasses="btn btn-success" OnClick="_ => Start()">
|
||||
<WButton CssClasses="btn btn-success" OnClick="_ => StartAsync()">
|
||||
<i class="icon-play align-middle"></i>
|
||||
<span class="align-middle">Start</span>
|
||||
</WButton>
|
||||
@@ -101,14 +101,14 @@
|
||||
{
|
||||
if (State == ServerState.Stopping)
|
||||
{
|
||||
<WButton CssClasses="btn btn-error" OnClick="_ => Kill()">
|
||||
<WButton CssClasses="btn btn-error" OnClick="_ => KillAsync()">
|
||||
<i class="icon-bomb align-middle"></i>
|
||||
<span class="align-middle">Kill</span>
|
||||
</WButton>
|
||||
}
|
||||
else
|
||||
{
|
||||
<WButton CssClasses="btn btn-error" OnClick="_ => Stop()">
|
||||
<WButton CssClasses="btn btn-error" OnClick="_ => StopAsync()">
|
||||
<i class="icon-squircle align-middle"></i>
|
||||
<span class="align-middle">Stop</span>
|
||||
</WButton>
|
||||
@@ -153,7 +153,7 @@
|
||||
data-tab="na"
|
||||
role="tab"
|
||||
@onclick:preventDefault
|
||||
@onclick="() => SwitchTab(tab)">
|
||||
@onclick="() => SwitchTabAsync(tab)">
|
||||
@tab.Name
|
||||
</a>
|
||||
}
|
||||
@@ -201,18 +201,18 @@
|
||||
|
||||
public ConcurrentList<string> CommandHistory = new();
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Load meta data
|
||||
Server = await ServerService.GetServer(ServerId);
|
||||
Server = await ServerService.GetServerAsync(ServerId);
|
||||
|
||||
// Load server tabs
|
||||
var tmpTabs = new List<ServerTab>();
|
||||
|
||||
foreach (var serverTabProvider in TabProviders)
|
||||
tmpTabs.AddRange(await serverTabProvider.GetTabs(Server));
|
||||
tmpTabs.AddRange(await serverTabProvider.GetTabsAsync(Server));
|
||||
|
||||
// If we are accessing a shared server, we need to handle permissions
|
||||
if (Server.Share != null)
|
||||
@@ -245,7 +245,7 @@
|
||||
CurrentTab = Tabs.FirstOrDefault();
|
||||
|
||||
// Load initial status for first render
|
||||
var status = await ServerService.GetStatus(ServerId);
|
||||
var status = await ServerService.GetStatusAsync(ServerId);
|
||||
|
||||
State = status.State;
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
return; // Exit early if we don't have permissions to load the console
|
||||
|
||||
// Load initial messages
|
||||
var initialLogs = await ServerService.GetLogs(ServerId);
|
||||
var initialLogs = await ServerService.GetLogsAsync(ServerId);
|
||||
|
||||
InitialConsoleMessage = "";
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
InitialConsoleMessage += message;
|
||||
|
||||
// Load websocket meta
|
||||
var websocketDetails = await ServerService.GetWebSocket(ServerId);
|
||||
var websocketDetails = await ServerService.GetWebSocketAsync(ServerId);
|
||||
|
||||
// Build signal r
|
||||
HubConnection = new HubConnectionBuilder()
|
||||
@@ -269,7 +269,7 @@
|
||||
{
|
||||
options.AccessTokenProvider = async () =>
|
||||
{
|
||||
var details = await ServerService.GetWebSocket(ServerId);
|
||||
var details = await ServerService.GetWebSocketAsync(ServerId);
|
||||
return details.AccessToken;
|
||||
};
|
||||
})
|
||||
@@ -317,7 +317,7 @@
|
||||
return acquiredLevel >= level;
|
||||
}
|
||||
|
||||
private async Task SwitchTab(ServerTab tab)
|
||||
private async Task SwitchTabAsync(ServerTab tab)
|
||||
{
|
||||
CurrentTab = tab;
|
||||
Navigation.NavigateTo($"/servers/{ServerId}/{tab.Path}");
|
||||
@@ -325,14 +325,14 @@
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task Start()
|
||||
=> await ServerService.Start(ServerId);
|
||||
private async Task StartAsync()
|
||||
=> await ServerService.StartAsync(ServerId);
|
||||
|
||||
private async Task Stop()
|
||||
=> await ServerService.Stop(ServerId);
|
||||
private async Task StopAsync()
|
||||
=> await ServerService.StopAsync(ServerId);
|
||||
|
||||
private async Task Kill()
|
||||
=> await ServerService.Kill(ServerId);
|
||||
private async Task KillAsync()
|
||||
=> await ServerService.KillAsync(ServerId);
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user