Refactored frontend to work with the latest mooncore changes
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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}"
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -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}"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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}"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user