1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2024-10-17 12:42:51 +02:00
Minecraft-Phantom-Panel/Web/Phantom.Web/Pages/InstanceEdit.razor

38 lines
917 B
Plaintext

@page "/instances/{InstanceGuid:guid}/edit"
@attribute [Authorize(Permission.CreateInstancesPolicy)]
@using Phantom.Common.Data.Web.Instance
@using Phantom.Common.Data.Web.Users
@using Phantom.Web.Services.Instances
@inherits PhantomComponent
@inject InstanceManager InstanceManager
@if (isLoading) {
<h1>Edit Instance</h1>
<p>Loading...</p>
return;
}
@if (Instance == null) {
<h1>Instance Not Found</h1>
<p>Return to <a href="instances">all instances</a>.</p>
return;
}
<h1>Edit Instance: @Instance.Configuration.InstanceName</h1>
<InstanceAddOrEditForm EditedInstance="Instance" />
@code {
[Parameter]
public Guid InstanceGuid { get; init; }
private Instance? Instance { get; set; }
private bool isLoading = true;
protected override async Task OnInitializedAsync() {
Instance = InstanceManager.GetByGuid(await GetAuthenticatedUser(), InstanceGuid);
isLoading = false;
}
}