Refactored frontend to work with the latest mooncore changes

This commit is contained in:
2025-07-16 20:46:45 +02:00
parent 383d4bb24b
commit 61253919cf
93 changed files with 3347 additions and 1661 deletions

View File

@@ -5,26 +5,18 @@
@inherits InputBase<bool>
<div class="flex items-center">
<div class="form-switch">
<input @bind="CurrentValue" type="checkbox" id="@("switch-" + GetHashCode())" class="sr-only">
<label class="bg-gray-700" for="switch-@(GetHashCode())">
<span class="bg-white shadow-sm" aria-hidden="true"></span>
<span class="sr-only">Switch label</span>
</label>
</div>
<div class="text-sm text-gray-500 italic ml-2">
<div class="flex items-center gap-1">
<input @bind="CurrentValue" type="checkbox" class="switch switch-primary" id="switch-@GetHashCode()" />
<label class="label-text text-base" for="switch-@GetHashCode()">
@if (CurrentValue)
{
<span>On</span>
}
else
{
<span>
Off
</span>
<span>Off</span>
}
</div>
</label>
</div>
@code

View File

@@ -1,6 +1,4 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Modals.Components
@using MoonCore.Blazor.Tailwind.Components
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
@@ -10,13 +8,13 @@
<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-white">IP Address</label>
<input @bind="Form.IpAddress" type="text" class="form-input w-full"/>
<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>
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">Port</label>
<input @bind="Form.Port" type="text" class="form-input w-full"/>
<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>
</div>
</HandleForm>

View File

@@ -1,6 +1,4 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Modals.Components
@using MoonCore.Blazor.Tailwind.Components
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
@@ -10,18 +8,18 @@
<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-white">IP Address</label>
<input @bind="Form.IpAddress" type="text" class="form-input w-full"/>
<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>
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">Start Port</label>
<input @bind="Form.Start" type="text" class="form-input w-full"/>
<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-white">End Port</label>
<input @bind="Form.End" type="text" class="form-input w-full"/>
<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>
</div>
</HandleForm>

View File

@@ -1,7 +1,4 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Modals.Components
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Helpers
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
@@ -12,13 +9,13 @@
<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-white">IP Address</label>
<input @bind="Form.IpAddress" type="text" class="form-input w-full"/>
<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>
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">Port</label>
<input @bind="Form.Port" type="text" class="form-input w-full"/>
<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>
</div>
</HandleForm>
@@ -38,7 +35,11 @@
protected override void OnInitialized()
{
Form = Mapper.Map<UpdateNodeAllocationRequest>(Allocation);
Form = new UpdateNodeAllocationRequest()
{
IpAddress = Allocation.IpAddress,
Port = Allocation.Port
};
}
private async Task OnValidSubmit()

View File

@@ -2,19 +2,23 @@
@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-white">Enable Transparent
Mode</label>
<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" />
<Switch @bind-Value="Request.EnableTransparentMode"/>
</div>
</div>
</div>
<div class="sm:col-span-2"><label class="block text-sm font-medium leading-6 text-white">Enable Dynamic
Firewall</label>
<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" />
<Switch @bind-Value="Request.EnableDynamicFirewall"/>
</div>
</div>
</div>

View File

