Files
lmxopcua/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/Clusters/ClusterRedundancy.razor
T
Joseph Doherty 396052a126
v2-ci / build (push) Failing after 38s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (push) Has been skipped
feat(adminui): F15 Phase C — config-tab read views (Equipment/UNS/Namespaces/Drivers/Tags/ACLs)
Per Q3 of the rebuild plan, each v1 ClusterDetail tab becomes a separate
route under /clusters/{id}/<tab>. This batch adds read-only table views
for the six core config entity types; live-edit forms with RowVersion
concurrency land in Phase C.2 once the read-view shape is reviewed.

- ClusterEquipment    /clusters/{id}/equipment   — joins via DriverInstance
                                                   so the cluster scope works
- ClusterUns          /clusters/{id}/uns         — Areas + Lines tables
- ClusterNamespaces   /clusters/{id}/namespaces  — Kind + URI + Enabled chip
- ClusterDrivers      /clusters/{id}/drivers     — collapsed list with JSON
                                                   config expandable per Q1
                                                   (typed editors deferred)
- ClusterTags         /clusters/{id}/tags        — first 200 by name + filter
- ClusterAcls         /clusters/{id}/acls        — LDAP group + scope +
                                                   NodePermissions bits

Shared ClusterNav.razor extracted; ClusterOverview + ClusterRedundancy
updated to use it. _Imports.razor adds Components.Shared so the shared
nav is in scope across pages.
2026-05-26 07:56:39 -04:00

109 lines
4.2 KiB
Plaintext

@page "/clusters/{ClusterId}/redundancy"
@attribute [Microsoft.AspNetCore.Authorization.Authorize]
@rendermode RenderMode.InteractiveServer
@using Microsoft.EntityFrameworkCore
@using ZB.MOM.WW.OtOpcUa.Configuration
@using ZB.MOM.WW.OtOpcUa.Configuration.Entities
@inject IDbContextFactory<OtOpcUaConfigDbContext> DbFactory
@if (!_loaded)
{
<p>Loading…</p>
}
else if (_cluster is null)
{
<section class="panel notice rise" style="animation-delay:.02s">
Cluster <span class="mono">@ClusterId</span> was not found.
<a class="ms-2" href="/clusters">Back to list</a>.
</section>
}
else
{
<div class="d-flex justify-content-between align-items-center mb-3">
<div>
<h4 class="mb-0">@_cluster.Name &middot; Redundancy</h4>
<span class="mono text-muted">@_cluster.ClusterId</span>
</div>
</div>
<ClusterNav ClusterId="@ClusterId" ActiveTab="redundancy" />
<section class="panel notice rise" style="animation-delay:.02s">
v2 redundancy is computed at runtime by <span class="mono">RedundancyStateActor</span>
on each admin node. The values below are the static configuration; the resolved live
<span class="mono">ServiceLevel</span> for each peer is broadcast on the
<span class="mono">redundancy-state</span> DPS topic and consumed by the OPC UA host's
<span class="mono">ServerStatus</span> publisher. See
<a href="/docs/v2/Architecture-v2.md">docs/v2/Architecture-v2.md</a>.
</section>
<section class="card-grid rise mt-3" style="animation-delay:.08s">
<div class="metric-card">
<div class="panel-head">Cluster redundancy</div>
<div class="kv"><span class="k">Mode</span><span class="v">@_cluster.RedundancyMode</span></div>
<div class="kv"><span class="k">Node count</span><span class="v">@_cluster.NodeCount</span></div>
</div>
</section>
<section class="panel rise mt-3" style="animation-delay:.14s">
<div class="panel-head">Node service-level configuration</div>
@if (_nodes is null || _nodes.Count == 0)
{
<div style="padding:1rem" class="text-muted">No nodes registered.</div>
}
else
{
<div class="table-wrap">
<table class="data-table">
<thead>
<tr>
<th>Node ID</th>
<th>ApplicationUri</th>
<th class="num">ServiceLevel base</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
@foreach (var n in _nodes)
{
<tr>
<td><span class="mono">@n.NodeId</span></td>
<td><span class="mono small">@n.ApplicationUri</span></td>
<td class="num">@n.ServiceLevelBase</td>
<td class="text-muted small">
@if (n.ServiceLevelBase >= 200) { <text>Primary preference</text> }
else if (n.ServiceLevelBase >= 100) { <text>Secondary preference</text> }
else { <text>Custom</text> }
</td>
</tr>
}
</tbody>
</table>
</div>
}
</section>
}
@code {
[Parameter] public string ClusterId { get; set; } = "";
private bool _loaded;
private ServerCluster? _cluster;
private List<ClusterNode>? _nodes;
protected override async Task OnInitializedAsync()
{
await using var db = await DbFactory.CreateDbContextAsync();
_cluster = await db.ServerClusters.AsNoTracking()
.FirstOrDefaultAsync(c => c.ClusterId == ClusterId);
if (_cluster is not null)
{
_nodes = await db.ClusterNodes.AsNoTracking()
.Where(n => n.ClusterId == ClusterId)
.OrderBy(n => n.NodeId)
.ToListAsync();
}
_loaded = true;
}
}