From e344530fc07d5d1e5a30b70bd9711c61f381a49f Mon Sep 17 00:00:00 2001 From: jamesread Date: Mon, 4 Mar 2024 22:47:45 +0000 Subject: [PATCH] bugfix: Switch to first dashboard if actions page is empty --- webui.dev/js/marshaller.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/webui.dev/js/marshaller.js b/webui.dev/js/marshaller.js index 27a4ee7..b79e2a1 100644 --- a/webui.dev/js/marshaller.js +++ b/webui.dev/js/marshaller.js @@ -170,25 +170,20 @@ function marshalDashboardStructureToHtml (json) { document.getElementById('navigation-links').appendChild(navigationLi) } - if (document.getElementById('root-group').querySelectorAll('action-button').length === 0 && json.dashboards.length > 0) { - showSection(json.dashboards[0].title) - } else { - showSection('Actions') - } - const rootGroup = document.querySelector('#root-group') - let hasRootActions = false - for (const btn of Object.values(window.actionButtons)) { if (btn.parentElement === null) { rootGroup.appendChild(btn) - hasRootActions = true } } - if (!hasRootActions) { + if (rootGroup.querySelectorAll('action-button').length > 0 && json.dashboards.length > 0) { nav.querySelector('li[title="Actions"]').style.display = 'none' + + showSection(json.dashboards[0].title) + } else { + showSection('Actions') } }