Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

fix(frontend): scope workload summaries by group hover

rcourtman50ba5ecac114
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 714f6633b1..b307746a22 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -146,7 +146,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 row-hover, chart-hover, or route-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. Hovering one summary chart must promote that series into the shared active entity so sibling cards highlight the same object instead of keeping chart-local hover islands.
+8. Keep summary chart interaction identity on one shared helper. Summary surfaces that expose row-hover, group-hover, chart-hover, or route-focus-driven chart emphasis must derive page/group/entity scope through `frontend-modern/src/components/shared/summaryCardInteraction.ts` and pass that same resolved scope 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. Hovering one summary chart must promote that series into the shared active entity so sibling cards highlight the same object instead of keeping chart-local hover islands, and hovering a grouped header must scope every card to that group without forking a workloads-local summary filter path.
9. Keep page summaries page-scoped when table rows enter contextual focus. Route-backed row selection may add a focused label and shared series emphasis, but infrastructure, workloads, and storage summary cards must continue to render the page-level series set instead of collapsing the summary down to the selected row or replacing the global trend view with row-local empty states.
10. Keep contextual row focus on the shared summary primitive. Summary surfaces and same-route table drill-ins must reuse `frontend-modern/src/components/shared/contextualFocus.ts` for interactive-series filtering, focused-name lookup, active-series derivation, and local scroll preservation instead of rebuilding page-local `Set` filters, focused-label scans, or ad hoc scroll restoration in each surface.
11. Keep summary-to-table coordination deliberate and reversible. Shared summary hover may highlight the matching table row when it is already visible, but transient chart hover must not auto-filter tables, auto-scroll the page, or reshuffle table ordering. When the active row is off-screen, page owners must route through `frontend-modern/src/components/shared/summaryTableFocus.ts` and surface a lightweight `Jump to row` affordance that reveals and scrolls only on explicit user action.
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 8d6e074f97..a53ccd60ff 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -166,7 +166,7 @@ regression protection.
24. Extend dashboard shell rendering through `frontend-modern/src/components/Dashboard/DashboardStateCards.tsx`, `frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx`, and `frontend-modern/src/components/Dashboard/DashboardStatsStrip.tsx` rather than accreting loading cards, workload table markup, or stats-strip presentation back into `frontend-modern/src/components/Dashboard/Dashboard.tsx`
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.
+27. Keep summary hover/focus and sticky-card behavior on shared hot paths: infrastructure, workloads, and storage summary shells must reuse one page/group/entity scope 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, grouped-header hover scopes the summary coherently, and the hot path does not multiply 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. Density maps on that hot path must stay overview-first under focus: preserve the multi-entity heatmap rows, layer focused-entity detail inside the card, and avoid swapping transient hover into a separate single-series chart path.
## Forbidden Paths
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index a4246ee94c..4b9c5de4d5 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -203,6 +203,11 @@ assembly branch.
`data-summary-row-active` and rely on the shared row presentation owned by
`frontend-modern/src/index.css` instead of provider-specific background
classes that drift across resource tables or hide inline metric bars.
+14. Keep infrastructure search aligned with the governed display label. Shared
+ infrastructure filtering through
+ `frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts`
+ must match the user-visible safe label for governed resources instead of
+ reintroducing redacted hostnames through search-only fallback candidates.
## Current State
diff --git a/frontend-modern/src/components/Dashboard/Dashboard.tsx b/frontend-modern/src/components/Dashboard/Dashboard.tsx
index 011b7513a6..4c45e85b51 100644
--- a/frontend-modern/src/components/Dashboard/Dashboard.tsx
+++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx
@@ -24,6 +24,7 @@ export function Dashboard(props: DashboardProps) {
fallbackSnapshots={state.workloadsSummaryFallbackSnapshots()}
visibleWorkloadIds={state.workloadsSummaryVisibleIds()}
chartHoverSync={state.chartHoverSync()}
+ hoveredGroupScope={state.activeSummaryWorkloadGroupScope()}
hoveredWorkloadId={state.hoveredWorkloadId()}
focusedWorkloadId={state.selectedGuestId()}
onChartHoverSyncChange={state.setChartHoverSync}
@@ -112,6 +113,7 @@ export function Dashboard(props: DashboardProps) {
handleCustomUrlUpdate={state.handleCustomUrlUpdate}
handleSort={state.handleSort}
handleTagClick={state.handleTagClick}
+ activeSummaryWorkloadGroupScope={state.activeSummaryWorkloadGroupScope}
activeSummaryWorkloadId={state.activeSummaryWorkloadId}
isMobile={state.isMobile}
mobileVisibleColumnIds={state.mobileVisibleColumnIds}
@@ -119,6 +121,7 @@ export function Dashboard(props: DashboardProps) {
nodeByInstance={state.nodeByInstance}
search={state.search}
selectedGuestId={state.selectedGuestId}
+ setHoveredWorkloadGroupScope={state.setHoveredWorkloadGroupScope}
setHoveredWorkloadId={state.setHoveredWorkloadId}
setSelectedGuestId={state.setSelectedGuestId}
setTableBodyRef={state.setTableBodyRef}
diff --git a/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx b/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx
index 848381b5db..be31b446d7 100644
--- a/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx
+++ b/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx
@@ -20,6 +20,7 @@ type DashboardWorkloadTableProps = Pick<
| 'handleCustomUrlUpdate'
| 'handleSort'
| 'handleTagClick'
+ | 'activeSummaryWorkloadGroupScope'
| 'activeSummaryWorkloadId'
| 'isMobile'
| 'mobileVisibleColumnIds'
@@ -27,6 +28,7 @@ type DashboardWorkloadTableProps = Pick<
| 'nodeByInstance'
| 'search'
| 'selectedGuestId'
+ | 'setHoveredWorkloadGroupScope'
| 'setHoveredWorkloadId'
| 'setSelectedGuestId'
| 'setTableBodyRef'
@@ -77,11 +79,13 @@ export function DashboardWorkloadTable(props: DashboardWorkloadTableProps) {
groupingMode={props.groupingMode}
handleCustomUrlUpdate={props.handleCustomUrlUpdate}
handleTagClick={props.handleTagClick}
+ activeSummaryWorkloadGroupScope={props.activeSummaryWorkloadGroupScope}
activeSummaryWorkloadId={props.activeSummaryWorkloadId}
mobileVisibleColumnIds={props.mobileVisibleColumnIds}
nodeByInstance={props.nodeByInstance}
search={props.search}
selectedGuestId={props.selectedGuestId}
+ setHoveredWorkloadGroupScope={props.setHoveredWorkloadGroupScope}
setHoveredWorkloadId={props.setHoveredWorkloadId}
setSelectedGuestId={props.setSelectedGuestId}
setTableBodyRef={props.setTableBodyRef}
diff --git a/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx b/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx
index 914dfcbe79..ce4964d2f2 100644
--- a/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx
+++ b/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx
@@ -6,9 +6,11 @@ import { TableBody, TableCell, TableRow } from '@/components/shared/Table';
import { getAlertStyles } from '@/utils/alerts';
import { isNodeOnline } from '@/utils/status';
import { getCanonicalWorkloadId } from '@/utils/workloads';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import { GuestDrawer } from './GuestDrawer';
import { GuestRow } from './GuestRow';
+import { buildWorkloadSummaryGroupScope } from './workloadSelectors';
import type { DashboardState } from './useDashboardState';
type WorkloadPanelProps = Pick<
@@ -24,11 +26,13 @@ type WorkloadPanelProps = Pick<
| 'groupingMode'
| 'handleCustomUrlUpdate'
| 'handleTagClick'
+ | 'activeSummaryWorkloadGroupScope'
| 'activeSummaryWorkloadId'
| 'mobileVisibleColumnIds'
| 'nodeByInstance'
| 'search'
| 'selectedGuestId'
+ | 'setHoveredWorkloadGroupScope'
| 'setHoveredWorkloadId'
| 'setSelectedGuestId'
| 'setTableBodyRef'
@@ -55,6 +59,22 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
const groupGuests = () => props.windowedGroupedGuests()[groupKey()] || [];
const fullGroupGuests = () => props.groupedGuests()[groupKey()] || [];
const node = () => props.nodeByInstance()[groupKey()];
+ const groupSummaryScope = createMemo<SummarySeriesGroupScope | null>(() => {
+ if (props.groupingMode() !== 'grouped') {
+ return null;
+ }
+ return buildWorkloadSummaryGroupScope(
+ groupKey(),
+ fullGroupGuests(),
+ props.getGroupLabel(groupKey(), fullGroupGuests()),
+ );
+ });
+ const isSummaryGroupHighlighted = createMemo(
+ () => props.activeSummaryWorkloadGroupScope()?.id === groupKey(),
+ );
+ const handleGroupHoverChange = (next: SummarySeriesGroupScope | null) => {
+ props.setHoveredWorkloadGroupScope(next);
+ };
return (
<>
@@ -62,7 +82,14 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
<Show
when={node()}
fallback={
- <TableRow class="bg-surface-alt">
+ <TableRow
+ class="bg-surface-alt transition-colors duration-150 hover:bg-surface-hover"
+ data-summary-group-id={groupKey()}
+ data-summary-group-series-count={String(groupSummaryScope()?.seriesIds.length ?? 0)}
+ data-summary-row-active={isSummaryGroupHighlighted() ? 'true' : 'false'}
+ onMouseEnter={() => handleGroupHoverChange(groupSummaryScope())}
+ onMouseLeave={() => handleGroupHoverChange(null)}
+ >
<TableCell
colspan={props.totalColumns()}
class="py-0.5 pr-1.5 sm:pr-2 pl-2 sm:pl-3 text-[12px] sm:text-sm font-semibold text-base-content"
@@ -84,7 +111,21 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
</TableRow>
}
>
- <NodeGroupHeader node={node()!} renderAs="tr" colspan={props.totalColumns()} />
+ <NodeGroupHeader
+ node={node()!}
+ renderAs="tr"
+ colspan={props.totalColumns()}
+ trClass="transition-colors duration-150 hover:bg-surface-hover"
+ trProps={{
+ 'data-summary-group-id': groupKey(),
+ 'data-summary-group-series-count': String(
+ groupSummaryScope()?.seriesIds.length ?? 0,
+ ),
+ 'data-summary-row-active': isSummaryGroupHighlighted() ? 'true' : 'false',
+ onMouseEnter: () => handleGroupHoverChange(groupSummaryScope()),
+ onMouseLeave: () => handleGroupHoverChange(null),
+ }}
+ />
</Show>
</Show>
<Index each={groupGuests()} fallback={<></>}>
diff --git a/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx b/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx
index 0a5cfcbde6..74858f653d 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx
+++ b/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx
@@ -709,6 +709,9 @@ describe('Dashboard performance contract', () => {
expect(workloadPanelSource).toContain(
'createMemo(() => getCanonicalWorkloadId(guest()))',
);
+ expect(workloadPanelSource).toContain('buildWorkloadSummaryGroupScope');
+ expect(workloadPanelSource).toContain('data-summary-group-id');
+ expect(workloadPanelSource).toContain('setHoveredWorkloadGroupScope');
expect(dashboardWorkloadTableSource).not.toContain(
'createMemo(() => getCanonicalWorkloadId(guest()))',
);
@@ -869,6 +872,9 @@ describe('Dashboard performance contract', () => {
expect(workloadPanelSource).toContain('NodeGroupHeader');
expect(workloadPanelSource).toContain('GuestDrawer');
expect(workloadPanelSource).toContain('createMemo(() => getCanonicalWorkloadId(guest()))');
+ expect(dashboardSelectionStateSource).toContain('activeSummaryWorkloadGroupScope');
+ expect(dashboardSelectionStateSource).toContain('setHoveredWorkloadGroupScope');
+ expect(dashboardSource).toContain('hoveredGroupScope={state.activeSummaryWorkloadGroupScope()}');
expect(workloadPanelSource).not.toContain('TableHead');
expect(dashboardStateCardsSource).toContain('buildInfrastructureWorkspacePath');
expect(dashboardStateCardsSource).toContain('dashboardInfrastructureEmptyState().title');
diff --git a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
index 7b11f92abf..9a2313de62 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
+++ b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
@@ -2,6 +2,7 @@ import { renderHook } from '@solidjs/testing-library';
import { createSignal } from 'solid-js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import type { WorkloadGuest } from '@/types/workloads';
import { ROUTE_STATE_REPLACE_OPTIONS } from '@/utils/routeStateNavigation';
@@ -207,4 +208,43 @@ describe('useDashboardSelectionState', () => {
expect(result.revealedGuestId()).toBe('app-container:truenas-main:nextcloud');
expect(row.scrollIntoView).toHaveBeenCalledWith({ behavior: 'smooth', block: 'center' });
});
+
+ it('tracks hovered workload groups without letting them override entity selection outside scope', () => {
+ const [filteredGuests] = createSignal<WorkloadGuest[]>([
+ {
+ id: 'cluster-a:node-1:101',
+ name: 'guest-1',
+ status: 'running',
+ instance: 'cluster-a',
+ node: 'node-1',
+ vmid: 101,
+ } as unknown as WorkloadGuest,
+ {
+ id: 'cluster-b:node-2:202',
+ name: 'guest-2',
+ status: 'running',
+ instance: 'cluster-b',
+ node: 'node-2',
+ vmid: 202,
+ } as unknown as WorkloadGuest,
+ ]);
+ const groupScope: SummarySeriesGroupScope = {
+ id: 'cluster-b',
+ label: 'Cluster B (1 workload)',
+ seriesIds: ['cluster-b:node-2:202'],
+ };
+
+ const { result } = renderHook(() =>
+ useDashboardSelectionState({
+ filteredGuests,
+ setSelectedNode: vi.fn(),
+ }),
+ );
+
+ expect(result.selectedGuestId()).toBe('cluster-a:node-1:101');
+ result.setHoveredWorkloadGroupScope(groupScope);
+
+ expect(result.activeSummaryWorkloadGroupScope()?.id).toBe('cluster-b');
+ expect(result.activeSummaryWorkloadId()).toBeNull();
+ });
});
diff --git a/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts b/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
index 7a2316a700..637957bad0 100644
--- a/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
+++ b/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
@@ -3,6 +3,7 @@ import {
WORKLOADS_PATH,
WORKLOADS_QUERY_PARAMS,
} from '@/routing/resourceLinks';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import type { WorkloadGuest } from '@/types/workloads';
import { areSearchParamsEquivalent } from '@/utils/searchParams';
import { getCanonicalWorkloadId, normalizeWorkloadViewModeParam } from '@/utils/workloads';
@@ -69,3 +70,13 @@ export const dashboardHasHoveredWorkload = (
filteredGuests: WorkloadGuest[],
hoveredId: string,
): boolean => filteredGuests.some((guest) => getCanonicalWorkloadId(guest) === hoveredId);
+
+export const dashboardHasVisibleWorkloadGroupScope = (
+ filteredGuests: WorkloadGuest[],
+ groupScope: SummarySeriesGroupScope,
+): boolean => {
+ const filteredGuestIds = new Set(
+ filteredGuests.map((guest) => getCanonicalWorkloadId(guest)).filter(Boolean),
+ );
+ return groupScope.seriesIds.some((seriesId) => filteredGuestIds.has(seriesId));
+};
diff --git a/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
index 9d846d4104..2f306802e3 100644
--- a/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
+++ b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
@@ -3,10 +3,12 @@ import { createEffect, createSignal, onCleanup, untrack, type Accessor } from 's
import { preserveScrollableAncestorVerticalOffset } from '@/components/shared/contextualFocus';
import { useSummaryPageInteractionState } from '@/components/shared/summaryTableFocus';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import type { WorkloadGuest } from '@/types/workloads';
import { createRouteStateNavigateScheduler } from '@/utils/routeStateNavigation';
import {
dashboardHasHoveredWorkload,
+ dashboardHasVisibleWorkloadGroupScope,
resolveDashboardResourceSelection,
resolveDashboardSelectionNavigateTarget,
} from './dashboardSelectionModel';
@@ -26,6 +28,8 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
const [selectedGuestId, setSelectedGuestIdRaw] = createSignal<string | null>(null);
const [hoveredWorkloadId, setHoveredWorkloadId] = createSignal<string | null>(null);
+ const [hoveredWorkloadGroupScope, setHoveredWorkloadGroupScope] =
+ createSignal<SummarySeriesGroupScope | null>(null);
const [handledResourceId, setHandledResourceId] = createSignal<string | null>(null);
const [revealedGuestId, setRevealedGuestId] = createSignal<string | null>(null);
@@ -33,6 +37,7 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
const [tableBodyRef, setTableBodyRef] = createSignal<HTMLTableSectionElement | null>(null);
const summaryInteraction = useSummaryPageInteractionState({
hoveredSeriesId: hoveredWorkloadId,
+ hoveredGroupScope: hoveredWorkloadGroupScope,
focusedSeriesId: selectedGuestId,
revealActiveSeries: setRevealedGuestId,
});
@@ -96,11 +101,22 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
}
});
+ createEffect(() => {
+ const groupScope = hoveredWorkloadGroupScope();
+ if (!groupScope) {
+ return;
+ }
+ if (!dashboardHasVisibleWorkloadGroupScope(options.filteredGuests(), groupScope)) {
+ setHoveredWorkloadGroupScope(null);
+ }
+ });
+
onCleanup(() => {
routeStateNavigate.cleanup();
});
return {
+ activeSummaryWorkloadGroupScope: summaryInteraction.activeGroupScope,
activeSummaryWorkloadId: summaryInteraction.activeSeriesId,
chartHoverSync: summaryInteraction.chartHoverSync,
hoveredWorkloadId,
@@ -108,6 +124,7 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
revealedGuestId,
selectedGuestId,
setChartHoverSync: summaryInteraction.setChartHoverSync,
+ setHoveredWorkloadGroupScope,
setHoveredWorkloadId,
setSelectedGuestId,
setTableBodyRef,
diff --git a/frontend-modern/src/components/Dashboard/useDashboardState.ts b/frontend-modern/src/components/Dashboard/useDashboardState.ts
index af3832c2f8..4cde72bb81 100644
--- a/frontend-modern/src/components/Dashboard/useDashboardState.ts
+++ b/frontend-modern/src/components/Dashboard/useDashboardState.ts
@@ -200,6 +200,7 @@ export function useDashboardState(props: DashboardProps) {
});
const {
+ activeSummaryWorkloadGroupScope,
activeSummaryWorkloadId,
chartHoverSync,
hoveredWorkloadId,
@@ -207,6 +208,7 @@ export function useDashboardState(props: DashboardProps) {
revealedGuestId,
selectedGuestId,
setChartHoverSync,
+ setHoveredWorkloadGroupScope,
setHoveredWorkloadId,
setSelectedGuestId,
setTableBodyRef,
@@ -248,6 +250,7 @@ export function useDashboardState(props: DashboardProps) {
activeAlerts,
alertsEnabled,
allGuests,
+ activeSummaryWorkloadGroupScope,
activeSummaryWorkloadId,
bottomSpacerHeight,
chartHoverSync,
@@ -301,6 +304,7 @@ export function useDashboardState(props: DashboardProps) {
setContainerRuntime,
setChartHoverSync,
setGroupingMode,
+ setHoveredWorkloadGroupScope,
setHoveredWorkloadId,
setSearch,
setSelectedGuestId,
diff --git a/frontend-modern/src/components/Dashboard/workloadSelectors.ts b/frontend-modern/src/components/Dashboard/workloadSelectors.ts
index a1e40b1518..c11d337015 100644
--- a/frontend-modern/src/components/Dashboard/workloadSelectors.ts
+++ b/frontend-modern/src/components/Dashboard/workloadSelectors.ts
@@ -1,10 +1,11 @@
import type { WorkloadGuest, ViewMode } from '@/types/workloads';
import type { WorkloadIOEmphasis } from './guestRowModel';
import { computeIOScale } from '@/components/Infrastructure/infrastructureSelectors';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import { parseFilterStack, evaluateFilterStack } from '@/utils/searchQuery';
import { normalizeSourcePlatformQueryValue } from '@/utils/sourcePlatforms';
import { DEGRADED_HEALTH_STATUSES, OFFLINE_HEALTH_STATUSES } from '@/utils/status';
-import { resolveWorkloadType } from '@/utils/workloads';
+import { getCanonicalWorkloadId, resolveWorkloadType } from '@/utils/workloads';
import { getKubernetesContextKey, workloadNodeScopeId } from './workloadTopology';
export interface FilterWorkloadsParams {
@@ -248,6 +249,29 @@ export const getWorkloadGroupKey = (guest: WorkloadGuest): string => {
return `${type}:${context}`;
};
+export const buildWorkloadSummaryGroupScope = (
+ groupId: string,
+ guests: WorkloadGuest[],
+ label: { type: string; name: string },
+): SummarySeriesGroupScope | null => {
+ const seriesIds = Array.from(
+ new Set(guests.map((guest) => getCanonicalWorkloadId(guest)).filter(Boolean)),
+ );
+ if (seriesIds.length === 0) {
+ return null;
+ }
+
+ const summaryLabelParts = [label.name.trim(), label.type.trim()].filter(Boolean);
+ const scopeLabel = summaryLabelParts.join(' · ');
+ const workloadCountLabel = `${guests.length} workload${guests.length === 1 ? '' : 's'}`;
+
+ return {
+ id: groupId.trim(),
+ label: scopeLabel ? `${scopeLabel} (${workloadCountLabel})` : workloadCountLabel,
+ seriesIds,
+ };
+};
+
export const groupWorkloads = (
guests: WorkloadGuest[],
mode: 'grouped' | 'flat',
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts
index 24341259dc..496896a9bf 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts
@@ -58,7 +58,7 @@ describe('infrastructureSelectors', () => {
expect(matchesSearch(resource, 'NODE-123')).toBe(true);
});
- it('matches governed resources by their local infrastructure label', () => {
+ it('matches governed resources by the safe display label instead of the redacted hostname', () => {
const governedResource = makeResource(2, {
name: 'secret-node-2',
displayName: 'secret-node-2',
@@ -69,8 +69,8 @@ describe('infrastructureSelectors', () => {
aiSafeSummary: 'Production Node',
});
- expect(matchesSearch(governedResource, 'Production')).toBe(false);
- expect(matchesSearch(governedResource, 'secret-node-2')).toBe(true);
+ expect(matchesSearch(governedResource, 'Production')).toBe(true);
+ expect(matchesSearch(governedResource, 'secret-node-2')).toBe(false);
});
it('matches by ip and tag and returns false when missing', () => {
diff --git a/frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts b/frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts
index 4a9280e7f1..4504882b61 100644
--- a/frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts
+++ b/frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts
@@ -1,6 +1,6 @@
import type { Resource } from '@/types/resource';
import { getCpuPercent, getDiskPercent, getMemoryPercent } from '@/types/resource';
-import { getPreferredInfrastructureDisplayName } from '@/utils/resourceIdentity';
+import { getPreferredInfrastructureDisplayName, getPreferredResourceDisplayName } from '@/utils/resourceIdentity';
import { normalizeSourcePlatformKey, type KnownSourcePlatform } from '@/utils/sourcePlatforms';
import { getCanonicalStatusLabel, STATUS_SORT_ORDER } from '@/utils/status';
@@ -133,7 +133,7 @@ export const matchesSearch = (resource: Resource, term: string): boolean => {
if (!term) return true;
const normalizedTerm = term.toLowerCase();
const candidates: string[] = [
- getPreferredInfrastructureDisplayName(resource),
+ getPreferredResourceDisplayName(resource),
resource.id,
resource.identity?.hostname ?? '',
...(resource.identity?.ips ?? []),
diff --git a/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsx b/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsx
index 4c6f8bf011..cd5951a361 100644
--- a/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsx
+++ b/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsx
@@ -5,6 +5,7 @@ import {
__resetInMemoryWorkloadCacheForTests,
type WorkloadSummarySnapshot,
} from './WorkloadsSummary';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import type { WorkloadChartsResponse } from '@/api/charts';
const mockGetWorkloadCharts = vi.fn();
@@ -494,6 +495,39 @@ describe('WorkloadsSummary performance behavior', () => {
});
});
+ it('filters summary charts to the hovered workload group while keeping entity focus inside that scope', async () => {
+ const workloadIds = ['cluster-a:pve1:101', 'cluster-a:pve1:102', 'cluster-b:pve2:201'];
+ const hoveredGroupScope: SummarySeriesGroupScope = {
+ id: 'cluster-a',
+ label: 'Cluster A (2 workloads)',
+ seriesIds: workloadIds.slice(0, 2),
+ };
+ mockGetWorkloadCharts.mockResolvedValueOnce(makeChartsResponse(workloadIds));
+
+ render(() => (
+ <WorkloadsSummary
+ timeRange="1h"
+ fallbackGuestCounts={{ total: workloadIds.length, running: workloadIds.length, stopped: 0 }}
+ fallbackSnapshots={makeSnapshots(workloadIds)}
+ hoveredGroupScope={hoveredGroupScope}
+ hoveredWorkloadId={workloadIds[0]}
+ />
+ ));
+
+ await waitFor(() => {
+ const sparklines = screen.getAllByTestId('sparkline');
+ expect(sparklines).toHaveLength(4);
+ for (const sparkline of sparklines) {
+ expect(sparkline.getAttribute('data-series-count')).toBe('2');
+ expect(sparkline.getAttribute('data-series-ids')).toBe(
+ `${workloadIds[0]}|${workloadIds[1]}`,
+ );
+ expect(sparkline.getAttribute('data-highlight-series-id')).toBe(workloadIds[0]);
+ 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.tsx
index adf3294f12..a2d21a1914 100644
--- a/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx
+++ b/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx
@@ -11,6 +11,7 @@ import { DensityMap } from '@/components/shared/DensityMap';
import { SummaryJumpToRowButton } from '@/components/shared/SummaryJumpToRowButton';
import { SummaryPanel } from '@/components/shared/SummaryPanel';
import { SummaryMetricCard } from '@/components/shared/SummaryMetricCard';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import {
ChartsAPI,
type ChartData,
@@ -34,6 +35,7 @@ interface WorkloadsSummaryProps {
};
fallbackSnapshots?: WorkloadSummarySnapshot[];
hoveredWorkloadId?: string | null;
+ hoveredGroupScope?: SummarySeriesGroupScope | null;
focusedWorkloadId?: string | null;
chartHoverSync?: SummaryChartHoverSync | null;
onTimeRangeChange?: (range: TimeRange) => void;
@@ -665,10 +667,10 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {
return merged.sort((a, b) => a.name.localeCompare(b.name));
});
- const displaySeries = createMemo(() => workloadSeries());
const summaryFocus = useSummaryContextualFocusState({
chartHoveredSeriesId: () => chartHoverSync()?.seriesId ?? null,
interactiveSeries: workloadSeries,
+ hoveredGroupScope: () => props.hoveredGroupScope,
hoveredSeriesId: () => props.hoveredWorkloadId,
focusedSeriesId: () => props.focusedWorkloadId,
isSeriesInteractive: (series) =>
@@ -681,12 +683,15 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {
createEffect(() => {
const hovered = chartHoverSync();
if (!hovered) return;
- if (!summaryFocus.hasInteractiveSeriesId(hovered.seriesId)) {
+ if (!summaryFocus.isSeriesIdVisibleInActiveScope(hovered.seriesId)) {
setChartHoverSync(null);
}
});
- const focusedWorkloadName = createMemo(() => summaryFocus.getActiveSeriesName(workloadSeries()));
+ const displaySeries = createMemo(() =>
+ summaryFocus.filterSeriesForActiveScope(workloadSeries()),
+ );
+ const focusedWorkloadName = createMemo(() => summaryFocus.getActiveSeriesName(displaySeries()));
const cpuSeries = createMemo<InteractiveSparklineSeries[]>(() =>
displaySeries().map((series) => ({
@@ -734,6 +739,7 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {
if (guestCounts().total === 0) return 'No workloads';
if (!hasCurrentRangeData()) return null;
if (fetchFailed()) return 'Trend data unavailable';
+ if (summaryFocus.activeGroupScope()) return 'No group history yet';
return 'No history yet';
};
diff --git a/frontend-modern/src/components/shared/NodeGroupHeader.tsx b/frontend-modern/src/components/shared/NodeGroupHeader.tsx
index 151cde603a..a4e4ba8f5a 100644
--- a/frontend-modern/src/components/shared/NodeGroupHeader.tsx
+++ b/frontend-modern/src/components/shared/NodeGroupHeader.tsx
@@ -1,4 +1,4 @@
-import { Component, Show } from 'solid-js';
+import { Component, Show, type JSX } from 'solid-js';
import type { Node } from '@/types/api';
import { getNodeDisplayName, hasAlternateDisplayName } from '@/utils/nodes';
import { StatusDot } from '@/components/shared/StatusDot';
@@ -8,6 +8,8 @@ interface NodeGroupHeaderProps {
node: Node;
colspan?: number;
renderAs?: 'tr' | 'div';
+ trClass?: string;
+ trProps?: JSX.HTMLAttributes<HTMLTableRowElement>;
}
export const NodeGroupHeader: Component<NodeGroupHeaderProps> = (props) => {
@@ -75,7 +77,7 @@ export const NodeGroupHeader: Component<NodeGroupHeaderProps> = (props) => {
</div>
}
>
- <tr class="bg-surface-alt">
+ <tr class={`bg-surface-alt ${props.trClass ?? ''}`.trim()} {...props.trProps}>
<td
colspan={props.colspan}
class="py-0.5 pr-2 pl-4 text-[12px] sm:text-sm font-semibold text-base-content"
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 4fa64e9238..cd24f4800a 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -259,11 +259,17 @@ describe('shared primitive guardrails', () => {
);
expect(contextualFocusSource).toContain('export function useSummaryContextualFocusState');
expect(contextualFocusSource).toContain('chartHoveredSeriesId');
+ expect(contextualFocusSource).toContain('hoveredGroupScope');
+ expect(contextualFocusSource).toContain('filterSeriesForActiveScope');
expect(summaryCardInteractionSource).toContain('chartHoveredSeriesId');
+ expect(summaryCardInteractionSource).toContain('SummarySeriesGroupScope');
+ expect(summaryCardInteractionSource).toContain('resolveSummaryGroupScope');
expect(interactiveSparklineModelSource).toContain('onHoverSyncChange');
expect(densityMapModelSource).toContain('onHoverSyncChange');
expect(dashboardSelectionStateSource).toContain('preserveScrollableAncestorVerticalOffset');
+ expect(dashboardSelectionStateSource).toContain('hoveredWorkloadGroupScope');
+ expect(dashboardSelectionStateSource).toContain('activeSummaryWorkloadGroupScope');
expect(dashboardSelectionStateSource).not.toContain('const scrollTop = scroller?.scrollTop');
expect(summaryJumpToRowButtonSource).toContain('<span>Jump to row</span>');
@@ -292,6 +298,8 @@ describe('shared primitive guardrails', () => {
expect(workloadsSummarySource).toContain('useSummaryContextualFocusState');
expect(workloadsSummarySource).toContain('chartHoverSync');
+ expect(workloadsSummarySource).toContain('hoveredGroupScope');
+ expect(workloadsSummarySource).toContain('filterSeriesForActiveScope');
expect(workloadsSummarySource).not.toContain('const interactiveWorkloadIds = createMemo');
});
diff --git a/frontend-modern/src/components/shared/__tests__/summaryCardInteraction.test.ts b/frontend-modern/src/components/shared/__tests__/summaryCardInteraction.test.ts
index 3755772ead..e329538c73 100644
--- a/frontend-modern/src/components/shared/__tests__/summaryCardInteraction.test.ts
+++ b/frontend-modern/src/components/shared/__tests__/summaryCardInteraction.test.ts
@@ -6,8 +6,10 @@ import {
useSummaryContextualFocusState,
} from '@/components/shared/contextualFocus';
import {
+ filterSummarySeriesByGroupScope,
resolveSummaryActiveSeriesId,
resolveSummaryCardInteractionState,
+ type SummarySeriesGroupScope,
} from '@/components/shared/summaryCardInteraction';
describe('summaryCardInteraction', () => {
@@ -77,10 +79,52 @@ describe('summaryCardInteraction', () => {
).toBe('inactive');
});
+ it('keeps group scope separate from active entity focus', () => {
+ const groupScope: SummarySeriesGroupScope = {
+ id: 'cluster-a',
+ label: 'Cluster A (2 workloads)',
+ seriesIds: ['alpha', 'beta'],
+ };
+
+ expect(
+ resolveSummaryActiveSeriesId({
+ hoveredSeriesId: 'gamma',
+ focusedSeriesId: 'alpha',
+ groupScope,
+ }),
+ ).toBe('alpha');
+
+ expect(
+ resolveSummaryCardInteractionState({
+ series: [{ id: 'alpha' }, { id: 'beta' }],
+ hoveredGroupScope: groupScope,
+ }),
+ ).toBe('active');
+
+ expect(
+ resolveSummaryCardInteractionState({
+ series: [{ id: 'gamma' }],
+ hoveredGroupScope: groupScope,
+ }),
+ ).toBe('inactive');
+
+ expect(
+ filterSummarySeriesByGroupScope(
+ [{ id: 'alpha' }, { id: 'beta' }, { id: 'gamma' }],
+ groupScope,
+ ).map((series) => series.id),
+ ).toEqual(['alpha', 'beta']);
+ });
+
it('filters contextual focus down to interactive series ids through one shared hook', () => {
const [hoveredSeriesId] = createSignal<string | null>('gamma');
const [focusedSeriesId] = createSignal<string | null>('alpha');
const [chartHoveredSeriesId, setChartHoveredSeriesId] = createSignal<string | null>(null);
+ const [hoveredGroupScope, setHoveredGroupScope] = createSignal<SummarySeriesGroupScope | null>({
+ id: 'cluster-a',
+ label: 'Cluster A (2 workloads)',
+ seriesIds: ['alpha', 'beta'],
+ });
const { result } = renderHook(() =>
useSummaryContextualFocusState({
@@ -89,6 +133,7 @@ describe('summaryCardInteraction', () => {
{ id: 'alpha', name: 'Alpha', interactive: true },
{ id: 'beta', name: 'Beta', interactive: false },
],
+ hoveredGroupScope,
hoveredSeriesId,
focusedSeriesId,
isSeriesInteractive: (series) => series.interactive,
@@ -97,6 +142,11 @@ describe('summaryCardInteraction', () => {
expect(result.hasInteractiveSeriesId('alpha')).toBe(true);
expect(result.hasInteractiveSeriesId('beta')).toBe(false);
+ expect(result.activeGroupScope()).toEqual({
+ id: 'cluster-a',
+ label: 'Cluster A (2 workloads)',
+ seriesIds: ['alpha'],
+ });
expect(result.effectiveHoveredSeriesId()).toBeNull();
expect(result.effectiveFocusedSeriesId()).toBe('alpha');
expect(result.activeSeriesId()).toBe('alpha');
@@ -115,6 +165,23 @@ describe('summaryCardInteraction', () => {
expect(result.getActiveSeriesName([{ id: 'alpha', name: 'Alpha', interactive: true }])).toBe(
'Alpha',
);
+
+ setChartHoveredSeriesId(null);
+ setHoveredGroupScope({
+ id: 'cluster-a',
+ label: 'Cluster A (2 workloads)',
+ seriesIds: ['alpha'],
+ });
+ expect(result.activeGroupScope()?.id).toBe('cluster-a');
+ expect(result.activeSeriesId()).toBe('alpha');
+ expect(
+ result.filterSeriesForActiveScope([
+ { id: 'alpha', name: 'Alpha', interactive: true },
+ { id: 'gamma', name: 'Gamma', interactive: true },
+ ]),
+ ).toEqual([{ id: 'alpha', name: 'Alpha', interactive: true }]);
+ expect(result.isSeriesIdVisibleInActiveScope('alpha')).toBe(true);
+ expect(result.isSeriesIdVisibleInActiveScope('gamma')).toBe(false);
});
it('preserves the nearest scrollable ancestor when contextual focus changes locally', () => {
diff --git a/frontend-modern/src/components/shared/contextualFocus.ts b/frontend-modern/src/components/shared/contextualFocus.ts
index 438f7239e6..29d07ffcdd 100644
--- a/frontend-modern/src/components/shared/contextualFocus.ts
+++ b/frontend-modern/src/components/shared/contextualFocus.ts
@@ -1,7 +1,10 @@
import { createMemo, type Accessor } from 'solid-js';
import {
+ filterSummarySeriesByGroupScope,
resolveSummaryActiveSeriesId,
resolveSummaryCardInteractionState,
+ resolveSummaryGroupScope,
+ type SummarySeriesGroupScope,
type SummaryCardInteractionState,
} from './summaryCardInteraction';
@@ -19,8 +22,10 @@ export interface SummaryChartHoverSync {
export interface UseSummaryContextualFocusStateOptions<T extends ContextualFocusSeries> {
chartHoveredSeriesId?: Accessor<string | null | undefined>;
focusedSeriesId?: Accessor<string | null | undefined>;
+ focusedGroupScope?: Accessor<SummarySeriesGroupScope | null | undefined>;
getSeriesName?: (series: T) => string | null | undefined;
hoveredSeriesId?: Accessor<string | null | undefined>;
+ hoveredGroupScope?: Accessor<SummarySeriesGroupScope | null | undefined>;
interactiveSeries: Accessor<readonly T[]>;
isSeriesInteractive?: (series: T) => boolean;
}
@@ -72,6 +77,8 @@ export function useSummaryContextualFocusState<T extends ContextualFocusSeries>(
const chartHoveredSeriesId = options.chartHoveredSeriesId ?? (() => null);
const hoveredSeriesId = options.hoveredSeriesId ?? (() => null);
const focusedSeriesId = options.focusedSeriesId ?? (() => null);
+ const hoveredGroupScope = options.hoveredGroupScope ?? (() => null);
+ const focusedGroupScope = options.focusedGroupScope ?? (() => null);
const getSeriesName =
options.getSeriesName ??
((series: T) => (typeof series.name === 'string' ? series.name : null));
@@ -111,11 +118,46 @@ export function useSummaryContextualFocusState<T extends ContextualFocusSeries>(
return hasInteractiveSeriesId(focusedSeriesId()) ? normalizeSeriesId(focusedSeriesId()) : null;
});
+ const normalizeGroupScope = (
+ scope: SummarySeriesGroupScope | null | undefined,
+ ): SummarySeriesGroupScope | null => {
+ const resolvedScope = resolveSummaryGroupScope({
+ hoveredGroupScope: scope,
+ });
+ if (!resolvedScope) {
+ return null;
+ }
+ const scopedSeriesIds = resolvedScope.seriesIds.filter((id) => interactiveSeriesIds().has(id));
+ if (scopedSeriesIds.length === 0) {
+ return null;
+ }
+ return {
+ ...resolvedScope,
+ seriesIds: scopedSeriesIds,
+ };
+ };
+
+ const effectiveHoveredGroupScope = createMemo<SummarySeriesGroupScope | null>(() =>
+ normalizeGroupScope(hoveredGroupScope()),
+ );
+
+ const effectiveFocusedGroupScope = createMemo<SummarySeriesGroupScope | null>(() =>
+ normalizeGroupScope(focusedGroupScope()),
+ );
+
+ const activeGroupScope = createMemo<SummarySeriesGroupScope | null>(() =>
+ resolveSummaryGroupScope({
+ hoveredGroupScope: effectiveHoveredGroupScope(),
+ focusedGroupScope: effectiveFocusedGroupScope(),
+ }),
+ );
+
const activeSeriesId = createMemo<string | null>(() => {
return resolveSummaryActiveSeriesId({
chartHoveredSeriesId: effectiveChartHoveredSeriesId(),
hoveredSeriesId: effectiveHoveredSeriesId(),
focusedSeriesId: effectiveFocusedSeriesId(),
+ groupScope: activeGroupScope(),
});
});
@@ -130,11 +172,11 @@ export function useSummaryContextualFocusState<T extends ContextualFocusSeries>(
const getActiveSeriesName = (series: readonly T[]): string | null => {
const currentActiveId = activeSeriesId();
- if (!currentActiveId) {
- return null;
+ if (currentActiveId) {
+ const match = series.find((entry) => normalizeSeriesId(entry.id) === currentActiveId);
+ return match ? getSeriesName(match) || null : null;
}
- const match = series.find((entry) => normalizeSeriesId(entry.id) === currentActiveId);
- return match ? getSeriesName(match) || null : null;
+ return activeGroupScope()?.label || null;
};
const interactionStateFor = (
@@ -145,16 +187,40 @@ export function useSummaryContextualFocusState<T extends ContextualFocusSeries>(
chartHoveredSeriesId: effectiveChartHoveredSeriesId(),
hoveredSeriesId: effectiveHoveredSeriesId(),
focusedSeriesId: effectiveFocusedSeriesId(),
+ groupScope: activeGroupScope(),
});
+ const filterSeriesForActiveScope = <S extends { id?: string | null }>(
+ series: readonly S[],
+ ): S[] => {
+ return filterSummarySeriesByGroupScope(series, activeGroupScope());
+ };
+
+ const isSeriesIdVisibleInActiveScope = (value: string | null | undefined): value is string => {
+ const normalized = normalizeSeriesId(value);
+ if (!normalized || !interactiveSeriesIds().has(normalized)) {
+ return false;
+ }
+ const groupScope = activeGroupScope();
+ if (!groupScope) {
+ return true;
+ }
+ return groupScope.seriesIds.includes(normalized);
+ };
+
return {
+ activeGroupScope,
activeSeriesId,
effectiveChartHoveredSeriesId,
effectiveFocusedSeriesId,
+ effectiveFocusedGroupScope,
effectiveHoveredSeriesId,
+ effectiveHoveredGroupScope,
+ filterSeriesForActiveScope,
getActiveSeriesName,
getFocusedSeriesName,
hasInteractiveSeriesId,
+ isSeriesIdVisibleInActiveScope,
interactionStateFor,
} as const;
}
diff --git a/frontend-modern/src/components/shared/summaryCardInteraction.ts b/frontend-modern/src/components/shared/summaryCardInteraction.ts
index e375bcc445..8fbc044b28 100644
--- a/frontend-modern/src/components/shared/summaryCardInteraction.ts
+++ b/frontend-modern/src/components/shared/summaryCardInteraction.ts
@@ -4,25 +4,95 @@ type SummarySeriesIdentity = {
id?: string | null;
};
+export interface SummarySeriesGroupScope {
+ id: string;
+ label?: string | null;
+ seriesIds: readonly string[];
+}
+
const normalizeSeriesId = (value: string | null | undefined): string => value?.trim() || '';
+export const normalizeSummarySeriesGroupScope = (
+ scope: SummarySeriesGroupScope | null | undefined,
+): SummarySeriesGroupScope | null => {
+ if (!scope) {
+ return null;
+ }
+
+ const id = normalizeSeriesId(scope.id);
+ const seriesIds = Array.from(
+ new Set((scope.seriesIds ?? []).map((value) => normalizeSeriesId(value)).filter(Boolean)),
+ );
+
+ if (!id || seriesIds.length === 0) {
+ return null;
+ }
+
+ const label = typeof scope.label === 'string' ? scope.label.trim() : '';
+ return {
+ id,
+ label: label || null,
+ seriesIds,
+ };
+};
+
+export const isSummarySeriesInGroupScope = (
+ scope: SummarySeriesGroupScope | null | undefined,
+ seriesId: string | null | undefined,
+): boolean => {
+ const normalizedScope = normalizeSummarySeriesGroupScope(scope);
+ const normalizedSeriesId = normalizeSeriesId(seriesId);
+ if (!normalizedScope || !normalizedSeriesId) {
+ return false;
+ }
+ return normalizedScope.seriesIds.includes(normalizedSeriesId);
+};
+
+export const resolveSummaryGroupScope = (options: {
+ hoveredGroupScope?: SummarySeriesGroupScope | null;
+ focusedGroupScope?: SummarySeriesGroupScope | null;
+}): SummarySeriesGroupScope | null => {
+ const hoveredGroupScope = normalizeSummarySeriesGroupScope(options.hoveredGroupScope);
+ if (hoveredGroupScope) {
+ return hoveredGroupScope;
+ }
+ return normalizeSummarySeriesGroupScope(options.focusedGroupScope);
+};
+
export function resolveSummaryActiveSeriesId(options: {
chartHoveredSeriesId?: string | null;
hoveredSeriesId?: string | null;
focusedSeriesId?: string | null;
+ groupScope?: SummarySeriesGroupScope | null;
}): string | null {
+ const groupScope = normalizeSummarySeriesGroupScope(options.groupScope);
const chartHoveredSeriesId = normalizeSeriesId(options.chartHoveredSeriesId);
- if (chartHoveredSeriesId) {
+ if (chartHoveredSeriesId && (!groupScope || isSummarySeriesInGroupScope(groupScope, chartHoveredSeriesId))) {
return chartHoveredSeriesId;
}
const hoveredSeriesId = normalizeSeriesId(options.hoveredSeriesId);
- if (hoveredSeriesId) {
+ if (hoveredSeriesId && (!groupScope || isSummarySeriesInGroupScope(groupScope, hoveredSeriesId))) {
return hoveredSeriesId;
}
const focusedSeriesId = normalizeSeriesId(options.focusedSeriesId);
- return focusedSeriesId || null;
+ if (focusedSeriesId && (!groupScope || isSummarySeriesInGroupScope(groupScope, focusedSeriesId))) {
+ return focusedSeriesId;
+ }
+
+ return null;
+}
+
+export function filterSummarySeriesByGroupScope<T extends SummarySeriesIdentity>(
+ series: readonly T[],
+ groupScope?: SummarySeriesGroupScope | null,
+): T[] {
+ const normalizedScope = normalizeSummarySeriesGroupScope(groupScope);
+ if (!normalizedScope) {
+ return [...series];
+ }
+ return series.filter((entry) => isSummarySeriesInGroupScope(normalizedScope, entry.id));
}
export function resolveSummaryCardInteractionState(options: {
@@ -30,13 +100,31 @@ export function resolveSummaryCardInteractionState(options: {
chartHoveredSeriesId?: string | null;
hoveredSeriesId?: string | null;
focusedSeriesId?: string | null;
+ hoveredGroupScope?: SummarySeriesGroupScope | null;
+ focusedGroupScope?: SummarySeriesGroupScope | null;
+ groupScope?: SummarySeriesGroupScope | null;
}): SummaryCardInteractionState {
+ const groupScope =
+ normalizeSummarySeriesGroupScope(options.groupScope) ??
+ resolveSummaryGroupScope({
+ hoveredGroupScope: options.hoveredGroupScope,
+ focusedGroupScope: options.focusedGroupScope,
+ });
const activeSeriesId = resolveSummaryActiveSeriesId({
chartHoveredSeriesId: options.chartHoveredSeriesId,
hoveredSeriesId: options.hoveredSeriesId,
focusedSeriesId: options.focusedSeriesId,
+ groupScope,
});
if (!activeSeriesId) {
+ if (groupScope) {
+ for (const series of options.series) {
+ if (isSummarySeriesInGroupScope(groupScope, series.id)) {
+ return 'active';
+ }
+ }
+ return 'inactive';
+ }
return 'default';
}
diff --git a/frontend-modern/src/components/shared/summaryTableFocus.ts b/frontend-modern/src/components/shared/summaryTableFocus.ts
index c06be5db83..801523f9ab 100644
--- a/frontend-modern/src/components/shared/summaryTableFocus.ts
+++ b/frontend-modern/src/components/shared/summaryTableFocus.ts
@@ -1,6 +1,10 @@
import { createMemo, createSignal, type Accessor } from 'solid-js';
import type { SummaryChartHoverSync } from './contextualFocus';
-import { resolveSummaryActiveSeriesId } from './summaryCardInteraction';
+import {
+ resolveSummaryActiveSeriesId,
+ resolveSummaryGroupScope,
+ type SummarySeriesGroupScope,
+} from './summaryCardInteraction';
const normalizeSeriesId = (value: string | null | undefined): string => value?.trim() || '';
@@ -109,6 +113,8 @@ export function useSummaryTableFocusBridge(options: UseSummaryTableFocusBridgeOp
export interface UseSummaryPageInteractionStateOptions {
hoveredSeriesId?: Accessor<string | null | undefined>;
focusedSeriesId?: Accessor<string | null | undefined>;
+ hoveredGroupScope?: Accessor<SummarySeriesGroupScope | null | undefined>;
+ focusedGroupScope?: Accessor<SummarySeriesGroupScope | null | undefined>;
revealActiveSeries?: (seriesId: string) => void;
}
@@ -116,12 +122,22 @@ export function useSummaryPageInteractionState(options: UseSummaryPageInteractio
const [chartHoverSync, setChartHoverSync] = createSignal<SummaryChartHoverSync | null>(null);
const hoveredSeriesId = options.hoveredSeriesId ?? (() => null);
const focusedSeriesId = options.focusedSeriesId ?? (() => null);
+ const hoveredGroupScope = options.hoveredGroupScope ?? (() => null);
+ const focusedGroupScope = options.focusedGroupScope ?? (() => null);
+
+ const activeGroupScope = createMemo<SummarySeriesGroupScope | null>(() =>
+ resolveSummaryGroupScope({
+ hoveredGroupScope: hoveredGroupScope(),
+ focusedGroupScope: focusedGroupScope(),
+ }),
+ );
const activeSeriesId = createMemo<string | null>(() =>
resolveSummaryActiveSeriesId({
chartHoveredSeriesId: chartHoverSync()?.seriesId ?? null,
hoveredSeriesId: hoveredSeriesId(),
focusedSeriesId: focusedSeriesId(),
+ groupScope: activeGroupScope(),
}),
);
@@ -131,6 +147,7 @@ export function useSummaryPageInteractionState(options: UseSummaryPageInteractio
});
return {
+ activeGroupScope,
activeSeriesId,
chartHoverSync,
jumpToActiveRow: tableFocus.jumpToActiveRow,
diff --git a/tests/integration/tests/48-summary-hover-selection.spec.ts b/tests/integration/tests/48-summary-hover-selection.spec.ts
index 09e49ab4e3..7762864817 100644
--- a/tests/integration/tests/48-summary-hover-selection.spec.ts
+++ b/tests/integration/tests/48-summary-hover-selection.spec.ts
@@ -373,6 +373,16 @@ async function readSummarySeriesId(
);
}
+async function readRenderedSeriesCounts(
+ summary: import("@playwright/test").Locator,
+): Promise<number[]> {
+ return summary.locator("[data-rendered-series-count]").evaluateAll((nodes) =>
+ nodes.map((node) =>
+ Number.parseInt(node.getAttribute("data-rendered-series-count") || "0", 10),
+ ),
+ );
+}
+
async function scrollPrimaryViewportToBottom(
page: import("@playwright/test").Page,
): Promise<void> {
@@ -698,4 +708,72 @@ test.describe.serial("Summary hover selection", () => {
await expect(focusedSummaryRow).toBeVisible();
}
});
+
+ test("treats workload group headers as first-class summary scope", 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
+ .poll(async () => {
+ const counts = await readRenderedSeriesCounts(workloadsSummary);
+ return counts.length === 4 && counts.every((count) => count > 1);
+ })
+ .toBe(true);
+ const resolvedBaselineCounts = await readRenderedSeriesCounts(workloadsSummary);
+
+ const baselineVisibleRows = await page.locator("tr[data-guest-id]").count();
+ const groupRows = page.locator("tr[data-summary-group-id]");
+ const groupRowCount = await groupRows.count();
+ expect(groupRowCount).toBeGreaterThan(0);
+
+ let matchedGroupRow: import("@playwright/test").Locator | null = null;
+ let matchedGroupSeriesCount = 0;
+ for (let index = 0; index < groupRowCount; index += 1) {
+ const row = groupRows.nth(index);
+ if (!(await row.isVisible())) {
+ continue;
+ }
+ const rawSeriesCount = await row.getAttribute("data-summary-group-series-count");
+ const seriesCount = Number.parseInt(rawSeriesCount || "0", 10);
+ if (!Number.isFinite(seriesCount) || seriesCount < 1) {
+ continue;
+ }
+ if (resolvedBaselineCounts.every((count) => count <= seriesCount)) {
+ continue;
+ }
+
+ matchedGroupRow = row;
+ matchedGroupSeriesCount = seriesCount;
+ break;
+ }
+
+ expect(matchedGroupRow).not.toBeNull();
+ expect(matchedGroupSeriesCount).toBeGreaterThan(0);
+ if (!matchedGroupRow) {
+ return;
+ }
+
+ await matchedGroupRow.hover();
+ await expect(matchedGroupRow).toHaveAttribute("data-summary-row-active", "true");
+ await expect
+ .poll(() => readRenderedSeriesCounts(workloadsSummary))
+ .toEqual(new Array(4).fill(matchedGroupSeriesCount));
+ await expect(page.locator("tr[data-guest-id]")).toHaveCount(baselineVisibleRows);
+
+ await page.mouse.move(1, 1);
+ await expect(matchedGroupRow).toHaveAttribute("data-summary-row-active", "false");
+ await expect
+ .poll(() => readRenderedSeriesCounts(workloadsSummary))
+ .toEqual(resolvedBaselineCounts);
+ });
});