65 lines
2.1 KiB
Plaintext
65 lines
2.1 KiB
Plaintext
@using MoonCore.Blazor.FlyonUi.Components
|
|
@using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations
|
|
@using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations
|
|
|
|
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
|
|
|
<div class="p-5">
|
|
<div class="flex items-center gap-4">
|
|
<div class="avatar avatar-placeholder max-sm:hidden">
|
|
<div class="border-base-content/20 rounded-box w-13 border-1">
|
|
<span class="icon-ethernet-port text-xl"></span>
|
|
</div>
|
|
</div>
|
|
<div class="space-y-1">
|
|
<h3 class="text-base-content text-2xl font-semibold">Update allocation</h3>
|
|
<p class="text-base-content/80">Update an existing allocation</p>
|
|
</div>
|
|
</div>
|
|
<div class="mt-5">
|
|
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
|
<div class="mt-2">
|
|
<label class="label-text">IP Address</label>
|
|
<input class="input" @bind="Form.IpAddress" type="text"/>
|
|
</div>
|
|
<div class="mt-2">
|
|
<label class="label-text">Port</label>
|
|
<input class="input" @bind="Form.Port" type="number"/>
|
|
</div>
|
|
</HandleForm>
|
|
</div>
|
|
<div class="mt-5 flex justify-end">
|
|
<button @onclick="HideAsync" type="button" class="btn btn-secondary me-2">
|
|
Cancel
|
|
</button>
|
|
<WButton OnClick="SubmitAsync">
|
|
Update
|
|
</WButton>
|
|
</div>
|
|
</div>
|
|
|
|
@code
|
|
{
|
|
[Parameter] public Func<UpdateNodeAllocationRequest, Task> OnSubmit { get; set; }
|
|
[Parameter] public NodeAllocationResponse Allocation { get; set; }
|
|
|
|
private UpdateNodeAllocationRequest Form;
|
|
private HandleForm HandleForm;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
Form = new UpdateNodeAllocationRequest()
|
|
{
|
|
IpAddress = Allocation.IpAddress,
|
|
Port = Allocation.Port
|
|
};
|
|
}
|
|
|
|
private async Task OnValidSubmit()
|
|
{
|
|
await OnSubmit.Invoke(Form);
|
|
await HideAsync();
|
|
}
|
|
|
|
private Task SubmitAsync() => HandleForm.SubmitAsync();
|
|
} |