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): render sparkline cursor from hover x
rcourtmanaa1e44b856e0
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex c53da64bb1..ce3b9dad63 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -228,7 +228,7 @@ 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 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.+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, and the rendered SVG/canvas hover cursor must bind to the actual numeric cursor coordinate rather than a boolean guard state.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 treatdiff --git a/frontend-modern/src/components/shared/InteractiveSparkline.tsx b/frontend-modern/src/components/shared/InteractiveSparkline.tsxindex 28859bab24..9c4d9e9377 100644--- a/frontend-modern/src/components/shared/InteractiveSparkline.tsx+++ b/frontend-modern/src/components/shared/InteractiveSparkline.tsx@@ -121,19 +121,17 @@ export const InteractiveSparkline: Component<InteractiveSparklineProps> = (props</For><Show when={sparkline.activeHoverCursorX() !== null}>- {(cursorX) => (- <line- x1={cursorX()}- y1={Math.max(0, (sparkline.activeHoverState()?.minY ?? 4) - 4)}- x2={cursorX()}- y2={sparkline.vbH}- stroke="currentColor"- stroke-opacity="0.45"- stroke-width="1"- stroke-dasharray="3 3"- vector-effect="non-scaling-stroke"- />- )}+ <line+ x1={sparkline.activeHoverCursorX() ?? 0}+ y1={Math.max(0, (sparkline.activeHoverState()?.minY ?? 4) - 4)}+ x2={sparkline.activeHoverCursorX() ?? 0}+ y2={sparkline.vbH}+ stroke="currentColor"+ stroke-opacity="0.45"+ stroke-width="1"+ stroke-dasharray="3 3"+ vector-effect="non-scaling-stroke"+ /></Show><For each={sparkline.chartData().paths}>diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex cb10c87a00..c8d49e5406 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -541,6 +541,8 @@ describe('shared primitive guardrails', () => {expect(interactiveSparklineSource).toContain('useInteractiveSparklineState');expect(interactiveSparklineSource).toContain('data-active-series-display');expect(interactiveSparklineSource).toContain('data-active-hover-cursor-x');+ expect(interactiveSparklineSource).toContain('x1={sparkline.activeHoverCursorX() ?? 0}');+ expect(interactiveSparklineSource).not.toContain('{(cursorX) => (');expect(interactiveSparklineSource).toContain('data-rendered-series-count');expect(interactiveSparklineSource).not.toContain('createEffect');expect(interactiveSparklineSource).not.toContain('createSignal');diff --git a/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsx b/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsxindex 42010e4825..2c8d8768f9 100644--- a/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsx@@ -116,10 +116,12 @@ describe('InteractiveSparkline hover behavior', () => {fireEvent.mouseMove(svg, { clientX: 100, clientY: 120 });const root = container.firstElementChild;- expect(svg.querySelector('line[stroke-dasharray="3 3"]')).toBeInTheDocument();+ const hoverLine = svg.querySelector('line[stroke-dasharray="3 3"]');+ expect(hoverLine).toBeInTheDocument();expect(Number.parseFloat(root?.getAttribute('data-active-hover-cursor-x') ?? 'NaN'),).toBeCloseTo(100, 1);+ expect(Number.parseFloat(hoverLine?.getAttribute('x1') ?? 'NaN')).toBeCloseTo(100, 1);});it('publishes synchronized hover identity and clears it on leave', () => {diff --git a/tests/integration/tests/48-summary-hover-selection.spec.ts b/tests/integration/tests/48-summary-hover-selection.spec.tsindex 85ff94bb9d..8d5c481e8a 100644--- a/tests/integration/tests/48-summary-hover-selection.spec.ts+++ b/tests/integration/tests/48-summary-hover-selection.spec.ts@@ -270,6 +270,58 @@ async function expectSummaryHoverTimestampsAligned(});}+async function expectSparklineSourceCursorTracksLocalScrub(+ page: import("@playwright/test").Page,+ sparklineRoot: import("@playwright/test").Locator,+): Promise<void> {+ const surface = sparklineRoot.locator("svg").first();+ await expect(surface).toBeVisible();+ const box = await surface.boundingBox();+ expect(box).not.toBeNull();+ if (!box) {+ throw new Error("Sparkline surface has no bounding box");+ }++ const samples: Array<{ cursorX: number; lineX: number }> = [];+ for (const ratio of [0.15, 0.45, 0.75]) {+ await page.mouse.move(+ box.x + box.width * ratio,+ box.y + box.height * 0.45,+ );+ await expect+ .poll(async () =>+ sparklineRoot.evaluate((node) => {+ const activeCursor = Number.parseFloat(+ node.getAttribute("data-active-hover-cursor-x") || "NaN",+ );+ const svgCursor = Number.parseFloat(+ node+ .querySelector('line[stroke-dasharray="3 3"]')+ ?.getAttribute("x1") || "NaN",+ );+ return Number.isFinite(activeCursor) && Number.isFinite(svgCursor);+ }),+ )+ .toBe(true);++ const sample = await sparklineRoot.evaluate((node) => ({+ cursorX: Number.parseFloat(+ node.getAttribute("data-active-hover-cursor-x") || "NaN",+ ),+ lineX: Number.parseFloat(+ node.querySelector('line[stroke-dasharray="3 3"]')?.getAttribute("x1") ||+ "NaN",+ ),+ }));+ expect(sample.cursorX).toBeCloseTo(sample.lineX, 1);+ samples.push(sample);+ }++ expect(samples[0].lineX).toBeLessThan(samples[1].lineX);+ expect(samples[1].lineX).toBeLessThan(samples[2].lineX);+ await page.mouse.move(1, 1);+}+async function readSummarySeriesId(row: import("@playwright/test").Locator,fallbackAttribute: string,@@ -354,6 +406,17 @@ test.describe.serial("Summary hover selection", () => {infrastructureRowId,2,);+ const infrastructureSparklines = infrastructureSummary.locator(+ "[data-active-series-display]",+ );+ await expectSparklineSourceCursorTracksLocalScrub(+ page,+ infrastructureSparklines.nth(0),+ );+ await expectSparklineSourceCursorTracksLocalScrub(+ page,+ infrastructureSparklines.nth(1),+ );await page.goto("/workloads", { waitUntil: "domcontentloaded" });const workloadsSummary = page.getByTestId("workloads-summary");@@ -375,6 +438,17 @@ test.describe.serial("Summary hover selection", () => {workloadRowId,2,);+ const workloadSparklines = workloadsSummary.locator(+ "[data-active-series-display]",+ );+ await expectSparklineSourceCursorTracksLocalScrub(+ page,+ workloadSparklines.nth(0),+ );+ await expectSparklineSourceCursorTracksLocalScrub(+ page,+ workloadSparklines.nth(1),+ );const vmwareWorkloadRow = page.locator('tr[data-guest-id^="vm-"]', { hasText: "warehouse-api-01" })