@@ -2,11 +2,7 @@
@using MoonCore.Blazor.FlyonUi.DataTables
@using MoonCore.Blazor.FlyonUi.Modals
@using MoonCore.Blazor.FlyonUi.Toasts
@using MoonCore.Blazor.Tailwind.Alerts
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
@using MoonCore.Blazor.Tailwind.Dt
@using MoonCore.Blazor.Tailwind.Modals
@using MoonCore.Blazor.Tailwind.Toasts
@using MoonCore.Helpers
@using MoonCore.Models
@using MoonlightServers.Frontend.UI.Components.Nodes.Modals
@@ -21,15 +17,14 @@
<div class="grid grid-cols-1 md:grid-cols-3 md:gap-x-5">
<div class="col-span-1">
<div class="card">
<div
class="card-header card-header bg-gray-700 rounded-t-lg text-gray-500 bg-opacity-50 border-0 py-2 text-base font-semibold">
<span class="card-title">Actions</span>
<div class="card-header">
Actions
</div>
<div class="card-body">
<div class="flex flex-col gap-y-3">
<button @onclick="AddAllocation" class="btn btn-primary">Create</button>
<button @onclick="AddAllocationRange" class="btn btn-tertiary">Create multiple</button>
<button @onclick="DeleteAllAllocations" class="btn btn-danger">Delete all</button>
<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>
</div>
</div>
</div>
@@ -37,19 +32,21 @@
<div class="col-span-1 md:col-span-2 -mb-3">
<DataTable @ref="Table" TItem="NodeAllocationResponse">
<Configuration>
<Pagination TItem="NodeAllocationResponse" ItemSource="LoadData" />
<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="#"
<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-danger">
<a @onclick="() => DeleteAllocation(context)"
@onclick:preventDefault href="#"
class="text-error">
<i class="icon-trash text-base"></i>
</a>
</div>
@@ -83,10 +80,7 @@
await Table.Refresh();
};
await ModalService.Launch<CreateMultipleAllocationModal>(parameters =>
{
parameters.Add("OnSubmit", onSubmit);
});
await ModalService.Launch<CreateMultipleAllocationModal>(parameters => { parameters.Add("OnSubmit", onSubmit); });
}
private async Task AddAllocation()
@@ -133,7 +127,7 @@
}
);
}
private async Task DeleteAllAllocations()
{
await AlertService.ConfirmDanger(

View File

@@ -2,26 +2,26 @@
<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-white">Name</label>
<label class="block text-sm font-medium leading-6 text-base-content">Name</label>
<div class="mt-2">
<input @bind="Request.Name" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.Name" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Fqdn</label>
<label class="block text-sm font-medium leading-6 text-base-content">Fqdn</label>
<div class="mt-2">
<input @bind="Request.Fqdn" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.Fqdn" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Http Port</label>
<label class="block text-sm font-medium leading-6 text-base-content">Http Port</label>
<div class="mt-2">
<input @bind="Request.HttpPort" type="number" autocomplete="off" class="form-input w-full">
<input @bind="Request.HttpPort" type="number" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2"><label class="block text-sm font-medium leading-6 text-white">Ftp Port</label>
<div class="sm:col-span-2"><label class="block text-sm font-medium leading-6 text-base-content">Ftp Port</label>
<div class="mt-2">
<input @bind="Request.FtpPort" type="number" autocomplete="off" class="form-input w-full">
<input @bind="Request.FtpPort" type="number" autocomplete="off" class="input w-full">
</div>
</div>
</div>

View File

@@ -1,7 +1,6 @@
@using Microsoft.Extensions.Logging
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.FlyonUi.Toasts
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Blazor.Tailwind.Toasts
@using MoonCore.Helpers
@using MoonlightServers.Frontend.Services
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
@@ -22,8 +21,8 @@
<div class="grid grid-cols-1 lg:grid-cols-3 gap-5">
<div class="col-span-1 card card-body">
<div class="flex justify-between">
<p class="text-xl font-semibold text-slate-200">
@Math.Round(Statistics.Cpu.Usage, 2)%
<p class="text-xl font-semibold text-base-content">
@(Math.Round(Statistics.Cpu.Usage, 2))%
</p>
<i class="icon-cpu text-4xl text-primary"></i>
</div>
@@ -36,10 +35,10 @@
<div class="col-span-1 card card-body">
<div class="flex justify-between">
<p class="text-xl font-semibold text-slate-200">
@Formatter.FormatSize(Statistics.Memory.Total - Statistics.Memory.Available)
<p class="text-xl font-semibold text-base-content">
@(Formatter.FormatSize(Statistics.Memory.Total - Statistics.Memory.Available))
/
@Formatter.FormatSize(Statistics.Memory.Total)
@(Formatter.FormatSize(Statistics.Memory.Total))
</p>
<i class="icon-memory-stick text-4xl text-primary"></i>
</div>
@@ -50,10 +49,10 @@
<div class="col-span-1 card card-body">
<div class="flex justify-between">
<div class="text-xl font-semibold text-slate-200">
@Formatter.FormatSize(Statistics.Memory.SwapTotal - Statistics.Memory.SwapFree)
<div class="text-xl font-semibold text-base-content">
@(Formatter.FormatSize(Statistics.Memory.SwapTotal - Statistics.Memory.SwapFree))
/
@Formatter.FormatSize(Statistics.Memory.SwapTotal)
@(Formatter.FormatSize(Statistics.Memory.SwapTotal))
</div>
<i class="icon-shapes text-4xl text-primary"></i>
</div>
@@ -81,9 +80,8 @@
<span>#@(i)</span>
</div>
<div class="grow">
<div class="progress bg-gray-750">
<div style="width: @(usage)%"
class="progress-bar h-3 @(GetBackgroundColorByPercent(percentRounded))"></div>
<div class="progress h-2" role="progressbar">
<div class="progress-bar transition-all duration-300 ease-in-out @(GetBackgroundColorByPercent(percentRounded))" style="width: @(usage)%"></div>
</div>
</div>
</div>
@@ -105,9 +103,8 @@
<div class="col-span-1 card card-body">
<div class="flex items-center">
<div class="grow">
<div class="progress bg-gray-750">
<div style="width: @(usedPercent)%"
class="progress-bar h-3 @(GetBackgroundColorByPercent(usedPercent))"></div>
<div class="progress h-2" role="progressbar">
<div class="progress-bar transition-all duration-300 ease-in-out @(GetBackgroundColorByPercent(usedPercent))" style="width: @(usedPercent)%"></div>
</div>
</div>
</div>
@@ -134,7 +131,7 @@
<div class="grid grid-cols-1 lg:grid-cols-3 gap-5">
<div class="col-span-1 card card-body">
<div class="flex justify-between">
<p class="text-xl font-semibold text-slate-200">
<p class="text-xl font-semibold text-base-content">
@Formatter.FormatSize(DockerStatistics.ImagesUsed) (@Formatter.FormatSize(DockerStatistics.ImagesReclaimable) unused)
</p>
<i class="icon-gallery-horizontal-end text-4xl text-primary"></i>
@@ -146,7 +143,7 @@
<div class="col-span-1 card card-body">
<div class="flex justify-between">
<p class="text-xl font-semibold text-slate-200">
<p class="text-xl font-semibold text-base-content">
@Formatter.FormatSize(DockerStatistics.ContainersUsed) ( @Formatter.FormatSize(DockerStatistics.ContainersReclaimable) unused)
</p>
<i class="icon-container text-4xl text-primary"></i>
@@ -158,7 +155,7 @@
<div class="col-span-1 card card-body">
<div class="flex justify-between">
<p class="text-xl font-semibold text-slate-200">
<p class="text-xl font-semibold text-base-content">
@Formatter.FormatSize(DockerStatistics.BuildCacheUsed) (@Formatter.FormatSize(DockerStatistics.BuildCacheReclaimable) unused)
</p>
<i class="icon-hard-hat text-4xl text-primary"></i>
@@ -199,7 +196,7 @@
catch (Exception e)
{
Logger.LogWarning("An error occured while fetching status update: {e}", e);
await ToastService.Danger("Unable to fetch status update", e.Message);
await ToastService.Error("Unable to fetch status update", e.Message);
}
}
@@ -210,7 +207,7 @@
else if (percent < 80)
return "bg-warning";
else
return "bg-danger";
return "bg-error";
}
public void Dispose()

View File

@@ -1,35 +1,25 @@
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
@using MoonCore.Blazor.Tailwind.Inputs
@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-white">Storage</label>
<label class="block text-sm font-medium leading-6 text-base-content">Storage</label>
<div class="mt-2">
<InputCustomSelect TValue="bool" @bind-Value="Request.UseVirtualDisk">
<CustomSelectOption Value="false">
<Template>
<span>
<i class="icon-database me-1 align-middle"></i>
<span class="align-middle">Docker Volume</span>
</span>
</Template>
</CustomSelectOption>
<CustomSelectOption Value="true">
<Template>
<span>
<i class="icon-hard-drive me-1 align-middle"></i>
<span class="align-middle">Virtual Disk</span>
</span>
</Template>
</CustomSelectOption>
</InputCustomSelect>
<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-white">Bandwidth</label>
<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="form-input w-full">
<input @bind="Request.Bandwidth" type="number" autocomplete="off" class="input w-full">
</div>
</div>
</div>

