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 dashboard stacked disk bar runtime owners
rcourtmanc0be88dd4218
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 6d652f274f..feb24fff3d 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -33,29 +33,34 @@ regression protection.11. `frontend-modern/src/components/Dashboard/ThresholdSlider.tsx`12. `frontend-modern/src/components/Dashboard/thresholdSliderModel.ts`13. `frontend-modern/src/components/Dashboard/useThresholdSliderState.ts`-14. `frontend-modern/src/components/Dashboard/DiskList.tsx`-15. `frontend-modern/src/components/Dashboard/diskListModel.ts`-16. `frontend-modern/src/components/Dashboard/useDiskListState.ts`-17. `frontend-modern/src/components/Dashboard/GuestRow.tsx`-18. `frontend-modern/src/components/Dashboard/guestRowModel.tsx`-19. `frontend-modern/src/components/Dashboard/useGuestRowState.ts`-20. `frontend-modern/src/components/Dashboard/GuestDrawer.tsx`-21. `frontend-modern/src/components/Dashboard/guestDrawerModel.ts`-22. `frontend-modern/src/components/Dashboard/useGuestDrawerState.ts`-23. `frontend-modern/src/components/Dashboard/workloadSelectors.ts`-24. `frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx`-25. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts`-26. `frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts`-27. `frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts`-28. `frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx`-29. `frontend-modern/src/components/Dashboard/__tests__/DashboardFilter.test.tsx`-30. `frontend-modern/src/components/Dashboard/__tests__/useDashboardFilterState.test.ts`-31. `frontend-modern/src/components/Dashboard/ThresholdSlider.test.tsx`-32. `frontend-modern/src/components/Dashboard/__tests__/useThresholdSliderState.test.ts`-33. `frontend-modern/src/components/Dashboard/__tests__/DiskList.test.tsx`-34. `frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx`-35. `frontend-modern/src/components/Dashboard/GuestDrawer.test.tsx`-36. `frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx`+14. `frontend-modern/src/components/Dashboard/StackedDiskBar.tsx`+15. `frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts`+16. `frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts`+17. `frontend-modern/src/components/Dashboard/DiskList.tsx`+18. `frontend-modern/src/components/Dashboard/diskListModel.ts`+19. `frontend-modern/src/components/Dashboard/useDiskListState.ts`+20. `frontend-modern/src/components/Dashboard/GuestRow.tsx`+21. `frontend-modern/src/components/Dashboard/guestRowModel.tsx`+22. `frontend-modern/src/components/Dashboard/useGuestRowState.ts`+23. `frontend-modern/src/components/Dashboard/GuestDrawer.tsx`+24. `frontend-modern/src/components/Dashboard/guestDrawerModel.ts`+25. `frontend-modern/src/components/Dashboard/useGuestDrawerState.ts`+26. `frontend-modern/src/components/Dashboard/workloadSelectors.ts`+27. `frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx`+28. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts`+29. `frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts`+30. `frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts`+31. `frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx`+32. `frontend-modern/src/components/Dashboard/__tests__/DashboardFilter.test.tsx`+33. `frontend-modern/src/components/Dashboard/__tests__/useDashboardFilterState.test.ts`+34. `frontend-modern/src/components/Dashboard/ThresholdSlider.test.tsx`+35. `frontend-modern/src/components/Dashboard/__tests__/useThresholdSliderState.test.ts`+36. `frontend-modern/src/components/Dashboard/__tests__/StackedDiskBar.test.tsx`+37. `frontend-modern/src/components/Dashboard/__tests__/useStackedDiskBarState.test.tsx`+38. `frontend-modern/src/components/Dashboard/__tests__/DiskList.test.tsx`+39. `frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx`+40. `frontend-modern/src/components/Dashboard/GuestDrawer.test.tsx`+41. `frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx`## Shared Boundaries@@ -80,6 +85,7 @@ regression protection.11. Extend dashboard disk-list derivations and fallback runtime wiring through `frontend-modern/src/components/Dashboard/diskListModel.ts` and `frontend-modern/src/components/Dashboard/useDiskListState.ts` rather than rebuilding usage math, progress-state mapping, or tooltip fallback logic inside `frontend-modern/src/components/Dashboard/DiskList.tsx`12. Extend dashboard filter defaults, active-filter counting, reset semantics, and mobile toolbar state through `frontend-modern/src/components/Dashboard/dashboardFilterModel.ts` and `frontend-modern/src/components/Dashboard/useDashboardFilterState.ts`, and keep dashboard-owned filter-config assembly in `frontend-modern/src/components/Dashboard/useDashboardState.ts`, rather than rebuilding filter-local state inside `frontend-modern/src/components/Dashboard/DashboardFilter.tsx` or inline config IIFEs in `frontend-modern/src/components/Dashboard/Dashboard.tsx`13. Extend threshold-slider value-position math, title/label derivation, and drag scroll-lock runtime through `frontend-modern/src/components/Dashboard/thresholdSliderModel.ts` and `frontend-modern/src/components/Dashboard/useThresholdSliderState.ts` rather than rebuilding slider-local state and pointer lifecycle inside `frontend-modern/src/components/Dashboard/ThresholdSlider.tsx`+14. Extend stacked disk-bar capacity math, segment/tooltip derivation, and resize-observer runtime through `frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts` and `frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts` rather than rebuilding disk-bar-local state, mode branching, and tooltip shaping inside `frontend-modern/src/components/Dashboard/StackedDiskBar.tsx`## Forbidden Paths@@ -152,6 +158,15 @@ and drag scroll-lock lifecycle lives in`frontend-modern/src/components/Dashboard/useThresholdSliderState.ts`.Future slider runtime changes must extend through those owners instead ofreintroducing mixed drag state and formatting logic into the shell.+The dashboard stacked disk bar now follows that same pattern: the shell stays+in `frontend-modern/src/components/Dashboard/StackedDiskBar.tsx`, while+disk-capacity math, segment and tooltip derivation, max-disk labeling, and+mode-specific presentation live in+`frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts` and+resize-observer plus tooltip lifecycle live in+`frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts`.+Future disk-bar runtime changes must extend through those owners instead of+reintroducing mixed resize state and presentation branching into the shell.The unified resource table hot path is now also governed as explicitperformance-owned runtime, with shared ownership against the unified-resourcediff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.jsonindex 2467711560..50a1312a03 100644--- a/docs/release-control/v6/internal/subsystems/registry.json+++ b/docs/release-control/v6/internal/subsystems/registry.json@@ -2526,6 +2526,8 @@"frontend-modern/src/components/Dashboard/guestDrawerModel.ts","frontend-modern/src/components/Dashboard/GuestRow.tsx","frontend-modern/src/components/Dashboard/guestRowModel.tsx",+ "frontend-modern/src/components/Dashboard/StackedDiskBar.tsx",+ "frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts","frontend-modern/src/components/Dashboard/ThresholdSlider.tsx","frontend-modern/src/components/Dashboard/thresholdSliderModel.ts","frontend-modern/src/components/Dashboard/useDashboardFilterState.ts",@@ -2533,6 +2535,7 @@"frontend-modern/src/components/Dashboard/useDiskListState.ts","frontend-modern/src/components/Dashboard/useGuestDrawerState.ts","frontend-modern/src/components/Dashboard/useGuestRowState.ts",+ "frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts","frontend-modern/src/components/Dashboard/useThresholdSliderState.ts","frontend-modern/src/components/Dashboard/workloadSelectors.ts","frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts",@@ -2550,7 +2553,9 @@"frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx","frontend-modern/src/components/Dashboard/__tests__/DashboardFilter.test.tsx","frontend-modern/src/components/Dashboard/__tests__/DiskList.test.tsx",+ "frontend-modern/src/components/Dashboard/__tests__/StackedDiskBar.test.tsx","frontend-modern/src/components/Dashboard/__tests__/useDashboardFilterState.test.ts",+ "frontend-modern/src/components/Dashboard/__tests__/useStackedDiskBarState.test.tsx","frontend-modern/src/components/Dashboard/__tests__/useThresholdSliderState.test.ts","frontend-modern/src/components/Dashboard/ThresholdSlider.test.tsx","internal/api/router_bench_test.go",@@ -2591,6 +2596,8 @@"frontend-modern/src/components/Dashboard/guestDrawerModel.ts","frontend-modern/src/components/Dashboard/GuestRow.tsx","frontend-modern/src/components/Dashboard/guestRowModel.tsx",+ "frontend-modern/src/components/Dashboard/StackedDiskBar.tsx",+ "frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts","frontend-modern/src/components/Dashboard/ThresholdSlider.tsx","frontend-modern/src/components/Dashboard/thresholdSliderModel.ts","frontend-modern/src/components/Dashboard/useDashboardFilterState.ts",@@ -2598,6 +2605,7 @@"frontend-modern/src/components/Dashboard/useDiskListState.ts","frontend-modern/src/components/Dashboard/useGuestDrawerState.ts","frontend-modern/src/components/Dashboard/useGuestRowState.ts",+ "frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts","frontend-modern/src/components/Dashboard/useThresholdSliderState.ts","frontend-modern/src/components/Dashboard/workloadSelectors.ts","frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts",@@ -2612,7 +2620,9 @@"frontend-modern/src/components/Dashboard/__tests__/DashboardFilter.test.tsx","frontend-modern/src/components/Dashboard/__tests__/DiskList.test.tsx","frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx",+ "frontend-modern/src/components/Dashboard/__tests__/StackedDiskBar.test.tsx","frontend-modern/src/components/Dashboard/__tests__/useDashboardFilterState.test.ts",+ "frontend-modern/src/components/Dashboard/__tests__/useStackedDiskBarState.test.tsx","frontend-modern/src/components/Dashboard/__tests__/useThresholdSliderState.test.ts","frontend-modern/src/components/Dashboard/__tests__/workloadSelectors.test.ts","frontend-modern/src/components/Dashboard/GuestDrawer.test.tsx",diff --git a/frontend-modern/src/components/Dashboard/StackedDiskBar.tsx b/frontend-modern/src/components/Dashboard/StackedDiskBar.tsxindex 8c08542139..5d055a7245 100644--- a/frontend-modern/src/components/Dashboard/StackedDiskBar.tsx+++ b/frontend-modern/src/components/Dashboard/StackedDiskBar.tsx@@ -1,262 +1,26 @@-import { Show, For, createMemo, createSignal, onMount, onCleanup } from 'solid-js';-import { useTooltip } from '@/hooks/useTooltip';+import { Show, For } from 'solid-js';import { TooltipPortal } from '@/components/shared/TooltipPortal';-import type { Disk } from '@/types/api';-import {- formatBytes,- formatPercent,- estimateTextWidth,- formatAnomalyRatio,- ANOMALY_SEVERITY_CLASS,-} from '@/utils/format';-import { getMetricColorRgba } from '@/utils/metricThresholds';-import type { AnomalyReport } from '@/types/aiIntelligence';--interface StackedDiskBarProps {- /** Array of disk objects - if empty/undefined, falls back to aggregate */- disks?: Disk[];- /** Aggregate disk data (fallback when disks array unavailable) */- aggregateDisk?: Disk;- /** Display mode for multi-disk hosts */- mode?: 'stacked' | 'aggregate' | 'mini';- /** Baseline anomaly if detected */- anomaly?: AnomalyReport | null;-}--// Color palette for disk segments - distinct colors for visual differentiation-const SEGMENT_COLORS = [- 'rgba(34, 197, 94, 0.6)', // green- 'rgba(59, 130, 246, 0.6)', // blue- 'rgba(168, 85, 247, 0.6)', // purple- 'rgba(249, 115, 22, 0.6)', // orange- 'rgba(236, 72, 153, 0.6)', // pink- 'rgba(20, 184, 166, 0.6)', // teal-];+import { type StackedDiskBarProps } from './stackedDiskBarModel';+import { useStackedDiskBarState } from './useStackedDiskBarState';export function StackedDiskBar(props: StackedDiskBarProps) {- const tip = useTooltip();- const [containerWidth, setContainerWidth] = createSignal(100);- let containerRef: HTMLDivElement | undefined;-- onMount(() => {- if (!containerRef) return;- setContainerWidth(containerRef.offsetWidth);-- const observer = new ResizeObserver((entries) => {- for (const entry of entries) {- setContainerWidth(entry.contentRect.width);- }- });-- observer.observe(containerRef);- onCleanup(() => observer.disconnect());- });-- const anomalyRatio = createMemo(() => formatAnomalyRatio(props.anomaly));-- // Determine if we have multiple disks or should use aggregate- const hasMultipleDisks = createMemo(() => {- const disks = props.disks;- return disks && disks.length > 1;- });-- const aggregateMode = createMemo(() => props.mode === 'aggregate');- const miniMode = createMemo(() => props.mode === 'mini');- const useStackedSegments = createMemo(- () => hasMultipleDisks() && !aggregateMode() && !miniMode(),- );-- // Calculate total capacity across all disks- const totalCapacity = createMemo(() => {- if (!props.disks || props.disks.length === 0) {- return props.aggregateDisk?.total ?? 0;- }- return props.disks.reduce((sum, d) => sum + (d.total || 0), 0);- });-- const totalUsed = createMemo(() => {- if (!props.disks || props.disks.length === 0) {- return props.aggregateDisk?.used ?? 0;- }- return props.disks.reduce((sum, d) => sum + (d.used || 0), 0);- });-- const overallPercent = createMemo(() => {- const total = totalCapacity();- if (total <= 0) return 0;- return (totalUsed() / total) * 100;- });-- const barPercent = createMemo(() => Math.min(overallPercent(), 100));-- // Calculate segment widths for stacked bar (each disk's used space as % of total capacity)- const segments = createMemo(() => {- if (!useStackedSegments() || !props.disks) return [];-- const total = totalCapacity();- if (total <= 0) return [];-- return props.disks.map((disk, idx) => {- const usedPercent = (disk.used / total) * 100;- const diskPercent = disk.total > 0 ? (disk.used / disk.total) * 100 : 0;- // Use warning/critical colors for high usage, otherwise use the color palette- const color =- diskPercent >= 90- ? getMetricColorRgba(90, 'disk')- : diskPercent >= 80- ? getMetricColorRgba(80, 'disk')- : SEGMENT_COLORS[idx % SEGMENT_COLORS.length];- return {- disk,- widthPercent: Math.min(usedPercent, 100),- diskUsagePercent: diskPercent,- color,- index: idx,- };- });- });-- // Check if we have any disk details to show- const hasDisks = createMemo(() => {- return props.disks && props.disks.length > 0;- });-- const miniDisks = createMemo(() => {- if (!props.disks) return [];- return props.disks.map((disk, idx) => {- const percent = disk.total > 0 ? (disk.used / disk.total) * 100 : 0;- const label = disk.mountpoint || disk.device || `Disk ${idx + 1}`;- return {- label,- percent,- color: getMetricColorRgba(percent, 'disk'),- };- });- });-- const maxDiskInfo = createMemo(() => {- if (!props.disks || props.disks.length === 0) return null;- let maxPercent = -1;- let maxLabel = '';- for (const disk of props.disks) {- const percent = disk.total > 0 ? (disk.used / disk.total) * 100 : 0;- if (percent > maxPercent) {- maxPercent = percent;- maxLabel = disk.mountpoint || disk.device || 'Disk';- }- }- if (maxPercent < 0) return null;- return { percent: maxPercent, label: maxLabel };- });-- const maxLabelShort = createMemo(() => {- const info = maxDiskInfo();- if (!info) return '';- return `max ${formatPercent(info.percent)}`;- });-- const maxLabelFull = createMemo(() => {- const info = maxDiskInfo();- if (!info) return '';- if (info.label) return `Max ${formatPercent(info.percent)} (${info.label})`;- return `Max ${formatPercent(info.percent)}`;- });-- const barColor = createMemo(() => {- const info = maxDiskInfo();- if (aggregateMode() && hasMultipleDisks() && info) {- return getMetricColorRgba(info.percent, 'disk');- }- return getMetricColorRgba(overallPercent(), 'disk');- });-- // Generate tooltip content- const tooltipContent = createMemo(() => {- const useUsageColors = aggregateMode() || miniMode();- if (hasDisks() && props.disks) {- return props.disks.map((disk, idx) => {- const percent = disk.total > 0 ? (disk.used / disk.total) * 100 : 0;- const label = disk.mountpoint || disk.device || `Disk ${idx + 1}`;- return {- label,- used: formatBytes(disk.used),- total: formatBytes(disk.total),- percent: formatPercent(percent),- color: useUsageColors- ? getMetricColorRgba(percent, 'disk')- : percent >= 90- ? getMetricColorRgba(90, 'disk')- : percent >= 80- ? getMetricColorRgba(80, 'disk')- : SEGMENT_COLORS[idx % SEGMENT_COLORS.length],- };- });- }- // Fallback for aggregate disk- if (props.aggregateDisk && props.aggregateDisk.total > 0) {- const percent = (props.aggregateDisk.used / props.aggregateDisk.total) * 100;- return [- {- label: 'Total',- used: formatBytes(props.aggregateDisk.used),- total: formatBytes(props.aggregateDisk.total),- percent: formatPercent(percent),- color: getMetricColorRgba(percent, 'disk'),- },- ];- }- return [];- });-- // Label for the bar- const displayLabel = createMemo(() => {- return formatPercent(overallPercent());- });-- // Sublabel showing used/total- const displaySublabel = createMemo(() => {- return `${formatBytes(totalUsed())}/${formatBytes(totalCapacity())}`;- });-- const showMaxLabel = createMemo(() => {- if (!aggregateMode() || !hasMultipleDisks()) return false;- const shortLabel = maxLabelShort();- if (!shortLabel) return false;- const fullText = `${displayLabel()} ${shortLabel}`;- return containerWidth() >= estimateTextWidth(fullText);- });-- // Check if sublabel fits- const showSublabel = createMemo(() => {- const baseText = `${displayLabel()}${showMaxLabel() ? ` ${maxLabelShort()}` : ''}`;- const fullText = `${baseText} (${displaySublabel()})`;- return containerWidth() >= estimateTextWidth(fullText);- });-- const containerClass = createMemo(() => {- return miniMode() && hasDisks()- ? 'metric-text w-full'- : 'metric-text w-full h-4 flex items-center justify-center';- });-- const handleMouseEnter = (e: MouseEvent) => {- if (tooltipContent().length > 0) tip.onMouseEnter(e);- };+ const state = useStackedDiskBarState(props);+ const presentation = state.presentation;return (- <div ref={containerRef} class={containerClass()}>+ <div ref={state.setContainerRef} class={presentation().containerClass}><Show- when={miniMode() && hasDisks()}+ when={presentation().miniMode && presentation().hasDisks}fallback={<divclass="relative w-full h-full overflow-hidden bg-surface-hover rounded"- onMouseEnter={handleMouseEnter}- onMouseLeave={tip.onMouseLeave}+ onMouseEnter={state.handleMouseEnter}+ onMouseLeave={state.handleMouseLeave}>{/* Stacked segments for multiple disks */}- <Show when={useStackedSegments()}>+ <Show when={presentation().useStackedSegments}><div class="absolute top-0 left-0 h-full w-full flex">- <For each={segments()}>+ <For each={presentation().segments}>{(segment, idx) => (<divclass="h-full"@@ -264,7 +28,7 @@ export function StackedDiskBar(props: StackedDiskBarProps) {width: `${segment.widthPercent}%`,'background-color': segment.color,'border-right':- idx() < segments().length - 1+ idx() < presentation().segments.length - 1? '1px solid rgba(255,255,255,0.3)': 'none',}}@@ -275,12 +39,12 @@ export function StackedDiskBar(props: StackedDiskBarProps) {</Show>{/* Single bar for aggregate or single disk */}- <Show when={!useStackedSegments()}>+ <Show when={!presentation().useStackedSegments}><divclass="absolute top-0 left-0 h-full"style={{- width: `${barPercent()}%`,- 'background-color': barColor(),+ width: `${presentation().barPercent}%`,+ 'background-color': presentation().barColor,}}/></Show>@@ -288,26 +52,29 @@ export function StackedDiskBar(props: StackedDiskBarProps) {{/* Label overlay */}<span class="absolute inset-0 flex items-center justify-center text-[10px] font-semibold text-base-content leading-none min-w-0 overflow-hidden"><span class="max-w-full min-w-0 whitespace-nowrap overflow-hidden text-ellipsis px-0.5 text-center">- <span>{displayLabel()}</span>- <Show when={showMaxLabel()}>- <span class="text-[8px] font-normal text-muted" title={maxLabelFull()}>+ <span>{presentation().displayLabel}</span>+ <Show when={presentation().showMaxLabel}>+ <span class="text-[8px] font-normal text-muted" title={presentation().maxLabelFull}>{' '}- {maxLabelShort()}+ {presentation().maxLabelShort}</span></Show>- <Show when={showSublabel()}>- <span class="metric-sublabel font-normal text-muted"> ({displaySublabel()})</span>+ <Show when={presentation().showSublabel}>+ <span class="metric-sublabel font-normal text-muted">+ {' '}+ ({presentation().displaySublabel})+ </span></Show>- <Show when={useStackedSegments()}>+ <Show when={presentation().showDiskCount}><span class="text-[8px] font-normal text-muted"> [{props.disks?.length}]</span></Show>{/* Anomaly indicator */}- <Show when={props.anomaly && anomalyRatio()}>+ <Show when={presentation().anomalyDescription && presentation().anomalyRatio}><span- class={`ml-0.5 font-bold animate-pulse ${ANOMALY_SEVERITY_CLASS[props.anomaly!.severity] || 'text-yellow-400'}`}- title={props.anomaly!.description}+ class={`ml-0.5 font-bold animate-pulse ${presentation().anomalyClass}`}+ title={presentation().anomalyDescription}>- {anomalyRatio()}+ {presentation().anomalyRatio}</span></Show></span>@@ -315,14 +82,14 @@ export function StackedDiskBar(props: StackedDiskBarProps) {</div>}>- <div class="w-full" onMouseEnter={handleMouseEnter} onMouseLeave={tip.onMouseLeave}>+ <div class="w-full" onMouseEnter={state.handleMouseEnter} onMouseLeave={state.handleMouseLeave}><divclass="grid gap-1"style={{- 'grid-template-columns': `repeat(${miniDisks().length}, minmax(0, 1fr))`,+ 'grid-template-columns': `repeat(${presentation().miniDisks.length}, minmax(0, 1fr))`,}}>- <For each={miniDisks()}>+ <For each={presentation().miniDisks}>{(disk) => (<div class="flex flex-col items-stretch gap-0.5"><span class="text-[8px] text-muted truncate" title={disk.label}>@@ -346,15 +113,15 @@ export function StackedDiskBar(props: StackedDiskBarProps) {{/* Tooltip for disk breakdown */}<TooltipPortal- when={tip.show() && tooltipContent().length > 0}- x={tip.pos().x}- y={tip.pos().y}+ when={state.tooltipVisible()}+ x={state.tip.pos().x}+ y={state.tip.pos().y}><div class="min-w-[140px]"><div class="font-medium mb-1 text-slate-300 border-b border-border pb-1">- {hasMultipleDisks() ? 'Disk Breakdown' : 'Disk Usage'}+ {presentation().tooltipTitle}</div>- <For each={tooltipContent()}>+ <For each={presentation().tooltipContent}>{(item, idx) => (<divclass="flex flex-col gap-1 py-0.5"diff --git a/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx b/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsxindex 88a47aa261..f5431ef806 100644--- a/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx+++ b/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx@@ -11,6 +11,9 @@ import dashboardFilterStateSource from '../useDashboardFilterState.ts?raw';import thresholdSliderSource from '../ThresholdSlider.tsx?raw';import thresholdSliderModelSource from '../thresholdSliderModel.ts?raw';import thresholdSliderStateSource from '../useThresholdSliderState.ts?raw';+import stackedDiskBarSource from '../StackedDiskBar.tsx?raw';+import stackedDiskBarModelSource from '../stackedDiskBarModel.ts?raw';+import stackedDiskBarStateSource from '../useStackedDiskBarState.ts?raw';import diskListSource from '../DiskList.tsx?raw';import diskListModelSource from '../diskListModel.ts?raw';import diskListStateSource from '../useDiskListState.ts?raw';@@ -510,6 +513,18 @@ describe('Dashboard performance contract', () => {expect(thresholdSliderModelSource).toContain('export function getThresholdSliderLabel');});+ it('keeps stacked disk bar runtime and derivations in canonical owners', () => {+ expect(stackedDiskBarSource).toContain('useStackedDiskBarState');+ expect(stackedDiskBarSource).not.toContain('const [containerWidth, setContainerWidth] =');+ expect(stackedDiskBarSource).not.toContain('const tooltipContent = createMemo(() => {');+ expect(stackedDiskBarSource).not.toContain('const SEGMENT_COLORS =');+ expect(stackedDiskBarStateSource).toContain('new ResizeObserver');+ expect(stackedDiskBarStateSource).toContain('useTooltip');+ expect(stackedDiskBarModelSource).toContain('export function buildStackedDiskBarPresentation');+ expect(stackedDiskBarModelSource).toContain('const SEGMENT_COLORS');+ expect(stackedDiskBarModelSource).toContain('tooltipTitle');+ });+it('keeps guest row contract and hot-path state in canonical row owners', () => {expect(guestRowSource).toContain('useGuestRowState');expect(guestRowSource).not.toContain('export const GUEST_COLUMNS');diff --git a/frontend-modern/src/components/Dashboard/__tests__/useStackedDiskBarState.test.tsx b/frontend-modern/src/components/Dashboard/__tests__/useStackedDiskBarState.test.tsxnew file mode 100644index 0000000000..de74a7be7d--- /dev/null+++ b/frontend-modern/src/components/Dashboard/__tests__/useStackedDiskBarState.test.tsx@@ -0,0 +1,81 @@+import { afterEach, describe, expect, it, vi } from 'vitest';+import { cleanup, render } from '@solidjs/testing-library';+import type { Disk } from '@/types/api';+import { useStackedDiskBarState } from '@/components/Dashboard/useStackedDiskBarState';++class MockResizeObserver {+ callback: ResizeObserverCallback;+ disconnect = vi.fn();+ observe = vi.fn();++ constructor(callback: ResizeObserverCallback) {+ this.callback = callback;+ }++ trigger(width: number) {+ this.callback(+ [+ {+ contentRect: { width } as DOMRectReadOnly,+ } as ResizeObserverEntry,+ ],+ this as unknown as ResizeObserver,+ );+ }+}++const originalResizeObserver = globalThis.ResizeObserver;++function makeDisk(overrides: Partial<Disk> = {}): Disk {+ return {+ total: 107374182400,+ used: 53687091200,+ free: 53687091200,+ usage: 50,+ mountpoint: '/',+ type: 'ext4',+ device: '/dev/sda1',+ ...overrides,+ };+}++afterEach(() => {+ cleanup();+ globalThis.ResizeObserver = originalResizeObserver;+});++describe('useStackedDiskBarState', () => {+ it('centralizes stacked disk derivations and resize observer cleanup', () => {+ const observers: MockResizeObserver[] = [];+ globalThis.ResizeObserver = class extends MockResizeObserver {+ constructor(callback: ResizeObserverCallback) {+ super(callback);+ observers.push(this);+ }+ } as unknown as typeof ResizeObserver;++ let captured: ReturnType<typeof useStackedDiskBarState> | undefined;++ const Harness = () => {+ captured = useStackedDiskBarState({+ disks: [makeDisk({ mountpoint: '/boot' }), makeDisk({ mountpoint: '/data' })],+ mode: 'aggregate',+ });+ return <div ref={captured.setContainerRef} />;+ };++ const { unmount } = render(() => <Harness />);++ expect(captured).toBeDefined();+ expect(observers).toHaveLength(1);+ expect(observers[0].observe).toHaveBeenCalled();+ expect(captured!.presentation().hasMultipleDisks).toBe(true);+ expect(captured!.presentation().aggregateMode).toBe(true);++ observers[0].trigger(320);+ expect(captured!.presentation().showSublabel).toBe(true);++ unmount();+ expect(observers[0].disconnect).toHaveBeenCalled();+ });+});diff --git a/frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts b/frontend-modern/src/components/Dashboard/stackedDiskBarModel.tsnew file mode 100644index 0000000000..890bf1cdda--- /dev/null+++ b/frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts@@ -0,0 +1,250 @@+import type { Disk } from '@/types/api';+import type { AnomalyReport } from '@/types/aiIntelligence';+import {+ ANOMALY_SEVERITY_CLASS,+ estimateTextWidth,+ formatAnomalyRatio,+ formatBytes,+ formatPercent,+} from '@/utils/format';+import { getMetricColorRgba } from '@/utils/metricThresholds';++export interface StackedDiskBarProps {+ disks?: Disk[];+ aggregateDisk?: Disk;+ mode?: 'stacked' | 'aggregate' | 'mini';+ anomaly?: AnomalyReport | null;+}++export interface StackedDiskSegment {+ color: string;+ disk: Disk;+ diskUsagePercent: number;+ index: number;+ widthPercent: number;+}++export interface StackedDiskTooltipItem {+ color: string;+ label: string;+ percent: string;+ total: string;+ used: string;+}++export interface StackedDiskMiniDisk {+ color: string;+ label: string;+ percent: number;+}++export interface StackedDiskMaxInfo {+ label: string;+ percent: number;+}++export interface StackedDiskBarPresentation {+ aggregateMode: boolean;+ anomalyClass: string;+ anomalyDescription?: string;+ anomalyRatio: string;+ barColor: string;+ barPercent: number;+ containerClass: string;+ displayLabel: string;+ displaySublabel: string;+ hasDisks: boolean;+ hasMultipleDisks: boolean;+ maxLabelFull: string;+ maxLabelShort: string;+ miniDisks: StackedDiskMiniDisk[];+ miniMode: boolean;+ segments: StackedDiskSegment[];+ showDiskCount: boolean;+ showMaxLabel: boolean;+ showSublabel: boolean;+ tooltipContent: StackedDiskTooltipItem[];+ tooltipTitle: string;+ useStackedSegments: boolean;+}++const SEGMENT_COLORS = [+ 'rgba(34, 197, 94, 0.6)',+ 'rgba(59, 130, 246, 0.6)',+ 'rgba(168, 85, 247, 0.6)',+ 'rgba(249, 115, 22, 0.6)',+ 'rgba(236, 72, 153, 0.6)',+ 'rgba(20, 184, 166, 0.6)',+];++function getDiskUsagePercent(disk: Disk): number {+ return disk.total > 0 ? (disk.used / disk.total) * 100 : 0;+}++function getDiskLabel(disk: Disk, index: number): string {+ return disk.mountpoint || disk.device || `Disk ${index + 1}`;+}++function getStackedDiskColor(percent: number, index: number): string {+ if (percent >= 90) {+ return getMetricColorRgba(90, 'disk');+ }+ if (percent >= 80) {+ return getMetricColorRgba(80, 'disk');+ }+ return SEGMENT_COLORS[index % SEGMENT_COLORS.length];+}++function buildTooltipContent(+ disks: Disk[],+ options: {+ aggregateDisk: Disk | undefined;+ aggregateMode: boolean;+ miniMode: boolean;+ },+): StackedDiskTooltipItem[] {+ const useUsageColors = options.aggregateMode || options.miniMode;+ if (disks.length > 0) {+ return disks.map((disk, index) => {+ const percentValue = getDiskUsagePercent(disk);+ return {+ color: useUsageColors+ ? getMetricColorRgba(percentValue, 'disk')+ : getStackedDiskColor(percentValue, index),+ label: getDiskLabel(disk, index),+ percent: formatPercent(percentValue),+ total: formatBytes(disk.total),+ used: formatBytes(disk.used),+ };+ });+ }++ if (options.aggregateDisk && options.aggregateDisk.total > 0) {+ const percentValue = getDiskUsagePercent(options.aggregateDisk);+ return [+ {+ color: getMetricColorRgba(percentValue, 'disk'),+ label: 'Total',+ percent: formatPercent(percentValue),+ total: formatBytes(options.aggregateDisk.total),+ used: formatBytes(options.aggregateDisk.used),+ },+ ];+ }++ return [];+}++function getMaxDiskInfo(disks: Disk[]): StackedDiskMaxInfo | null {+ if (disks.length === 0) {+ return null;+ }++ let maxInfo: StackedDiskMaxInfo | null = null;+ for (const [index, disk] of disks.entries()) {+ const percent = getDiskUsagePercent(disk);+ if (!maxInfo || percent > maxInfo.percent) {+ maxInfo = {+ label: getDiskLabel(disk, index),+ percent,+ };+ }+ }+ return maxInfo;+}++export function buildStackedDiskBarPresentation(+ props: StackedDiskBarProps,+ containerWidth: number,+): StackedDiskBarPresentation {+ const disks = props.disks ?? [];+ const hasDisks = disks.length > 0;+ const hasMultipleDisks = disks.length > 1;+ const aggregateMode = props.mode === 'aggregate';+ const miniMode = props.mode === 'mini';+ const useStackedSegments = hasMultipleDisks && !aggregateMode && !miniMode;+ const totalCapacity = hasDisks+ ? disks.reduce((sum, disk) => sum + (disk.total || 0), 0)+ : (props.aggregateDisk?.total ?? 0);+ const totalUsed = hasDisks+ ? disks.reduce((sum, disk) => sum + (disk.used || 0), 0)+ : (props.aggregateDisk?.used ?? 0);+ const overallPercent = totalCapacity > 0 ? (totalUsed / totalCapacity) * 100 : 0;+ const barPercent = Math.min(overallPercent, 100);+ const anomalyRatio = formatAnomalyRatio(props.anomaly);+ const maxInfo = getMaxDiskInfo(disks);+ const maxLabelShort = maxInfo ? `max ${formatPercent(maxInfo.percent)}` : '';+ const maxLabelFull = maxInfo+ ? `Max ${formatPercent(maxInfo.percent)} (${maxInfo.label})`+ : '';+ const displayLabel = formatPercent(overallPercent);+ const displaySublabel = `${formatBytes(totalUsed)}/${formatBytes(totalCapacity)}`;+ const showMaxLabel =+ aggregateMode &&+ hasMultipleDisks &&+ maxLabelShort.length > 0 &&+ containerWidth >= estimateTextWidth(`${displayLabel} ${maxLabelShort}`);+ const showSublabel =+ containerWidth >=+ estimateTextWidth(+ `${displayLabel}${showMaxLabel ? ` ${maxLabelShort}` : ''} (${displaySublabel})`,+ );+ const barColor =+ aggregateMode && hasMultipleDisks && maxInfo+ ? getMetricColorRgba(maxInfo.percent, 'disk')+ : getMetricColorRgba(overallPercent, 'disk');+ const segments =+ useStackedSegments && totalCapacity > 0+ ? disks.map((disk, index) => {+ const diskUsagePercent = getDiskUsagePercent(disk);+ return {+ color: getStackedDiskColor(diskUsagePercent, index),+ disk,+ diskUsagePercent,+ index,+ widthPercent: Math.min((disk.used / totalCapacity) * 100, 100),+ };+ })+ : [];+ const miniDisks = disks.map((disk, index) => {+ const percent = getDiskUsagePercent(disk);+ return {+ color: getMetricColorRgba(percent, 'disk'),+ label: getDiskLabel(disk, index),+ percent,+ };+ });+ const tooltipContent = buildTooltipContent(disks, {+ aggregateDisk: props.aggregateDisk,+ aggregateMode,+ miniMode,+ });++ return {+ aggregateMode,+ anomalyClass: props.anomaly+ ? (ANOMALY_SEVERITY_CLASS[props.anomaly.severity] ?? 'text-yellow-400')+ : 'text-yellow-400',+ anomalyDescription: props.anomaly?.description,+ anomalyRatio,+ barColor,+ barPercent,+ containerClass:+ miniMode && hasDisks ? 'metric-text w-full' : 'metric-text w-full h-4 flex items-center justify-center',+ displayLabel,+ displaySublabel,+ hasDisks,+ hasMultipleDisks,+ maxLabelFull,+ maxLabelShort,+ miniDisks,+ miniMode,+ segments,+ showDiskCount: useStackedSegments,+ showMaxLabel,+ showSublabel,+ tooltipContent,+ tooltipTitle: hasMultipleDisks ? 'Disk Breakdown' : 'Disk Usage',+ useStackedSegments,+ };+}diff --git a/frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts b/frontend-modern/src/components/Dashboard/useStackedDiskBarState.tsnew file mode 100644index 0000000000..2416b9b7df--- /dev/null+++ b/frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts@@ -0,0 +1,51 @@+import { createMemo, createSignal, onCleanup, onMount } from 'solid-js';+import { useTooltip } from '@/hooks/useTooltip';+import {+ buildStackedDiskBarPresentation,+ type StackedDiskBarProps,+} from './stackedDiskBarModel';++export function useStackedDiskBarState(props: StackedDiskBarProps) {+ const tip = useTooltip();+ const [containerWidth, setContainerWidth] = createSignal(100);+ let containerRef: HTMLDivElement | undefined;+ let resizeObserver: ResizeObserver | undefined;++ const presentation = createMemo(() => buildStackedDiskBarPresentation(props, containerWidth()));++ onMount(() => {+ if (!containerRef) {+ return;+ }++ setContainerWidth(containerRef.offsetWidth);++ resizeObserver = new ResizeObserver((entries) => {+ for (const entry of entries) {+ setContainerWidth(entry.contentRect.width);+ }+ });+ resizeObserver.observe(containerRef);+ });++ onCleanup(() => {+ resizeObserver?.disconnect();+ });++ const handleMouseEnter = (event: MouseEvent) => {+ if (presentation().tooltipContent.length > 0) {+ tip.onMouseEnter(event);+ }+ };++ return {+ handleMouseEnter,+ handleMouseLeave: tip.onMouseLeave,+ presentation,+ setContainerRef: (element: HTMLDivElement) => {+ containerRef = element;+ },+ tip,+ tooltipVisible: createMemo(() => tip.show() && presentation().tooltipContent.length > 0),+ };+}diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.tsindex 561001247a..8610e4fe73 100644--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts@@ -85,6 +85,9 @@ import dashboardStateSource from '@/components/Dashboard/useDashboardState.ts?raimport dashboardFilterStateSource from '@/components/Dashboard/useDashboardFilterState.ts?raw';import thresholdSliderModelSource from '@/components/Dashboard/thresholdSliderModel.ts?raw';import thresholdSliderStateSource from '@/components/Dashboard/useThresholdSliderState.ts?raw';+import stackedDiskBarSource from '@/components/Dashboard/StackedDiskBar.tsx?raw';+import stackedDiskBarModelSource from '@/components/Dashboard/stackedDiskBarModel.ts?raw';+import stackedDiskBarStateSource from '@/components/Dashboard/useStackedDiskBarState.ts?raw';import workloadsSummarySource from '@/components/Workloads/WorkloadsSummary.tsx?raw';import dashboardRouteSource from '@/pages/Dashboard.tsx?raw';import dashboardHelpersSource from '@/pages/DashboardPanels/dashboardHelpers.ts?raw';@@ -524,6 +527,14 @@ describe('frontend resource type boundaries', () => {expect(thresholdSliderModelSource).toContain('export function getThresholdSliderThumbTransform');expect(thresholdSliderModelSource).toContain('export function getThresholdSliderTitle');expect(thresholdSliderModelSource).toContain('export function getThresholdSliderLabel');+ expect(stackedDiskBarSource).toContain('useStackedDiskBarState');+ expect(stackedDiskBarSource).not.toContain('const [containerWidth, setContainerWidth] =');+ expect(stackedDiskBarSource).not.toContain('const tooltipContent = createMemo(() => {');+ expect(stackedDiskBarSource).not.toContain('const SEGMENT_COLORS =');+ expect(stackedDiskBarStateSource).toContain('new ResizeObserver');+ expect(stackedDiskBarStateSource).toContain('useTooltip');+ expect(stackedDiskBarModelSource).toContain('export function buildStackedDiskBarPresentation');+ expect(stackedDiskBarModelSource).toContain('const SEGMENT_COLORS');expect(workloadsSummarySource).toContain('normalizeOrgScope(getOrgID())');expect(workloadsSummarySource).not.toContain("const DEFAULT_ORG_SCOPE = 'default'");expect(workloadsSummarySource).not.toContain('const normalizeOrgScope =');diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.pyindex a92ebcab79..d77f4524b6 100644--- a/scripts/release_control/subsystem_lookup_test.py+++ b/scripts/release_control/subsystem_lookup_test.py@@ -1916,6 +1916,36 @@ class SubsystemLookupTest(unittest.TestCase):match["verification_requirement"]["id"],"dashboard-workload-hot-path",)++ def test_lookup_paths_assigns_dashboard_stacked_disk_bar_runtime_to_performance_and_scalability(self) -> None:+ result = lookup_paths(+ [+ "frontend-modern/src/components/Dashboard/StackedDiskBar.tsx",+ "frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts",+ "frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts",+ ]+ )+ self.assertEqual(result["unowned_runtime_files"], [])+ self.assertEqual(+ {item["subsystem"] for item in result["impacted_subsystems"]},+ {"performance-and-scalability"},+ )+ for file_entry in result["files"]:+ self.assertEqual(file_entry["classification"], "runtime")+ self.assertEqual(+ {match["subsystem"] for match in file_entry["matches"]},+ {"performance-and-scalability"},+ )+ match = file_entry["matches"][0]+ self.assertEqual(+ match["contract"],+ "docs/release-control/v6/internal/subsystems/performance-and-scalability.md",+ )+ self.assertEqual(match["lane_context"]["lane_id"], "L10")+ self.assertEqual(+ match["verification_requirement"]["id"],+ "dashboard-workload-hot-path",+ )self.assertEqual(match["verification_requirement"]["id"],"dashboard-workload-hot-path",