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): use canonical density-map tooltip detail
rcourtmane4a89ac6c59d
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex b307746a22..40643f682e 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -230,7 +230,7 @@ connections` visible as the API-backed alternative for Proxmox and`frontend-modern/src/routing/resourceLinks.ts` instead of freezing rawroute 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. That focused rail must only surface complementary context such as the active entity identity, sparkline, and peak value; it must not repeat a second `Latest` or current-value readout that the hover tooltip already owns.+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 keep focused-entity detail in the hover tooltip 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 adding persistent card chrome that steals heatmap space. The card body must stay overview-first; the tooltip may carry the active entity identity, current value, peak, and mini sparkline.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, the rendered SVG/canvas hover cursor must bind to the actual numeric cursor coordinate rather than a boolean guard state, the time cursor must span the chart viewport instead of collapsing to the series height, and the hover tooltip must track the pointer instead of anchoring to the chart top edge.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-facet@@ -623,9 +623,10 @@ The shared density map now follows that same owner split.`frontend-modern/src/components/shared/useDensityMapState.ts` owns hoversignals, canvas draw lifecycle, and resize handling, and`frontend-modern/src/components/shared/densityMapModel.ts` owns bucket/window-math, hover target selection, tooltip time formatting, and density-cell+math, hover target selection, focused-series tooltip detail, and density-cellopacity rules. Future density-map work should extend those owners instead of-pushing canvas lifecycle or chart math back into the shared shell.+pushing canvas lifecycle, tooltip shaping, or chart math back into the shared+shell.The shared active-use trial nudge now follows that same owner split.`frontend-modern/src/components/shared/ActiveUseTrialNudge.tsx` stays therender shell, `frontend-modern/src/components/shared/useActiveUseTrialNudgeState.ts`diff --git a/frontend-modern/src/components/shared/DensityMap.tsx b/frontend-modern/src/components/shared/DensityMap.tsxindex 10f385a51d..3f79b69e6c 100644--- a/frontend-modern/src/components/shared/DensityMap.tsx+++ b/frontend-modern/src/components/shared/DensityMap.tsx@@ -1,10 +1,10 @@import { Component, Show } from 'solid-js';-import { Portal } from 'solid-js/web';import {formatDensityMapHoverTime,hasDensityMapFocusActivity,type DensityMapProps,} from './densityMapModel';+import { TooltipPortal } from './TooltipPortal';import { useDensityMapState } from './useDensityMapState';export type { DensityMapProps } from './densityMapModel';@@ -14,6 +14,7 @@ export const DensityMap: Component<DensityMapProps> = (props) => {const interactionState = () => props.interactionState ?? 'default';const formatDetailValue = (value: number | null) =>value === null ? 'No sample' : densityMap.formatValue(value);+ const hoveredFocusDetail = () => (densityMap.hoveredState() ? densityMap.focusDetail() : null);return (<div@@ -27,73 +28,6 @@ export const DensityMap: Component<DensityMapProps> = (props) => {data-rendered-series-count={densityMap.chartData().series.length}data-summary-chart-state={interactionState()}>- <div class="mx-1 mb-1 flex h-7 items-center overflow-hidden">- <Show- when={densityMap.focusDetail()}- fallback={- <div class="w-full truncate text-[9px] font-medium uppercase tracking-[0.12em] text-slate-500/80">- Top activity overview- </div>- }- >- {(detail) => (- <div- class="flex w-full min-w-0 items-center gap-2 text-[10px]"- data-density-map-focus-detail="true"- data-density-map-focus-empty={hasDensityMapFocusActivity(detail()) ? 'false' : 'true'}- data-density-map-focus-series-id={detail().seriesId}- >- <div class="flex min-w-0 flex-1 items-center gap-1.5">- <span- class="h-2 w-2 shrink-0 rounded-full"- style={{ background: detail().seriesColor }}- />- <span class="truncate font-semibold uppercase tracking-[0.1em] text-slate-600 dark:text-slate-300">- {detail().seriesName}- </span>- <Show when={detail().sparklinePath}>- {(path) => (- <svg- viewBox="0 0 64 22"- class="h-4 w-12 shrink-0 overflow-visible text-slate-400"- aria-hidden="true"- >- <path- d={path()}- fill="none"- stroke={detail().seriesColor}- stroke-linecap="round"- stroke-linejoin="round"- stroke-width="1.75"- />- </svg>- )}- </Show>- </div>- <Show- when={hasDensityMapFocusActivity(detail())}- fallback={- <div class="shrink-0 rounded-full bg-slate-100 px-2 py-1 text-[9px] font-medium uppercase tracking-[0.08em] text-slate-500 dark:bg-slate-800 dark:text-slate-300">- {props.focusEmptyStateLabel ?? 'No activity in range'}- </div>- }- >- <div class="flex shrink-0 items-center gap-3 leading-none">- <div class="flex flex-col items-start">- <span class="text-[9px] uppercase tracking-wide text-slate-500 dark:text-slate-400">- Peak- </span>- <span class="mt-0.5 font-semibold text-slate-900 dark:text-slate-50">- {formatDetailValue(detail().peakValue)}- </span>- </div>- </div>- </Show>- </div>- )}- </Show>- </div>-<div class="flex-1 relative min-h-0 bg-transparent flex">{/* Y-axis: typically in a density map we might just show "Top Nodes" */}<div class="absolute left-0 top-0 h-full w-full pointer-events-none flex flex-col justify-between py-1 opacity-0 group-hover:opacity-100 transition-opacity">@@ -120,34 +54,80 @@ export const DensityMap: Component<DensityMapProps> = (props) => {</span></div>- <Portal>- <Show when={densityMap.hoveredState()}>- {(hover) => (- <div- class="fixed pointer-events-none text-xs rounded px-2 py-1.5 shadow-lg border border-slate-600"- style={{- left: `${hover().tooltipX}px`,- top: `${hover().tooltipY - 6}px`,- transform: 'translate(-50%, -100%)',- 'z-index': '9999',- 'background-color': 'rgb(15, 23, 42)',- color: 'rgb(248, 250, 252)',- }}- >- <div class="font-medium text-center mb-1 text-slate-300">- {formatDensityMapHoverTime(hover().timestamp)}- </div>- <div class="flex items-center gap-1.5 leading-tight">- <span class="w-2 h-2 rounded-sm" style={{ background: hover().seriesColor }} />- <span class="font-semibold text-white">{hover().seriesName}</span>- <span class="ml-2 font-medium text-emerald-400">- {densityMap.formatValue(hover().value)}+ <Show when={densityMap.hoveredState()}>+ {(hover) => (+ <TooltipPortal when={true} x={hover().tooltipX} y={hover().tooltipY + 2}>+ <div class="min-w-[152px]" data-density-map-tooltip="true">+ <div class="mb-1 flex items-center gap-1.5 border-b border-border pb-1 text-[10px] leading-none">+ <span class="h-2 w-2 rounded-sm" style={{ background: hover().seriesColor }} />+ <span class="max-w-[94px] truncate font-semibold tracking-[0.12em] text-base-content">+ {hover().seriesName}+ </span>+ <span class="ml-auto whitespace-nowrap text-muted">+ {formatDensityMapHoverTime(hover().timestamp)}</span></div>+ <div class="flex items-center gap-2.5">+ <div class="flex items-baseline gap-1">+ <span class="text-[9px] uppercase tracking-wide text-muted">Current</span>+ <span class="text-[11px] font-semibold text-emerald-400">+ {densityMap.formatValue(hover().value)}+ </span>+ </div>+ <Show+ when={hoveredFocusDetail()}+ fallback={+ <div class="flex items-baseline gap-1">+ <span class="text-[9px] uppercase tracking-wide text-muted">Peak</span>+ <span class="text-[11px] font-semibold text-base-content">No sample</span>+ </div>+ }+ >+ {(detail) => (+ <Show+ when={hasDensityMapFocusActivity(detail())}+ fallback={+ <div class="flex items-baseline gap-1">+ <span class="text-[9px] uppercase tracking-wide text-muted">Peak</span>+ <span class="text-[11px] font-semibold text-base-content">+ {props.focusEmptyStateLabel ?? 'No activity in range'}+ </span>+ </div>+ }+ >+ <div class="flex items-baseline gap-1">+ <span class="text-[9px] uppercase tracking-wide text-muted">Peak</span>+ <span class="text-[11px] font-semibold text-base-content">+ {formatDetailValue(detail().peakValue)}+ </span>+ </div>+ </Show>+ )}+ </Show>+ <Show when={hoveredFocusDetail()?.sparklinePath}>+ {(path) => (+ <svg+ viewBox="0 0 64 22"+ class="ml-0.5 h-4 w-[56px] shrink-0 overflow-visible"+ aria-hidden="true"+ data-density-map-tooltip-sparkline="true"+ >+ <path+ d={path()}+ fill="none"+ stroke={hover().seriesColor}+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="1.75"+ />+ </svg>+ )}+ </Show>+ </div></div>- )}- </Show>- </Portal>+ </TooltipPortal>+ )}+ </Show></div>);};diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex cd24f4800a..c28949bec4 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -634,7 +634,10 @@ describe('shared primitive guardrails', () => {it('keeps density map on shell, runtime, and model owners', () => {expect(densityMapSource).toContain('useDensityMapState');expect(densityMapSource).not.toContain('Latest');+ expect(densityMapSource).not.toContain('Top activity overview');expect(densityMapSource).not.toContain('detail().currentValue');+ expect(densityMapSource).toContain('data-density-map-tooltip="true"');+ expect(densityMapSource).toContain('data-density-map-tooltip-sparkline="true"');expect(densityMapSource).not.toContain('timeRangeToMs');expect(densityMapSource).not.toContain('createSignal');expect(densityMapSource).not.toContain('ctx.fillRect');diff --git a/frontend-modern/src/components/shared/__tests__/DensityMap.test.tsx b/frontend-modern/src/components/shared/__tests__/DensityMap.test.tsxindex a2c62937d4..3c8d0ffc38 100644--- a/frontend-modern/src/components/shared/__tests__/DensityMap.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/DensityMap.test.tsx@@ -54,6 +54,7 @@ describe('DensityMap', () => {timeRange="1h"series={[{+ id: 'cpu',name: 'CPU',color: '#10b981',data: [@@ -88,6 +89,10 @@ describe('DensityMap', () => {fireEvent.mouseMove(canvas, { clientX: 160, clientY: 20 });expect(await screen.findByText('CPU')).toBeInTheDocument();+ expect(screen.getByText('Current')).toBeInTheDocument();+ expect(screen.getByText('Peak')).toBeInTheDocument();+ expect(document.querySelector('[data-density-map-tooltip="true"]')).not.toBeNull();+ expect(document.querySelector('[data-density-map-tooltip-sparkline="true"]')).not.toBeNull();});it('publishes synchronized hover identity and clears it on leave', () => {@@ -212,7 +217,7 @@ describe('DensityMap', () => {expect(detail?.sparklinePath).toContain('M');});- it('renders focused detail while keeping the density-map overview series count intact', () => {+ it('keeps the density-map card free of persistent focus chrome while preserving overview count', () => {const now = Date.now();const { container } = render(() => (<DensityMap@@ -245,15 +250,13 @@ describe('DensityMap', () => {expect(root?.getAttribute('data-summary-chart-kind')).toBe('density-map');expect(root?.getAttribute('data-active-hover-timestamp')).toBe('');expect(root?.getAttribute('data-rendered-series-count')).toBe('2');- expect(screen.getByText('Alpha')).toBeInTheDocument();- expect(screen.getByText('Peak')).toBeInTheDocument();- expect(screen.getAllByText('32.0')).toHaveLength(1);- const overlay = container.querySelector('[data-density-map-focus-detail="true"]');- expect(overlay).not.toBeNull();- expect(overlay).toHaveAttribute('data-density-map-focus-series-id', 'alpha');+ expect(screen.queryByText('Top activity overview')).toBeNull();+ expect(screen.queryByText('Peak')).toBeNull();+ expect(screen.queryByText('Alpha')).toBeNull();+ expect(container.querySelector('[data-density-map-focus-detail="true"]')).toBeNull();});- it('shows an intentional empty-state pill when the focused series has no activity in range', () => {+ it('keeps empty focused density maps free of persistent empty-state chrome', () => {const now = Date.now();const { container } = render(() => (<DensityMap@@ -280,11 +283,60 @@ describe('DensityMap', () => {/>));- const overlay = container.querySelector('[data-density-map-focus-detail="true"]');- expect(overlay).not.toBeNull();- expect(overlay).toHaveAttribute('data-density-map-focus-empty', 'true');- expect(screen.getByText('No disk activity in range')).toBeInTheDocument();- expect(screen.queryByText('Latest')).toBeNull();+ expect(container.querySelector('[data-density-map-focus-detail="true"]')).toBeNull();+ expect(screen.queryByText('No disk activity in range')).toBeNull();expect(screen.queryByText('Peak')).toBeNull();});++ it('shows empty-state peak copy in the tooltip when the hovered series has no activity in range', async () => {+ const now = Date.now();+ const { container } = render(() => (+ <DensityMap+ timeRange="1h"+ highlightSeriesId="alpha"+ focusEmptyStateLabel="No disk activity in range"+ series={[+ {+ id: 'alpha',+ name: 'Alpha',+ color: '#10b981',+ data: [],+ },+ {+ id: 'beta',+ name: 'Beta',+ color: '#3b82f6',+ data: [+ { timestamp: now - 30_000, value: 18 },+ { timestamp: now - 5_000, value: 24 },+ ],+ },+ ]}+ />+ ));++ const canvas = container.querySelector('canvas');+ expect(canvas).not.toBeNull();+ if (!canvas) return;++ (canvas as unknown as { getBoundingClientRect: () => DOMRect }).getBoundingClientRect = () =>+ ({+ left: 0,+ top: 0,+ width: 180,+ height: 80,+ right: 180,+ bottom: 80,+ x: 0,+ y: 0,+ toJSON: () => ({}),+ }) as unknown as DOMRect;++ fireEvent.mouseMove(canvas, { clientX: 20, clientY: 60 });++ expect(await screen.findByText('Alpha')).toBeInTheDocument();+ expect(screen.getByText('Peak')).toBeInTheDocument();+ expect(screen.getByText('No disk activity in range')).toBeInTheDocument();+ expect(document.querySelector('[data-density-map-tooltip-sparkline="true"]')).toBeNull();+ });});diff --git a/tests/integration/tests/48-summary-hover-selection.spec.ts b/tests/integration/tests/48-summary-hover-selection.spec.tsindex 7762864817..bbc7aad765 100644--- a/tests/integration/tests/48-summary-hover-selection.spec.ts+++ b/tests/integration/tests/48-summary-hover-selection.spec.ts@@ -224,15 +224,6 @@ async function expectActiveDensityMapsPreserveOverview();return {activeCount: activeNodes.length,- focusDetailCount: activeNodes.filter((node) => {- const detail = node.querySelector(- '[data-density-map-focus-detail="true"]',- );- return (- detail?.getAttribute("data-density-map-focus-series-id") ===- expectedId- );- }).length,preservedOverview: activeNodes.every((node) =>Number(node.getAttribute("data-rendered-series-count") || "0") >@@ -243,11 +234,40 @@ async function expectActiveDensityMapsPreserveOverview().toEqual({activeCount: expectedCount,- focusDetailCount: expectedCount,preservedOverview: true,});}+async function hoverDensityMapUntilTooltipAppears(+ page: import("@playwright/test").Page,+ densityMap: import("@playwright/test").Locator,+): Promise<void> {+ const canvas = densityMap.locator("canvas").first();+ await expect(canvas).toBeVisible();+ const box = await canvas.boundingBox();+ expect(box).not.toBeNull();+ if (!box) {+ throw new Error("Density map canvas has no bounding box");+ }++ for (const point of [+ { x: 0.84, y: 0.2 },+ { x: 0.7, y: 0.35 },+ { x: 0.56, y: 0.5 },+ ]) {+ await page.mouse.move(+ box.x + box.width * point.x,+ box.y + box.height * point.y,+ );+ const tooltip = page.locator('[data-density-map-tooltip="true"]').last();+ if (await tooltip.isVisible().catch(() => false)) {+ return;+ }+ }++ throw new Error("Unable to activate a density-map tooltip");+}+async function expectSummaryHoverTimestampsAligned(summary: import("@playwright/test").Locator,expectedCount: number,@@ -776,4 +796,36 @@ test.describe.serial("Summary hover selection", () => {.poll(() => readRenderedSeriesCounts(workloadsSummary)).toEqual(resolvedBaselineCounts);});++ test("keeps density-map detail inside the hover tooltip instead of card chrome", async ({+ page,+ }, testInfo) => {+ test.skip(+ testInfo.project.name.startsWith("mobile-"),+ "Desktop runtime proof",+ );++ await ensureMockModeEnabled(page);++ await page.goto("/workloads", { waitUntil: "domcontentloaded" });+ const workloadsSummary = page.getByTestId("workloads-summary");+ await expect(workloadsSummary).toBeVisible();+ await expect(+ workloadsSummary.locator('[data-density-map-focus-detail="true"]'),+ ).toHaveCount(0);+ await expect(workloadsSummary).not.toContainText("Top activity overview");++ const firstDensityMap = workloadsSummary+ .locator('[data-summary-chart-kind="density-map"]')+ .first();+ await hoverDensityMapUntilTooltipAppears(page, firstDensityMap);++ const tooltip = page.locator('[data-density-map-tooltip="true"]').last();+ await expect(tooltip).toBeVisible();+ await expect(tooltip).toContainText("Current");+ await expect(tooltip).toContainText("Peak");+ await expect(+ tooltip.locator('[data-density-map-tooltip-sparkline="true"]'),+ ).toBeVisible();+ });});