59 lines
2.0 KiB
Plaintext
59 lines
2.0 KiB
Plaintext
@using MoonCore.Blazor.FlyonUi.Components
|
|
@using MoonlightServers.Frontend.UI.Components.Forms
|
|
@using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages
|
|
@using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages
|
|
|
|
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
|
|
|
<h1 class="mb-5 font-semibold text-xl">Update variable</h1>
|
|
|
|
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
|
<div class="grid grid-cols-2 gap-2">
|
|
<div class="col-span-2">
|
|
<label class="block text-sm font-medium leading-6 text-base-content">Display Name</label>
|
|
<input @bind="Form.DisplayName" type="text" class="input w-full"/>
|
|
</div>
|
|
|
|
<div class="col-span-2">
|
|
<label class="block text-sm font-medium leading-6 text-base-content">Identifier</label>
|
|
<input @bind="Form.Identifier" type="text" class="input w-full"/>
|
|
</div>
|
|
|
|
<div class="col-span-2">
|
|
<label class="block text-sm font-medium leading-6 text-base-content">Automatic pulling</label>
|
|
<Switch @bind-Value="Form.AutoPulling"/>
|
|
</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">Update</WButton>
|
|
</div>
|
|
|
|
@code
|
|
{
|
|
[Parameter] public Func<UpdateStarDockerImageRequest, Task> OnSubmit { get; set; }
|
|
[Parameter] public StarDockerImageResponse DockerImage { get; set; }
|
|
|
|
private UpdateStarDockerImageRequest Form;
|
|
private HandleForm HandleForm;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
Form = new UpdateStarDockerImageRequest()
|
|
{
|
|
AutoPulling = DockerImage.AutoPulling,
|
|
DisplayName = DockerImage.DisplayName,
|
|
Identifier = DockerImage.Identifier
|
|
};
|
|
}
|
|
|
|
private async Task OnValidSubmit()
|
|
{
|
|
await OnSubmit.Invoke(Form);
|
|
await Hide();
|
|
}
|
|
|
|
private Task Submit() => HandleForm.Submit();
|
|
} |