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
fix(frontend): keep sparkline cursor on local scrub
rcourtman78a0eac73c08
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 86e035ee55..c53da64bb1 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -228,19 +228,20 @@ connections` visible as the API-backed alternative for Proxmox androute strings or provider-local link builders inside feature panels.15. Keep shared summary-card emphasis coherent. When shared summary primitives enter an `inactive` state, `SummaryMetricCard`, `InteractiveSparkline`, and `DensityMap` must all demote background context together so storage, infrastructure, and workloads read as one interaction model instead of mixing page-local opacity, sticky-shell, or highlight rules.16. Keep density-map summaries overview-first. When a shared summary density map receives row focus or chart-hover emphasis, `frontend-modern/src/components/shared/DensityMap.tsx`, `frontend-modern/src/components/shared/useDensityMapState.ts`, and `frontend-modern/src/components/shared/densityMapModel.ts` must preserve the multi-entity overview rows and layer focused-entity detail into the card chrome instead of swapping the card into a single-series chart, dimming the rest of the map into unusable background noise, duplicating cursor-value tooltip copy, or covering the heatmap body with a floating detail overlay.-17. Keep shared contextual focus canonical after adoption. Once a summary or table surface enters route-backed contextual focus, future additions must extend `frontend-modern/src/components/shared/contextualFocus.ts` and its guardrail tests rather than forking another helper for workload IDs, resource IDs, or scroll-preserving same-route selection.-18. Keep shared infrastructure/resource selectors on the canonical agent-facet+17. Keep sparkline scrubbing source-local and sibling-sync timestamp-based. The chart a user is actively scrubbing in `frontend-modern/src/components/shared/InteractiveSparkline.tsx` and `frontend-modern/src/components/shared/useInteractiveSparklineState.ts` must keep its dashed hover cursor on the real local mouse `x`, while sibling cards may map the shared hover timestamp onto their own timelines. Shared cursor sync must not snap the source chart back onto the nearest sample timestamp.+18. Keep shared contextual focus canonical after adoption. Once a summary or table surface enters route-backed contextual focus, future additions must extend `frontend-modern/src/components/shared/contextualFocus.ts` and its guardrail tests rather than forking another helper for workload IDs, resource IDs, or scroll-preserving same-route selection.+19. Keep shared infrastructure/resource selectors on the canonical agent-facettruth. Shared primitives and settings-facing selector helpers must treattop-level TrueNAS appliances as agent-facet infrastructure via sharedhelper ownership instead of reviving a direct `resource.type === 'truenas'`branch inside page shells, selectors, or reporting-resource type helpers.-19. Keep shared feature-shell Patrol run fixtures on the canonical run-record+20. Keep shared feature-shell Patrol run fixtures on the canonical run-recordcontract. When `frontend-modern/src/features/patrol/` consumes Patrol runhistory, the shared normalized record must preserve provider-backed countssuch as `truenas_checked` instead of letting feature-local fixtures orfallback objects collapse API-backed TrueNAS systems back into genericagent-host presentation.-20. Keep the authenticated app root aligned with that same first-session path.+21. Keep the authenticated app root aligned with that same first-session path.That same shared-primitive ownership now includes contextual row focus.`frontend-modern/src/components/shared/contextualFocus.ts` is the canonicalowner for interactive-series filtering, focused-label lookup, active-series@@ -253,34 +254,34 @@ connections` visible as the API-backed alternative for Proxmox andthe governed dashboard empty state route first-time operators intoInfrastructure Install, instead of preserving a separate root-only jump to`/infrastructure` that drifts from the rest of the onboarding contract.-21. Keep relay settings shell copy on the shared presentation owner in+22. Keep relay settings shell copy on the shared presentation owner in`frontend-modern/src/utils/relayPresentation.ts`. The route metadata in`settingsHeaderMeta.ts` and the leading `SettingsPanel` in`RelaySettingsPanel.tsx` must reuse the same description and availabilitycopy instead of drifting into separate rollout or pairing wording.-22. Keep shared settings-shell legal and docs referrals on+23. Keep shared settings-shell legal and docs referrals on`frontend-modern/src/utils/docsLinks.ts`. Shared settings surfaces such as`AIRuntimeControlsSection.tsx` must not hardcode GitHub `main` doc URLs forprivacy, security, proxy-auth, scope-reference, or Terms-of-Service links.-23. Keep shared settings-shell telemetry transparency controls on the governed+24. Keep shared settings-shell telemetry transparency controls on the governedgeneral settings panel. Preview/reset affordances for anonymous telemetrymust stay rendered inside`frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx`instead of drifting into route-local modals, hidden dev tools, or shellchrome that operators would not naturally inspect.-24. Keep the short telemetry/privacy summary copy on that same shared surface+25. Keep the short telemetry/privacy summary copy on that same shared surfaceaccurate to the governed privacy doc. If the trust boundary depends on aspecific retention window or on “IP addresses are not stored” rather than“IPs are never seen,” the summary copy in`GeneralSettingsPanel.tsx` must state those facts plainly instead ofreverting to a stronger but inaccurate shorthand.-25. Keep shared storage-route feature presentation on neutral capability truth.+26. Keep shared storage-route feature presentation on neutral capability truth.Reusable mappers and presenters in `frontend-modern/src/features/storageBackups/`must distinguish inventory datastores from backup repositories so VMwarerows on the shared storage route stay canonical to the admitted phase-1 floor instead ofreviving backup-target, protected-target, or recovery-local semantics on ashared page.-26. Keep infrastructure settings-shell API alternatives on the shared shell+27. Keep infrastructure settings-shell API alternatives on the shared shellcontract. `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`,`frontend-modern/src/components/Settings/settingsHeaderMeta.ts`,`frontend-modern/src/components/Settings/settingsNavigationModel.ts`, and@@ -288,7 +289,7 @@ connections` visible as the API-backed alternative for Proxmox andpresent `Platform connections` as the canonical API-backed alternative forProxmox, TrueNAS, and future provider integrations instead of revivingtop-level `Direct Proxmox` wording or shell-local provider routes.-27. Keep the infrastructure settings platform-connections summary and provider+28. Keep the infrastructure settings platform-connections summary and providerworkspaces on one shared state source. `frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts`,`frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts`,`frontend-modern/src/components/Settings/InfrastructurePlatformConnectionsSummaryCard.tsx`,@@ -296,14 +297,14 @@ connections` visible as the API-backed alternative for Proxmox andderive TrueNAS connection counts and availability from the sharedinfrastructure settings state instead of letting the reporting summary andthe provider-specific panel issue separate connection fetches.-28. Keep alert-history feature composition on the current owned state contract.+29. Keep alert-history feature composition on the current owned state contract.`frontend-modern/src/features/alerts/tabs/HistoryTab.tsx` must react to theshared `alertData()` history state instead of reviving deleted aliases, andit must pass unified-resource resolution through to`frontend-modern/src/features/alerts/AlertResourceIncidentsPanel.tsx` sothe panel can render shared route chips without creating another page-localresource lookup or provider-specific handoff layer.-29. Keep the alert-thresholds containers surface on the canonical shared owner.+30. Keep the alert-thresholds containers surface on the canonical shared owner.`alertOverridesModel.ts`, `useAlertOverridesState.ts`, and`useAlertsConfigurationState.ts` must surface API-backed `app-container`parents such as TrueNAS as first-class `Container Runtimes`, whilediff --git a/frontend-modern/src/components/shared/InteractiveSparkline.tsx b/frontend-modern/src/components/shared/InteractiveSparkline.tsxindex cd6cbda253..28859bab24 100644--- a/frontend-modern/src/components/shared/InteractiveSparkline.tsx+++ b/frontend-modern/src/components/shared/InteractiveSparkline.tsx@@ -35,6 +35,7 @@ export const InteractiveSparkline: Component<InteractiveSparklineProps> = (propsdata-highlight-series-id={props.highlightSeriesId ?? ''}data-highlight-series-active={sparkline.externalSeriesIndex() !== null ? 'true' : 'false'}data-active-hover-timestamp={sparkline.activeHoverTimestamp() ?? ''}+ data-active-hover-cursor-x={sparkline.activeHoverCursorX() ?? ''}data-active-series-display={sparkline.activeSeriesDisplay()}data-rendered-series-count={sparkline.renderedSeriesCount()}data-summary-chart-state={interactionState()}diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex c853dbca6e..cb10c87a00 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -540,6 +540,7 @@ describe('shared primitive guardrails', () => {it('keeps interactive sparkline on shell, runtime, and model owners', () => {expect(interactiveSparklineSource).toContain('useInteractiveSparklineState');expect(interactiveSparklineSource).toContain('data-active-series-display');+ expect(interactiveSparklineSource).toContain('data-active-hover-cursor-x');expect(interactiveSparklineSource).toContain('data-rendered-series-count');expect(interactiveSparklineSource).not.toContain('createEffect');expect(interactiveSparklineSource).not.toContain('createSignal');@@ -555,6 +556,10 @@ describe('shared primitive guardrails', () => {expect(interactiveSparklineStateSource).toContain('createSignal');expect(interactiveSparklineStateSource).toContain('scheduleSparkline');expect(interactiveSparklineStateSource).toContain('computeInteractiveSparklineHoverState');+ expect(interactiveSparklineStateSource).toContain('const localHover = hoveredState();');+ expect(interactiveSparklineStateSource).toContain('return localHover.x;');+ expect(interactiveSparklineStateSource).toContain('timestamp: synchronizedHoverTimestamp()');+ expect(interactiveSparklineStateSource).not.toContain('timestamp: activeHoverTimestamp()');expect(interactiveSparklineModelSource).toContain('buildInteractiveSparklineChartData');expect(interactiveSparklineModelSource).toContain('computeInteractiveSparklineHoverState');diff --git a/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsx b/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsxindex b41118ceb8..42010e4825 100644--- a/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsx@@ -73,6 +73,55 @@ describe('InteractiveSparkline hover behavior', () => {expect(screen.queryByText('CPU')).toBeNull();});+ it('keeps the local hover cursor on the actual scrub position instead of snapping to the nearest sample timestamp', () => {+ vi.useFakeTimers();+ vi.setSystemTime(new Date('2024-01-01T12:00:00Z'));+ const now = Date.now();+ const windowStart = now - 60 * 60_000;++ const { container } = render(() => (+ <InteractiveSparkline+ timeRange="1h"+ rangeLabel="1h"+ series={[+ {+ name: 'CPU',+ color: '#ff0000',+ data: [+ { timestamp: windowStart + 5 * 60_000, value: 40 },+ { timestamp: windowStart + 55 * 60_000, value: 50 },+ ],+ },+ ]}+ />+ ));++ const svg = container.querySelector('svg');+ expect(svg).not.toBeNull();+ if (!svg) return;++ (svg as unknown as { getBoundingClientRect: () => DOMRect }).getBoundingClientRect = () =>+ ({+ left: 0,+ top: 100,+ width: 200,+ height: 50,+ right: 200,+ bottom: 150,+ x: 0,+ y: 100,+ toJSON: () => ({}),+ }) as unknown as DOMRect;++ fireEvent.mouseMove(svg, { clientX: 100, clientY: 120 });++ const root = container.firstElementChild;+ expect(svg.querySelector('line[stroke-dasharray="3 3"]')).toBeInTheDocument();+ expect(+ Number.parseFloat(root?.getAttribute('data-active-hover-cursor-x') ?? 'NaN'),+ ).toBeCloseTo(100, 1);+ });+it('publishes synchronized hover identity and clears it on leave', () => {vi.useFakeTimers();vi.setSystemTime(new Date('2024-01-01T12:00:00Z'));diff --git a/frontend-modern/src/components/shared/useInteractiveSparklineState.ts b/frontend-modern/src/components/shared/useInteractiveSparklineState.tsindex 56c1894441..ed01017209 100644--- a/frontend-modern/src/components/shared/useInteractiveSparklineState.ts+++ b/frontend-modern/src/components/shared/useInteractiveSparklineState.ts@@ -212,13 +212,17 @@ export function useInteractiveSparklineState(const activeHoverTimestamp = createMemo<number | null>(() => {return hoveredState()?.timestamp ?? synchronizedHoverTimestamp();});- const activeHoverCursorX = createMemo<number | null>(() =>- getInteractiveSparklineCursorXForTimestamp({+ const activeHoverCursorX = createMemo<number | null>(() => {+ const localHover = hoveredState();+ if (localHover) {+ return localHover.x;+ }+ return getInteractiveSparklineCursorXForTimestamp({chartData: chartData(),- timestamp: activeHoverTimestamp(),+ timestamp: synchronizedHoverTimestamp(),vbW,- }),- );+ });+ });const activeEmphasisSeriesIndex = createMemo(() =>getInteractiveSparklineActiveEmphasisSeriesIndex({highlightNearestSeriesOnHover: props.highlightNearestSeriesOnHover === true,