feat(webui): config page

This commit is contained in:
2026-11-25 11:52:38 +00:00
parent 32a6d0c51f
commit 1f8bdd8777
11 changed files with 377 additions and 54 deletions
+21
View File
@@ -92,6 +92,27 @@ describe('useNavStore panels', () => {
})
})
describe('useNavStore raw sheet selection', () => {
it('openSheet sets an opaque sel, pushes history and lets close go Back', () => {
const nav = useNavStore()
nav.goTo('config', { q: 'x' })
nav.openSheet('helper:router')
expect(nav.params).toEqual({ q: 'x', sel: 'helper:router' })
expect(nav.pushPending).toBe(true)
expect(nav.panelPushed).toBe(true)
})
it('swapSheet changes sel in place and keeps the pushed marker', () => {
const nav = useNavStore()
nav.openSheet('helper:router')
nav.pushPending = false
nav.swapSheet('helper:limits')
expect(nav.params.sel).toBe('helper:limits')
expect(nav.pushPending).toBe(false)
expect(nav.panelPushed).toBe(true)
})
})
describe('useNavStore no-op navigation', () => {
it('goTo to the identical page and params with replace:false does not leave a push pending', () => {
const nav = useNavStore()
+10 -1
View File
@@ -59,12 +59,21 @@ export const useNavStore = defineStore('nav', {
},
/** Opens a detail panel and pushes a history entry, so Back closes it. */
openPanel(kind: PanelKind, id: string): void {
const sel = formatSel(kind, id)
this.openSheet(formatSel(kind, id))
},
/** Opens a sheet whose `sel` is not an entity panel (e.g. `helper:router`), pushing a history entry like openPanel. */
openSheet(sel: string): void {
if (this.params.sel === sel) return
this.params = { ...this.params, sel }
this.pushPending = true
this.panelPushed = true
},
/** Switches the open sheet's `sel` in place: no new history entry, and Back still closes it. */
swapSheet(sel: string): void {
if (this.params.sel === sel) return
this.params = { ...this.params, sel }
this.pushPending = false
},
/** Goes Back when the panel owns the last history entry; otherwise drops `sel` in place. */
closePanel(): void {
if (this.panelPushed && typeof window !== 'undefined') {