@page "/"
@using Microsoft.AspNetCore.Components.Web
@using ZB.MOM.WW.OtOpcUa.Admin.Services
@using ZB.MOM.WW.OtOpcUa.Configuration.Entities
@rendermode RenderMode.InteractiveServer
@inject ClusterService ClusterSvc
@inject GenerationService GenerationSvc
@inject NavigationManager Nav
Fleet overview
@if (_clusters is null)
{
}
else if (_clusters.Count == 0)
{
}
else
{
Clusters
@_clusters.Count
Active drafts
@_activeDraftCount
Published generations
@_publishedCount
Disabled clusters
@_disabledCount
Clusters
| Cluster ID |
Name |
Enterprise / Site |
Redundancy |
State |
|
@foreach (var c in _clusters)
{
Nav.NavigateTo($"/clusters/{c.ClusterId}"))">
| @c.ClusterId |
@c.Name |
@c.Enterprise / @c.Site |
@c.RedundancyMode |
@if (c.Enabled)
{
enabled
}
else
{
disabled
}
|
Open |
}
}
@code {
private List? _clusters;
private int _activeDraftCount;
private int _publishedCount;
private int _disabledCount;
protected override async Task OnInitializedAsync()
{
_clusters = await ClusterSvc.ListAsync(CancellationToken.None);
_disabledCount = _clusters.Count(c => !c.Enabled);
foreach (var c in _clusters)
{
var gens = await GenerationSvc.ListRecentAsync(c.ClusterId, 50, CancellationToken.None);
_activeDraftCount += gens.Count(g => g.Status.ToString() == "Draft");
_publishedCount += gens.Count(g => g.Status.ToString() == "Published");
}
}
}