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

65 lines
1.2 KiB
Plaintext

@page "/cityname"
@using ServerManagement.StateStore
@inject NavigationManager NavigationManager
@inject ContainerStorage containerStorage
<h3>City Name</h3>
<br/>
@if (!string.IsNullOrWhiteSpace(errorMessage))
{
<div class="alert alert-danger">
@errorMessage
</div>
}
@if (server != null)
{
<FieldComponent Label="City name">
<Control>
<input type="text" @bind-value="server.City" 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;
[SupplyParameterFromQuery]
private string? ServerName { get; set; }
protected override void OnInitialized()
{
base.OnInitialized();
}
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
this.server = containerStorage.GetServer();
StateHasChanged();
}
}
private void GoNext()
{
if (server != null)
{
if (string.IsNullOrWhiteSpace(server.City))
{
this.errorMessage = "City name is required.";
}
else
{
containerStorage.SetServer(server);
NavigationManager.NavigateTo($"/serverstatus");
}
}
}
}