Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Split command palette runtime owners
rcourtmanca69dccaa9a5
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex bbab3a7ac0..5c7df36369 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -248,6 +248,14 @@ handoff lifecycle, andutility tab ordering, alert badge counts, fade-state derivation, and tabbutton class policy. Future mobile-nav work should extend those owners insteadof pushing tab-order or DOM lifecycle logic back into the shared shell.+The shared command palette now follows that same owner split.+`frontend-modern/src/components/shared/CommandPaletteModal.tsx` stays the+render shell, `frontend-modern/src/components/shared/useCommandPaletteState.ts`+owns query state, open-reset/focus lifecycle, route-path wiring, and Enter-key+selection, and `frontend-modern/src/components/shared/commandPaletteModel.ts`+owns canonical command construction plus query normalization and filtering+policy. Future command-palette work should extend those owners instead of+pushing route construction or search policy back into the shared shell.The audit log settings surface now follows that same owner split.`frontend-modern/src/components/Settings/AuditLogPanel.tsx` stays the canonicaldiff --git a/frontend-modern/src/components/shared/CommandPaletteModal.tsx b/frontend-modern/src/components/shared/CommandPaletteModal.tsxindex 39eb600da4..19cc71b1ed 100644--- a/frontend-modern/src/components/shared/CommandPaletteModal.tsx+++ b/frontend-modern/src/components/shared/CommandPaletteModal.tsx@@ -1,141 +1,21 @@-import { Show, For, createMemo, createSignal, createEffect } from 'solid-js';-import { useNavigate } from '@solidjs/router';+import { For, Show } from 'solid-js';import { Dialog } from '@/components/shared/Dialog';import { SearchField } from '@/components/shared/SearchField';import {- buildRecoveryPath,- buildInfrastructurePath,- buildStoragePath,- buildWorkloadsPath,-} from '@/routing/resourceLinks';+ type CommandPaletteModalCommand,+ type CommandPaletteModalProps,+ useCommandPaletteState,+} from './useCommandPaletteState';-interface CommandPaletteModalProps {- isOpen: boolean;- onClose: () => void;-}--type Command = {- id: string;- label: string;- description?: string;- shortcut?: string;- keywords?: string[];- action: () => void;-};+export type { CommandPaletteModalProps } from './useCommandPaletteState';export function CommandPaletteModal(props: CommandPaletteModalProps) {- const navigate = useNavigate();- const [query, setQuery] = createSignal('');- const infrastructurePath = buildInfrastructurePath();- const workloadsPath = buildWorkloadsPath();- const podWorkloadsPath = buildWorkloadsPath({ type: 'pod' });- const storagePath = buildStoragePath();- const recoveryPath = buildRecoveryPath();-- let inputRef: HTMLInputElement | undefined;-- const commands = createMemo<Command[]>(() => {- const base: Command[] = [- {- id: 'nav-infrastructure',- label: 'Go to Infrastructure',- description: infrastructurePath,- shortcut: 'g i',- keywords: ['infra', 'agents', 'nodes', 'resources'],- action: () => navigate(infrastructurePath),- },- {- id: 'nav-workloads',- label: 'Go to Workloads',- description: workloadsPath,- shortcut: 'g w',- keywords: [- 'vm',- 'system-container',- 'app-container',- 'docker',- 'k8s',- 'kubernetes',- 'pods',- ],- action: () => navigate(workloadsPath),- },- {- id: 'nav-workloads-pods',- label: 'Go to Kubernetes Pods',- description: podWorkloadsPath,- keywords: ['k8s', 'kubernetes', 'pods', 'deployments', 'clusters'],- action: () => navigate(podWorkloadsPath),- },- {- id: 'nav-storage',- label: 'Go to Storage',- description: storagePath,- shortcut: 'g s',- keywords: ['ceph', 'pbs'],- action: () => navigate(storagePath),- },- {- id: 'nav-recovery',- label: 'Go to Recovery',- description: recoveryPath,- shortcut: 'g b',- keywords: ['recovery', 'backups', 'snapshots', 'replication', 'restore'],- action: () => navigate(recoveryPath),- },- {- id: 'nav-alerts',- label: 'Go to Alerts',- description: '/alerts',- shortcut: 'g a',- keywords: ['alarms', 'notifications'],- action: () => navigate('/alerts'),- },- {- id: 'nav-settings',- label: 'Go to Settings',- description: '/settings',- shortcut: 'g t',- keywords: ['preferences', 'config'],- action: () => navigate('/settings'),- },- ];- return base;- });+ const commandPalette = useCommandPaletteState(props);- const normalizedQuery = createMemo(() => query().toLowerCase().trim().replace(/\s+/g, ''));-- const filteredCommands = createMemo(() => {- const q = normalizedQuery();- if (!q) return commands();- return commands().filter((cmd) => {- const haystack = [- cmd.label,- cmd.description ?? '',- cmd.shortcut ?? '',- ...(cmd.keywords ?? []),- ]- .join(' ')- .toLowerCase()- .replace(/\s+/g, '');- return haystack.includes(q);- });- });-- const handleSelect = (command: Command) => {- command.action();- props.onClose();+ const handleSelect = (command: CommandPaletteModalCommand) => {+ commandPalette.handleSelect(command);};- createEffect(() => {- if (props.isOpen) {- setQuery('');- queueMicrotask(() => inputRef?.focus());- } else {- setQuery('');- }- });-return (<DialogisOpen={props.isOpen}@@ -145,18 +25,10 @@ export function CommandPaletteModal(props: CommandPaletteModalProps) {><div class="border-b border-border px-5 py-4"><SearchField- value={query()}- onChange={setQuery}- inputRef={(el) => (inputRef = el)}- onKeyDown={(e) => {- if (e.key === 'Enter') {- const first = filteredCommands()[0];- if (first) {- e.preventDefault();- handleSelect(first);- }- }- }}+ value={commandPalette.query()}+ onChange={commandPalette.setQuery}+ inputRef={commandPalette.setInputRef}+ onKeyDown={commandPalette.handleInputKeyDown}placeholder="Type a command or search..."class="w-full"inputClass="bg-base"@@ -167,10 +39,10 @@ export function CommandPaletteModal(props: CommandPaletteModalProps) {<div class="max-h-[320px] overflow-y-auto px-3 py-3"><Show- when={filteredCommands().length > 0}+ when={commandPalette.filteredCommands().length > 0}fallback={<div class="px-3 py-8 text-center text-sm text-muted">No matches found.</div>}>- <For each={filteredCommands()}>+ <For each={commandPalette.filteredCommands()}>{(command) => (<buttontype="button"@@ -184,7 +56,7 @@ export function CommandPaletteModal(props: CommandPaletteModalProps) {</Show></div><Show when={command.shortcut}>- <span class="rounded bg-base px-2 py-1 text-[10px] font-medium text-base-content border border-border-subtle">+ <span class="rounded border border-border-subtle bg-base px-2 py-1 text-[10px] font-medium text-base-content">{command.shortcut}</span></Show>diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 83f4ecb2d4..aae6dfaa7a 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -1,5 +1,7 @@import { describe, expect, it } from 'vitest';import calloutCardSource from '@/components/shared/CalloutCard.tsx?raw';+import commandPaletteModalSource from '@/components/shared/CommandPaletteModal.tsx?raw';+import commandPaletteModelSource from '@/components/shared/commandPaletteModel.ts?raw';import containerUpdateBadgeSource from '@/components/shared/ContainerUpdateBadge.tsx?raw';import containerUpdateBadgeModelSource from '@/components/shared/containerUpdateBadgeModel.ts?raw';import densityMapSource from '@/components/shared/DensityMap.tsx?raw';@@ -22,6 +24,7 @@ import infrastructureSummaryTableStateSource from '@/components/shared/useInfrasimport monitoredSystemLimitWarningBannerSource from '@/components/shared/MonitoredSystemLimitWarningBanner.tsx?raw';import selectionCardGroupSource from '@/components/shared/SelectionCardGroup.tsx?raw';import tagBadgesSource from '@/components/shared/TagBadges.tsx?raw';+import commandPaletteStateSource from '@/components/shared/useCommandPaletteState.ts?raw';import containerUpdateButtonStateSource from '@/components/shared/useContainerUpdateButtonState.ts?raw';import densityMapStateSource from '@/components/shared/useDensityMapState.ts?raw';import helpIconStateSource from '@/components/shared/useHelpIconState.ts?raw';@@ -98,6 +101,22 @@ describe('shared primitive guardrails', () => {);});+ it('keeps command palette on shell, runtime, and model owners', () => {+ expect(commandPaletteModalSource).toContain('useCommandPaletteState');+ expect(commandPaletteModalSource).not.toContain('useNavigate');+ expect(commandPaletteModalSource).not.toContain('createSignal');+ expect(commandPaletteModalSource).not.toContain('buildInfrastructurePath');++ expect(commandPaletteStateSource).toContain('useNavigate');+ expect(commandPaletteStateSource).toContain('createSignal');+ expect(commandPaletteStateSource).toContain('buildInfrastructurePath');+ expect(commandPaletteStateSource).toContain('export function useCommandPaletteState');++ expect(commandPaletteModelSource).toContain('buildCommandPaletteCommands');+ expect(commandPaletteModelSource).toContain('normalizeCommandPaletteQuery');+ expect(commandPaletteModelSource).toContain('filterCommandPaletteCommands');+ });+it('routes settings info callouts through CalloutCard', () => {expect(calloutCardSource).toContain("type CalloutTone = 'danger' | 'info' | 'success' | 'warning'",diff --git a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsxindex 011c9b336f..882460b1e3 100644--- a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx@@ -1,6 +1,9 @@import { afterEach, describe, expect, it, vi } from 'vitest';import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';import type { JSX } from 'solid-js';+import commandPaletteModalSource from '@/components/shared/CommandPaletteModal.tsx?raw';+import commandPaletteModelSource from '@/components/shared/commandPaletteModel.ts?raw';+import commandPaletteStateSource from '@/components/shared/useCommandPaletteState.ts?raw';const navigateMock = vi.fn();@@ -21,6 +24,22 @@ describe('CommandPaletteModal', () => {navigateMock.mockReset();});+ it('keeps the command palette on shell, runtime, and model owners', () => {+ expect(commandPaletteModalSource).toContain('useCommandPaletteState');+ expect(commandPaletteModalSource).not.toContain('useNavigate');+ expect(commandPaletteModalSource).not.toContain('createSignal');+ expect(commandPaletteModalSource).not.toContain('buildInfrastructurePath');++ expect(commandPaletteStateSource).toContain('useNavigate');+ expect(commandPaletteStateSource).toContain('createSignal');+ expect(commandPaletteStateSource).toContain('buildInfrastructurePath');+ expect(commandPaletteStateSource).toContain('export function useCommandPaletteState');++ expect(commandPaletteModelSource).toContain('buildCommandPaletteCommands');+ expect(commandPaletteModelSource).toContain('normalizeCommandPaletteQuery');+ expect(commandPaletteModelSource).toContain('filterCommandPaletteCommands');+ });+it('renders the dedicated pod workloads command with a canonical path', () => {render(() => <CommandPaletteModal isOpen={true} onClose={vi.fn()} />);diff --git a/frontend-modern/src/components/shared/commandPaletteModel.ts b/frontend-modern/src/components/shared/commandPaletteModel.tsnew file mode 100644index 0000000000..dae8b9c4de--- /dev/null+++ b/frontend-modern/src/components/shared/commandPaletteModel.ts@@ -0,0 +1,118 @@+export interface CommandPaletteModalProps {+ isOpen: boolean;+ onClose: () => void;+}++export type CommandPaletteModalCommand = {+ id: string;+ label: string;+ description?: string;+ shortcut?: string;+ keywords?: string[];+ action: () => void;+};++export type CommandPaletteCommandPaths = {+ infrastructurePath: string;+ workloadsPath: string;+ podWorkloadsPath: string;+ storagePath: string;+ recoveryPath: string;+};++export function buildCommandPaletteCommands(options: {+ paths: CommandPaletteCommandPaths;+ navigate: (path: string) => void;+}): CommandPaletteModalCommand[] {+ return [+ {+ id: 'nav-infrastructure',+ label: 'Go to Infrastructure',+ description: options.paths.infrastructurePath,+ shortcut: 'g i',+ keywords: ['infra', 'agents', 'nodes', 'resources'],+ action: () => options.navigate(options.paths.infrastructurePath),+ },+ {+ id: 'nav-workloads',+ label: 'Go to Workloads',+ description: options.paths.workloadsPath,+ shortcut: 'g w',+ keywords: [+ 'vm',+ 'system-container',+ 'app-container',+ 'docker',+ 'k8s',+ 'kubernetes',+ 'pods',+ ],+ action: () => options.navigate(options.paths.workloadsPath),+ },+ {+ id: 'nav-workloads-pods',+ label: 'Go to Kubernetes Pods',+ description: options.paths.podWorkloadsPath,+ keywords: ['k8s', 'kubernetes', 'pods', 'deployments', 'clusters'],+ action: () => options.navigate(options.paths.podWorkloadsPath),+ },+ {+ id: 'nav-storage',+ label: 'Go to Storage',+ description: options.paths.storagePath,+ shortcut: 'g s',+ keywords: ['ceph', 'pbs'],+ action: () => options.navigate(options.paths.storagePath),+ },+ {+ id: 'nav-recovery',+ label: 'Go to Recovery',+ description: options.paths.recoveryPath,+ shortcut: 'g b',+ keywords: ['recovery', 'backups', 'snapshots', 'replication', 'restore'],+ action: () => options.navigate(options.paths.recoveryPath),+ },+ {+ id: 'nav-alerts',+ label: 'Go to Alerts',+ description: '/alerts',+ shortcut: 'g a',+ keywords: ['alarms', 'notifications'],+ action: () => options.navigate('/alerts'),+ },+ {+ id: 'nav-settings',+ label: 'Go to Settings',+ description: '/settings',+ shortcut: 'g t',+ keywords: ['preferences', 'config'],+ action: () => options.navigate('/settings'),+ },+ ];+}++export function normalizeCommandPaletteQuery(query: string): string {+ return query.toLowerCase().trim().replace(/\s+/g, '');+}++export function filterCommandPaletteCommands(+ commands: CommandPaletteModalCommand[],+ query: string,+): CommandPaletteModalCommand[] {+ const normalizedQuery = normalizeCommandPaletteQuery(query);+ if (!normalizedQuery) return commands;++ return commands.filter((command) => {+ const haystack = [+ command.label,+ command.description ?? '',+ command.shortcut ?? '',+ ...(command.keywords ?? []),+ ]+ .join(' ')+ .toLowerCase()+ .replace(/\s+/g, '');++ return haystack.includes(normalizedQuery);+ });+}diff --git a/frontend-modern/src/components/shared/useCommandPaletteState.ts b/frontend-modern/src/components/shared/useCommandPaletteState.tsnew file mode 100644index 0000000000..bede37d75c--- /dev/null+++ b/frontend-modern/src/components/shared/useCommandPaletteState.ts@@ -0,0 +1,76 @@+import { useNavigate } from '@solidjs/router';+import { createEffect, createMemo, createSignal } from 'solid-js';+import {+ buildRecoveryPath,+ buildInfrastructurePath,+ buildStoragePath,+ buildWorkloadsPath,+} from '@/routing/resourceLinks';+import {+ buildCommandPaletteCommands,+ filterCommandPaletteCommands,+ type CommandPaletteModalCommand,+ type CommandPaletteModalProps,+} from './commandPaletteModel';++export type {+ CommandPaletteModalCommand,+ CommandPaletteModalProps,+} from './commandPaletteModel';++export function useCommandPaletteState(props: CommandPaletteModalProps) {+ const navigate = useNavigate();+ const [query, setQuery] = createSignal('');+ const [inputRef, setInputRef] = createSignal<HTMLInputElement>();++ const commands = createMemo(() =>+ buildCommandPaletteCommands({+ paths: {+ infrastructurePath: buildInfrastructurePath(),+ workloadsPath: buildWorkloadsPath(),+ podWorkloadsPath: buildWorkloadsPath({ type: 'pod' }),+ storagePath: buildStoragePath(),+ recoveryPath: buildRecoveryPath(),+ },+ navigate,+ }),+ );++ const filteredCommands = createMemo(() =>+ filterCommandPaletteCommands(commands(), query()),+ );++ const handleSelect = (command: CommandPaletteModalCommand) => {+ command.action();+ props.onClose();+ };++ const handleInputKeyDown = (event: KeyboardEvent) => {+ if (event.key !== 'Enter') return;+ const first = filteredCommands()[0];+ if (!first) return;+ event.preventDefault();+ handleSelect(first);+ };++ createEffect(() => {+ if (props.isOpen) {+ setQuery('');+ queueMicrotask(() => inputRef()?.focus());+ return;+ }++ setQuery('');+ });++ return {+ filteredCommands,+ handleInputKeyDown,+ handleSelect,+ query,+ setInputRef,+ setQuery,+ };+}++export type CommandPaletteState = ReturnType<typeof useCommandPaletteState>;diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.tsindex 28f9d0e0f4..34ffe0e857 100644--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts@@ -8,6 +8,8 @@ import chartsApiSource from '@/api/charts.ts?raw';import investigateAlertButtonSource from '@/components/Alerts/InvestigateAlertButton.tsx?raw';import alertTargetTypesSource from '@/utils/alertTargetTypes.ts?raw';import resourceBadgesSource from '@/components/Infrastructure/resourceBadges.ts?raw';+import commandPaletteModalSource from '@/components/shared/CommandPaletteModal.tsx?raw';+import commandPaletteModelSource from '@/components/shared/commandPaletteModel.ts?raw';import containerUpdateBadgeSource from '@/components/shared/ContainerUpdateBadge.tsx?raw';import containerUpdateBadgeModelSource from '@/components/shared/containerUpdateBadgeModel.ts?raw';import densityMapSource from '@/components/shared/DensityMap.tsx?raw';@@ -25,6 +27,7 @@ import interactiveSparklineSource from '@/components/shared/InteractiveSparklineimport interactiveSparklineModelSource from '@/components/shared/interactiveSparklineModel.ts?raw';import infrastructureSelectorModelSource from '@/components/shared/infrastructureSelectorModel.ts?raw';import sharedInfrastructureSummaryTableModelSource from '@/components/shared/infrastructureSummaryTableModel.ts?raw';+import commandPaletteStateSource from '@/components/shared/useCommandPaletteState.ts?raw';import containerUpdateButtonStateSource from '@/components/shared/useContainerUpdateButtonState.ts?raw';import helpIconStateSource from '@/components/shared/useHelpIconState.ts?raw';import historyChartStateSource from '@/components/shared/useHistoryChartState.ts?raw';@@ -2622,6 +2625,16 @@ describe('frontend resource type boundaries', () => {expect(resourceIdentitySource).not.toContain('const asTrimmedString = (value: unknown): string | undefined => {',);+ expect(commandPaletteModalSource).toContain('useCommandPaletteState');+ expect(commandPaletteModalSource).not.toContain('useNavigate');+ expect(commandPaletteModalSource).not.toContain('createSignal');+ expect(commandPaletteModalSource).not.toContain('buildInfrastructurePath');+ expect(commandPaletteStateSource).toContain('useNavigate');+ expect(commandPaletteStateSource).toContain('createSignal');+ expect(commandPaletteStateSource).toContain('buildInfrastructurePath');+ expect(commandPaletteModelSource).toContain('buildCommandPaletteCommands');+ expect(commandPaletteModelSource).toContain('normalizeCommandPaletteQuery');+ expect(commandPaletteModelSource).toContain('filterCommandPaletteCommands');expect(infrastructureSummaryModelSource).not.toContain('const asTrimmedString = (value: unknown): string | null => {',);