瀏覽代碼

bugfix: Still hide an empty actions section if a section is currently selected (#469)

James Read 1 年之前
父節點
當前提交
209234c09f
共有 1 個文件被更改,包括 7 次插入 和 3 次删除
  1. 7 3
      webui.dev/js/marshaller.js

+ 7 - 3
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('/')