From d8254630bb0757764c3a2f4c0e417e78d573a22f Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 19 Jun 2026 02:16:59 -0400 Subject: [PATCH] refactor(adminui): trim inline-script label + null-case test + helper-proxy note Code-review nits: trim the seed name so the in-session dropdown label matches the server-trimmed persisted name; add a null-selectedId test for ResolveScriptLabel; and note in CreateNewScriptAsync that the ordering invariant is proxied by the pure helper (AdminUI has no bUnit). --- .../Components/Shared/Uns/VirtualTagModal.razor | 9 +++++++-- .../Uns/VirtualTagScriptDropdownTests.cs | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Uns/VirtualTagModal.razor b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Uns/VirtualTagModal.razor index 7ce3552f..ade546bd 100644 --- a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Uns/VirtualTagModal.razor +++ b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Uns/VirtualTagModal.razor @@ -321,7 +321,10 @@ _scriptCreateError = null; try { - var seedName = string.IsNullOrWhiteSpace(_form.Name) ? "New script" : $"{_form.Name} script"; + // Trim so the local dropdown label matches what CreateScriptAsync persists (it Trim()s + // the name server-side) — otherwise stray whitespace makes the in-session label drift + // from every later modal open. + var seedName = string.IsNullOrWhiteSpace(_form.Name) ? "New script" : $"{_form.Name.Trim()} script"; var result = await Svc.CreateScriptAsync(seedName); if (!result.Ok || string.IsNullOrEmpty(result.CreatedId)) { @@ -331,7 +334,9 @@ // Add the new script to the options list BEFORE setting the selected value so the // can resolve the label on first render — if we set ScriptId first the - // dropdown has no matching