@page "/clusters/{ClusterId}" @using Microsoft.AspNetCore.Components.Web @using Microsoft.AspNetCore.SignalR.Client @using ZB.MOM.WW.OtOpcUa.Admin.Hubs @using ZB.MOM.WW.OtOpcUa.Admin.Services @using ZB.MOM.WW.OtOpcUa.Configuration.Entities @using ZB.MOM.WW.OtOpcUa.Configuration.Enums @implements IAsyncDisposable @rendermode RenderMode.InteractiveServer @inject ClusterService ClusterSvc @inject GenerationService GenerationSvc @inject NavigationManager Nav @if (_cluster is null) {
Loading…
} else { @if (_liveBanner is not null) {@_cluster.ClusterId
@if (!_cluster.Enabled) { Disabled }
Open a draft to edit this cluster's content.
} } @code { [Parameter] public string ClusterId { get; set; } = string.Empty; private ServerCluster? _cluster; private ConfigGeneration? _currentDraft; private ConfigGeneration? _currentPublished; private string _tab = "overview"; private bool _busy; private HubConnection? _hub; private string? _liveBanner; private string Tab(string key) => _tab == key ? "active" : string.Empty; protected override async Task OnInitializedAsync() { await LoadAsync(); await ConnectHubAsync(); } private async Task LoadAsync() { _cluster = await ClusterSvc.FindAsync(ClusterId, CancellationToken.None); var gens = await GenerationSvc.ListRecentAsync(ClusterId, 50, CancellationToken.None); _currentDraft = gens.FirstOrDefault(g => g.Status == GenerationStatus.Draft); _currentPublished = gens.FirstOrDefault(g => g.Status == GenerationStatus.Published); } private async Task ConnectHubAsync() { _hub = new HubConnectionBuilder() .WithUrl(Nav.ToAbsoluteUri("/hubs/fleet")) .WithAutomaticReconnect() .Build(); _hub.On