Przeglądaj źródła

fix: #685 - show navigation (and picocrank upgrade)

jamesread 8 miesięcy temu
rodzic
commit
28c813762f
4 zmienionych plików z 32 dodań i 26 usunięć
  1. 2 0
      .gitignore
  2. 4 4
      frontend/package-lock.json
  3. 1 1
      frontend/package.json
  4. 25 21
      frontend/resources/vue/App.vue

+ 2 - 0
.gitignore

@@ -17,3 +17,5 @@ webui/
 server.log
 OliveTin
 integration-tests/configs/authRequireGuestsToLogin/sessions.yaml
+webui
+webui.dev

+ 4 - 4
frontend/package-lock.json

@@ -17,7 +17,7 @@
 				"@xterm/addon-fit": "^0.10.0",
 				"@xterm/xterm": "^5.5.0",
 				"iconify-icon": "^3.0.2",
-				"picocrank": "^1.6.4",
+				"picocrank": "^1.8.0",
 				"unplugin-vue-components": "^30.0.0",
 				"vite": "^7.1.12",
 				"vue-router": "^4.6.3"
@@ -2362,9 +2362,9 @@
 			"license": "ISC"
 		},
 		"node_modules/picocrank": {
-			"version": "1.6.4",
-			"resolved": "https://registry.npmjs.org/picocrank/-/picocrank-1.6.4.tgz",
-			"integrity": "sha512-zD1wnkoUDAXZOUs9zKqS4rqz9mljeqFwM7QWx4ykXJsmH6iOLAIKh2AVlxa384oeXJXIWM9VLiySEnhQZmQmjA==",
+			"version": "1.8.0",
+			"resolved": "https://registry.npmjs.org/picocrank/-/picocrank-1.8.0.tgz",
+			"integrity": "sha512-YPGmXvw7vvjIcgrAe3io87kZDM+NUa+aiEYxk8CVqBzgI4koXeF+2VEGPHBwknZBBEbJfXsSdnxVwXrLKpWKfw==",
 			"license": "ISC",
 			"dependencies": {
 				"@hugeicons/core-free-icons": "^1.0.16",

+ 1 - 1
frontend/package.json

@@ -30,7 +30,7 @@
 		"@xterm/addon-fit": "^0.10.0",
 		"@xterm/xterm": "^5.5.0",
 		"iconify-icon": "^3.0.2",
-		"picocrank": "^1.6.4",
+		"picocrank": "^1.8.0",
 		"unplugin-vue-components": "^30.0.0",
 		"vite": "^7.1.12",
 		"vue-router": "^4.6.3"

+ 25 - 21
frontend/resources/vue/App.vue

@@ -1,5 +1,5 @@
 <template>
-    <Header title="OliveTin" :logoUrl="logoUrl" @toggleSidebar="toggleSidebar">
+    <Header title="OliveTin" :logoUrl="logoUrl" @toggleSidebar="toggleSidebar" :sidebarEnabled="showNavigation">
         <template #toolbar>
             <div id="banner" v-if="bannerMessage" :style="bannerCss">
                 <p>{{ bannerMessage }}</p>
@@ -86,7 +86,9 @@ const initError = ref(false)
 const initErrorMessage = ref('')
 
 function toggleSidebar() {
-    sidebar.value.toggle()
+    if (sidebar.value && showNavigation.value) {
+        sidebar.value.toggle()
+    }
 }
 
 function updateHeaderFromInit() {
@@ -132,25 +134,27 @@ async function requestInit() {
         showLogs.value = initResponse.showLogList
         showDiagnostics.value = initResponse.showDiagnostics
 
-        for (const rootDashboard of initResponse.rootDashboards) {
-            sidebar.value.addNavigationLink({
-                id: rootDashboard,
-                name: rootDashboard,
-                title: rootDashboard,
-                path: rootDashboard === 'Actions' ? '/' : `/dashboards/${rootDashboard}`,
-                icon: DashboardSquare01Icon,
-            })
-        }
-
-        sidebar.value.addSeparator()
-        sidebar.value.addRouterLink('Entities')
-
-        if (showLogs.value) {
-            sidebar.value.addRouterLink('Logs')
-        }
-
-        if (showDiagnostics.value) {
-            sidebar.value.addRouterLink('Diagnostics')
+        if (showNavigation.value && sidebar.value) {
+            for (const rootDashboard of initResponse.rootDashboards) {
+                sidebar.value.addNavigationLink({
+                    id: rootDashboard,
+                    name: rootDashboard,
+                    title: rootDashboard,
+                    path: rootDashboard === 'Actions' ? '/' : `/dashboards/${rootDashboard}`,
+                    icon: DashboardSquare01Icon,
+                })
+            }
+
+            sidebar.value.addSeparator()
+            sidebar.value.addRouterLink('Entities')
+
+            if (showLogs.value) {
+                sidebar.value.addRouterLink('Logs')
+            }
+
+            if (showDiagnostics.value) {
+                sidebar.value.addRouterLink('Diagnostics')
+            }
         }
 
         hasLoaded.value = true;