Refactored ui. Improved console experience. Added command endpoint
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
@inject ILogger<ServerCard> Logger
|
||||
|
||||
@{
|
||||
var gradient = "from-base-content/20";
|
||||
var border = "border-base-content";
|
||||
var gradient = "from-base-100/20";
|
||||
var border = "border-base-content/80";
|
||||
|
||||
if (IsLoaded && !IsFailed)
|
||||
{
|
||||
@@ -20,7 +20,7 @@
|
||||
ServerState.Starting => "from-warning/20",
|
||||
ServerState.Stopping => "from-warning/20",
|
||||
ServerState.Online => "from-success/20",
|
||||
_ => "from-base-content/20"
|
||||
_ => "from-base-100"
|
||||
};
|
||||
|
||||
border = Status.State switch
|
||||
@@ -30,13 +30,13 @@
|
||||
ServerState.Starting => "border-warning",
|
||||
ServerState.Stopping => "border-warning",
|
||||
ServerState.Online => "border-success",
|
||||
_ => "border-base-content"
|
||||
_ => "border-base-content/80"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
<a href="/servers/@Server.Id"
|
||||
class="w-full bg-gradient-to-r @gradient to-base-content/75 to-25% px-5 py-3.5 rounded-xl border-l-8 @border">
|
||||
class="w-full bg-gradient-to-r @gradient to-base-100/75 to-25% px-5 py-3.5 rounded-xl border-l-8 @border">
|
||||
<div class="grid grid-cols-6">
|
||||
<div class="flex items-center col-span-6 sm:col-span-2 2xl:col-span-1">
|
||||
<div class="bg-base-content/10 bg-opacity-45 py-1 px-2 rounded-lg flex items-center">
|
||||
@@ -54,7 +54,7 @@
|
||||
Status.State is ServerState.Starting or ServerState.Stopping or ServerState.Online
|
||||
)
|
||||
{
|
||||
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row">
|
||||
<div class="bg-base-200/75 py-1 px-2 rounded-lg flex flex-row">
|
||||
<div>
|
||||
<i class="icon-cpu"></i>
|
||||
</div>
|
||||
@@ -62,7 +62,7 @@
|
||||
<div class="ms-3">@(Stats.CpuUsage)%</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row">
|
||||
<div class="bg-base-200/75 py-1 px-2 rounded-lg flex flex-row">
|
||||
<div>
|
||||
<i class="icon-memory-stick"></i>
|
||||
</div>
|
||||
@@ -70,7 +70,7 @@
|
||||
<div class="ms-3">@(Formatter.FormatSize(Stats.MemoryUsage)) / @(Formatter.FormatSize(ByteConverter.FromMegaBytes(Server.Memory).Bytes))</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row">
|
||||
<div class="bg-base-200/75 py-1 px-2 rounded-lg flex flex-row">
|
||||
<div>
|
||||
<i class="icon-hard-drive"></i>
|
||||
</div>
|
||||
@@ -82,7 +82,7 @@
|
||||
{
|
||||
if (!IsLoaded)
|
||||
{
|
||||
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row text-gray-700">
|
||||
<div class="bg-base-200/75 py-1 px-2 rounded-lg flex flex-row text-gray-700">
|
||||
<div>
|
||||
<i class="icon-loader"></i>
|
||||
</div>
|
||||
@@ -92,7 +92,7 @@
|
||||
}
|
||||
else if (IsFailed)
|
||||
{
|
||||
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row text-error">
|
||||
<div class="bg-base-200/75 py-1 px-2 rounded-lg flex flex-row text-error">
|
||||
<div>
|
||||
<i class="icon-cable"></i>
|
||||
</div>
|
||||
@@ -102,7 +102,7 @@
|
||||
}
|
||||
else if (IsLoaded && !IsFailed && Status.State is ServerState.Offline)
|
||||
{
|
||||
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row text-error">
|
||||
<div class="bg-base-200/75 py-1 px-2 rounded-lg flex flex-row text-error">
|
||||
<div>
|
||||
<i class="icon-power-off"></i>
|
||||
</div>
|
||||
@@ -112,7 +112,7 @@
|
||||
}
|
||||
else if (IsLoaded && !IsFailed && Status.State is ServerState.Installing)
|
||||
{
|
||||
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row text-primary">
|
||||
<div class="bg-base-200/75 py-1 px-2 rounded-lg flex flex-row text-primary">
|
||||
<div>
|
||||
<i class="icon-hammer"></i>
|
||||
</div>
|
||||
@@ -127,7 +127,7 @@
|
||||
|
||||
@if (Server.Share != null)
|
||||
{
|
||||
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row col-span-2">
|
||||
<div class="bg-base-200/75 py-1 px-2 rounded-lg flex flex-row col-span-2">
|
||||
<div>
|
||||
<i class="icon-share-2"></i>
|
||||
</div>
|
||||
@@ -137,7 +137,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row">
|
||||
<div class="bg-base-200/75 py-1 px-2 rounded-lg flex flex-row">
|
||||
<div>
|
||||
<i class="icon-sparkles"></i>
|
||||
</div>
|
||||
@@ -145,7 +145,7 @@
|
||||
<div class="ms-3">@Server.StarName</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row">
|
||||
<div class="bg-base-200/75 py-1 px-2 rounded-lg flex flex-row">
|
||||
<div>
|
||||
<i class="icon-database"></i>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
@using Microsoft.AspNetCore.SignalR.Client
|
||||
@using MoonlightServers.Frontend.Services
|
||||
|
||||
@inherits BaseServerTab
|
||||
|
||||
@inject ServerService ServerService
|
||||
|
||||
<div class="h-44">
|
||||
<XtermConsole @ref="XtermConsole" OnAfterInitialized="OnAfterConsoleInitialized"/>
|
||||
<XtermConsole @ref="XtermConsole"
|
||||
OnAfterInitialized="OnAfterConsoleInitialized"
|
||||
CommandHistory="Parent.CommandHistory"
|
||||
OnCommand="OnCommand"/>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -16,10 +22,10 @@
|
||||
|
||||
HubConnection.On<string>("ConsoleOutput", async content =>
|
||||
{
|
||||
if(XtermConsole != null)
|
||||
if (XtermConsole != null)
|
||||
await XtermConsole.Write(content);
|
||||
});
|
||||
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -27,4 +33,7 @@
|
||||
{
|
||||
await XtermConsole!.Write(InitialConsoleMessage);
|
||||
}
|
||||
|
||||
private async Task OnCommand(string command)
|
||||
=> await ServerService.RunCommand(Server.Id, command + "\n");
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
else
|
||||
{
|
||||
<WButton CssClasses="btn btn-primary" OnClick="Reinstall">
|
||||
<i class="align-middle icon-hammer me-1"></i>
|
||||
<i class="align-middle icon-hammer"></i>
|
||||
<span class="align-middle">Reinstall</span>
|
||||
</WButton>
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="grid grid-col-1 gap-y-3">
|
||||
@foreach (var share in Shares)
|
||||
{
|
||||
<div class="col-span-1 card card-body px-5 py-3 flex flex-row items-center justify-between">
|
||||
<div class="col-span-1 card card-body py-3 flex flex-row items-center justify-between">
|
||||
<div class="flex justify-start font-semibold">
|
||||
<i class="icon-user-round me-2"></i>
|
||||
<span>@share.Username</span>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
@foreach (var variable in Variables)
|
||||
{
|
||||
<div class="sm:col-span-2 card card-body p-5">
|
||||
<div class="sm:col-span-2 card card-body">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">
|
||||
@variable.Name
|
||||
</label>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.Servers
|
||||
@using MoonCore.Blazor.FlyonUi.Forms
|
||||
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
|
||||
@@ -12,7 +13,7 @@
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Allocations</label>
|
||||
<div class="mt-2">
|
||||
<InputMultipleItem TItem="NodeAllocationResponse"
|
||||
Value="Allocations"
|
||||
Value="Parent.Allocations"
|
||||
DisplayField="@(x => $"{x.IpAddress}:{x.Port}")"
|
||||
SearchField="@(x => $"{x.IpAddress}:{x.Port}")"
|
||||
ItemSource="Loader">
|
||||
@@ -25,7 +26,7 @@
|
||||
{
|
||||
[Parameter] public UpdateServerRequest Request { get; set; }
|
||||
[Parameter] public ServerResponse Server { get; set; }
|
||||
[Parameter] public List<NodeAllocationResponse> Allocations { get; set; }
|
||||
[Parameter] public Update Parent { get; set; }
|
||||
|
||||
private async Task<NodeAllocationResponse[]> Loader()
|
||||
{
|
||||
@@ -3,6 +3,7 @@
|
||||
@using MoonCore.Models
|
||||
@using Moonlight.Shared.Http.Responses.Admin.Users
|
||||
@using MoonCore.Blazor.FlyonUi.Forms
|
||||
@using MoonlightServers.Frontend.UI.Views.Admin.All
|
||||
|
||||
@inject HttpApiClient ApiClient
|
||||
|
||||
@@ -20,7 +21,7 @@
|
||||
<InputItem TItem="UserResponse"
|
||||
DisplayField="@(x => x.Username)"
|
||||
SearchField="@(x => x.Username)"
|
||||
@bind-Value="Owner"
|
||||
@bind-Value="Parent.Owner"
|
||||
ItemSource="Loader">
|
||||
</InputItem>
|
||||
|
||||
@@ -61,7 +62,7 @@
|
||||
@code
|
||||
{
|
||||
[Parameter] public UpdateServerRequest Request { get; set; }
|
||||
[Parameter] public UserResponse Owner { get; set; }
|
||||
[Parameter] public Update Parent { get; set; }
|
||||
|
||||
private async Task<UserResponse[]> Loader()
|
||||
{
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
|
||||
@foreach (var variable in Variables)
|
||||
@foreach (var variable in ServerVariables)
|
||||
{
|
||||
var reqVariable = Request.Variables.FirstOrDefault(x => x.Key == variable.Key);
|
||||
var starVariable = StarVariables.FirstOrDefault(x => x.Key == variable.Key);
|
||||
@@ -46,7 +46,7 @@
|
||||
[Parameter] public ServerResponse Server { get; set; }
|
||||
|
||||
private StarVariableDetailResponse[] StarVariables;
|
||||
private ServerVariableResponse[] Variables;
|
||||
private ServerVariableResponse[] ServerVariables;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
{
|
||||
@@ -56,7 +56,7 @@
|
||||
)
|
||||
);
|
||||
|
||||
Variables = await PagedData<ServerVariableResponse>.All(async (page, pageSize) =>
|
||||
ServerVariables = await PagedData<ServerVariableResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<ServerVariableResponse>>(
|
||||
$"api/admin/servers/{Server.Id}/variables?page={page}&pageSize={pageSize}"
|
||||
)
|
||||
Reference in New Issue
Block a user