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:
14
MoonlightServers.Shared/Admin/Nodes/CreateNodeDto.cs
Normal file
14
MoonlightServers.Shared/Admin/Nodes/CreateNodeDto.cs
Normal 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; }
|
||||
}
|
||||
9
MoonlightServers.Shared/Admin/Nodes/NodeDto.cs
Normal file
9
MoonlightServers.Shared/Admin/Nodes/NodeDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace MoonlightServers.Shared.Admin.Nodes;
|
||||
|
||||
public record NodeDto(
|
||||
int Id,
|
||||
string Name,
|
||||
string HttpEndpointUrl,
|
||||
DateTimeOffset CreatedAt,
|
||||
DateTimeOffset UpdatedAt
|
||||
);
|
||||
8
MoonlightServers.Shared/Admin/Nodes/NodeHealthDto.cs
Normal file
8
MoonlightServers.Shared/Admin/Nodes/NodeHealthDto.cs
Normal 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; }
|
||||
}
|
||||
14
MoonlightServers.Shared/Admin/Nodes/UpdateNodeDto.cs
Normal file
14
MoonlightServers.Shared/Admin/Nodes/UpdateNodeDto.cs
Normal 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; }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests;
|
||||
|
||||
public class FormSubmitDto
|
||||
{
|
||||
[Required] [MaxLength(32)] public string TextField { get; set; }
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses;
|
||||
|
||||
public class FormResultDto
|
||||
{
|
||||
public string Result { get; set; }
|
||||
}
|
||||
@@ -6,4 +6,12 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Moonlight.Shared" Version="2.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Client\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
15
MoonlightServers.Shared/Permissions.cs
Normal file
15
MoonlightServers.Shared/Permissions.cs
Normal 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)}";
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user