From 4bd2651925661b5b6a0fb7de54a790b4bca4df80 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 21 Aug 2026 07:08:37 -0400 Subject: [PATCH] =?UTF-8?q?feat(centralui):=20TemplatePickerDialog=20?= =?UTF-8?q?=E2=80=94=20folder-tree=20template=20picker=20hosted=20by=20IDi?= =?UTF-8?q?alogService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude-Session: https://claude.ai/code/session_01G2GHPnbbKGvyyfbr2XBRVH --- .../Shared/TemplatePickerDialog.razor | 138 ++++++++++++++++++ .../Shared/TemplatePickerDialogTests.cs | 136 +++++++++++++++++ 2 files changed, 274 insertions(+) create mode 100644 src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/TemplatePickerDialog.razor create mode 100644 tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Shared/TemplatePickerDialogTests.cs diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/TemplatePickerDialog.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/TemplatePickerDialog.razor new file mode 100644 index 00000000..079bd570 --- /dev/null +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/TemplatePickerDialog.razor @@ -0,0 +1,138 @@ +@* + Body component for the Create Instance template picker, hosted by + IDialogService.ShowAsync. Wraps the shared TemplateFolderTree (the same tree + the Templates page renders) with its own search box. Templates are the only + selectable nodes — folders just toggle — and a double-click selects. Closes + with TemplatePickResult, a record so Cancel (null) is distinguishable from a + pick, the same contract MoveTemplateDialog uses. + + Selection is tracked here rather than through TreeView's SelectedKey: in + Single mode TemplateFolderTree forwards only the Checkbox-mode SelectedKeys + pair, so the row highlight has to come from this component's own NodeContent. +*@ +@using ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates +@using ZB.MOM.WW.ScadaBridge.CentralUI.Services + +
+
+ + @if (!string.IsNullOrEmpty(_search)) + { + + } +
+ + +
+ +
+ + + + + + @node.Name + @if (node.Kind == TemplateTreeNodeKind.Folder && node.Children.Count > 0) + { + + @node.Children.Count + + } + + No templates match. + +
+ + + +@code { + /// Supplied by IDialogService.ShowAsync; closes/cancels the modal. + [Parameter] public DialogContext Context { get; set; } = default!; + + /// Folder catalogue backing the tree. + [Parameter] public IReadOnlyList Folders { get; set; } = Array.Empty(); + + /// Template catalogue backing the tree. + [Parameter] public IReadOnlyList