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
Frontend consistency sweep Tier 5: drawer tabs use canonical Subtabs
rcourtman1200eeac49c4
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsxindex 1f0267da91..cb5abc772f 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx@@ -2,6 +2,7 @@ import { Show, For, Suspense } from 'solid-js';import type { Component } from 'solid-js';import type { Resource } from '@/types/resource';import { StatusDot } from '@/components/shared/StatusDot';+import { Subtabs } from '@/components/shared/Subtabs';import { ReportMergeModal } from './ReportMergeModal';import { ProxmoxMailGatewayDrawer } from '@/features/proxmox/ProxmoxMailGatewayDrawer';import { K8sDeploymentsDrawer } from '@/components/Kubernetes/K8sDeploymentsDrawer';@@ -120,25 +121,13 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {</Show></div>- <div class="flex items-center gap-6 border-b border-border px-1 mb-1">- <For each={drawer.tabs()}>- {(tab) => (- <button- onClick={() => drawer.setActiveTab(tab.id)}- class={`pb-2 text-sm font-medium transition-colors relative ${- drawer.activeTab() === tab.id- ? 'text-blue-600 dark:text-blue-400'- : ' hover:text-muted'- }`}- >- {tab.label}- <Show when={drawer.activeTab() === tab.id}>- <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />- </Show>- </button>- )}- </For>- </div>+ <Subtabs+ class="mb-1"+ ariaLabel="Resource detail sections"+ value={drawer.activeTab()}+ onChange={(value) => drawer.setActiveTab(value as Parameters<typeof drawer.setActiveTab>[0])}+ tabs={drawer.tabs().map((tab) => ({ value: tab.id, label: tab.label }))}+ /><divclass={drawer.activeTab() === 'overview' ? '' : 'hidden'}diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.k8s-capabilities.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.k8s-capabilities.test.tsxindex 6739be3cc9..c96747da01 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.k8s-capabilities.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.k8s-capabilities.test.tsx@@ -102,7 +102,7 @@ describe('ResourceDetailDrawer kubernetes capabilities', () => {it('uses the canonical Kubernetes cluster name for drawer fetch keys', async () => {render(() => <ResourceDetailDrawer resource={buildKubernetesResource()} />);- await fireEvent.click(screen.getByRole('button', { name: 'Namespaces' }));+ await fireEvent.click(screen.getByRole('tab', { name: 'Namespaces' }));await waitFor(() => {expect(screen.getByTestId('k8s-namespaces-drawer')).toHaveAttribute('data-cluster',@@ -110,7 +110,7 @@ describe('ResourceDetailDrawer kubernetes capabilities', () => {);});- await fireEvent.click(screen.getByRole('button', { name: 'Deployments' }));+ await fireEvent.click(screen.getByRole('tab', { name: 'Deployments' }));await waitFor(() => {expect(screen.getByTestId('k8s-deployments-drawer')).toHaveAttribute('data-cluster',diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.machine-history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.machine-history.test.tsxindex 1713361174..46bdebfc64 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.machine-history.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.machine-history.test.tsx@@ -90,7 +90,7 @@ describe('ResourceDetailDrawer machine metrics history', () => {/>));- await fireEvent.click(screen.getByRole('button', { name: 'History' }));+ await fireEvent.click(screen.getByRole('tab', { name: 'History' }));const history = screen.getByTestId('machine-history');expect(history).toHaveAttribute('data-resource-type', 'agent');@@ -112,7 +112,7 @@ describe('ResourceDetailDrawer machine metrics history', () => {/>));- expect(screen.queryByRole('button', { name: 'History' })).not.toBeInTheDocument();+ expect(screen.queryByRole('tab', { name: 'History' })).not.toBeInTheDocument();});it('adds a first-class discovery tab for Pulse Agent machines', async () => {@@ -131,9 +131,9 @@ describe('ResourceDetailDrawer machine metrics history', () => {/>));- expect(screen.getByRole('button', { name: 'Discovery' })).toBeInTheDocument();+ expect(screen.getByRole('tab', { name: 'Discovery' })).toBeInTheDocument();- await fireEvent.click(screen.getByRole('button', { name: 'Discovery' }));+ await fireEvent.click(screen.getByRole('tab', { name: 'Discovery' }));const discovery = screen.getByTestId('machine-discovery');expect(discovery).toHaveAttribute('data-resource-type', 'agent');diff --git a/frontend-modern/src/components/Workloads/GuestDrawer.tsx b/frontend-modern/src/components/Workloads/GuestDrawer.tsxindex 499c1f4dbc..778441a03c 100644--- a/frontend-modern/src/components/Workloads/GuestDrawer.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawer.tsx@@ -1,6 +1,7 @@import { Component, Show, Suspense, createMemo } from 'solid-js';import { DiscoveryTab } from '../Discovery/DiscoveryTab';import { DrawerSubjectHeading } from '@/components/shared/DrawerSubjectHeading';+import { Subtabs, type SubtabOption } from '@/components/shared/Subtabs';import { getSimpleStatusIndicator } from '@/utils/status';import { getGuestDrawerHistoryFallbackMetrics, type GuestDrawerProps } from './guestDrawerModel';import { useGuestDrawerState } from './useGuestDrawerState';@@ -52,58 +53,26 @@ export const GuestDrawer: Component<GuestDrawerProps> = (props) => {statusVariant={headerIndicator().variant}statusLabel={headerIndicator().label}/>- {/* Tabs */}- <div class="mb-1 flex items-center justify-between gap-3 border-b border-border px-1">- <div class="flex items-center gap-6">- <button- type="button"- onClick={() => switchTab('overview')}- class={`pb-2 text-sm font-medium transition-colors relative ${- activeTab() === 'overview' ? 'text-blue-600 dark:text-blue-400' : ' hover:text-muted'- }`}- >- Overview- {activeTab() === 'overview' && (- <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />- )}- </button>- {hasHistorySupport() && (- <button- type="button"- onClick={() => switchTab('history')}- class={`pb-2 text-sm font-medium transition-colors relative ${- activeTab() === 'history' ? 'text-blue-600 dark:text-blue-400' : ' hover:text-muted'- }`}- >- History- {activeTab() === 'history' && (- <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />- )}- </button>- )}- {hasDiscoverySupport() && (- <button- type="button"- onClick={() => switchTab('discovery')}- class={`pb-2 text-sm font-medium transition-colors relative ${- activeTab() === 'discovery'- ? 'text-blue-600 dark:text-blue-400'- : ' hover:text-muted'- }`}- >- Discovery- {activeTab() === 'discovery' && (- <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />- )}- </button>- )}- </div>- <Show when={hasHistorySupport() && activeTab() === 'history'}>- <div class="pb-1">+ <Subtabs+ class="mb-1"+ ariaLabel="Guest drawer sections"+ value={activeTab()}+ onChange={(value) => switchTab(value as Parameters<typeof switchTab>[0])}+ tabs={[+ { value: 'overview', label: 'Overview' },+ ...(hasHistorySupport()+ ? [{ value: 'history', label: 'History' } satisfies SubtabOption]+ : []),+ ...(hasDiscoverySupport()+ ? [{ value: 'discovery', label: 'Discovery' } satisfies SubtabOption]+ : []),+ ]}+ trailing={+ <Show when={hasHistorySupport() && activeTab() === 'history'}><GuestDrawerHistoryRangeSelect range={historyRange()} onRangeChange={setHistoryRange} />- </div>- </Show>- </div>+ </Show>+ }+ />{/* Use CSS hidden instead of Show to avoid mount/unmount which causes scroll jumps.overflow-anchor: none prevents browser scroll anchoring from jumping when display toggles. */}diff --git a/frontend-modern/src/components/Workloads/NodeDrawer.tsx b/frontend-modern/src/components/Workloads/NodeDrawer.tsxindex 2dab2996dc..6432e0cd27 100644--- a/frontend-modern/src/components/Workloads/NodeDrawer.tsx+++ b/frontend-modern/src/components/Workloads/NodeDrawer.tsx@@ -3,6 +3,7 @@ import { Show, Suspense, createMemo, createSignal, type Component } from 'solid-import type { HistoryTimeRange } from '@/api/charts';import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';import { DrawerSubjectHeading } from '@/components/shared/DrawerSubjectHeading';+import { Subtabs, type SubtabOption } from '@/components/shared/Subtabs';import type { Disk, Node } from '@/types/api';import { getDiscoveryLoadingState } from '@/utils/discoveryPresentation';import { getNodeDisplayName } from '@/utils/nodes';@@ -51,55 +52,24 @@ export const NodeDrawer: Component<NodeDrawerProps> = (props) => {statusLabel={headerIndicator().label}/>- <div class="mb-1 flex items-center justify-between gap-3 border-b border-border px-1">- <div class="flex items-center gap-6">- <button- type="button"- onClick={() => setActiveTab('overview')}- class={`pb-2 text-sm font-medium transition-colors relative ${- activeTab() === 'overview' ? 'text-blue-600 dark:text-blue-400' : ' hover:text-muted'- }`}- >- Overview- {activeTab() === 'overview' && (- <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />- )}- </button>- <button- type="button"- onClick={() => setActiveTab('history')}- class={`pb-2 text-sm font-medium transition-colors relative ${- activeTab() === 'history' ? 'text-blue-600 dark:text-blue-400' : ' hover:text-muted'- }`}- >- History- {activeTab() === 'history' && (- <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />- )}- </button>- <Show when={props.discoveryTarget?.agentId}>- <button- type="button"- onClick={() => setActiveTab('discovery')}- class={`pb-2 text-sm font-medium transition-colors relative ${- activeTab() === 'discovery'- ? 'text-blue-600 dark:text-blue-400'- : ' hover:text-muted'- }`}- >- Discovery- {activeTab() === 'discovery' && (- <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />- )}- </button>- </Show>- </div>- <Show when={activeTab() === 'history'}>- <div class="pb-1">+ <Subtabs+ class="mb-1"+ ariaLabel="Node drawer sections"+ value={activeTab()}+ onChange={(value) => setActiveTab(value as NodeDrawerTab)}+ tabs={[+ { value: 'overview', label: 'Overview' },+ { value: 'history', label: 'History' },+ ...(props.discoveryTarget?.agentId+ ? [{ value: 'discovery', label: 'Discovery' } satisfies SubtabOption]+ : []),+ ]}+ trailing={+ <Show when={activeTab() === 'history'}><GuestDrawerHistoryRangeSelect range={historyRange()} onRangeChange={setHistoryRange} />- </div>- </Show>- </div>+ </Show>+ }+ /><Show when={activeTab() === 'overview'}><NodeDrawerOverview node={props.node} disks={props.disks} />diff --git a/frontend-modern/src/components/shared/Subtabs.tsx b/frontend-modern/src/components/shared/Subtabs.tsxindex 0c45a87d41..4bfda555ee 100644--- a/frontend-modern/src/components/shared/Subtabs.tsx+++ b/frontend-modern/src/components/shared/Subtabs.tsx@@ -13,10 +13,18 @@ interface SubtabsProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, 'onChangariaLabel: string;listClass?: string;tabClass?: string;+ /**+ * Optional content rendered on the right side of the same border-b row as the+ * tablist (e.g. a contextual range select on a drawer's History tab). When+ * absent, the shell renders only the tablist — preserving the original+ * single-row layout for existing callers.+ */+ trailing?: JSX.Element;}export const subtabsShellClass = 'border-b border-border';export const subtabsListClass = 'flex flex-wrap items-center gap-6';+export const subtabsTrailingRowClass = 'flex flex-wrap items-center justify-between gap-3';export const subtabButtonClass ='inline-flex min-h-10 items-center border-b-2 px-1 py-2 text-sm font-medium transition-colors';export const subtabButtonActiveClass = 'border-blue-600 text-base-content';@@ -30,36 +38,48 @@ export const Subtabs: Component<SubtabsProps> = (props) => {'class','listClass','tabClass',+ 'trailing',]);+ const tablist = () => (+ <div+ role="tablist"+ aria-label={local.ariaLabel}+ class={`${subtabsListClass} ${local.listClass ?? ''}`.trim()}+ >+ <For each={local.tabs}>+ {(tab) => {+ const selected = () => local.value === tab.value;+ return (+ <button+ type="button"+ role="tab"+ aria-selected={selected()}+ tabIndex={selected() ? 0 : -1}+ disabled={tab.disabled}+ onClick={() => local.onChange(tab.value)}+ class={`${subtabButtonClass} ${+ selected() ? subtabButtonActiveClass : subtabButtonInactiveClass+ } ${local.tabClass ?? ''}`.trim()}+ >+ {tab.label}+ </button>+ );+ }}+ </For>+ </div>+ );+return (<div {...divProps} class={`${subtabsShellClass} ${local.class ?? ''}`.trim()}>- <div- role="tablist"- aria-label={local.ariaLabel}- class={`${subtabsListClass} ${local.listClass ?? ''}`.trim()}- >- <For each={local.tabs}>- {(tab) => {- const selected = () => local.value === tab.value;- return (- <button- type="button"- role="tab"- aria-selected={selected()}- tabIndex={selected() ? 0 : -1}- disabled={tab.disabled}- onClick={() => local.onChange(tab.value)}- class={`${subtabButtonClass} ${- selected() ? subtabButtonActiveClass : subtabButtonInactiveClass- } ${local.tabClass ?? ''}`.trim()}- >- {tab.label}- </button>- );- }}- </For>- </div>+ {local.trailing ? (+ <div class={subtabsTrailingRowClass}>+ {tablist()}+ {local.trailing}+ </div>+ ) : (+ tablist()+ )}</div>);};diff --git a/frontend-modern/src/features/docker/DockerHostDrawer.tsx b/frontend-modern/src/features/docker/DockerHostDrawer.tsxindex 4ed02787ed..9163c0fcdd 100644--- a/frontend-modern/src/features/docker/DockerHostDrawer.tsx+++ b/frontend-modern/src/features/docker/DockerHostDrawer.tsx@@ -3,6 +3,7 @@ import { Show, Suspense, createMemo, createSignal, type Component } from 'solid-import type { HistoryTimeRange } from '@/api/charts';import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';import { DrawerSubjectHeading } from '@/components/shared/DrawerSubjectHeading';+import { Subtabs, type SubtabOption } from '@/components/shared/Subtabs';import { getSimpleStatusIndicator } from '@/utils/status';import { GuestDrawerHistory, GuestDrawerHistoryRangeSelect } from '@/components/Workloads/GuestDrawerHistory';import { GUEST_DRAWER_HISTORY_DEFAULT_RANGE } from '@/components/Workloads/guestDrawerModel';@@ -50,55 +51,24 @@ export const DockerHostDrawer: Component<DockerHostDrawerProps> = (props) => {statusLabel={headerIndicator().label}/>- <div class="mb-1 flex items-center justify-between gap-3 border-b border-border px-1">- <div class="flex items-center gap-6">- <button- type="button"- onClick={() => setActiveTab('overview')}- class={`pb-2 text-sm font-medium transition-colors relative ${- activeTab() === 'overview' ? 'text-blue-600 dark:text-blue-400' : ' hover:text-muted'- }`}- >- Overview- {activeTab() === 'overview' && (- <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />- )}- </button>- <button- type="button"- onClick={() => setActiveTab('history')}- class={`pb-2 text-sm font-medium transition-colors relative ${- activeTab() === 'history' ? 'text-blue-600 dark:text-blue-400' : ' hover:text-muted'- }`}- >- History- {activeTab() === 'history' && (- <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />- )}- </button>- <Show when={discoveryConfig()}>- <button- type="button"- onClick={() => setActiveTab('discovery')}- class={`pb-2 text-sm font-medium transition-colors relative ${- activeTab() === 'discovery'- ? 'text-blue-600 dark:text-blue-400'- : ' hover:text-muted'- }`}- >- Discovery- {activeTab() === 'discovery' && (- <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />- )}- </button>- </Show>- </div>- <Show when={activeTab() === 'history'}>- <div class="pb-1">+ <Subtabs+ class="mb-1"+ ariaLabel="Docker host drawer sections"+ value={activeTab()}+ onChange={(value) => setActiveTab(value as DockerHostDrawerTab)}+ tabs={[+ { value: 'overview', label: 'Overview' },+ { value: 'history', label: 'History' },+ ...(discoveryConfig()+ ? [{ value: 'discovery', label: 'Discovery' } satisfies SubtabOption]+ : []),+ ]}+ trailing={+ <Show when={activeTab() === 'history'}><GuestDrawerHistoryRangeSelect range={historyRange()} onRangeChange={setHistoryRange} />- </div>- </Show>- </div>+ </Show>+ }+ /><Show when={activeTab() === 'overview'}><DockerHostDrawerOverview host={props.host} />diff --git a/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsxindex acd4eecedb..d3fa933595 100644--- a/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx+++ b/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx@@ -121,8 +121,8 @@ describe('DockerHostsTable', () => {expect(screen.getByTestId('docker-host-drawer')).toBeInTheDocument();expect(window.location.pathname).toBe('/docker/overview');expect(window.location.search).toBe('');- expect(screen.getByRole('button', { name: 'Overview' })).toHaveAttribute('type', 'button');- expect(screen.getByRole('button', { name: 'History' })).toHaveAttribute('type', 'button');+ expect(screen.getByRole('tab', { name: 'Overview' })).toHaveAttribute('type', 'button');+ expect(screen.getByRole('tab', { name: 'History' })).toHaveAttribute('type', 'button');});it('identifies the host system separately from the container runtime', () => {