feat(adminui): F15 Phase C — config-tab read views (Equipment/UNS/Namespaces/Drivers/Tags/ACLs)
Some checks failed
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

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.
This commit is contained in:
Joseph Doherty
2026-05-26 07:56:39 -04:00
parent fd0cc4dfdb
commit 396052a126
9 changed files with 574 additions and 8 deletions

View File

@@ -0,0 +1,96 @@
@page "/clusters/{ClusterId}/acls"
@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
<div class="d-flex justify-content-between align-items-center mb-3">
<h4 class="mb-0">ACLs &middot; <span class="mono">@ClusterId</span></h4>
</div>
<ClusterNav ClusterId="@ClusterId" ActiveTab="acls" />
@if (_rows is null)
{
<p>Loading…</p>
}
else
{
<section class="panel notice rise" style="animation-delay:.02s">
ACL rows grant LDAP groups specific <span class="mono">NodePermissions</span> on a scope
(a folder, an equipment, a tag). Q4 of the AdminUI rebuild plan dropped per-cluster role
grants in favour of fleet-wide LDAP-group → role mapping; ACLs here are the finer-grained
per-node scope. Live editing lands in a Phase C.2 follow-up.
</section>
<section class="panel rise mt-3" style="animation-delay:.08s">
<div class="panel-head">@_rows.Count ACL row@(_rows.Count == 1 ? "" : "s")</div>
@if (_rows.Count == 0)
{
<div style="padding:1rem" class="text-muted">No ACL rows for this cluster — default permissions from the fleet-wide LDAP group mapping apply.</div>
}
else
{
<div class="table-wrap">
<table class="data-table">
<thead>
<tr>
<th>NodeAclId</th>
<th>LDAP group</th>
<th>Scope</th>
<th>Scope target</th>
<th>Permissions</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
@foreach (var a in _rows)
{
<tr>
<td><span class="mono small">@a.NodeAclId</span></td>
<td><span class="mono">@a.LdapGroup</span></td>
<td>@a.ScopeKind</td>
<td><span class="mono small">@(a.ScopeId ?? "—")</span></td>
<td>
@foreach (var perm in PermissionChips(a.PermissionFlags))
{
<span class="chip chip-idle me-1">@perm</span>
}
</td>
<td class="text-muted small">@(a.Notes ?? "")</td>
</tr>
}
</tbody>
</table>
</div>
}
</section>
}
@code {
[Parameter] public string ClusterId { get; set; } = "";
private List<NodeAcl>? _rows;
protected override async Task OnInitializedAsync()
{
await using var db = await DbFactory.CreateDbContextAsync();
_rows = await db.NodeAcls.AsNoTracking()
.Where(a => a.ClusterId == ClusterId)
.OrderBy(a => a.NodeAclId)
.ToListAsync();
}
private static IEnumerable<string> PermissionChips(ZB.MOM.WW.OtOpcUa.Configuration.Enums.NodePermissions flags)
{
foreach (var v in Enum.GetValues<ZB.MOM.WW.OtOpcUa.Configuration.Enums.NodePermissions>())
{
// Skip None (zero) and composite values that aren't single bits.
var n = (int)v;
if (n == 0) continue;
if ((n & (n - 1)) != 0) continue;
if (flags.HasFlag(v)) yield return v.ToString();
}
}
}

View File