View File

@@ -1,22 +1,22 @@
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
@using MoonCore.Blazor.Tailwind.Inputs
@using MoonCore.Helpers
@using MoonCore.Models
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
@using MoonCore.Blazor.FlyonUi.Forms
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
@inject HttpApiClient ApiClient
<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-white">Allocations</label>
<label class="block text-sm font-medium leading-6 text-base-content">Allocations</label>
<div class="mt-2">
<InputMultiSelect TItem="NodeAllocationDetailResponse"
TProperty="int"
@bind-Value="Request.AllocationIds"
Loader="Loader"
AllowSearch="true"
DisplayProperty="@(x => $"{x.IpAddress}:{x.Port}")"
ValueProperty="@(x => x.Id)"/>
<InputMultipleItem TItem="NodeAllocationResponse"
DisplayField="@(x => $"{x.IpAddress}:{x.Port}")"
SearchField="@(x => $"{x.IpAddress}:{x.Port}")"
Value="Allocations"
ItemSource="ItemSource">
</InputMultipleItem>
</div>
</div>
</div>
@@ -24,16 +24,19 @@
@code
{
[Parameter] public CreateServerRequest Request { get; set; }
[Parameter] public List<NodeAllocationResponse> Allocations { get; set; }
[Parameter] public NodeResponse? Node { get; set; }
private async Task<NodeAllocationResponse[]> Loader()
private async Task<NodeAllocationResponse[]> ItemSource()
{
// Handle unselected node
if (Request.NodeId <= 0)
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
if (Node == null)
return [];
var items = await PagedData<NodeAllocationResponse>.All(async (page, pageSize) =>
await ApiClient.GetJson<PagedData<NodeAllocationResponse>>(
$"api/admin/servers/nodes/{Request.NodeId}/allocations/free?page={page}&pageSize={pageSize}"
$"api/admin/servers/nodes/{Node.Id}/allocations/free?page={page}&pageSize={pageSize}"
)
);

View File

@@ -3,83 +3,83 @@
@using MoonCore.Models
@using MoonlightServers.Shared.Http.Responses.Admin.Nodes
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
@using MoonCore.Blazor.Tailwind.Inputs
@using Moonlight.Shared.Http.Responses.Admin.Users
@using MoonCore.Blazor.FlyonUi.Forms
@inject HttpApiClient ApiClient
<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-white">Name</label>
<label class="block text-sm font-medium leading-6 text-base-content">Name</label>
<div class="mt-2">
<input @bind="Request.Name" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.Name" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Owner</label>
<label class="block text-sm font-medium leading-6 text-base-content">Owner</label>
<div class="mt-2">
<InputItemSearchSelect TItem="UserResponse"
TProperty="int"
@bind-Value="Request.OwnerId"
AllowNone="false"
Loader="Loader"
DisplayProperty="@(x => x.Email)"
ValueProperty="@(x => x.Id)"/>
<InputItem TItem="UserResponse"
DisplayField="@(x => x.Username)"
SearchField="@(x => x.Username)"
ItemSource="LoadUsers"
@bind-Value="User">
</InputItem>
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Star</label>
<label class="block text-sm font-medium leading-6 text-base-content">Star</label>
<div class="mt-2">
<InputItemSelect TItem="StarDetailResponse"
TProperty="int"
@bind-Value="Request.StarId"
DisplayProperty="@(x => x.Name)"
ValueProperty="@(x => x?.Id ?? -1)"
Loader="LoadStars"/>
<InputItem TItem="StarDetailResponse"
DisplayField="@(x => x.Name)"
SearchField="@(x => x.Name)"
ItemSource="LoadStars"
@bind-Value="Star">
</InputItem>
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Node</label>
<label class="block text-sm font-medium leading-6 text-base-content">Node</label>
<div class="mt-2">
<InputItemSelect TItem="NodeDetailResponse"
TProperty="int"
@bind-Value="Request.NodeId"
DisplayProperty="@(x => x.Name)"
ValueProperty="@(x => x?.Id ?? -1)"
Loader="LoadNodes"/>
<InputItem TItem="NodeResponse"
DisplayField="@(x => x.Name)"
SearchField="@(x => x.Name)"
ItemSource="LoadNodes"
@bind-Value="Node">
</InputItem>
</div>
</div>
</div>
<div class="border-t border-gray-100/10 pt-6 my-8">
<div class="mb-8"><h2 class="text-base font-semibold leading-7 text-gray-100">
<div class="border-t border-base-content/20 pt-6 my-8">
<div class="mb-8">
<h2 class="text-base font-semibold leading-7 text-base-content">
Resources
</h2>
<p class="mt-1 text-sm leading-6 text-gray-400">Define the servers resource limit</p></div>
<p class="mt-1 text-sm leading-6 text-base-content/60">Define the servers resource limit</p>
</div>
<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-white">Cpu</label>
<label class="block text-sm font-medium leading-6 text-base-content">Cpu</label>
<div class="mt-2">
<input @bind="Request.Cpu" type="number" autocomplete="off" class="form-input w-full">
<input @bind="Request.Cpu" type="number" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Memory</label>
<label class="block text-sm font-medium leading-6 text-base-content">Memory</label>
<div class="mt-2">
<input @bind="Request.Memory" type="number" autocomplete="off" class="form-input w-full">
<input @bind="Request.Memory" type="number" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Disk</label>
<label class="block text-sm font-medium leading-6 text-base-content">Disk</label>
<div class="mt-2">
<input @bind="Request.Disk" type="number" autocomplete="off" class="form-input w-full">
<input @bind="Request.Disk" type="number" autocomplete="off" class="input w-full">
</div>
</div>
</div>
@@ -89,46 +89,34 @@
{
[Parameter] public CreateServerRequest Request { get; set; }
private UserResponse[]? Users;
[Parameter] public UserResponse? User { get; set; }
[Parameter] public NodeResponse? Node { get; set; }
[Parameter] public StarDetailResponse? Star { get; set; }
private async Task<StarDetailResponse[]> LoadStars()
{
var items = await PagedData<StarDetailResponse>.All(async (page, pageSize) =>
return await PagedData<StarDetailResponse>.All(async (page, pageSize) =>
await ApiClient.GetJson<PagedData<StarDetailResponse>>(
$"api/admin/servers/stars?page={page}&pageSize={pageSize}"
)
);
return items;
}
private async Task<NodeResponse[]> LoadNodes()
{
var items = await PagedData<NodeResponse>.All(async (page, pageSize) =>
return await PagedData<NodeResponse>.All(async (page, pageSize) =>
await ApiClient.GetJson<PagedData<NodeResponse>>(
$"api/admin/servers/nodes?page={page}&pageSize={pageSize}"
)
);
return items;
}
private async Task<UserResponse[]> Loader(string searchTerm)
private async Task<UserResponse[]> LoadUsers()
{
if (Users == null)
{
Users = await PagedData<UserResponse>.All(async (page, pageSize) =>
await ApiClient.GetJson<PagedData<UserResponse>>(
$"api/admin/users?page={page}&pageSize={pageSize}"
)
);
}
if (string.IsNullOrEmpty(searchTerm))
return Users;
return Users
.Where(x => x.Email.Contains(searchTerm))
.ToArray();
return await PagedData<UserResponse>.All(async (page, pageSize) =>
await ApiClient.GetJson<PagedData<UserResponse>>(
$"api/admin/users?page={page}&pageSize={pageSize}"
)
);
}
}

View File

@@ -1,9 +1,9 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
@using MoonCore.Helpers
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Models
@using MoonlightServers.Shared.Http.Requests.Admin.ServerVariables
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
@using MoonlightServers.Shared.Http.Responses.Admin.StarVariables
@inject HttpApiClient ApiClient
@@ -19,17 +19,17 @@
: variable.DefaultValue;
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">
<label class="block text-sm font-medium leading-6 text-base-content">
@variable.Name
</label>
<div class="mt-2">
<input type="text"
class="form-input placeholder-gray-500 w-full"
class="input placeholder-base-content/50 w-full"
value="@value"
placeholder="@variable.DefaultValue"
@onchange="@(args => UpdateValue(variable, args))"/>
</div>
<p class="mt-1 text-sm leading-6 text-gray-400">
<p class="mt-1 text-sm leading-6 text-base-content/60">
@variable.Description
</p>
</div>
@@ -40,12 +40,13 @@
@code
{
[Parameter] public CreateServerRequest Request { get; set; }
[Parameter] public StarDetailResponse? Star { get; set; }
private StarVariableDetailResponse[] StarVariables;
private async Task Load(LazyLoader _)
{
if (Request.StarId <= 0)
if (Star == null)
{
StarVariables = [];
return;

View File

@@ -1,10 +1,9 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Components
@using MoonlightServers.Shared.Enums
@using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares
@using MoonlightServers.Shared.Models
@inherits MoonCore.Blazor.Tailwind.Modals.Components.BaseModal
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
<div class="text-lg font-semibold mb-5">
Create a new share
@@ -12,8 +11,8 @@
<HandleForm @ref="HandleForm" Model="Request" OnValidSubmit="OnValidSubmit">
<div class="mb-8">
<label class="block text-sm font-medium leading-6 text-white">Username</label>
<input @bind="Request.Username" type="text" class="form-input w-full"/>
<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>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-y-5 lg:gap-y-3">
@foreach (var name in Names)

View File

@@ -1,3 +1,4 @@
@using Microsoft.Extensions.Logging
@using MoonCore.Helpers
@using MoonlightServers.Frontend.Services
@using MoonlightServers.Shared.Enums
@@ -7,38 +8,38 @@
@inject ILogger<ServerCard> Logger
@{
var gradient = "from-gray-600/20";
var border = "border-gray-600";
var gradient = "from-base-content/20";
var border = "border-base-content";
if (IsLoaded && !IsFailed)
{
gradient = Status.State switch
{
ServerState.Installing => "from-primary/20",
ServerState.Offline => "from-danger/20",
ServerState.Offline => "from-error/20",
ServerState.Starting => "from-warning/20",
ServerState.Stopping => "from-warning/20",
ServerState.Online => "from-success/20",
_ => "from-gray-600/20"
_ => "from-base-content/20"
};
border = Status.State switch
{
ServerState.Installing => "border-primary",
ServerState.Offline => "border-danger",
ServerState.Offline => "border-error",
ServerState.Starting => "border-warning",
ServerState.Stopping => "border-warning",
ServerState.Online => "border-success",
_ => "border-gray-600"
_ => "border-base-content"
};
}
}
<a href="/servers/@Server.Id"
class="w-full bg-gradient-to-r @gradient to-gray-750 to-25% px-5 py-3.5 rounded-xl border-l-8 @border">
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">
<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-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex items-center">
<div class="bg-base-content/10 bg-opacity-45 py-1 px-2 rounded-lg flex items-center">
<i class="icon-server me-3 align-middle"></i>
<div class="text-lg align-middle">
@Server.Name
@@ -53,7 +54,7 @@
Status.State is ServerState.Starting or ServerState.Stopping or ServerState.Online
)
{
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row">
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row">
<div>
<i class="icon-cpu"></i>
</div>
@@ -61,7 +62,7 @@
<div class="ms-3">@(Stats.CpuUsage)%</div>
</div>
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row">
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row">
<div>
<i class="icon-memory-stick"></i>
</div>
@@ -69,7 +70,7 @@
<div class="ms-3">@(Formatter.FormatSize(Stats.MemoryUsage)) / @(Formatter.FormatSize(ByteConverter.FromMegaBytes(Server.Memory).Bytes))</div>
</div>
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row">
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row">
<div>
<i class="icon-hard-drive"></i>
</div>
@@ -81,7 +82,7 @@
{
if (!IsLoaded)
{
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row text-gray-700">
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row text-gray-700">
<div>
<i class="icon-loader"></i>
</div>
@@ -91,7 +92,7 @@
}
else if (IsFailed)
{
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row text-danger">
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row text-error">
<div>
<i class="icon-cable"></i>
</div>
@@ -101,7 +102,7 @@
}
else if (IsLoaded && !IsFailed && Status.State is ServerState.Offline)
{
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row text-danger">
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row text-error">
<div>
<i class="icon-power-off"></i>
</div>
@@ -111,7 +112,7 @@
}
else if (IsLoaded && !IsFailed && Status.State is ServerState.Installing)
{
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row text-primary">
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row text-primary">
<div>
<i class="icon-hammer"></i>
</div>
@@ -126,7 +127,7 @@
@if (Server.Share != null)
{
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row col-span-2">
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row col-span-2">
<div>
<i class="icon-share-2"></i>
</div>
@@ -136,7 +137,7 @@
}
else
{
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row">
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row">
<div>
<i class="icon-sparkles"></i>
</div>
@@ -144,7 +145,7 @@
<div class="ms-3">@Server.StarName</div>
</div>
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row">
<div class="bg-base-content/35 py-1 px-2 rounded-lg flex flex-row">
<div>
<i class="icon-database"></i>
</div>

View File

@@ -1,26 +1,22 @@
@using MoonCore.Blazor.FlyonUi.Helpers
@using MoonlightServers.Frontend.Services
@using MoonCore.Blazor.Tailwind.Fm
@using MoonCore.Blazor.Tailwind.Services
@using MoonCore.Blazor.FlyonUi.Files.Manager
@using MoonlightServers.Frontend.Helpers
@inherits BaseServerTab
@inject ServerFileSystemService FileSystemService
@inject DownloadService DownloadService
<FileManager FileSystemProvider="Provider" MaxUploadSize="4096"/>
<FileManager FsAccess="FsAccess" />
@code
{
private IFileSystemProvider Provider;
private IFsAccess FsAccess;
protected override void OnInitialized()
{
Provider = new ServerFileSystemProvider(
FsAccess = new ServerFsAccess(
Server.Id,
FileSystemService,
DownloadService
FileSystemService
);
}
}

View File

@@ -1,8 +1,5 @@
@using MoonCore.Blazor.FlyonUi.Alerts
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Alerts
@using MoonCore.Helpers
@using MoonCore.Blazor.Tailwind.Components
@using MoonlightServers.Frontend.Services
@using MoonlightServers.Shared.Enums

View File

@@ -2,10 +2,6 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.FlyonUi.Modals
@using MoonCore.Blazor.FlyonUi.Toasts
@using MoonCore.Blazor.Tailwind.Alerts
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Blazor.Tailwind.Modals
@using MoonCore.Blazor.Tailwind.Toasts
@using MoonCore.Models
@using MoonlightServers.Frontend.Services
@using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares
@@ -19,7 +15,7 @@
@inject AlertService AlertService
<div class="flex flex-row mb-5">
<input @bind="UsernameInput" class="form-input grow placeholder-gray-500 me-1.5" autocomplete="none" placeholder="Enter a username"/>
<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">
<i class="icon-send me-1"></i>
<span>Invite</span>
@@ -48,7 +44,7 @@
<i class="icon-settings-2 me-1"></i>
<span>Edit</span>
</WButton>
<WButton OnClick="_ => Delete(share)" CssClasses="btn btn-danger">
<WButton OnClick="_ => Delete(share)" CssClasses="btn btn-error">
<i class="icon-trash-2 me-1"></i>
<span>Delete</span>
</WButton>

View File

@@ -1,7 +1,5 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.FlyonUi.Toasts
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Blazor.Tailwind.Toasts
@using MoonlightServers.Frontend.Services
@using MoonlightServers.Shared.Http.Responses.Client.Servers.Variables
@@ -15,17 +13,17 @@
@foreach (var variable in Variables)
{
<div class="sm:col-span-2 card card-body p-5">
<label class="block text-sm font-medium leading-6 text-white">
<label class="block text-sm font-medium leading-6 text-base-content">
@variable.Name
</label>
<p class="mt-1 mb-2.5 text-sm leading-6 text-gray-400">
<p class="mt-1 mb-2.5 text-sm leading-6 text-base-content/60">
@variable.Description
</p>
<div class="mt-auto">
<input @onchange="e => UpdateVariable(variable, e)"
value="@variable.Value"
type="text"
class="form-input w-full">
class="input w-full">
</div>
</div>
}

View File

@@ -71,7 +71,7 @@
}
else if (Status == 3)
{
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row text-danger">
<div class="bg-gray-900 bg-opacity-45 py-1 px-2 rounded-lg flex flex-row text-error">
<div>
<i class="icon-power-off"></i>
</div>

View File

@@ -1,11 +1,10 @@
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
@using MoonCore.Blazor.Tailwind.Inputs
<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-white">Bandwidth</label>
<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="form-input w-full">
<input @bind="Request.Bandwidth" type="number" autocomplete="off" class="input w-full">
</div>
</div>
</div>

View File

@@ -1,23 +1,22 @@
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
@using MoonCore.Blazor.Tailwind.Inputs
@using MoonCore.Helpers
@using MoonCore.Models
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
@using MoonlightServers.Shared.Http.Responses.Admin.Servers
@using MoonCore.Blazor.FlyonUi.Forms
@inject HttpApiClient ApiClient
<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-white">Allocations</label>
<label class="block text-sm font-medium leading-6 text-base-content">Allocations</label>
<div class="mt-2">
<InputMultiSelect TItem="NodeAllocationDetailResponse"
TProperty="int"
@bind-Value="Request.AllocationIds"
Loader="Loader"
AllowSearch="true"
DisplayProperty="@(x => $"{x.IpAddress}:{x.Port}")"
ValueProperty="@(x => x.Id)"/>
<InputMultipleItem TItem="NodeAllocationResponse"
Value="Allocations"
DisplayField="@(x => $"{x.IpAddress}:{x.Port}")"
SearchField="@(x => $"{x.IpAddress}:{x.Port}")"
ItemSource="Loader">
</InputMultipleItem>
</div>
</div>
</div>
@@ -26,15 +25,14 @@
{
[Parameter] public UpdateServerRequest Request { get; set; }
[Parameter] public ServerResponse Server { get; set; }
[Parameter] public List<NodeAllocationResponse> Allocations { get; set; }
private async Task<NodeAllocationResponse[]> Loader()
{
var items = await PagedData<NodeAllocationResponse>.All(async (page, pageSize) =>
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 items;
}
}

View File

@@ -1,59 +1,58 @@
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
@using MoonCore.Helpers
@using MoonCore.Models
@using MoonCore.Blazor.Tailwind.Inputs
@using Moonlight.Shared.Http.Responses.Admin.Users
@using MoonCore.Blazor.FlyonUi.Forms
@inject HttpApiClient ApiClient
<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-white">Name</label>
<label class="block text-sm font-medium leading-6 text-base-content">Name</label>
<div class="mt-2">
<input @bind="Request.Name" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.Name" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Owner</label>
<label class="block text-sm font-medium leading-6 text-base-content">Owner</label>
<div class="mt-2">
<InputItemSearchSelect TItem="UserResponse"
TProperty="int"
@bind-Value="Request.OwnerId"
AllowNone="false"
Loader="Loader"
DisplayProperty="@(x => x.Email)"
ValueProperty="@(x => x.Id)"/>
<InputItem TItem="UserResponse"
DisplayField="@(x => x.Username)"
SearchField="@(x => x.Username)"
@bind-Value="Owner"
ItemSource="Loader">
</InputItem>
</div>
</div>
</div>
<div class="border-t border-gray-100/10 pt-6 my-8">
<div class="mb-8"><h2 class="text-base font-semibold leading-7 text-gray-100">
<div class="border-t border-base-content/10 pt-6 my-8">
<div class="mb-8"><h2 class="text-base font-semibold leading-7 text-base-content">
Resources
</h2>
<p class="mt-1 text-sm leading-6 text-gray-400">Define the servers resource limit</p></div>
<p class="mt-1 text-sm leading-6 text-base-content/60">Define the servers resource limit</p></div>
<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-white">Cpu</label>
<label class="block text-sm font-medium leading-6 text-base-content">Cpu</label>
<div class="mt-2">
<input @bind="Request.Cpu" type="number" autocomplete="off" class="form-input w-full">
<input @bind="Request.Cpu" type="number" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Memory</label>
<label class="block text-sm font-medium leading-6 text-base-content">Memory</label>
<div class="mt-2">
<input @bind="Request.Memory" type="number" autocomplete="off" class="form-input w-full">
<input @bind="Request.Memory" type="number" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Disk</label>
<label class="block text-sm font-medium leading-6 text-base-content">Disk</label>
<div class="mt-2">
<input @bind="Request.Disk" type="number" autocomplete="off" class="form-input w-full">
<input @bind="Request.Disk" type="number" autocomplete="off" class="input w-full">
</div>
</div>
</div>
@@ -62,25 +61,14 @@
@code
{
[Parameter] public UpdateServerRequest Request { get; set; }
[Parameter] public UserResponse Owner { get; set; }
private UserResponse[]? Users;
private async Task<UserResponse[]> Loader(string searchTerm)
private async Task<UserResponse[]> Loader()
{
if (Users == null)
{
Users = await PagedData<UserResponse>.All(async (page, pageSize) =>
await ApiClient.GetJson<PagedData<UserResponse>>(
$"api/admin/users?page={page}&pageSize={pageSize}"
)
);
}
if (string.IsNullOrEmpty(searchTerm))
return Users;
return Users
.Where(x => x.Email.Contains(searchTerm))
.ToArray();
return await PagedData<UserResponse>.All(async (page, pageSize) =>
await ApiClient.GetJson<PagedData<UserResponse>>(
$"api/admin/users?page={page}&pageSize={pageSize}"
)
);
}
}

View File

@@ -1,7 +1,6 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonlightServers.Shared.Http.Requests.Admin.Servers
@using MoonCore.Helpers
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Models
@using MoonlightServers.Shared.Http.Requests.Admin.ServerVariables
@using MoonlightServers.Shared.Http.Responses.Admin.Servers
@@ -26,14 +25,14 @@
: variable.Value;
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">
<label class="block text-sm font-medium leading-6 text-base-content">
@starVariable.Name
</label>
<div class="mt-2">
<input type="text" class="form-input w-full" value="@value"
<input type="text" class="input w-full" value="@value"
@onchange="@(args => UpdateValue(variable, args))"/>
</div>
<p class="mt-1 text-sm leading-6 text-gray-400">
<p class="mt-1 text-sm leading-6 text-base-content/60">
@starVariable.Description
</p>
</div>

View File

@@ -1,11 +1,10 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Components
@using MoonlightServers.Shared.Enums
@using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares
@using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares
@using MoonlightServers.Shared.Models
@inherits MoonCore.Blazor.Tailwind.Modals.Components.BaseModal
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
<div class="text-lg font-semibold mb-5">
Update share for @Share.Username

View File

@@ -1,8 +1,5 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Modals.Components
@using MoonlightServers.Shared.Enums
@using MoonlightServers.Frontend.UI.Components.Forms
@using MoonCore.Blazor.Tailwind.Components
@using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
@@ -12,17 +9,17 @@
<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-white">Display Name</label>
<input @bind="Form.DisplayName" type="text" class="form-input w-full"/>
<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>
<div class="col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Identifier</label>
<input @bind="Form.Identifier" type="text" class="form-input w-full"/>
<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-white">Automatic pulling</label>
<label class="block text-sm font-medium leading-6 text-base-content">Automatic pulling</label>
<Switch @bind-Value="Form.AutoPulling"/>
</div>
</div>

View File

@@ -1,7 +1,5 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Modals.Components
@using MoonlightServers.Shared.Enums
@using MoonCore.Blazor.Tailwind.Components
@using MoonlightServers.Shared.Models
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
@@ -11,13 +9,13 @@
<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-white">File</label>
<input @bind="Form.File" type="text" class="form-input w-full"/>
<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>
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">Type</label>
<select @bind="Form.Parser" class="form-select w-full">
<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>
@@ -26,16 +24,16 @@
</div>
<div class="col-span-2">
<button @onclick="AddEntry" class="btn btn-primary w-full">Add entry</button>
<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">
<input @bind="entry.Key" placeholder="Key" class="form-input placeholder-gray-500 grow rounded-r-none"/>
<input @bind="entry.Value" placeholder="Value" class="form-input placeholder-gray-500 grow rounded-none"/>
<button @onclick="() => RemoveEntry(entry)" class="btn btn-danger grow-0 rounded-l-none">
<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">
<i class="icon-x"></i>
</button>
</div>

View File

@@ -1,9 +1,7 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Modals.Components
@using MoonlightServers.Shared.Enums
@using MoonlightServers.Shared.Http.Requests.Admin.StarVariables
@using MoonlightServers.Frontend.UI.Components.Forms
@using MoonCore.Blazor.Tailwind.Components
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
@@ -12,38 +10,38 @@
<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-white">Name</label>
<input @bind="Form.Name" type="text" class="form-input w-full"/>
<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>
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">Description</label>
<input @bind="Form.Description" type="text" class="form-input w-full"/>
<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-white">Key</label>
<input @bind="Form.Key" type="text" class="form-input w-full"/>
<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-white">Default Value</label>
<input @bind="Form.DefaultValue" type="text" class="form-input w-full"/>
<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-white">Allow Viewing</label>
<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-white">Allow Editing</label>
<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-white">Type</label>
<select @bind="Form.Type" class="form-select w-full">
<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>
@@ -52,8 +50,8 @@
</div>
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">Filter</label>
<input @bind="Form.Filter" type="text" class="form-input w-full"/>
<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>
</div>
</HandleForm>

View File

@@ -1,8 +1,5 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Modals.Components
@using MoonlightServers.Frontend.UI.Components.Forms
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Helpers
@using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages
@using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages
@@ -13,17 +10,17 @@
<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-white">Display Name</label>
<input @bind="Form.DisplayName" type="text" class="form-input w-full"/>
<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>
<div class="col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Identifier</label>
<input @bind="Form.Identifier" type="text" class="form-input w-full"/>
<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-white">Automatic pulling</label>
<label class="block text-sm font-medium leading-6 text-base-content">Automatic pulling</label>
<Switch @bind-Value="Form.AutoPulling"/>
</div>
</div>
@@ -44,7 +41,12 @@
protected override void OnInitialized()
{
Form = Mapper.Map<UpdateStarDockerImageRequest>(DockerImage);
Form = new UpdateStarDockerImageRequest()
{
AutoPulling = DockerImage.AutoPulling,
DisplayName = DockerImage.DisplayName,
Identifier = DockerImage.Identifier
};
}
private async Task OnValidSubmit()

View File

@@ -1,8 +1,5 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Modals.Components
@using MoonlightServers.Shared.Enums
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Helpers
@using MoonlightServers.Shared.Models
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
@@ -12,13 +9,13 @@
<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-white">File</label>
<input @bind="Form.File" type="text" class="form-input w-full"/>
<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>
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">Type</label>
<select @bind="Form.Parser" class="form-select w-full">
<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>
@@ -27,16 +24,16 @@
</div>
<div class="col-span-2">
<button @onclick="AddEntry" class="btn btn-primary w-full">Add entry</button>
<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">
<input @bind="entry.Key" placeholder="Key" class="form-input placeholder-gray-500 grow rounded-r-none"/>
<input @bind="entry.Value" placeholder="Value" class="form-input placeholder-gray-500 grow rounded-none"/>
<button @onclick="() => RemoveEntry(entry)" class="btn btn-danger grow-0 rounded-l-none">
<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">
<i class="icon-x"></i>
</button>
</div>

View File

@@ -1,10 +1,7 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Modals.Components
@using MoonlightServers.Shared.Enums
@using MoonlightServers.Shared.Http.Requests.Admin.StarVariables
@using MoonlightServers.Frontend.UI.Components.Forms
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Helpers
@using MoonlightServers.Shared.Http.Responses.Admin.StarVariables
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
@@ -14,38 +11,38 @@
<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-white">Name</label>
<input @bind="Form.Name" type="text" class="form-input w-full"/>
<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>
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">Description</label>
<input @bind="Form.Description" type="text" class="form-input w-full"/>
<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-white">Key</label>
<input @bind="Form.Key" type="text" class="form-input w-full"/>
<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-white">Default Value</label>
<input @bind="Form.DefaultValue" type="text" class="form-input w-full"/>
<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-white">Allow Viewing</label>
<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-white">Allow Editing</label>
<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-white">Type</label>
<select @bind="Form.Type" class="form-select w-full">
<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>
@@ -54,8 +51,8 @@
</div>
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">Filter</label>
<input @bind="Form.Filter" type="text" class="form-input w-full"/>
<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>
</div>
</HandleForm>
@@ -75,7 +72,17 @@
protected override void OnInitialized()
{
Form = Mapper.Map<UpdateStarVariableRequest>(Variable);
Form = new()
{
Name = Variable.Name,
AllowEditing = Variable.AllowEditing,
AllowViewing = Variable.AllowViewing,
DefaultValue = Variable.DefaultValue,
Description = Variable.Description,
Filter = Variable.Filter,
Key = Variable.Key,
Type = Variable.Type
};
}
private async Task OnValidSubmit()

View File

@@ -2,10 +2,6 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.FlyonUi.Modals
@using MoonCore.Blazor.FlyonUi.Toasts
@using MoonCore.Blazor.Tailwind.Alerts
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Blazor.Tailwind.Modals
@using MoonCore.Blazor.Tailwind.Toasts
@using MoonCore.Helpers
@using MoonCore.Models
@using MoonlightServers.Frontend.UI.Components.Stars.Modals
@@ -34,11 +30,11 @@
</div>
<div class="gap-x-2">
<button @onclick="() => UpdateDockerImage(dockerImage)" class="btn btn-primary">
<button type="button" @onclick="() => UpdateDockerImage(dockerImage)" class="btn btn-primary">
<i class="icon-settings text-base"></i>
</button>
<button @onclick="() => DeleteDockerImage(dockerImage)" class="btn btn-danger">
<button type="button" @onclick="() => DeleteDockerImage(dockerImage)" class="btn btn-error">
<i class="icon-trash text-base"></i>
</button>
</div>

View File

@@ -3,33 +3,33 @@
<div>
<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-white">Name</label>
<label class="block text-sm font-medium leading-6 text-base-content">Name</label>
<div class="mt-2">
<input @bind="Request.Name" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.Name" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Version</label>
<label class="block text-sm font-medium leading-6 text-base-content">Version</label>
<div class="mt-2">
<input @bind="Request.Version" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.Version" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Author</label>
<label class="block text-sm font-medium leading-6 text-base-content">Author</label>
<div class="mt-2">
<input @bind="Request.Author" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.Author" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Donate Url</label>
<label class="block text-sm font-medium leading-6 text-base-content">Donate Url</label>
<div class="mt-2">
<input @bind="Request.DonateUrl" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.DonateUrl" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Update Url</label>
<label class="block text-sm font-medium leading-6 text-base-content">Update Url</label>
<div class="mt-2">
<input @bind="Request.UpdateUrl" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.UpdateUrl" type="text" autocomplete="off" class="input w-full">
</div>
</div>
</div>

View File

@@ -1,23 +1,22 @@
@using MoonCore.Blazor.FlyonUi.Ace
@using MoonlightServers.Shared.Http.Requests.Admin.Stars
@using MoonCore.Blazor.Tailwind.Ace
<div>
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
<div class="sm:col-span-3">
<label class="block text-sm font-medium leading-6 text-white">Docker Image</label>
<label class="block text-sm font-medium leading-6 text-base-content">Docker Image</label>
<div class="mt-2">
<input @bind="Request.InstallDockerImage" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.InstallDockerImage" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-3">
<label class="block text-sm font-medium leading-6 text-white">Shell</label>
<label class="block text-sm font-medium leading-6 text-base-content">Shell</label>
<div class="mt-2">
<input @bind="Request.InstallShell" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.InstallShell" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-6">
<label class="block text-sm font-medium leading-6 text-white">Script</label>
<label class="block text-sm font-medium leading-6 text-base-content">Script</label>
<div class="mt-2" @onfocusout="OnFocusOut">
<CodeEditor @ref="CodeEditor" InitialContent="@Request.InstallScript" OnConfigure="OnConfigure" />
</div>

View File

@@ -1,5 +1,4 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Helpers
@using MoonCore.Models
@using MoonlightServers.Shared.Http.Requests.Admin.Stars
@@ -13,15 +12,15 @@
<div>
<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-white">Allow docker image change</label>
<label class="block text-sm font-medium leading-6 text-base-content">Allow docker image change</label>
<div class="mt-2">
<Switch @bind-Value="Request.AllowDockerImageChange" />
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Default docker image</label>
<label class="block text-sm font-medium leading-6 text-base-content">Default docker image</label>
<div class="mt-2">
<select @bind="Request.DefaultDockerImage" class="form-select w-full">
<select @bind="Request.DefaultDockerImage" class="select w-full">
@foreach (var dockerImage in DockerImages)
{
var index = DockerImages.IndexOf(dockerImage);

View File

@@ -1,10 +1,8 @@
@using System.Text.Json
@using Microsoft.Extensions.Logging
@using MoonCore.Blazor.FlyonUi.Alerts
@using MoonCore.Blazor.FlyonUi.Modals
@using MoonCore.Blazor.FlyonUi.Toasts
@using MoonCore.Blazor.Tailwind.Alerts
@using MoonCore.Blazor.Tailwind.Modals
@using MoonCore.Blazor.Tailwind.Toasts
@using MoonlightServers.Frontend.UI.Components.Stars.Modals
@using MoonlightServers.Shared.Http.Requests.Admin.Stars
@using MoonlightServers.Shared.Models
@@ -35,11 +33,11 @@ else
</div>
<div class="gap-x-2">
<button @onclick="() => UpdateConfig(configuration)" class="btn btn-primary">
<button type="button" @onclick="() => UpdateConfig(configuration)" class="btn btn-primary">
<i class="icon-settings text-base"></i>
</button>
<button @onclick="() => DeleteConfig(configuration)" class="btn btn-danger">
<button type="button" @onclick="() => DeleteConfig(configuration)" class="btn btn-error">
<i class="icon-trash text-base"></i>
</button>
</div>

View File

@@ -2,21 +2,21 @@
<div>
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6">
<div class="sm:col-span-4">
<label class="block text-sm font-medium leading-6 text-white">Startup Command</label>
<label class="block text-sm font-medium leading-6 text-base-content">Startup Command</label>
<div class="mt-2">
<input @bind="Request.StartupCommand" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.StartupCommand" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Stop Command</label>
<label class="block text-sm font-medium leading-6 text-base-content">Stop Command</label>
<div class="mt-2">
<input @bind="Request.StopCommand" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.StopCommand" type="text" autocomplete="off" class="input w-full">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-sm font-medium leading-6 text-white">Online Detection</label>
<label class="block text-sm font-medium leading-6 text-base-content">Online Detection</label>
<div class="mt-2">
<input @bind="Request.OnlineDetection" type="text" autocomplete="off" class="form-input w-full">
<input @bind="Request.OnlineDetection" type="text" autocomplete="off" class="input w-full">
</div>
</div>
</div>

View File

@@ -2,10 +2,6 @@
@using MoonCore.Blazor.FlyonUi.Components
@using MoonCore.Blazor.FlyonUi.Modals
@using MoonCore.Blazor.FlyonUi.Toasts
@using MoonCore.Blazor.Tailwind.Alerts
@using MoonCore.Blazor.Tailwind.Components
@using MoonCore.Blazor.Tailwind.Modals
@using MoonCore.Blazor.Tailwind.Toasts
@using MoonCore.Helpers
@using MoonCore.Models
@using MoonlightServers.Frontend.UI.Components.Stars.Modals
@@ -34,11 +30,11 @@
</div>
<div class="gap-x-2">
<button @onclick="() => UpdateVariable(variable)" class="btn btn-primary">
<button type="button" @onclick="() => UpdateVariable(variable)" class="btn btn-primary">
<i class="icon-settings text-base"></i>
</button>
<button @onclick="() => DeleteVariable(variable)" class="btn btn-danger">
<button type="button" @onclick="() => DeleteVariable(variable)" class="btn btn-error">
<i class="icon-trash text-base"></i>
</button>
</div>

View File

@@ -1,9 +1,10 @@
@using Microsoft.Extensions.Logging
@using XtermBlazor
@inject IJSRuntime JsRuntime
@inject ILogger<XtermConsole> Logger
<div class="bg-black rounded-lg p-2">
<div class="bg-background rounded-lg p-2">
@if (IsInitialized)
{
<Xterm @ref="Terminal"