Просмотр исходного кода

fix: show navigation links with topbar section navigation

The picocrank Header only gives its TopBar the topBarNavigation prop, so
sectionNavigationStyle: topbar rendered an empty bar with no way to
navigate.

Fixes #1127

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesread 2 дней назад
Родитель
Сommit
f164dba6e3

+ 1 - 0
frontend/resources/vue/App.vue

@@ -7,6 +7,7 @@
       :sidebar-enabled="sidebarEnabled"
       :sidebar-enabled="sidebarEnabled"
       :top-bar-enabled="topbarEnabled"
       :top-bar-enabled="topbarEnabled"
       :navigation="navigation"
       :navigation="navigation"
+      :top-bar-navigation="navigation"
       :username="headerUsername"
       :username="headerUsername"
       :login-route="headerLoginRoute"
       :login-route="headerLoginRoute"
       @toggle-sidebar="toggleSidebar"
       @toggle-sidebar="toggleSidebar"

+ 22 - 0
integration-tests/tests/topbarNavigation/config.yaml

@@ -0,0 +1,22 @@
+#
+# Integration Test Config: Topbar navigation
+#
+
+listenAddressSingleHTTPFrontend: 0.0.0.0:1337
+
+checkForUpdates: false
+sectionNavigationStyle: topbar
+
+actions:
+  - title: Ping example.com
+    shell: ping example.com -c 1
+    icon: ping
+
+dashboards:
+  - title: Alpha
+    contents:
+      - title: Ping example.com
+
+  - title: Beta
+    contents:
+      - title: Ping example.com

+ 38 - 0
integration-tests/tests/topbarNavigation/topbarNavigation.mjs

@@ -0,0 +1,38 @@
+import { By, until } from 'selenium-webdriver'
+import { expect } from 'chai'
+import {
+  getRootAndWait,
+  takeScreenshotOnFailure,
+} from '../../lib/elements.js'
+
+describe('config: sectionNavigationStyle topbar', function () {
+  let originalWindowRect
+
+  before(async function () {
+    originalWindowRect = await webdriver.manage().window().getRect()
+    await runner.start('topbarNavigation')
+  })
+
+  after(async () => {
+    await webdriver.manage().window().setRect(originalWindowRect)
+    await runner.stop()
+  })
+
+  afterEach(function () {
+    takeScreenshotOnFailure(this.currentTest, webdriver)
+  })
+
+  it('shows dashboard links in the top bar', async () => {
+    await webdriver.manage().window().setRect({ width: 1600, height: 900 })
+    await getRootAndWait()
+
+    const betaLink = await webdriver.wait(
+      until.elementLocated(By.xpath("//nav[contains(@class, 'topbar')]//a[contains(., 'Beta')]")),
+      5000
+    )
+    await betaLink.click()
+
+    await webdriver.wait(until.urlContains('Beta'), 5000)
+    expect(await webdriver.getCurrentUrl()).to.contain('Beta')
+  })
+})