@@ -0,0 +1,86 @@
@page "/clusters/{ClusterId}/drivers"
@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
<div class="d-flex justify-content-between align-items-center mb-3">
<h4 class="mb-0">Drivers &middot; <span class="mono">@ClusterId</span></h4>
</div>
<ClusterNav ClusterId="@ClusterId" ActiveTab="drivers" />
@if (_rows is null)
{
<p>Loading…</p>
}
else
{
<section class="panel notice rise" style="animation-delay:.02s">
Per Q1 of the AdminUI rebuild plan, typed driver editors (Modbus, FOCAS) are deferred.
The expanded view below shows raw JSON config. Live editing — including a generic JSON
editor and per-driver-type forms when operators ask — lands in a Phase C.2 follow-up.
</section>
<section class="panel rise mt-3" style="animation-delay:.08s">
<div class="panel-head">@_rows.Count driver instance@(_rows.Count == 1 ? "" : "s")</div>
@if (_rows.Count == 0)
{
<div style="padding:1rem" class="text-muted">No driver instances for this cluster.</div>
}
else
{
@foreach (var d in _rows)
{
<details style="border-top:1px solid var(--rule)">
<summary style="padding:.75rem 1rem;cursor:pointer">
<span class="mono">@d.DriverInstanceId</span>
&middot; <span>@d.Name</span>
&middot; <span class="chip chip-idle ms-1">@d.DriverType</span>
@if (!d.Enabled) { <span class="chip chip-idle ms-1">Disabled</span> }
<span class="text-muted small ms-2">ns=@d.NamespaceId</span>
</summary>
<div style="padding:0 1rem 1rem">
<pre class="mono small" style="background:var(--surface-2);padding:1rem;border-radius:4px;overflow:auto">@FormatJson(d.DriverConfig)</pre>
@if (!string.IsNullOrWhiteSpace(d.ResilienceConfig))
{
<div class="text-muted small mt-2">Resilience overrides:</div>
<pre class="mono small" style="background:var(--surface-2);padding:1rem;border-radius:4px;overflow:auto">@FormatJson(d.ResilienceConfig)</pre>
}
</div>
</details>
}
}
</section>
}
@code {
[Parameter] public string ClusterId { get; set; } = "";
private List<DriverInstance>? _rows;
protected override async Task OnInitializedAsync()
{
await using var db = await DbFactory.CreateDbContextAsync();
_rows = await db.DriverInstances.AsNoTracking()
.Where(d => d.ClusterId == ClusterId)
.OrderBy(d => d.DriverInstanceId)
.ToListAsync();
}
private static string FormatJson(string raw)
{
if (string.IsNullOrWhiteSpace(raw)) return "";
try
{
using var doc = System.Text.Json.JsonDocument.Parse(raw);
return System.Text.Json.JsonSerializer.Serialize(doc.RootElement,
new System.Text.Json.JsonSerializerOptions { WriteIndented = true });
}
catch
{
return raw;
}
}
}

View File

