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
Unify summary hover emphasis and mock continuity
rcourtman1a0770f05085
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 13ab18600d..d35cc901e3 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -145,6 +145,7 @@ work extends shared components instead of creating new local variants.5. Keep shared platform-connections shell state on the reusable settings boundary: `frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts`, `frontend-modern/src/components/Settings/InfrastructurePlatformConnectionsSummaryCard.tsx`, and `frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx` must continue to derive provider counts, availability, and shared subtab copy from one infrastructure-settings source instead of creating provider-local summary fetches or VMware-only shell vocabulary.6. Keep shared storage feature presenters on canonical platform truth. When reusable storage presenters under `frontend-modern/src/features/storageBackups/` classify canonical resources for the shared storage route, API-backed virtualization datastores such as VMware must stay inventory-only datastores instead of inheriting PBS-specific backup-repository or protected-target copy from older fallback branches.7. Keep top-of-page summary interaction on shared primitives. Infrastructure, workloads, and storage summary cards must route sticky-shell behavior through `frontend-modern/src/components/shared/StickySummarySection.tsx` and route row-hover or focused-series rendering through shared chart primitives such as `frontend-modern/src/components/shared/InteractiveSparkline.tsx` and `frontend-modern/src/components/shared/DensityMap.tsx`, rather than page-local sticky wrappers or metric-card-specific hover logic.+8. Keep summary chart interaction identity on one shared helper. Summary surfaces that expose hover- or focus-driven chart emphasis must derive the active series ID through `frontend-modern/src/components/shared/summaryCardInteraction.ts` and pass the same resolved ID into card-state, sparkline, and density-map primitives, rather than letting cards read `hovered || focused` while charts listen to a different page-local ID source.## Forbidden Paths@@ -218,6 +219,7 @@ work extends shared components instead of creating new local variants.TrueNAS, and expose the same first-host next step instead of falling backto passive “nothing here yet” wording.13. Keep cross-surface investigation handoffs on shared route ownership.+14. 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.Feature shells such as Alerts and Patrol may decide which governeddestination chips to render, but canonical href, label, dedupe, andinfrastructure-fallback truth must stay indiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 049c78991c..f4d46b947e 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -167,6 +167,7 @@ regression protection.25. Extend dashboard workload table shell ownership through `frontend-modern/src/components/Dashboard/WorkloadTableHeader.tsx` and `frontend-modern/src/components/Dashboard/WorkloadPanel.tsx` rather than rebuilding sortable header markup, grouped node rows, row expansion, or guest-drawer rendering inside `frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx`26. Keep long-range workload chart capping time-proportional across `frontend-modern/src/components/Workloads/WorkloadsSummary.tsx`, `frontend-modern/src/api/charts.ts`, and `internal/api/router.go`: when the workload hot path caps mixed-cadence history for top cards, it must bucket by time window rather than raw point index so 7-day and 30-day workload cards stay visually even without relaxing the protected payload budget.27. Keep summary hover/focus and sticky-card behavior on shared hot paths: infrastructure, workloads, and storage summary shells must reuse one focused-series model plus `frontend-modern/src/components/shared/StickySummarySection.tsx` inside the app scroll shell instead of per-page scroll listeners or per-card hover derivations, so row scrubbing highlights all cards without multiplying render or scroll work.+28. Keep summary-card hover emphasis on one bounded rendering budget: when a summary row is active, shared sparkline and density-map primitives must promote the selected series and demote background series through the same active-series ID rather than layering a second page-local highlight pass, so zoom-range and hover scrubbing stay visually coherent without reintroducing multi-series overdraw on the hot summary cards.## Forbidden Paths@@ -194,6 +195,11 @@ The dashboard workload selector path and the dashboard runtime that consumes itare now part of the protected performance surface rather than proof-onlycontext. Future hot-path filter/group/sort/windowing changes must route throughthe explicit dashboard performance proof policy in the subsystem registry.+That same hot-path ownership now covers top-of-page summary emphasis: infrastructure+and workloads summary cards must treat hover and focus as one shared active-series+contract so time-range switches and row scrubbing reuse one existing chart path+instead of repainting page-local “selected row” overlays on top of already+downsampled summary history.That same hot-path rule now applies to infrastructure summary resourcefiltering: `frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts`must include API-backed systems such as top-level TrueNAS appliances throughdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex be4952e86d..82c0982d25 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -163,6 +163,12 @@ querying, and the operator-facing storage health presentation layer.storage detail charts must all address history through the canonicalunified-resource metrics-target IDs, and the storage page must reuse theshared sticky summary primitive instead of a storage-local scroll wrapper.+13. Keep storage summary interaction scoped through the same canonical IDs.+ When operators hover or focus pools versus physical disks, the storage+ summary must reuse one resolved active-series ID across card state and+ chart highlighting so pool-only cards demote cleanly during disk focus and+ disk-temperature cards demote cleanly during pool focus, instead of+ leaving stale row-local IDs or storage-local hover branches on the page.## Current Statediff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 4ca19bb6bb..fc3f9531b7 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -173,6 +173,11 @@ assembly branch.`vmware` metadata plus shared `resource-incident` timeline entries oncanonical `agent`, `vm`, and `storage` resources instead of creatingprovider-only resource kinds, identities, or history schemas.+9. Keep summary-surface emphasis on canonical resource IDs. Infrastructure+ summary hover/focus behavior must keep using the same unified-resource IDs+ that power the table rows, chart series, and detail-route handoffs instead+ of introducing page-local summary IDs or provider-local hover aliases when+ the selected series is highlighted.## Current State@@ -215,6 +220,12 @@ must still ingest that provider-owned source instead of letting the seedsilence the platform entirely. Operator-facing source filters may accept the`vmware-vsphere` alias for the VMware platform, but the emitted shared sourcefamily remains canonical `vmware`.+That same canonical identity boundary now also applies to infrastructure+summary emphasis. `frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx`+may vary card presentation, but the active sparkline or density-map series must+still resolve through the shared resource ID already emitted by unified+resources so table hover, focused detail state, and summary highlight all point+to the same resource identity.That same unified-resource boundary now also owns stored metrics-targetcontinuity for provider-backed resources. When registry rebuild cannot derive afresh metrics target from raw source facets, `internal/unifiedresources/registry.go`diff --git a/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx b/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsxindex f4b8653e68..5f2b5b336b 100644--- a/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx+++ b/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx@@ -5,6 +5,10 @@ import { InteractiveSparkline } from '@/components/shared/InteractiveSparkline';import { DensityMap } from '@/components/shared/DensityMap';import { SummaryPanel } from '@/components/shared/SummaryPanel';import { SummaryMetricCard } from '@/components/shared/SummaryMetricCard';+import {+ resolveSummaryActiveSeriesId,+ resolveSummaryCardInteractionState,+} from '@/components/shared/summaryCardInteraction';import { formatThroughputRate } from '@/utils/throughputPresentation';import type { InfrastructureSummaryProps } from './infrastructureSummaryModel';import { useInfrastructureSummaryState } from './useInfrastructureSummaryState';@@ -19,6 +23,19 @@ export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (proif (!name) return undefined;return <span class="text-xs text-muted ml-1.5 truncate">— {name}</span>;};+ const activeSeriesId = () =>+ resolveSummaryActiveSeriesId({+ hoveredSeriesId: props.hoveredResourceId,+ focusedSeriesId: props.focusedResourceId,+ });+ const interactionStateFor = (+ series: Array<{ id: string }>,+ ) =>+ resolveSummaryCardInteractionState({+ series,+ hoveredSeriesId: props.hoveredResourceId,+ focusedSeriesId: props.focusedResourceId,+ });return (<Show when={props.resources.length > 0}>@@ -50,6 +67,7 @@ export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (proloaded={state.isCurrentRangeLoaded()}hasData={state.hasData('cpu')}emptyMessage={state.emptyMessage()}+ interactionState={interactionStateFor(state.seriesFor('cpu'))}><InteractiveSparklineseries={state.seriesFor('cpu')}@@ -57,7 +75,8 @@ export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (protimeRange={props.timeRange}yMode="percent"highlightNearestSeriesOnHover- highlightSeriesId={props.hoveredResourceId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(state.seriesFor('cpu'))}/></SummaryMetricCard>@@ -67,6 +86,7 @@ export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (proloaded={state.isCurrentRangeLoaded()}hasData={state.hasData('memory')}emptyMessage={state.emptyMessage()}+ interactionState={interactionStateFor(state.seriesFor('memory'))}><InteractiveSparklineseries={state.seriesFor('memory')}@@ -74,7 +94,8 @@ export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (protimeRange={props.timeRange}yMode="percent"highlightNearestSeriesOnHover- highlightSeriesId={props.hoveredResourceId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(state.seriesFor('memory'))}/></SummaryMetricCard>@@ -93,13 +114,15 @@ export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (proloaded={state.isCurrentRangeLoaded()}hasData={state.hasDiskIOData()}emptyMessage={state.emptyMessage()}+ interactionState={interactionStateFor(state.diskioSeries())}><DensityMapseries={state.diskioSeries()}rangeLabel={rangeLabel()}timeRange={props.timeRange}formatValue={formatThroughputRate}- highlightSeriesId={props.hoveredResourceId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(state.diskioSeries())}/></SummaryMetricCard>@@ -163,13 +186,15 @@ export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (proloaded={state.isCurrentRangeLoaded()}hasData={state.hasNetData()}emptyMessage={state.emptyHistoryLabel()}+ interactionState={interactionStateFor(state.networkSeries())}><DensityMapseries={state.networkSeries()}rangeLabel={rangeLabel()}timeRange={props.timeRange}formatValue={formatThroughputRate}- highlightSeriesId={props.hoveredResourceId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(state.networkSeries())}/></SummaryMetricCard></Show>diff --git a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.tsindex bd024ad28e..91aff028b3 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts+++ b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';import type { Resource } from '@/types/resource';import type { InfrastructureSummarySeries } from '@/components/Infrastructure/infrastructureSummaryModel';+import { resolveSummaryActiveSeriesId } from '@/components/shared/summaryCardInteraction';import {buildInfrastructureDisplaySeries,buildInfrastructureEmptyHistoryLabel,@@ -140,6 +141,21 @@ describe('infrastructureSummaryModel', () => {]);});+ it('uses one canonical active series id across hover and focused summary selection', () => {+ expect(+ resolveSummaryActiveSeriesId({+ hoveredSeriesId: 'agent-1',+ focusedSeriesId: 'agent-2',+ }),+ ).toBe('agent-1');+ expect(+ resolveSummaryActiveSeriesId({+ hoveredSeriesId: null,+ focusedSeriesId: 'agent-2',+ }),+ ).toBe('agent-2');+ });+it('shows the network card when either data or network capability exists', () => {expect(shouldShowInfrastructureNetworkCard(false, [diff --git a/frontend-modern/src/components/Storage/StorageSummary.tsx b/frontend-modern/src/components/Storage/StorageSummary.tsxindex 1afe2a779e..1cda70c209 100644--- a/frontend-modern/src/components/Storage/StorageSummary.tsx+++ b/frontend-modern/src/components/Storage/StorageSummary.tsx@@ -3,6 +3,10 @@ import { InteractiveSparkline } from '@/components/shared/InteractiveSparkline';import type { InteractiveSparklineSeries } from '@/components/shared/InteractiveSparkline';import { SummaryPanel } from '@/components/shared/SummaryPanel';import { SummaryMetricCard } from '@/components/shared/SummaryMetricCard';+import {+ resolveSummaryActiveSeriesId,+ resolveSummaryCardInteractionState,+} from '@/components/shared/summaryCardInteraction';import {ChartsAPI,type MetricPoint,@@ -259,6 +263,17 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {if (!name) return undefined;return <span class="text-xs text-muted ml-1.5 truncate">— {name}</span>;};+ const activeSeriesId = () =>+ resolveSummaryActiveSeriesId({+ hoveredSeriesId: props.hoveredResourceId,+ focusedSeriesId: props.focusedResourceId,+ });+ const interactionStateFor = (series: InteractiveSparklineSeries[]) =>+ resolveSummaryCardInteractionState({+ series,+ hoveredSeriesId: props.hoveredResourceId,+ focusedSeriesId: props.focusedResourceId,+ });return (<Show when={showComponent()}>@@ -286,6 +301,7 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {loaded={loaded()}hasData={hasPoolUsage()}emptyMessage={emptyLabel()}+ interactionState={interactionStateFor(displayedPoolUsageSeries())}><InteractiveSparklineseries={displayedPoolUsageSeries()}@@ -293,7 +309,8 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {timeRange={props.timeRange as TimeRange}yMode="percent"highlightNearestSeriesOnHover- highlightSeriesId={props.hoveredResourceId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(displayedPoolUsageSeries())}/></SummaryMetricCard>@@ -303,6 +320,7 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {loaded={loaded()}hasData={hasDiskTemp()}emptyMessage={emptyLabel()}+ interactionState={interactionStateFor(displayedDiskTempSeries())}><InteractiveSparklineseries={displayedDiskTempSeries()}@@ -312,7 +330,8 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {formatValue={formatTemp}formatTopLabel={(max) => `${max.toFixed(0)}°C`}highlightNearestSeriesOnHover- highlightSeriesId={props.hoveredResourceId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(displayedDiskTempSeries())}/></SummaryMetricCard>@@ -322,6 +341,7 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {loaded={loaded()}hasData={hasPoolUsed()}emptyMessage={emptyLabel()}+ interactionState={interactionStateFor(displayedPoolUsedSeries())}><InteractiveSparklineseries={displayedPoolUsedSeries()}@@ -331,7 +351,8 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {formatValue={(v) => formatBytes(v)}formatTopLabel={(max) => formatBytes(max)}highlightNearestSeriesOnHover- highlightSeriesId={props.hoveredResourceId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(displayedPoolUsedSeries())}/></SummaryMetricCard>@@ -341,6 +362,7 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {loaded={loaded()}hasData={hasPoolAvail()}emptyMessage={emptyLabel()}+ interactionState={interactionStateFor(displayedPoolAvailSeries())}><InteractiveSparklineseries={displayedPoolAvailSeries()}@@ -350,7 +372,8 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {formatValue={(v) => formatBytes(v)}formatTopLabel={(max) => formatBytes(max)}highlightNearestSeriesOnHover- highlightSeriesId={props.hoveredResourceId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(displayedPoolAvailSeries())}/></SummaryMetricCard></SummaryPanel>diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsxindex 9603174d6a..aac3240390 100644--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx@@ -413,6 +413,9 @@ describe('Storage', () => {},},disks: {},+ stats: {+ oldestDataTimestamp: Date.now() - 60_000,+ },});hookResources = [@@ -449,12 +452,14 @@ describe('Storage', () => {'[data-highlight-series-active="true"][data-highlight-series-id="pool:alpha"]',).length,).toBe(3);+ expect(summary.querySelectorAll('[data-summary-card-state="inactive"]').length).toBe(1);});fireEvent.mouseLeave(alphaRow);await waitFor(() => {expect(summary.querySelectorAll('[data-highlight-series-active="true"]').length).toBe(0);+ expect(summary.querySelectorAll('[data-summary-card-state="inactive"]').length).toBe(0);});storageSummarySpy.mockRestore();diff --git a/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsx b/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsxindex 71b1d940ce..1b5f8a37e1 100644--- a/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsx+++ b/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsx@@ -23,6 +23,8 @@ vi.mock('@/api/charts', async () => {vi.mock('@/components/shared/InteractiveSparkline', () => ({InteractiveSparkline: (props: {series?: Array<{ id?: string; name?: string; data?: Array<unknown> }>;+ highlightSeriesId?: string | null;+ interactionState?: string;}) => {const series = props.series ?? [];const maxPoints = series.reduce((max, current) => Math.max(max, current.data?.length ?? 0), 0);@@ -33,6 +35,8 @@ vi.mock('@/components/shared/InteractiveSparkline', () => ({data-series-ids={series.map((current) => current.id || '').join('|')}data-series-names={series.map((current) => current.name || '').join('|')}data-max-points={maxPoints}+ data-highlight-series-id={props.highlightSeriesId || ''}+ data-interaction-state={props.interactionState || 'default'}/>);},@@ -41,6 +45,8 @@ vi.mock('@/components/shared/InteractiveSparkline', () => ({vi.mock('@/components/shared/DensityMap', () => ({DensityMap: (props: {series?: Array<{ id?: string; name?: string; data?: Array<unknown> }>;+ highlightSeriesId?: string | null;+ interactionState?: string;}) => {const series = props.series ?? [];const maxPoints = series.reduce((max, current) => Math.max(max, current.data?.length ?? 0), 0);@@ -51,6 +57,8 @@ vi.mock('@/components/shared/DensityMap', () => ({data-series-ids={series.map((current) => current.id || '').join('|')}data-series-names={series.map((current) => current.name || '').join('|')}data-max-points={maxPoints}+ data-highlight-series-id={props.highlightSeriesId || ''}+ data-interaction-state={props.interactionState || 'default'}/>);},@@ -280,6 +288,29 @@ describe('WorkloadsSummary performance behavior', () => {});});+ it('falls back to the focused workload id for summary chart emphasis', async () => {+ const workloadId = 'cluster-a:pve1:101';+ mockGetWorkloadCharts.mockResolvedValueOnce(makeChartsResponse([workloadId]));++ render(() => (+ <WorkloadsSummary+ timeRange="1h"+ fallbackGuestCounts={{ total: 1, running: 1, stopped: 0 }}+ fallbackSnapshots={makeSnapshots([workloadId])}+ focusedWorkloadId={workloadId}+ />+ ));++ await waitFor(() => {+ const sparklines = screen.getAllByTestId('sparkline');+ expect(sparklines).toHaveLength(4);+ for (const sparkline of sparklines) {+ expect(sparkline.getAttribute('data-highlight-series-id')).toBe(workloadId);+ expect(sparkline.getAttribute('data-interaction-state')).toBe('active');+ }+ });+ });+it('applies fallback snapshot names after workload id normalization', async () => {const rawChartId = 'pve1-101';const normalizedSnapshotId = 'pve1:pve1:101';diff --git a/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx b/frontend-modern/src/components/Workloads/WorkloadsSummary.tsxindex e7061ca032..af81b88228 100644--- a/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx+++ b/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx@@ -6,6 +6,10 @@ import {import { DensityMap } from '@/components/shared/DensityMap';import { SummaryPanel } from '@/components/shared/SummaryPanel';import { SummaryMetricCard } from '@/components/shared/SummaryMetricCard';+import {+ resolveSummaryActiveSeriesId,+ resolveSummaryCardInteractionState,+} from '@/components/shared/summaryCardInteraction';import {ChartsAPI,type ChartData,@@ -714,6 +718,17 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {if (!name) return undefined;return <span class="text-xs text-muted ml-1.5 truncate">— {name}</span>;};+ const activeSeriesId = () =>+ resolveSummaryActiveSeriesId({+ hoveredSeriesId: props.hoveredWorkloadId,+ focusedSeriesId: props.focusedWorkloadId,+ });+ const interactionStateFor = (series: InteractiveSparklineSeries[]) =>+ resolveSummaryCardInteractionState({+ series,+ hoveredSeriesId: props.hoveredWorkloadId,+ focusedSeriesId: props.focusedWorkloadId,+ });return (<SummaryPanel@@ -741,6 +756,7 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {loaded={!isLoading()}hasData={hasCpuData()}emptyMessage={fallbackTrendMessage() ?? undefined}+ interactionState={interactionStateFor(cpuSeries())}><InteractiveSparklineseries={cpuSeries()}@@ -750,7 +766,8 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {sortTooltipByValuemaxTooltipRows={8}highlightNearestSeriesOnHover- highlightSeriesId={props.hoveredWorkloadId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(cpuSeries())}/></SummaryMetricCard>@@ -760,6 +777,7 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {loaded={!isLoading()}hasData={hasMemoryData()}emptyMessage={fallbackTrendMessage() ?? undefined}+ interactionState={interactionStateFor(memorySeries())}><InteractiveSparklineseries={memorySeries()}@@ -769,7 +787,8 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {sortTooltipByValuemaxTooltipRows={8}highlightNearestSeriesOnHover- highlightSeriesId={props.hoveredWorkloadId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(memorySeries())}/></SummaryMetricCard>@@ -779,13 +798,15 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {loaded={!isLoading()}hasData={hasDiskIOData()}emptyMessage={fallbackTrendMessage() ?? undefined}+ interactionState={interactionStateFor(diskioSeries())}><DensityMapseries={diskioSeries()}rangeLabel={selectedRange()}timeRange={selectedRange()}formatValue={formatThroughputRate}- highlightSeriesId={props.hoveredWorkloadId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(diskioSeries())}/></SummaryMetricCard>@@ -795,13 +816,15 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {loaded={!isLoading()}hasData={hasNetworkData()}emptyMessage={fallbackTrendMessage() ?? undefined}+ interactionState={interactionStateFor(networkSeries())}><DensityMapseries={networkSeries()}rangeLabel={selectedRange()}timeRange={selectedRange()}formatValue={formatThroughputRate}- highlightSeriesId={props.hoveredWorkloadId}+ highlightSeriesId={activeSeriesId()}+ interactionState={interactionStateFor(networkSeries())}/></SummaryMetricCard></SummaryPanel>diff --git a/frontend-modern/src/components/shared/DensityMap.tsx b/frontend-modern/src/components/shared/DensityMap.tsxindex 281c85172b..ee6f3a2522 100644--- a/frontend-modern/src/components/shared/DensityMap.tsx+++ b/frontend-modern/src/components/shared/DensityMap.tsx@@ -7,12 +7,16 @@ export type { DensityMapProps } from './densityMapModel';export const DensityMap: Component<DensityMapProps> = (props) => {const densityMap = useDensityMapState(props);+ const interactionState = () => props.interactionState ?? 'default';return (<div- class="relative w-full h-full flex flex-col group"+ class={`relative w-full h-full flex flex-col group transition-opacity duration-150 ease-out ${+ interactionState() === 'inactive' ? 'opacity-35' : 'opacity-100'+ }`.trim()}data-highlight-series-id={props.highlightSeriesId ?? ''}data-highlight-series-active={densityMap.externalSeriesIndex() !== null ? 'true' : 'false'}+ data-summary-chart-state={interactionState()}><div class="flex-1 relative min-h-0 bg-transparent flex">{/* Y-axis: typically in a density map we might just show "Top Nodes" */}diff --git a/frontend-modern/src/components/shared/InteractiveSparkline.tsx b/frontend-modern/src/components/shared/InteractiveSparkline.tsxindex 9adae3e4a0..39825e86fd 100644--- a/frontend-modern/src/components/shared/InteractiveSparkline.tsx+++ b/frontend-modern/src/components/shared/InteractiveSparkline.tsx@@ -15,6 +15,11 @@ export const InteractiveSparkline: Component<InteractiveSparklineProps> = (propslet chartSurfaceRef: Element | undefined;let canvasRef: HTMLCanvasElement | undefined;let canvasHostRef: HTMLDivElement | undefined;+ const interactionState = () => props.interactionState ?? 'default';+ const inactiveSeriesColor = () =>+ typeof document !== 'undefined' && document.documentElement.classList.contains('dark')+ ? 'rgb(148, 163, 184)'+ : 'rgb(100, 116, 139)';const sparkline = useInteractiveSparklineState(props, {getCanvas: () => canvasRef,@@ -24,9 +29,12 @@ export const InteractiveSparkline: Component<InteractiveSparklineProps> = (propsreturn (<div- class="w-full h-full min-h-[88px] flex flex-col"+ class={`w-full h-full min-h-[88px] flex flex-col transition-opacity duration-150 ease-out ${+ interactionState() === 'inactive' ? 'opacity-35' : 'opacity-100'+ }`.trim()}data-highlight-series-id={props.highlightSeriesId ?? ''}data-highlight-series-active={sparkline.externalSeriesIndex() !== null ? 'true' : 'false'}+ data-summary-chart-state={interactionState()}><div class="relative flex-1 min-h-0"><div class="absolute inset-y-0 left-0 w-7 pointer-events-none">@@ -133,22 +141,30 @@ export const InteractiveSparkline: Component<InteractiveSparklineProps> = (props<pathd={pathData.path}fill="none"- stroke={pathData.color}+ stroke={(() => {+ const active = sparkline.activeEmphasisSeriesIndex();+ if (active !== null && active !== pathData.seriesIndex) {+ return inactiveSeriesColor();+ }+ return pathData.color;+ })()}stroke-width={(() => {const active = sparkline.activeEmphasisSeriesIndex();if (active === null) {return '1.5';}- return active === pathData.seriesIndex ? '2.8' : '0.9';+ return active === pathData.seriesIndex ? '3.2' : '0.7';})()}stroke-linecap="round"stroke-linejoin="round"opacity={(() => {const active = sparkline.activeEmphasisSeriesIndex();+ const interactionOpacity =+ interactionState() === 'inactive' ? 0.35 : 1;if (active === null) {- return '0.75';+ return `${0.75 * interactionOpacity}`;}- return active === pathData.seriesIndex ? '1' : '0.1';+ return `${(active === pathData.seriesIndex ? 1 : 0.05) * interactionOpacity}`;})()}style={{ transition: 'opacity 90ms linear, stroke-width 90ms linear' }}vector-effect="non-scaling-stroke"diff --git a/frontend-modern/src/components/shared/SummaryMetricCard.tsx b/frontend-modern/src/components/shared/SummaryMetricCard.tsxindex 80969ab0d2..0dc3856c70 100644--- a/frontend-modern/src/components/shared/SummaryMetricCard.tsx+++ b/frontend-modern/src/components/shared/SummaryMetricCard.tsx@@ -1,6 +1,7 @@import { Show, type JSX } from 'solid-js';import { Card } from './Card';import { SparklineSkeleton } from './SparklineSkeleton';+import type { SummaryCardInteractionState } from './summaryCardInteraction';export interface SummaryMetricCardProps {/** Uppercase label at top-left of the card. */@@ -17,38 +18,56 @@ export interface SummaryMetricCardProps {children: JSX.Element;/** Optional shared density override for compact monitoring surfaces. */density?: 'default' | 'compact';+ /** Optional interaction state for shared hover/focus summary behavior. */+ interactionState?: SummaryCardInteractionState;}export function SummaryMetricCard(props: SummaryMetricCardProps) {const isCompact = () => props.density === 'compact';+ const interactionState = () => props.interactionState ?? 'default';+ const interactionClass = () => {+ switch (interactionState()) {+ case 'active':+ return 'border-sky-500/45 ring-2 ring-inset ring-sky-500/25 shadow-sm';+ case 'inactive':+ return 'opacity-50';+ default:+ return '';+ }+ };return (- <Card- padding="sm"- class={`h-full ${isCompact() ? '!p-1.5 sm:!p-2' : ''}`.trim()}+ <div+ data-summary-card-state={interactionState()}+ class={`h-full rounded-md transition-all duration-150 ease-out ${interactionClass()}`.trim()}>- <div class="flex flex-col h-full">- <div class={`flex min-w-0 items-center ${isCompact() ? 'mb-1' : 'mb-1.5'}`}>- <span class="text-xs font-medium text-muted uppercase tracking-wide shrink-0">- {props.label}- </span>- {props.secondaryLabel}+ <Card+ padding="sm"+ class={`h-full ${isCompact() ? '!p-1.5 sm:!p-2' : ''}`.trim()}+ >+ <div class="flex flex-col h-full">+ <div class={`flex min-w-0 items-center ${isCompact() ? 'mb-1' : 'mb-1.5'}`}>+ <span class="text-xs font-medium text-muted uppercase tracking-wide shrink-0">+ {props.label}+ </span>+ {props.secondaryLabel}+ </div>+ <Show+ when={props.hasData}+ fallback={+ props.loaded ? (+ <div class="flex h-[56px] items-center text-sm text-muted">+ {props.emptyMessage ?? 'No history yet'}+ </div>+ ) : (+ <SparklineSkeleton />+ )+ }+ >+ <div class="flex-1 min-h-0">{props.children}</div>+ </Show></div>- <Show- when={props.hasData}- fallback={- props.loaded ? (- <div class="flex h-[56px] items-center text-sm text-muted">- {props.emptyMessage ?? 'No history yet'}- </div>- ) : (- <SparklineSkeleton />- )- }- >- <div class="flex-1 min-h-0">{props.children}</div>- </Show>- </div>- </Card>+ </Card>+ </div>);}diff --git a/frontend-modern/src/components/shared/__tests__/DensityMap.test.tsx b/frontend-modern/src/components/shared/__tests__/DensityMap.test.tsxindex 7a594e187c..884b6a4327 100644--- a/frontend-modern/src/components/shared/__tests__/DensityMap.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/DensityMap.test.tsx@@ -15,8 +15,12 @@ HTMLCanvasElement.prototype.getContext = vi.fn(() => ({scale: vi.fn(),beginPath: vi.fn(),roundRect: vi.fn(),+ stroke: vi.fn(),+ strokeRect: vi.fn(),fill: vi.fn(),fillRect: vi.fn(),+ lineWidth: 1,+ strokeStyle: '',globalAlpha: 1,fillStyle: '',})) as unknown as typeof HTMLCanvasElement.prototype.getContext;diff --git a/frontend-modern/src/components/shared/__tests__/summaryCardInteraction.test.ts b/frontend-modern/src/components/shared/__tests__/summaryCardInteraction.test.tsnew file mode 100644index 0000000000..ccd817833d--- /dev/null+++ b/frontend-modern/src/components/shared/__tests__/summaryCardInteraction.test.ts@@ -0,0 +1,51 @@+import { describe, expect, it } from 'vitest';+import {+ resolveSummaryActiveSeriesId,+ resolveSummaryCardInteractionState,+} from '@/components/shared/summaryCardInteraction';++describe('summaryCardInteraction', () => {+ it('prefers hovered series ids and falls back to focused ids', () => {+ expect(+ resolveSummaryActiveSeriesId({+ hoveredSeriesId: 'beta',+ focusedSeriesId: 'alpha',+ }),+ ).toBe('beta');++ expect(+ resolveSummaryActiveSeriesId({+ hoveredSeriesId: '',+ focusedSeriesId: 'alpha',+ }),+ ).toBe('alpha');+ });++ it('returns default without an active hover or focus context', () => {+ expect(+ resolveSummaryCardInteractionState({+ series: [{ id: 'alpha' }],+ }),+ ).toBe('default');+ });++ it('marks cards active when the hovered series is present', () => {+ expect(+ resolveSummaryCardInteractionState({+ series: [{ id: 'alpha' }, { id: 'beta' }],+ hoveredSeriesId: 'beta',+ focusedSeriesId: 'alpha',+ }),+ ).toBe('active');+ });++ it('marks cards inactive when another summary series owns the current interaction', () => {+ expect(+ resolveSummaryCardInteractionState({+ series: [{ id: 'pool:alpha' }, { id: 'pool:beta' }],+ hoveredSeriesId: 'SERIAL-123',+ focusedSeriesId: 'pool:alpha',+ }),+ ).toBe('inactive');+ });+});diff --git a/frontend-modern/src/components/shared/densityMapModel.ts b/frontend-modern/src/components/shared/densityMapModel.tsindex 110d5898ef..73f071c340 100644--- a/frontend-modern/src/components/shared/densityMapModel.ts+++ b/frontend-modern/src/components/shared/densityMapModel.ts@@ -1,6 +1,7 @@import type { TimeRange } from '@/api/charts';import { timeRangeToMs } from '@/utils/timeRange';import type { InteractiveSparklineSeries } from './InteractiveSparkline';+import type { SummaryCardInteractionState } from './summaryCardInteraction';export interface DensityMapProps {series: InteractiveSparklineSeries[];@@ -8,6 +9,7 @@ export interface DensityMapProps {timeRange?: TimeRange;formatValue?: (value: number) => string;highlightSeriesId?: string | null;+ interactionState?: SummaryCardInteractionState;}export interface DensityMapHoveredState {diff --git a/frontend-modern/src/components/shared/interactiveSparklineModel.ts b/frontend-modern/src/components/shared/interactiveSparklineModel.tsindex 052f691abc..8aa90c98ed 100644--- a/frontend-modern/src/components/shared/interactiveSparklineModel.ts+++ b/frontend-modern/src/components/shared/interactiveSparklineModel.ts@@ -1,6 +1,7 @@import type { MetricPoint, TimeRange } from '@/api/charts';import { downsampleLTTB, calculateOptimalPoints } from '@/utils/downsample';import { timeRangeToMs } from '@/utils/timeRange';+import type { SummaryCardInteractionState } from './summaryCardInteraction';export interface InteractiveSparklineSeries {id?: string;@@ -23,6 +24,7 @@ export interface InteractiveSparklineProps {maxTooltipRows?: number;highlightNearestSeriesOnHover?: boolean;highlightSeriesId?: string | null;+ interactionState?: SummaryCardInteractionState;}export interface InteractiveSparklineChartSeries extends InteractiveSparklineSeries {diff --git a/frontend-modern/src/components/shared/summaryCardInteraction.ts b/frontend-modern/src/components/shared/summaryCardInteraction.tsnew file mode 100644index 0000000000..bf5bef8370--- /dev/null+++ b/frontend-modern/src/components/shared/summaryCardInteraction.ts@@ -0,0 +1,42 @@+export type SummaryCardInteractionState = 'default' | 'active' | 'inactive';++type SummarySeriesIdentity = {+ id?: string | null;+};++const normalizeSeriesId = (value: string | null | undefined): string => value?.trim() || '';++export function resolveSummaryActiveSeriesId(options: {+ hoveredSeriesId?: string | null;+ focusedSeriesId?: string | null;+}): string | null {+ const hoveredSeriesId = normalizeSeriesId(options.hoveredSeriesId);+ if (hoveredSeriesId) {+ return hoveredSeriesId;+ }++ const focusedSeriesId = normalizeSeriesId(options.focusedSeriesId);+ return focusedSeriesId || null;+}++export function resolveSummaryCardInteractionState(options: {+ series: readonly SummarySeriesIdentity[];+ hoveredSeriesId?: string | null;+ focusedSeriesId?: string | null;+}): SummaryCardInteractionState {+ const activeSeriesId = resolveSummaryActiveSeriesId({+ hoveredSeriesId: options.hoveredSeriesId,+ focusedSeriesId: options.focusedSeriesId,+ });+ if (!activeSeriesId) {+ return 'default';+ }++ for (const series of options.series) {+ if (normalizeSeriesId(series.id) === activeSeriesId) {+ return 'active';+ }+ }++ return 'inactive';+}diff --git a/frontend-modern/src/components/shared/useDensityMapState.ts b/frontend-modern/src/components/shared/useDensityMapState.tsindex 4fe9a3905c..9bfa5dd230 100644--- a/frontend-modern/src/components/shared/useDensityMapState.ts+++ b/frontend-modern/src/components/shared/useDensityMapState.ts@@ -54,7 +54,12 @@ export function useDensityMapState(props: DensityMapProps) {const rows = data.series.length;const cellWidth = width / DENSITY_MAP_COLUMNS;const cellHeight = height / rows;+ const interactionOpacity = props.interactionState === 'inactive' ? 0.35 : 1;const activeSeriesIndex = hoveredState()?.seriesIndex ?? externalSeriesIndex();+ const activeSeries =+ activeSeriesIndex !== null && activeSeriesIndex >= 0 && activeSeriesIndex < data.series.length+ ? data.series[activeSeriesIndex]+ : null;for (let row = 0; row < rows; row += 1) {const cellY = row * cellHeight;@@ -64,7 +69,7 @@ export function useDensityMapState(props: DensityMapProps) {const value = data.grid[row][column];if (value <= 0) {- context.globalAlpha = isDimmed ? 0.45 : 1;+ context.globalAlpha = (isDimmed ? 0.08 : 1) * interactionOpacity;context.fillStyle = 'rgba(128, 128, 128, 0.05)';context.fillRect(cellX + DENSITY_MAP_PADDING_X / 2,@@ -76,7 +81,9 @@ export function useDensityMapState(props: DensityMapProps) {}context.globalAlpha =- getDensityMapCellOpacity(value, data.globalMax) * (isDimmed ? 0.18 : 1);+ getDensityMapCellOpacity(value, data.globalMax) *+ (isDimmed ? 0.05 : 1) *+ interactionOpacity;context.fillStyle = data.series[row].color;if (context.roundRect) {context.beginPath();@@ -99,6 +106,25 @@ export function useDensityMapState(props: DensityMapProps) {}}+ if (activeSeries !== null && activeSeriesIndex !== null) {+ const highlightY = activeSeriesIndex * cellHeight;+ context.save();+ context.globalAlpha = 0.12 * interactionOpacity;+ context.fillStyle = activeSeries.color;+ context.fillRect(0, highlightY, width, cellHeight);+ context.globalAlpha = 0.7 * interactionOpacity;+ context.strokeStyle = activeSeries.color;+ context.lineWidth = 1.25;+ if (context.roundRect) {+ context.beginPath();+ context.roundRect(0.5, highlightY+0.5, width-1, Math.max(cellHeight-1, 1), 4);+ context.stroke();+ } else {+ context.strokeRect(0.5, highlightY+0.5, width-1, Math.max(cellHeight-1, 1));+ }+ context.restore();+ }+context.globalAlpha = 1;};diff --git a/frontend-modern/src/components/shared/useInteractiveSparklineState.ts b/frontend-modern/src/components/shared/useInteractiveSparklineState.tsindex 1d15835548..29ed5a4b27 100644--- a/frontend-modern/src/components/shared/useInteractiveSparklineState.ts+++ b/frontend-modern/src/components/shared/useInteractiveSparklineState.ts@@ -39,6 +39,7 @@ export function useInteractiveSparklineState();const formatValue = (value: number) =>props.formatValue ? props.formatValue(value) : `${value.toFixed(1)}%`;+ const interactionOpacityMultiplier = () => (props.interactionState === 'inactive' ? 0.35 : 1);const [hoveredState, setHoveredState] = createSignal<InteractiveSparklineHoverState | null>(null);const [lockedSeriesIndex, setLockedSeriesIndex] = createSignal<number | null>(null);@@ -180,6 +181,7 @@ export function useInteractiveSparklineState(const gridColor = isDark ? 'rgba(255, 255, 255, 0.06)' : 'rgba(17, 24, 39, 0.06)';const gridColorStrong = isDark ? 'rgba(255, 255, 255, 0.10)' : 'rgba(17, 24, 39, 0.10)';const hoverLineColor = isDark ? 'rgba(255, 255, 255, 0.45)' : 'rgba(17, 24, 39, 0.45)';+ const inactiveSeriesColor = isDark ? 'rgb(148, 163, 184)' : 'rgb(100, 116, 139)';const yLines = yMode() === 'percent' ? [0.2, 0.4, 0.6, 0.8] : [0.25, 0.5, 0.75];ctx.save();@@ -217,16 +219,19 @@ export function useInteractiveSparklineState(: 1.5: active === seriesIndex? isLg- ? 3.5- : 2.8+ ? 4+ : 3.2: isLg- ? 1- : 0.9;- const opacity = active === null ? 0.75 : active === seriesIndex ? 1 : 0.1;+ ? 0.7+ : 0.6;+ const opacity =+ (active === null ? 0.75 : active === seriesIndex ? 1 : 0.05) *+ interactionOpacityMultiplier();ctx.save();ctx.globalAlpha = opacity;- ctx.strokeStyle = series.color;+ ctx.strokeStyle =+ active !== null && active !== seriesIndex ? inactiveSeriesColor : series.color;ctx.lineWidth = lineWidth;ctx.lineCap = 'round';ctx.lineJoin = 'round';diff --git a/internal/mock/fixture_graph.go b/internal/mock/fixture_graph.goindex 074d38a0ea..8fd8eb0aa2 100644--- a/internal/mock/fixture_graph.go+++ b/internal/mock/fixture_graph.go@@ -25,14 +25,13 @@ func emptyFixtureGraph() FixtureGraph {}func buildFixtureGraph(cfg MockConfig, now time.Time) FixtureGraph {- state := buildFixtureState(cfg)- state.LastUpdate = now-- return FixtureGraph{- State: state,- AlertHistory: buildAlertHistory(state.Nodes, state.VMs, state.Containers),- PlatformFixtures: rebasePlatformFixtures(defaultPlatformFixtures(), now),+ graph := FixtureGraph{+ State: buildFixtureState(cfg),+ PlatformFixtures: defaultPlatformFixtures(),}+ graph.UpdateMetrics(cfg, now)+ graph.AlertHistory = buildAlertHistory(graph.State.Nodes, graph.State.VMs, graph.State.Containers)+ return graph}func cloneFixtureGraph(in FixtureGraph) FixtureGraph {@@ -47,8 +46,7 @@ func (g *FixtureGraph) UpdateMetrics(cfg MockConfig, now time.Time) {if g == nil {return}- updateFixtureStateMetrics(&g.State, cfg)- g.State.LastUpdate = now+ updateFixtureStateMetricsAt(&g.State, cfg, now)g.PlatformFixtures = rebasePlatformFixtures(g.PlatformFixtures, now)}diff --git a/internal/mock/generator.go b/internal/mock/generator.goindex e9724fd2af..61bd904a8b 100644--- a/internal/mock/generator.go+++ b/internal/mock/generator.go@@ -4713,12 +4713,19 @@ func generateSnapshots(vms []models.VM, containers []models.Container) []models.// UpdateMetrics simulates changing metrics over timefunc updateFixtureStateMetrics(data *models.StateSnapshot, config MockConfig) {- updateDockerHosts(data, config)- updateKubernetesClusters(data, config)- updateHosts(data, config)+ updateFixtureStateMetricsAt(data, config, time.Now())+}++func updateFixtureStateMetricsAt(data *models.StateSnapshot, config MockConfig, refreshNow time.Time) {+ if refreshNow.IsZero() {+ refreshNow = time.Now()+ }++ updateDockerHosts(data, config, refreshNow)+ updateKubernetesClusters(data, config, refreshNow)+ updateHosts(data, config, refreshNow)syncMockKubernetesNodeHosts(data)- refreshNow := time.Now()step := int64(updateInterval.Seconds())if step <= 0 {step = 2@@ -4858,9 +4865,8 @@ func updateFixtureStateMetrics(data *models.StateSnapshot, config MockConfig) {// Update PMG metrics with gentle fluctuationsfor i := range data.PMGInstances {inst := &data.PMGInstances[i]- now := time.Now()- inst.LastSeen = now- inst.LastUpdated = now+ inst.LastSeen = refreshNow+ inst.LastUpdated = refreshNowif inst.MailStats != nil {inst.MailStats.CountTotal = fluctuateFloat(inst.MailStats.CountTotal, 0.05, 0, math.MaxFloat64)@@ -4874,7 +4880,7 @@ func updateFixtureStateMetrics(data *models.StateSnapshot, config MockConfig) {inst.MailStats.PregreetRejects = fluctuateFloat(inst.MailStats.PregreetRejects, 0.07, 0, math.MaxFloat64)inst.MailStats.GreylistCount = fluctuateFloat(inst.MailStats.GreylistCount, 0.05, 0, math.MaxFloat64)inst.MailStats.AverageProcessTimeMs = fluctuateFloat(inst.MailStats.AverageProcessTimeMs, 0.05, 200, 2000)- inst.MailStats.UpdatedAt = now+ inst.MailStats.UpdatedAt = refreshNow}if len(inst.MailCount) > 0 {@@ -4885,7 +4891,7 @@ func updateFixtureStateMetrics(data *models.StateSnapshot, config MockConfig) {base := 60 + rand.Float64()*30newPoint := models.PMGMailCountPoint{- Timestamp: now,+ Timestamp: refreshNow,Count: base + rand.Float64()*15,CountIn: base*0.6 + rand.Float64()*10,CountOut: base*0.4 + rand.Float64()*8,@@ -4926,16 +4932,14 @@ func updateFixtureStateMetrics(data *models.StateSnapshot, config MockConfig) {}}- data.LastUpdate = time.Now()+ data.LastUpdate = refreshNow}-func updateKubernetesClusters(data *models.StateSnapshot, config MockConfig) {+func updateKubernetesClusters(data *models.StateSnapshot, config MockConfig, now time.Time) {if len(data.KubernetesClusters) == 0 {return}- now := time.Now()-for i := range data.KubernetesClusters {cluster := &data.KubernetesClusters[i]@@ -5002,12 +5006,10 @@ func updateKubernetesClusters(data *models.StateSnapshot, config MockConfig) {}}-func updateDockerHosts(data *models.StateSnapshot, config MockConfig) {+func updateDockerHosts(data *models.StateSnapshot, config MockConfig, now time.Time) {if len(data.DockerHosts) == 0 {return}-- now := time.Now()step := int64(updateInterval.Seconds())if step <= 0 {step = 2@@ -5341,12 +5343,10 @@ func ensureDockerSwarmInfo(host *models.DockerHost) {}}-func updateHosts(data *models.StateSnapshot, config MockConfig) {+func updateHosts(data *models.StateSnapshot, config MockConfig, now time.Time) {if len(data.Hosts) == 0 {return}-- now := time.Now()step := int64(updateInterval.Seconds())if step <= 0 {step = 2diff --git a/internal/mock/platform_fixtures_test.go b/internal/mock/platform_fixtures_test.goindex e402359578..bf9c854540 100644--- a/internal/mock/platform_fixtures_test.go+++ b/internal/mock/platform_fixtures_test.go@@ -1,6 +1,7 @@package mockimport (+ "fmt""math""testing""time"@@ -145,3 +146,78 @@ func TestBuildFixtureGraphRefreshesPlatformFixtureMetricsFromCanonicalModel(t *tt.Fatalf("expected refreshed VMware datastore free space %d, got %d", wantFree, datastore.FreeSpace)}}++func TestBuildFixtureGraphRefreshesStateMetricsFromCanonicalModel(t *testing.T) {+ now := time.Date(2026, time.March, 31, 17, 30, 45, 0, time.UTC)++ graph := buildFixtureGraph(DefaultConfig, now)++ node := graph.State.Nodes[0]+ if got, want := node.CPU*100, SampleMetric("node", node.ID, "cpu", now); math.Abs(got-want) > 1e-9 {+ t.Fatalf("expected refreshed node cpu %.6f, got %.6f", want, got)+ }+ if got, want := node.Memory.Usage, SampleMetric("node", node.ID, "memory", now); math.Abs(got-want) > 1e-9 {+ t.Fatalf("expected refreshed node memory %.6f, got %.6f", want, got)+ }++ var runningVMID string+ var runningVMCPU float64+ var runningVMMemory float64+ for _, vm := range graph.State.VMs {+ if vm.Status != "running" {+ continue+ }+ runningVMID = vm.ID+ runningVMCPU = vm.CPU * 100+ runningVMMemory = vm.Memory.Usage+ break+ }+ if runningVMID == "" {+ t.Fatal("expected at least one running VM in canonical fixture graph")+ }+ if got, want := runningVMCPU, SampleMetric("vm", runningVMID, "cpu", now); math.Abs(got-want) > 1e-9 {+ t.Fatalf("expected refreshed vm cpu %.6f, got %.6f", want, got)+ }+ if got, want := runningVMMemory, SampleMetric("vm", runningVMID, "memory", now); math.Abs(got-want) > 1e-9 {+ t.Fatalf("expected refreshed vm memory %.6f, got %.6f", want, got)+ }++ var onlineHostID string+ var onlineHostCPU float64+ var onlineHostMemory float64+ for _, host := range graph.State.Hosts {+ if host.Status == "offline" {+ continue+ }+ onlineHostID = host.ID+ onlineHostCPU = host.CPUUsage+ onlineHostMemory = host.Memory.Usage+ break+ }+ if onlineHostID == "" {+ t.Fatal("expected at least one online host in canonical fixture graph")+ }+ if got, want := onlineHostCPU, SampleMetric("agent", onlineHostID, "cpu", now); math.Abs(got-want) > 1e-9 {+ t.Fatalf("expected refreshed host cpu %.6f, got %.6f", want, got)+ }+ if got, want := onlineHostMemory, SampleMetric("agent", onlineHostID, "memory", now); math.Abs(got-want) > 1e-9 {+ t.Fatalf("expected refreshed host memory %.6f, got %.6f", want, got)+ }++ storage := graph.State.Storage[0]+ if got, want := storage.Usage, SampleMetric("storage", storage.ID, "usage", now); math.Abs(got-want) > 1e-9 {+ t.Fatalf("expected refreshed storage usage %.6f, got %.6f", want, got)+ }++ disk := graph.State.PhysicalDisks[0]+ resourceID := disk.Serial+ if resourceID == "" {+ resourceID = disk.ID+ }+ if resourceID == "" {+ resourceID = fmt.Sprintf("%s-%s-%s", disk.Instance, disk.Node, disk.DevPath)+ }+ if got, want := disk.Temperature, int(math.Round(SampleMetric("disk", resourceID, "smart_temp", now))); got != want {+ t.Fatalf("expected refreshed physical disk temperature %d, got %d", want, got)+ }+}