Added multi allocation actions in node update page

This commit is contained in:
2024-12-14 18:38:12 +01:00
parent 680827e0ea
commit 747712c5c4
4 changed files with 167 additions and 10 deletions

View File

@@ -0,0 +1,55 @@
@using MoonCore.Blazor.Tailwind.Modals.Components
@using MoonCore.Blazor.Tailwind.Components
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
@inherits BaseModal
<h1 class="mb-5 font-semibold text-xl">Add a range of new allocations</h1>
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
<div class="grid grid-cols-1 gap-2">
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">IP Address</label>
<input @bind="Form.IpAddress" type="text" class="form-input w-full"/>
</div>
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">Start Port</label>
<input @bind="Form.Start" type="text" class="form-input w-full"/>
</div>
<div class="col-span-1">
<label class="block text-sm font-medium leading-6 text-white">End Port</label>
<input @bind="Form.End" type="text" class="form-input w-full"/>
</div>
</div>
</HandleForm>
<div class="mt-5 flex space-x-2">
<WButton OnClick="_ => Hide()" CssClasses="btn btn-secondary grow">Cancel</WButton>
<WButton OnClick="_ => Submit()" CssClasses="btn btn-primary grow">Create</WButton>
</div>
@code
{
[Parameter] public Func<CreateNodeAllocationRangeRequest, Task> OnSubmit { get; set; }
private CreateNodeAllocationRangeRequest Form;
private HandleForm HandleForm;
protected override void OnInitialized()
{
Form = new()
{
IpAddress = "0.0.0.0"
};
}
private async Task OnValidSubmit()
{
await OnSubmit.Invoke(Form);
await Hide();
}
private Task Submit() => HandleForm.Submit();
}