@@ -0,0 +1,85 @@
@page "/clusters/{ClusterId}/equipment"
@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
<div class="d-flex justify-content-between align-items-center mb-3">
<h4 class="mb-0">Equipment &middot; <span class="mono">@ClusterId</span></h4>
</div>
<ClusterNav ClusterId="@ClusterId" ActiveTab="equipment" />
@if (_rows is null)
{
<p>Loading…</p>
}
else
{
<section class="panel notice rise" style="animation-delay:.02s">
Equipment rows are scoped to a UNS line and bound to a single driver. EquipmentId is
system-generated (decision #125); browse identifiers are MachineCode (operator) + ZTag
(ERP). Live editing lands in a Phase C.2 follow-up.
</section>
<section class="panel rise mt-3" style="animation-delay:.08s">
<div class="panel-head">@_rows.Count equipment row@(_rows.Count == 1 ? "" : "s")</div>
@if (_rows.Count == 0)
{
<div style="padding:1rem" class="text-muted">No equipment defined for this cluster.</div>
}
else
{
<div class="table-wrap">
<table class="data-table">
<thead>
<tr>
<th>EquipmentId</th>
<th>Name</th>
<th>MachineCode</th>
<th>ZTag</th>
<th>Driver</th>
<th>UNS line</th>
<th>Identification</th>
</tr>
</thead>
<tbody>
@foreach (var e in _rows)
{
<tr>
<td><span class="mono small">@e.EquipmentId</span></td>
<td>@e.Name</td>
<td><span class="mono">@e.MachineCode</span></td>
<td>@(e.ZTag ?? "—")</td>
<td><span class="mono small">@e.DriverInstanceId</span></td>
<td><span class="mono small">@e.UnsLineId</span></td>
<td class="text-muted small">
@if (!string.IsNullOrWhiteSpace(e.Manufacturer)) { <span>@e.Manufacturer</span> }
@if (!string.IsNullOrWhiteSpace(e.Model)) { <span class="ms-1">/ @e.Model</span> }
</td>
</tr>
}
</tbody>
</table>
</div>
}
</section>
}
@code {
[Parameter] public string ClusterId { get; set; } = "";
private List<Equipment>? _rows;
protected override async Task OnInitializedAsync()
{
await using var db = await DbFactory.CreateDbContextAsync();
var driversInCluster = db.DriverInstances.AsNoTracking()
.Where(d => d.ClusterId == ClusterId).Select(d => d.DriverInstanceId);
_rows = await db.Equipment.AsNoTracking()
.Where(e => driversInCluster.Contains(e.DriverInstanceId))
.OrderBy(e => e.Name)
.ToListAsync();
}
}

View File

@@ -0,0 +1,79 @@
@page "/clusters/{ClusterId}/namespaces"
@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
<div class="d-flex justify-content-between align-items-center mb-3">
<h4 class="mb-0">Namespaces &middot; <span class="mono">@ClusterId</span></h4>
</div>
<ClusterNav ClusterId="@ClusterId" ActiveTab="namespaces" />
@if (_rows is null)
{
<p>Loading…</p>
}
else
{
<section class="panel notice rise" style="animation-delay:.02s">
Namespaces are content (decision #123) — they're served at the OPC UA endpoint and bound
to driver instances. NamespaceUri must be unique fleet-wide. Live editing lands in a
Phase C.2 follow-up.
</section>
<section class="panel rise mt-3" style="animation-delay:.08s">
<div class="panel-head">@_rows.Count namespace@(_rows.Count == 1 ? "" : "s")</div>
@if (_rows.Count == 0)
{
<div style="padding:1rem" class="text-muted">No namespaces defined for this cluster.</div>
}
else
{
<div class="table-wrap">
<table class="data-table">
<thead>
<tr>
<th>NamespaceId</th>
<th>Kind</th>
<th>URI</th>
<th>Status</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
@foreach (var n in _rows)
{
<tr>
<td><span class="mono">@n.NamespaceId</span></td>
<td>@n.Kind</td>
<td><span class="mono small">@n.NamespaceUri</span></td>
<td>
@if (n.Enabled) { <span class="chip chip-ok">Enabled</span> }
else { <span class="chip chip-idle">Disabled</span> }
</td>
<td class="text-muted small">@(n.Notes ?? "")</td>
</tr>
}
</tbody>
</table>
</div>
}
</section>
}
@code {
[Parameter] public string ClusterId { get; set; } = "";
private List<Namespace>? _rows;
protected override async Task OnInitializedAsync()
{
await using var db = await DbFactory.CreateDbContextAsync();
_rows = await db.Namespaces.AsNoTracking()
.Where(n => n.ClusterId == ClusterId)
.OrderBy(n => n.NamespaceId)
.ToListAsync();
}
}

View File

@@ -31,10 +31,7 @@ else
</div> </div>
</div> </div>
<ul class="nav nav-tabs mb-3"> <ClusterNav ClusterId="@ClusterId" ActiveTab="overview" />
<li class="nav-item"><a class="nav-link active" href="/clusters/@ClusterId">Overview</a></li>
<li class="nav-item"><a class="nav-link" href="/clusters/@ClusterId/redundancy">Redundancy</a></li>
</ul>
<section class="card-grid rise" style="animation-delay:.08s"> <section class="card-grid rise" style="animation-delay:.08s">
<div class="metric-card"> <div class="metric-card">

View File

@@ -26,10 +26,7 @@ else
</div> </div>
</div> </div>
<ul class="nav nav-tabs mb-3"> <ClusterNav ClusterId="@ClusterId" ActiveTab="redundancy" />
<li class="nav-item"><a class="nav-link" href="/clusters/@ClusterId">Overview</a></li>
<li class="nav-item"><a class="nav-link active" href="/clusters/@ClusterId/redundancy">Redundancy</a></li>
</ul>
<section class="panel notice rise" style="animation-delay:.02s"> <section class="panel notice rise" style="animation-delay:.02s">
v2 redundancy is computed at runtime by <span class="mono">RedundancyStateActor</span> v2 redundancy is computed at runtime by <span class="mono">RedundancyStateActor</span>

View File

@@ -0,0 +1,103 @@
@page "/clusters/{ClusterId}/tags"
@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
<div class="d-flex justify-content-between align-items-center mb-3">
<h4 class="mb-0">Tags &middot; <span class="mono">@ClusterId</span></h4>
</div>
<ClusterNav ClusterId="@ClusterId" ActiveTab="tags" />
@if (_rows is null)
{
<p>Loading…</p>
}
else
{
<section class="panel notice rise" style="animation-delay:.02s">
Tags are bound to a driver instance and (optionally) an equipment + poll group. The view
below shows the first @PageSize tags by Name; full pagination + search land in Phase C.2.
</section>
<div class="d-flex align-items-center mb-3 gap-2 mt-3">
<input type="text" class="form-control form-control-sm" style="max-width:300px"
placeholder="Filter by name (substring)…"
@bind="_filter" @bind:event="oninput" />
<span class="text-muted small">
Showing @VisibleRows.Count of @_rows.Count
</span>
</div>
<section class="panel rise" style="animation-delay:.08s">
<div class="panel-head">Tags</div>
@if (VisibleRows.Count == 0)
{
<div style="padding:1rem" class="text-muted">No tags match the current filter.</div>
}
else
{
<div class="table-wrap">
<table class="data-table">
<thead>
<tr>
<th>TagId</th>
<th>Name</th>
<th>Driver</th>
<th>Equipment</th>
<th>Data type</th>
<th>Access</th>
<th>Folder</th>
<th>Poll group</th>
</tr>
</thead>
<tbody>
@foreach (var t in VisibleRows)
{
<tr>
<td><span class="mono small">@t.TagId</span></td>
<td>@t.Name</td>
<td><span class="mono small">@t.DriverInstanceId</span></td>
<td>@(t.EquipmentId ?? "—")</td>
<td><span class="mono small">@t.DataType</span></td>
<td>@t.AccessLevel</td>
<td class="text-muted small">@(t.FolderPath ?? "")</td>
<td>@(t.PollGroupId ?? "—")</td>
</tr>
}
</tbody>
</table>
</div>
}
</section>
}
@code {
private const int PageSize = 200;
[Parameter] public string ClusterId { get; set; } = "";
private List<Tag>? _rows;
private string _filter = "";
private List<Tag> VisibleRows => (_rows ?? new())
.Where(t => string.IsNullOrWhiteSpace(_filter)
|| t.Name.Contains(_filter, StringComparison.OrdinalIgnoreCase))
.Take(PageSize)
.ToList();
protected override async Task OnInitializedAsync()
{
await using var db = await DbFactory.CreateDbContextAsync();
// Tags don't carry ClusterId; resolve via DriverInstance scoping.
var driverIds = db.DriverInstances.AsNoTracking()
.Where(d => d.ClusterId == ClusterId)
.Select(d => d.DriverInstanceId);
_rows = await db.Tags.AsNoTracking()
.Where(t => driverIds.Contains(t.DriverInstanceId))
.OrderBy(t => t.Name)
.ToListAsync();
}
}

View File

@@ -0,0 +1,99 @@
@page "/clusters/{ClusterId}/uns"
@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
<div class="d-flex justify-content-between align-items-center mb-3">
<h4 class="mb-0">UNS structure &middot; <span class="mono">@ClusterId</span></h4>
</div>
<ClusterNav ClusterId="@ClusterId" ActiveTab="uns" />
@if (_areas is null || _lines is null)
{
<p>Loading…</p>
}
else
{
<section class="panel notice rise" style="animation-delay:.02s">
UNS levels: Enterprise (cluster) → Site (cluster) → Area → Line → Equipment. Areas and
lines are cluster-scoped; equipment hangs under a single line. Live editing lands in a
Phase C.2 follow-up.
</section>
<section class="panel rise mt-3" style="animation-delay:.08s">
<div class="panel-head">Areas (level 3) &middot; @_areas.Count</div>
@if (_areas.Count == 0)
{
<div style="padding:1rem" class="text-muted">No areas defined.</div>
}
else
{
<div class="table-wrap">
<table class="data-table">
<thead><tr><th>UnsAreaId</th><th>Name</th><th>Notes</th></tr></thead>
<tbody>
@foreach (var a in _areas)
{
<tr>
<td><span class="mono">@a.UnsAreaId</span></td>
<td>@a.Name</td>
<td class="text-muted small">@(a.Notes ?? "")</td>
</tr>
}
</tbody>
</table>
</div>
}
</section>
<section class="panel rise mt-3" style="animation-delay:.14s">
<div class="panel-head">Lines (level 4) &middot; @_lines.Count</div>
@if (_lines.Count == 0)
{
<div style="padding:1rem" class="text-muted">No lines defined.</div>
}
else
{
<div class="table-wrap">
<table class="data-table">
<thead><tr><th>UnsLineId</th><th>Name</th><th>Area</th><th>Notes</th></tr></thead>
<tbody>
@foreach (var l in _lines)
{
<tr>
<td><span class="mono">@l.UnsLineId</span></td>
<td>@l.Name</td>
<td><span class="mono">@l.UnsAreaId</span></td>
<td class="text-muted small">@(l.Notes ?? "")</td>
</tr>
}
</tbody>
</table>
</div>
}
</section>
}
@code {
[Parameter] public string ClusterId { get; set; } = "";
private List<UnsArea>? _areas;
private List<UnsLine>? _lines;
protected override async Task OnInitializedAsync()
{
await using var db = await DbFactory.CreateDbContextAsync();
_areas = await db.UnsAreas.AsNoTracking()
.Where(a => a.ClusterId == ClusterId)
.OrderBy(a => a.UnsAreaId)
.ToListAsync();
var areaIds = _areas.Select(a => a.UnsAreaId).ToList();
_lines = await db.UnsLines.AsNoTracking()
.Where(l => areaIds.Contains(l.UnsAreaId))
.OrderBy(l => l.UnsAreaId).ThenBy(l => l.UnsLineId)
.ToListAsync();
}
}

View File

@@ -0,0 +1,24 @@
@* Shared nav strip rendered above every cluster-scoped page. Per Q3 of the AdminUI rebuild
plan, the v1 monolithic ClusterDetail tab host is split into separate routes — these are
`<a href>` links, not Blazor router transitions, so each page bootstraps its own data
independently and can opt into a heavier render mode without dragging the others. *@
@code {
[Parameter, EditorRequired] public string ClusterId { get; set; } = "";
[Parameter, EditorRequired] public string ActiveTab { get; set; } = "";
}
<ul class="nav nav-tabs mb-3">
<li class="nav-item"><a class="nav-link @Active("overview")" href="/clusters/@ClusterId">Overview</a></li>
<li class="nav-item"><a class="nav-link @Active("equipment")" href="/clusters/@ClusterId/equipment">Equipment</a></li>
<li class="nav-item"><a class="nav-link @Active("uns")" href="/clusters/@ClusterId/uns">UNS</a></li>
<li class="nav-item"><a class="nav-link @Active("namespaces")" href="/clusters/@ClusterId/namespaces">Namespaces</a></li>
<li class="nav-item"><a class="nav-link @Active("drivers")" href="/clusters/@ClusterId/drivers">Drivers</a></li>
<li class="nav-item"><a class="nav-link @Active("tags")" href="/clusters/@ClusterId/tags">Tags</a></li>
<li class="nav-item"><a class="nav-link @Active("acls")" href="/clusters/@ClusterId/acls">ACLs</a></li>
<li class="nav-item"><a class="nav-link @Active("redundancy")" href="/clusters/@ClusterId/redundancy">Redundancy</a></li>
</ul>
@code {
private string Active(string tab) => tab == ActiveTab ? "active" : "";
}