Recreated plugin with new project template. Started implementing server system daemon

This commit is contained in:
2026-03-01 21:09:29 +01:00
parent f6b71f4de6
commit 52dbd13fb5
350 changed files with 2795 additions and 21553 deletions

View File

@@ -0,0 +1,74 @@
@using Moonlight.Frontend.Helpers
@using MoonlightServers.Shared
@using MoonlightServers.Shared.Http.Requests
@using MoonlightServers.Shared.Http.Responses
@using ShadcnBlazor.Buttons
@using ShadcnBlazor.Dialogs
@using ShadcnBlazor.Extras.AlertDialogs
@using ShadcnBlazor.Extras.Forms
@using ShadcnBlazor.Fields
@using ShadcnBlazor.Inputs
@inherits ShadcnBlazor.Extras.Dialogs.DialogBase
@inject HttpClient HttpClient
@inject AlertDialogService AlertDialogService
<DialogHeader>
<DialogTitle>Example Form</DialogTitle>
<DialogDescription>This forms removes all spaces from the input</DialogDescription>
</DialogHeader>
<EnhancedEditForm @ref="Form" OnValidSubmit="OnSubmit" Model="Dto">
<DataAnnotationsValidator/>
<FieldSet>
<FormValidationSummary/>
<FieldGroup>
<Field>
<FieldLabel for="formInput">Form Input</FieldLabel>
<TextInputField id="formInput" @bind-Value="Dto.TextField"/>
<FieldDescription>Input you want to remove the spaces from</FieldDescription>
</Field>
</FieldGroup>
</FieldSet>
</EnhancedEditForm>
<DialogFooter>
<Button @onclick="() => Form.SubmitAsync()">Submit</Button>
<DialogClose/>
</DialogFooter>
@code
{
private FormSubmitDto Dto = new();
private EnhancedEditForm Form;
private async Task<bool> OnSubmit(EditContext editContext, ValidationMessageStore validationMessageStore)
{
var response = await HttpClient.PostAsJsonAsync(
"api/form",
Dto,
SerializationContext.Default.Options
);
if (response.IsSuccessStatusCode)
{
var data = await response.Content.ReadFromJsonAsync<FormResultDto>(
SerializationContext.Default.Options
);
if (data == null)
return true;
await AlertDialogService.InfoAsync("Result", data.Result);
await CloseAsync();
return true;
}
await ProblemDetailsHelper.HandleProblemDetailsAsync(response, Dto, validationMessageStore);
return false;
}
}