From 209234c09f10d80dfcbfc6dc60d0f712eae6064d Mon Sep 17 00:00:00 2001 From: James Read Date: Sat, 2 Nov 2024 01:32:02 +0000 Subject: [PATCH] bugfix: Still hide an empty actions section if a section is currently selected (#469) --- webui.dev/js/marshaller.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/webui.dev/js/marshaller.js b/webui.dev/js/marshaller.js index ee4936f..2f3f4b9 100644 --- a/webui.dev/js/marshaller.js +++ b/webui.dev/js/marshaller.js @@ -376,14 +376,18 @@ function marshalDashboardStructureToHtml (json) { } } + const shouldHideActions = rootGroup.querySelectorAll('action-button').length === 0 && json.dashboards.length > 0 + + if (shouldHideActions) { + nav.querySelector('li[title="Actions"]').style.display = 'none' + } + if (window.currentPath !== '') { showSection(window.currentPath) } else if (window.location.pathname !== '/' && document.body.getAttribute('initial-marshal-complete') === null) { showSection(window.location.pathname) } else { - if (rootGroup.querySelectorAll('action-button').length === 0 && json.dashboards.length > 0) { - nav.querySelector('li[title="Actions"]').style.display = 'none' - + if (shouldHideActions) { showSection('/' + getSystemTitle(json.dashboards[0].title)) } else { showSection('/')