From 8047de6903a2a04731cb5d8e28a8a12f23b03bcd Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 8 Sep 2026 09:49:05 -0400 Subject: [PATCH] =?UTF-8?q?fix(central-ui):=20Flow=20Debugger=20picker=20?= =?UTF-8?q?=E2=80=94=20site=20change=20clears=20the=20pick=20(test);=20wid?= =?UTF-8?q?er=20column,=20shorter=20placeholder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pins the site-change behaviour the picker's reference contract exists for: after picking an instance, switching the site select empties both the page's _selectedInstanceId and the picker's field text (the new site hands it a different instance list), and leaves the script select on its placeholder. Layout: the Instance column goes col-md-2 → col-md-3 so a full instance name fits — the script-entry branch still sums to 8 of 12 (site 2 + instance 3 + script 3), and Method never renders beside them — with the placeholder shortened to "Search instances…" for the narrower field. Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29 --- .../Pages/Deployment/FlowDebugger.razor | 8 ++++-- .../Deployment/FlowDebuggerPageTests.cs | 27 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/FlowDebugger.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/FlowDebugger.razor index 309a3ceb..d5ab097f 100644 --- a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/FlowDebugger.razor +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/FlowDebugger.razor @@ -59,14 +59,18 @@ } -
+ @* Wider than the site select beside it: the field carries a whole instance + name, not a short site name. The script-entry branch still sums to 8 of 12 + (site 2 + instance 3 + script 3) alongside the auto-width toolbar columns. *@ +
@* A site can hold hundreds of instances, so this is the shared area-tree combobox, not a flat list (design 2026-09-08). _areas/_instances are loaded once per site — the picker treats a new list as a site change. *@ + Disabled="@(_running || _selectedSiteId == 0)" + Placeholder="Search instances…" DataTestPrefix="flow-instance" />
diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Deployment/FlowDebuggerPageTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Deployment/FlowDebuggerPageTests.cs index 0a368c08..ed738665 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Deployment/FlowDebuggerPageTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Deployment/FlowDebuggerPageTests.cs @@ -815,4 +815,31 @@ public class FlowDebuggerPageTests : BunitContext cut.WaitForAssertion(() => Assert.Equal("Sim01", cut.Find("[data-test='flow-instance-input']").GetAttribute("value"))); } + + [Fact] + public void ScriptEntry_SiteChange_ClearsThePickedInstance() + { + RegisterServices(); + WireInstance(); + // A second site the operator can switch to, with no instances of its own. + _sites.GetAllSitesAsync(Arg.Any()).Returns(Task.FromResult>( + [new Site("Plant A", "site-a") { Id = 1 }, new Site("Plant B", "site-b") { Id = 2 }])); + _templates.GetInstancesBySiteIdAsync(2, Arg.Any()) + .Returns(Task.FromResult>([])); + _templates.GetAreasBySiteIdAsync(2, Arg.Any()) + .Returns(Task.FromResult>([])); + + var cut = Render(); + cut.Find("button[data-test='flow-entry-script']").Click(); + cut.Find("select[data-test='flow-site-select']").Change("1"); + PickInstance(cut, 7); + Assert.Equal("Sim01", cut.Find("[data-test='flow-instance-input']").GetAttribute("value")); + + cut.Find("select[data-test='flow-site-select']").Change("2"); + + // The pick is dropped on both sides: the page's id and the picker's field text, which + // it re-derives because the new site handed it a different instance list. + Assert.Equal(string.Empty, cut.Find("[data-test='flow-instance-input']").GetAttribute("value")); + Assert.Equal(["— choose —"], cut.FindAll("select[data-test='flow-script-select'] option").Select(o => o.TextContent.Trim()).ToList()); + } }