1
0
Kevin Matsubara 734a59f38b Replace SessionStorage with ContainerStorage.
This is retained on the SignalR connection and is unique to the user.
2025-03-30 22:32:22 +02:00

59 lines
1.1 KiB
Plaintext

@page "/servername"
@using ServerManagement.StateStore
@inject NavigationManager NavigationManager
@inject ContainerStorage containerStorage
<h3>Server Name</h3>
<br/>
@if (!string.IsNullOrWhiteSpace(errorMessage))
{
<div class="alert alert-danger">
@errorMessage
</div>
}
@if (server != null)
{
<FieldComponent Label="Server name">
<Control>
<input type="text" @bind-value="server.Name" class="form-control"></input>
</Control>
</FieldComponent>
<br/>
<button type="button" class="btn btn-primary" @onclick="GoNext">Next</button>
}
@code {
private Server? server;
private string? errorMessage;
protected override void OnInitialized()
{
base.OnInitialized();
}
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
server = new Server();
StateHasChanged();
}
}
private void GoNext()
{
if (string.IsNullOrWhiteSpace(server?.Name))
{
this.errorMessage = "Server name is required.";
}
else
{
containerStorage.SetServer(server);
NavigationManager.NavigateTo($"/cityname");
}
}
}