From c8de58d6d3844d1dce9ab312592de966dd7ff89a Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 25 May 2026 02:22:32 -0400 Subject: [PATCH] fix(admin-ui): render published gen read-only on the 6 cluster-detail content tabs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Equipment, UNS Structure, Namespaces, Drivers, Tags, and ACLs tabs all rendered only an "Open a draft to edit" placeholder when no draft was open — even when the cluster had a fully populated published generation. docs/v2/admin-ui.md \xa7Cluster Detail describes these as "read-only views of the published generation" with an "Edit in draft" affordance; that view was never wired. The earlier code path also correctly rendered nothing when the cluster had no published gen yet, which was indistinguishable from the broken state. Collapse the six per-tab conditions into one shared branch that threads the published gen ID into the existing tab components when no draft exists, wrapped in
so any Add/Edit button click in the read-only state cannot silently mutate published rows even though the tab components themselves don't yet honor an IsReadOnly flag. Banner above the content explains the state. Surgical: zero changes to the ~1500 LoC across the six tab components. Verified live on cluster-dev gen 1: Drivers tab now shows the cluster-dev-galaxy-main GalaxyMxGateway row read-only; Namespaces tab shows cluster-dev-galaxy-ns SystemPlatform row; both with the read-only banner and visibly disabled affordances. Follow-up worth doing later: refactor each tab component to accept an IsReadOnly parameter so the disabled-affordance UX is per-tab rather than a blanket fieldset opacity wash. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Pages/Clusters/ClusterDetail.razor | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.Admin/Components/Pages/Clusters/ClusterDetail.razor b/src/Server/ZB.MOM.WW.OtOpcUa.Admin/Components/Pages/Clusters/ClusterDetail.razor index 87f6e26..4bd5120 100644 --- a/src/Server/ZB.MOM.WW.OtOpcUa.Admin/Components/Pages/Clusters/ClusterDetail.razor +++ b/src/Server/ZB.MOM.WW.OtOpcUa.Admin/Components/Pages/Clusters/ClusterDetail.razor @@ -101,29 +101,44 @@ else { } - else if (_tab == "equipment" && _currentDraft is not null) + else if (_tab is "equipment" or "uns" or "namespaces" or "drivers" or "tags" or "acls") { - - } - else if (_tab == "uns" && _currentDraft is not null) - { - - } - else if (_tab == "namespaces" && _currentDraft is not null) - { - - } - else if (_tab == "drivers" && _currentDraft is not null) - { - - } - else if (_tab == "tags" && _currentDraft is not null) - { - - } - else if (_tab == "acls" && _currentDraft is not null) - { - + @* Bug #10 fix — these six tabs are scoped to a generation. Per docs/v2/admin-ui.md the + design intent is a read-only view of the published generation when no draft is open + ("Edit in draft" affordance), and the editable view of the draft when one is open. + The earlier implementation rendered nothing in the no-draft case, leaving operators + with just the "Open a draft to edit" placeholder. We now route both states through + the same tab components, gating edits via
so a button click in + the read-only state cannot silently mutate the published rows even though the tab + components themselves haven't been refactored to honor an IsReadOnly flag yet. *@ + var genId = _currentDraft?.GenerationId ?? _currentPublished?.GenerationId; + var isReadOnly = _currentDraft is null; + if (genId is null) + { +
+ No published generation yet. Click New draft above to author this cluster's first generation. +
+ } + else + { + if (isReadOnly) + { +
+ Read-only view of published generation @genId. Click New draft above to make changes. +
+ } +
+ @switch (_tab) + { + case "equipment": break; + case "uns": break; + case "namespaces": break; + case "drivers": break; + case "tags": break; + case "acls": break; + } +
+ } } else if (_tab == "redundancy") { @@ -133,10 +148,6 @@ else { } - else - { -
Open a draft to edit this cluster's content.
- } } @code {