From 91beb9d1817c52362d80edc0b8840ebc258919b9 Mon Sep 17 00:00:00 2001 From: Alex Hope-O'Connor Date: Sat, 28 Feb 2026 19:13:42 +1000 Subject: [PATCH] EffectiveConfig: single expand/collapse toolbar button Replace separate Expand all / Collapse all buttons with one toggle button. Icon and label switch based on AllSectionsExpanded (expand when any section collapsed, collapse when all expanded). --- .../EffectiveConfigSection.razor | 5 +++++ .../EffectiveConfigToolbar.razor | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/DnsmasqWebUI/Components/Dnsmasq/EffectiveConfig/EffectiveConfigSection.razor b/src/DnsmasqWebUI/Components/Dnsmasq/EffectiveConfig/EffectiveConfigSection.razor index d94cfeb..4ac0199 100644 --- a/src/DnsmasqWebUI/Components/Dnsmasq/EffectiveConfig/EffectiveConfigSection.razor +++ b/src/DnsmasqWebUI/Components/Dnsmasq/EffectiveConfig/EffectiveConfigSection.razor @@ -11,8 +11,13 @@
+ @{ + var _sectionViews = EffectiveConfigViews.GetViewsForContext(Context); + var _allSectionsExpanded = _sectionViews.Count > 0 && _sectionViews.All(v => _openPanels.Contains(v.SectionId)); + } diff --git a/src/DnsmasqWebUI/Components/Dnsmasq/EffectiveConfig/EffectiveConfigToolbar.razor b/src/DnsmasqWebUI/Components/Dnsmasq/EffectiveConfig/EffectiveConfigToolbar.razor index 990b4cd..c23632d 100644 --- a/src/DnsmasqWebUI/Components/Dnsmasq/EffectiveConfig/EffectiveConfigToolbar.razor +++ b/src/DnsmasqWebUI/Components/Dnsmasq/EffectiveConfig/EffectiveConfigToolbar.razor @@ -7,11 +7,10 @@ value="@SearchTerm" @oninput="OnSearchInput" /> }
- - @if (IsEditMode) { @@ -41,8 +40,17 @@ [Parameter] public EventCallback SearchTermChanged { get; set; } [Parameter] public bool IsEditMode { get; set; } [Parameter] public int PendingChangesCount { get; set; } + [Parameter] public bool AllSectionsExpanded { get; set; } [Parameter] public EventCallback OnExpandAll { get; set; } [Parameter] public EventCallback OnCollapseAll { get; set; } + + private async Task OnToggleExpandCollapse() + { + if (AllSectionsExpanded) + await OnCollapseAll.InvokeAsync(); + else + await OnExpandAll.InvokeAsync(); + } [Parameter] public EventCallback OnEnterEditMode { get; set; } [Parameter] public EventCallback OnExitEditModeWithConfirm { get; set; } [Parameter] public EventCallback OnOpenSaveModal { get; set; }