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; }