77 lines
2.6 KiB
Plaintext
77 lines
2.6 KiB
Plaintext
@page "/admin/servers/nodes/create"
|
|
|
|
@using MoonCore.Blazor.FlyonUi.Components
|
|
@using MoonCore.Blazor.FlyonUi.Toasts
|
|
@using MoonCore.Helpers
|
|
@using MoonlightServers.Shared.Http.Requests.Admin.Nodes
|
|
|
|
@inject HttpApiClient ApiClient
|
|
@inject NavigationManager Navigation
|
|
@inject ToastService ToastService
|
|
|
|
@attribute [Authorize(Policy = "permissions:admin.servers.nodes.create")]
|
|
|
|
<PageHeader Title="Create Node">
|
|
<a href="/admin/servers/nodes" class="btn btn-secondary">
|
|
<i class="icon-chevron-left"></i>
|
|
Back
|
|
</a>
|
|
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
|
<i class="icon-check"></i>
|
|
Create
|
|
</WButton>
|
|
</PageHeader>
|
|
|
|
<div class="mt-5">
|
|
<HandleForm @ref="Form" Model="Request" OnValidSubmit="OnSubmit">
|
|
<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-base-content">Name</label>
|
|
<div class="mt-2">
|
|
<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-base-content">Fqdn</label>
|
|
<div class="mt-2">
|
|
<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-base-content">HttpPort</label>
|
|
<div class="mt-2">
|
|
<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-base-content">FtpPort</label>
|
|
<div class="mt-2">
|
|
<input @bind="Request.FtpPort" type="number" autocomplete="off" class="input w-full">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</HandleForm>
|
|
</div>
|
|
|
|
@*
|
|
TODO: EnableTransparentMode, EnableDynamicFirewall
|
|
*@
|
|
|
|
@code
|
|
{
|
|
private HandleForm Form;
|
|
private CreateNodeRequest Request;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
Request = new();
|
|
}
|
|
|
|
private async Task OnSubmit()
|
|
{
|
|
await ApiClient.Post("api/admin/servers/nodes", Request);
|
|
|
|
await ToastService.SuccessAsync("Successfully created node");
|
|
Navigation.NavigateTo("/admin/servers/nodes");
|
|
}
|
|
} |