Implemented node crud and status health check. Added daemon status health endpoint. Refactored project structure. Added sidebar items and ui views

This commit is contained in:
2026-03-05 10:56:52 +00:00
parent 2d1b48b0d4
commit 7c5dc657dc
54 changed files with 1808 additions and 222 deletions

View File

@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace MoonlightServers.Shared.Admin.Nodes;
public class CreateNodeDto
{
[Required]
[MaxLength(50)]
public string Name { get; set; }
[Required]
[MaxLength(100)]
public string HttpEndpointUrl { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace MoonlightServers.Shared.Admin.Nodes;
public record NodeDto(
int Id,
string Name,
string HttpEndpointUrl,
DateTimeOffset CreatedAt,
DateTimeOffset UpdatedAt
);

View File

@@ -0,0 +1,8 @@
namespace MoonlightServers.Shared.Admin.Nodes;
public class NodeHealthDto
{
public int RemoteStatusCode { get; set; }
public int StatusCode { get; set; }
public bool IsHealthy { get; set; }
}

View File

@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace MoonlightServers.Shared.Admin.Nodes;
public class UpdateNodeDto
{
[Required]
[MaxLength(50)]
public string Name { get; set; }
[Required]
[MaxLength(100)]
public string HttpEndpointUrl { get; set; }
}

View File

@@ -1,8 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace MoonlightServers.Shared.Http.Requests;
public class FormSubmitDto
{
[Required] [MaxLength(32)] public string TextField { get; set; }
}

View File

@@ -1,6 +0,0 @@
namespace MoonlightServers.Shared.Http.Responses;
public class FormResultDto
{
public string Result { get; set; }
}

View File

@@ -6,4 +6,12 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Moonlight.Shared" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Client\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,15 @@
namespace MoonlightServers.Shared;
public static class Permissions
{
public const string Prefix = "Permissions:Servers.";
public static class Nodes
{
private const string Section = "Nodes";
public const string View = $"{Prefix}{Section}.{nameof(View)}";
public const string Edit = $"{Prefix}{Section}.{nameof(Edit)}";
public const string Create = $"{Prefix}{Section}.{nameof(Create)}";
public const string Delete = $"{Prefix}{Section}.{nameof(Delete)}";
}
}

View File

@@ -1,13 +1,21 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using MoonlightServers.Shared.Http.Requests;
using MoonlightServers.Shared.Http.Responses;
using Moonlight.Shared.Http.Responses;
using MoonlightServers.Shared.Admin.Nodes;
namespace MoonlightServers.Shared;
[JsonSerializable(typeof(FormSubmitDto))]
[JsonSerializable(typeof(FormResultDto))]
// Admin
// - Node
[JsonSerializable(typeof(CreateNodeDto))]
[JsonSerializable(typeof(UpdateNodeDto))]
[JsonSerializable(typeof(NodeDto))]
[JsonSerializable(typeof(PagedData<NodeDto>))]
[JsonSourceGenerationOptions(JsonSerializerDefaults.Web)]
public partial class SerializationContext : JsonSerializerContext
{
}