58 lines
1.8 KiB
Plaintext
58 lines
1.8 KiB
Plaintext
@page "/admin/webspaces/servers/new"
|
|
@using Moonlight.App.Repositories
|
|
@using Moonlight.App.Models.Forms
|
|
@using Moonlight.App.Database.Entities
|
|
@using Mappy.Net
|
|
|
|
@inject Repository<CloudPanel> CloudPanelRepository
|
|
@inject NavigationManager NavigationManager
|
|
|
|
<OnlyAdmin>
|
|
<div class="card card-body p-10">
|
|
<SmartForm Model="Model" OnValidSubmit="OnValidSubmit">
|
|
<label class="form-label">
|
|
<TL>Name</TL>
|
|
</label>
|
|
<div class="input-group mb-5">
|
|
<InputText @bind-Value="Model.Name" class="form-control"></InputText>
|
|
</div>
|
|
<label class="form-label">
|
|
<TL>Host</TL>
|
|
</label>
|
|
<div class="input-group mb-5">
|
|
<InputText @bind-Value="Model.Host" class="form-control"></InputText>
|
|
</div>
|
|
<label class="form-label">
|
|
<TL>Api Url</TL>
|
|
</label>
|
|
<div class="input-group mb-5">
|
|
<InputText @bind-Value="Model.ApiUrl" class="form-control"></InputText>
|
|
</div>
|
|
<label class="form-label">
|
|
<TL>Api Key</TL>
|
|
</label>
|
|
<div class="input-group mb-5">
|
|
<InputText @bind-Value="Model.ApiKey" class="form-control"></InputText>
|
|
</div>
|
|
<div>
|
|
<button type="submit" class="btn btn-primary float-end">
|
|
<TL>Create</TL>
|
|
</button>
|
|
</div>
|
|
</SmartForm>
|
|
</div>
|
|
</OnlyAdmin>
|
|
|
|
@code
|
|
{
|
|
private CloudPanelDataModel Model = new();
|
|
|
|
private Task OnValidSubmit()
|
|
{
|
|
CloudPanelRepository.Add(Mapper.Map<CloudPanel>(Model));
|
|
|
|
NavigationManager.NavigateTo("/admin/webspaces/servers");
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
} |