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: normalize contextual focus summaries

rcourtmanaf14faa29b37
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 2cba459cb8..45dee3eb25 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -303,6 +303,12 @@ Lifecycle-adjacent setup and hosted bootstrap surfaces may depend on those
shared helpers, but they must not reintroduce raw URL concatenation,
userinfo-bearing fetch targets, or origin-root OIDC discovery drift when
operators validate identity configuration.
+That same lifecycle-adjacent identity validation path now also assumes the
+manual SAML test payload preserves the optional `idpSloUrl` alongside
+`idpSsoUrl` on the shared API contract, so operators validating hosted
+identity before first-user or first-host handoff do not silently lose logout
+endpoint validation when they choose manual SAML entry instead of metadata
+import.
Agent lifecycle owns the install/register/update continuity surfaces, but it
does not own unified-resource history or control-plane timeline persistence.
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 287255d791..bc5e6a63aa 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -324,6 +324,13 @@ must normalize absolute HTTP(S) inputs through shared helpers, reject
userinfo-bearing URLs before any outbound request, and append the OIDC
well-known path relative to the issuer base instead of resetting discovery to
the origin root.
+That same SSO boundary also owns manual SAML endpoint validation payloads.
+`internal/api/identity_sso_handlers.go`, `internal/api/saml_service.go`, and
+`internal/api/contract_test.go` must preserve both `idpSsoUrl` and optional
+`idpSloUrl` on the shared SAML test request, and both fields must fail closed
+through the same validated absolute HTTP(S) helpers instead of letting the
+manual logout URL drift out of the request model or bypass the governed URL
+normalization path.
Commercial self-service actions in that shell must stay same-origin as well:
the frontend may only call the portal-owned `/api/portal/commercial/*` routes,
and `internal/cloudcp/portal/commercial_proxy.go` plus `internal/cloudcp/routes.go`
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index d35cc901e3..7756aebc18 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -146,6 +146,7 @@ work extends shared components instead of creating new local variants.
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.
+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.
## Forbidden Paths
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 f4d46b947e..b33cb64156 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -200,6 +200,13 @@ and workloads summary cards must treat hover and focus as one shared active-seri
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 covers contextual row focus on those pages.
+`frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts` must
+write workload selection back into the workloads route through the shared
+same-path route-state scheduler so opening a focused workload preserves scroll
+and does not look like a full page reload, and the governed infrastructure and
+workloads summary surfaces must keep rendering the page-level series set while
+that focus only changes the emphasized label and active-series highlight.
That same hot-path rule now applies to infrastructure summary resource
filtering: `frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts`
must include API-backed systems such as top-level TrueNAS appliances through
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 82c0982d25..eaa08e8e5e 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -210,6 +210,12 @@ payload as its disk-health truth. When API-backed platforms such as TrueNAS
raise SMART-backed disk incidents, those reasons must surface through
`physicalDisk.risk.reasons` so storage rows and disk detail use the same shared
disk-health contract instead of depending on incident-only side channels.
+That same storage page ownership now also includes contextual focus behavior
+for pools and disks. Expanding a storage row may set a focused metrics-target
+ID for shared summary emphasis, but `frontend-modern/src/components/Storage/StorageSummary.tsx`
+must keep the storage summary page-scoped instead of collapsing its sparklines
+to the single expanded row or replacing the page overview with row-local empty
+states.
The recovery backend is a real product boundary, not just a helper package:
`internal/recovery/` owns per-tenant SQLite persistence, rollup derivation,
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index fc3f9531b7..c0d6dba5ac 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -178,6 +178,12 @@ assembly branch.
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.
+10. Keep infrastructure contextual focus route-backed and page-scoped. When an
+ infrastructure row opens its detail drawer, the selection must stay on the
+ same route through canonical resource query state, preserve scroll via the
+ shared route-state scheduler, and keep `frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx`
+ rendering the full page-level series set while only the focused label and
+ highlight state change.
## Current State
diff --git a/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts b/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts
index 9f58138745..a1be0cc176 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts
+++ b/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts
@@ -5,6 +5,7 @@ import type { WorkloadGuest } from '@/types/workloads';
import {
dashboardHasHoveredWorkload,
resolveDashboardResourceSelection,
+ resolveDashboardSelectionNavigateTarget,
} from '../dashboardSelectionModel';
describe('dashboardSelectionModel', () => {
@@ -49,4 +50,34 @@ describe('dashboardSelectionModel', () => {
expect(dashboardHasHoveredWorkload(guests, 'cluster-a:node-1:101')).toBe(true);
expect(dashboardHasHoveredWorkload(guests, 'cluster-a:node-1:102')).toBe(false);
});
+
+ it('builds route-backed workload selection targets without dropping other filters', () => {
+ expect(
+ resolveDashboardSelectionNavigateTarget({
+ pathname: '/workloads',
+ search: '?type=app-container&platform=truenas&agent=truenas-main',
+ resourceId: 'app-container:truenas-main:nextcloud',
+ }),
+ ).toBe(
+ '/workloads?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud',
+ );
+
+ expect(
+ resolveDashboardSelectionNavigateTarget({
+ pathname: '/workloads',
+ search:
+ '?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud',
+ resourceId: null,
+ }),
+ ).toBe('/workloads?type=app-container&platform=truenas&agent=truenas-main');
+
+ expect(
+ resolveDashboardSelectionNavigateTarget({
+ pathname: '/workloads',
+ search:
+ '?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud',
+ resourceId: 'app-container:truenas-main:nextcloud',
+ }),
+ ).toBeNull();
+ });
});
diff --git a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
index 1be91a0d7a..44e625b0aa 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
+++ b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
@@ -3,11 +3,13 @@ import { createSignal } from 'solid-js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { WorkloadGuest } from '@/types/workloads';
+import { ROUTE_STATE_REPLACE_OPTIONS } from '@/utils/routeStateNavigation';
import { resolveDashboardResourceSelection } from '../dashboardSelectionModel';
import { useDashboardSelectionState } from '../useDashboardSelectionState';
let locationSearch = '?resource=cluster-a:node-1:101';
+const navigateSpy = vi.fn();
vi.mock('@solidjs/router', () => ({
useLocation: () => ({
@@ -16,11 +18,14 @@ vi.mock('@solidjs/router', () => ({
return locationSearch;
},
}),
+ useNavigate: () => navigateSpy,
}));
describe('useDashboardSelectionState', () => {
beforeEach(() => {
locationSearch = '?resource=cluster-a:node-1:101';
+ navigateSpy.mockReset();
+ vi.useFakeTimers();
vi.stubGlobal('requestAnimationFrame', (cb: FrameRequestCallback) => {
cb(0);
return 1;
@@ -28,6 +33,8 @@ describe('useDashboardSelectionState', () => {
});
afterEach(() => {
+ vi.runOnlyPendingTimers();
+ vi.useRealTimers();
vi.unstubAllGlobals();
});
@@ -44,7 +51,9 @@ describe('useDashboardSelectionState', () => {
expect(result.selectedGuestId()).toBe('cluster-a:node-1:101');
expect(setSelectedNode).toHaveBeenCalledWith('cluster-a-node-1');
- expect(resolveDashboardResourceSelection(locationSearch)?.selectedNode).toBe('cluster-a-node-1');
+ expect(resolveDashboardResourceSelection(locationSearch)?.selectedNode).toBe(
+ 'cluster-a-node-1',
+ );
});
it('clears stale hovered workload ids when filtered guests change', () => {
@@ -88,4 +97,24 @@ describe('useDashboardSelectionState', () => {
expect(setSelectedNode).not.toHaveBeenCalled();
expect(resolveDashboardResourceSelection(locationSearch)?.selectedNode).toBeNull();
});
+
+ it('writes workload row selection back into the route state without dropping filters', () => {
+ locationSearch = '?type=app-container&platform=truenas&agent=truenas-main';
+ const [filteredGuests] = createSignal<WorkloadGuest[]>([]);
+
+ const { result } = renderHook(() =>
+ useDashboardSelectionState({
+ filteredGuests,
+ setSelectedNode: vi.fn(),
+ }),
+ );
+
+ result.setSelectedGuestId('app-container:truenas-main:nextcloud');
+ vi.runAllTimers();
+
+ expect(navigateSpy).toHaveBeenCalledWith(
+ '/workloads?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud',
+ ROUTE_STATE_REPLACE_OPTIONS,
+ );
+ });
});
diff --git a/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts b/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
index 447782ed7f..7a2316a700 100644
--- a/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
+++ b/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
@@ -1,5 +1,10 @@
-import { parseWorkloadsLinkSearch } from '@/routing/resourceLinks';
+import {
+ parseWorkloadsLinkSearch,
+ WORKLOADS_PATH,
+ WORKLOADS_QUERY_PARAMS,
+} from '@/routing/resourceLinks';
import type { WorkloadGuest } from '@/types/workloads';
+import { areSearchParamsEquivalent } from '@/utils/searchParams';
import { getCanonicalWorkloadId, normalizeWorkloadViewModeParam } from '@/utils/workloads';
export interface DashboardResourceSelection {
@@ -7,6 +12,12 @@ export interface DashboardResourceSelection {
selectedNode: string | null;
}
+export interface DashboardSelectionNavigateTargetOptions {
+ pathname: string;
+ search: string;
+ resourceId: string | null;
+}
+
export const resolveDashboardResourceSelection = (
search: string,
): DashboardResourceSelection | null => {
@@ -31,6 +42,29 @@ export const resolveDashboardResourceSelection = (
};
};
+export const resolveDashboardSelectionNavigateTarget = ({
+ pathname,
+ search,
+ resourceId,
+}: DashboardSelectionNavigateTargetOptions): string | null => {
+ const currentParams = new URLSearchParams(search);
+ const nextParams = new URLSearchParams(search);
+ nextParams.delete(WORKLOADS_QUERY_PARAMS.resource);
+
+ const normalizedResourceId = resourceId?.trim() || '';
+ if (normalizedResourceId) {
+ nextParams.set(WORKLOADS_QUERY_PARAMS.resource, normalizedResourceId);
+ }
+
+ if (areSearchParamsEquivalent(currentParams, nextParams)) {
+ return null;
+ }
+
+ const nextSearch = nextParams.toString();
+ const nextPathname = pathname.trim() || WORKLOADS_PATH;
+ return nextSearch ? `${nextPathname}?${nextSearch}` : nextPathname;
+};
+
export const dashboardHasHoveredWorkload = (
filteredGuests: WorkloadGuest[],
hoveredId: string,
diff --git a/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
index 4626acced8..011ee2ded9 100644
--- a/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
+++ b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
@@ -1,10 +1,12 @@
-import { useLocation } from '@solidjs/router';
-import { createEffect, createSignal, type Accessor } from 'solid-js';
+import { useLocation, useNavigate } from '@solidjs/router';
+import { createEffect, createSignal, onCleanup, untrack, type Accessor } from 'solid-js';
import type { WorkloadGuest } from '@/types/workloads';
+import { createRouteStateNavigateScheduler } from '@/utils/routeStateNavigation';
import {
dashboardHasHoveredWorkload,
resolveDashboardResourceSelection,
+ resolveDashboardSelectionNavigateTarget,
} from './dashboardSelectionModel';
interface UseDashboardSelectionStateOptions {
@@ -14,6 +16,11 @@ interface UseDashboardSelectionStateOptions {
export function useDashboardSelectionState(options: UseDashboardSelectionStateOptions) {
const location = useLocation();
+ const navigate = useNavigate();
+ const routeStateNavigate = createRouteStateNavigateScheduler(
+ navigate,
+ () => `${untrack(() => location.pathname)}${untrack(() => location.search)}`,
+ );
const [selectedGuestId, setSelectedGuestIdRaw] = createSignal<string | null>(null);
const [hoveredWorkloadId, setHoveredWorkloadId] = createSignal<string | null>(null);
@@ -26,7 +33,7 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
tableRef = element;
};
- const setSelectedGuestId = (id: string | null) => {
+ const setSelectedGuestIdState = (id: string | null) => {
let scroller: HTMLElement | null = tableRef ?? null;
while (scroller) {
const { overflowY } = getComputedStyle(scroller);
@@ -48,10 +55,23 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
});
};
+ const setSelectedGuestId = (id: string | null) => {
+ setSelectedGuestIdState(id);
+ const nextPath = resolveDashboardSelectionNavigateTarget({
+ pathname: location.pathname,
+ search: location.search,
+ resourceId: id,
+ });
+ if (nextPath) {
+ routeStateNavigate.schedule(nextPath);
+ }
+ };
+
createEffect(() => {
const selection = resolveDashboardResourceSelection(location.search);
if (!selection) {
if (handledResourceId() !== null) {
+ setSelectedGuestIdState(null);
setHandledResourceId(null);
}
return;
@@ -60,7 +80,7 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
const { resourceId, selectedNode } = selection;
if (resourceId === handledResourceId()) return;
- setSelectedGuestId(resourceId);
+ setSelectedGuestIdState(resourceId);
if (selectedNode) {
options.setSelectedNode(selectedNode);
}
@@ -75,6 +95,10 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
}
});
+ onCleanup(() => {
+ routeStateNavigate.cleanup();
+ });
+
return {
hoveredWorkloadId,
selectedGuestId,
diff --git a/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx b/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx
index 5f2b5b336b..de6023cc35 100644
--- a/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx
+++ b/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx
@@ -15,6 +15,8 @@ import { useInfrastructureSummaryState } from './useInfrastructureSummaryState';
export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (props) => {
const state = useInfrastructureSummaryState(props);
+ const effectiveHoveredResourceId = () =>
+ state.hasInteractiveResourceId(props.hoveredResourceId) ? props.hoveredResourceId : null;
const rangeLabel = () => props.timeRange || '1h';
@@ -25,16 +27,14 @@ export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (pro
};
const activeSeriesId = () =>
resolveSummaryActiveSeriesId({
- hoveredSeriesId: props.hoveredResourceId,
- focusedSeriesId: props.focusedResourceId,
+ hoveredSeriesId: effectiveHoveredResourceId(),
+ focusedSeriesId: state.effectiveFocusedResourceId(),
});
- const interactionStateFor = (
- series: Array<{ id: string }>,
- ) =>
+ const interactionStateFor = (series: Array<{ id: string }>) =>
resolveSummaryCardInteractionState({
series,
- hoveredSeriesId: props.hoveredResourceId,
- focusedSeriesId: props.focusedResourceId,
+ hoveredSeriesId: effectiveHoveredResourceId(),
+ focusedSeriesId: state.effectiveFocusedResourceId(),
});
return (
@@ -73,6 +73,7 @@ export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (pro
series={state.seriesFor('cpu')}
rangeLabel={rangeLabel()}
timeRange={props.timeRange}
+ activeSeriesDisplay="isolate"
yMode="percent"
highlightNearestSeriesOnHover
highlightSeriesId={activeSeriesId()}
@@ -92,6 +93,7 @@ export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (pro
series={state.seriesFor('memory')}
rangeLabel={rangeLabel()}
timeRange={props.timeRange}
+ activeSeriesDisplay="isolate"
yMode="percent"
highlightNearestSeriesOnHover
highlightSeriesId={activeSeriesId()}
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts
index 91aff028b3..6aa4dd68a1 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts
@@ -56,6 +56,13 @@ describe('infrastructureSummaryModel', () => {
expect(getFocusedInfrastructureResourceName(allSeries, 'missing')).toBeNull();
});
+ it('allows page-scoped display series while still resolving the focused label canonically', () => {
+ const allSeries = [makeSeries('host-1', { name: 'Host 1' }), makeSeries('host-2', { name: 'Host 2' })];
+
+ expect(buildInfrastructureDisplaySeries(allSeries, null)).toEqual(allSeries);
+ expect(getFocusedInfrastructureResourceName(allSeries, 'host-2')).toBe('Host 2');
+ });
+
it('keeps first-sample waiting logic on canonical summary inputs', () => {
const onlineResource = makeResource({ lastSeen: 5_000 });
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/useInfrastructureSummaryState.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/useInfrastructureSummaryState.test.tsx
new file mode 100644
index 0000000000..e6189017b7
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/__tests__/useInfrastructureSummaryState.test.tsx
@@ -0,0 +1,118 @@
+import { renderHook, waitFor } from '@solidjs/testing-library';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import type { Resource } from '@/types/resource';
+
+import {
+ __resetInMemoryChartCacheForTests,
+ useInfrastructureSummaryState,
+} from '../useInfrastructureSummaryState';
+
+const mockFetchInfrastructureSummaryAndCache = vi.fn();
+const mockReadInfrastructureSummaryCache = vi.fn(() => null);
+
+vi.mock('@/hooks/useResources', () => ({
+ useResources: () => ({
+ workloads: () => [],
+ resources: () => [],
+ }),
+}));
+
+vi.mock('@/utils/infrastructureSummaryCache', () => ({
+ fetchInfrastructureSummaryAndCache: (...args: unknown[]) =>
+ mockFetchInfrastructureSummaryAndCache(...args),
+ readInfrastructureSummaryCache: (...args: unknown[]) =>
+ mockReadInfrastructureSummaryCache(...args),
+}));
+
+vi.mock('@/utils/apiClient', async () => {
+ const actual = await vi.importActual<typeof import('@/utils/apiClient')>('@/utils/apiClient');
+ return {
+ ...actual,
+ getOrgID: () => 'default',
+ };
+});
+
+const now = Date.now();
+const twoPointSeries = [
+ { timestamp: now - 60_000, value: 12 },
+ { timestamp: now, value: 18 },
+];
+
+const makeResource = (id: string, name: string): Resource =>
+ ({
+ id,
+ type: 'agent',
+ name,
+ displayName: name,
+ platformId: id,
+ platformType: 'agent',
+ sourceType: 'hybrid',
+ status: 'online',
+ lastSeen: now,
+ platformData: { sources: ['agent'] },
+ }) as Resource;
+
+describe('useInfrastructureSummaryState', () => {
+ beforeEach(() => {
+ mockFetchInfrastructureSummaryAndCache.mockReset();
+ mockReadInfrastructureSummaryCache.mockReset();
+ mockReadInfrastructureSummaryCache.mockReturnValue(null);
+ __resetInMemoryChartCacheForTests();
+ localStorage.clear();
+ });
+
+ afterEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it('keeps infrastructure summaries page-scoped when a focused resource is selected', async () => {
+ mockFetchInfrastructureSummaryAndCache.mockResolvedValue({
+ map: new Map([
+ [
+ 'host-1',
+ {
+ cpu: twoPointSeries,
+ memory: twoPointSeries,
+ disk: [],
+ diskread: twoPointSeries,
+ diskwrite: twoPointSeries,
+ netin: twoPointSeries,
+ netout: twoPointSeries,
+ },
+ ],
+ [
+ 'host-2',
+ {
+ cpu: twoPointSeries,
+ memory: twoPointSeries,
+ disk: [],
+ diskread: twoPointSeries,
+ diskwrite: twoPointSeries,
+ netin: twoPointSeries,
+ netout: twoPointSeries,
+ },
+ ],
+ ]),
+ oldestDataTimestamp: now - 60_000,
+ });
+
+ const resources = [makeResource('host-1', 'Host 1'), makeResource('host-2', 'Host 2')];
+
+ const { result } = renderHook(() =>
+ useInfrastructureSummaryState({
+ resources,
+ timeRange: '1h',
+ focusedResourceId: 'host-1',
+ }),
+ );
+
+ await waitFor(() => {
+ expect(result.effectiveFocusedResourceId()).toBe('host-1');
+ expect(result.focusedResourceName()).toBe('Host 1');
+ expect(result.seriesFor('cpu')).toHaveLength(2);
+ expect(result.networkSeries()).toHaveLength(2);
+ });
+ expect(result.hasInteractiveResourceId('host-1')).toBe(true);
+ });
+});
diff --git a/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts b/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
index 2c772dbe5a..30b819dff0 100644
--- a/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
+++ b/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
@@ -78,7 +78,7 @@ export function useInfrastructureSummaryState(props: InfrastructureSummaryProps)
let activeFetchRequest = 0;
let activeScopeKey: string | null = null;
- const awaitAbortable = <T,>(promise: Promise<T>, signal: AbortSignal): Promise<T> => {
+ const awaitAbortable = <T>(promise: Promise<T>, signal: AbortSignal): Promise<T> => {
if (signal.aborted) {
return Promise.reject(new DOMException('Aborted', 'AbortError'));
}
@@ -230,11 +230,35 @@ export function useInfrastructureSummaryState(props: InfrastructureSummaryProps)
);
const displaySeries = createMemo(() => {
- return buildInfrastructureDisplaySeries(resourceSeries(), props.focusedResourceId);
+ return buildInfrastructureDisplaySeries(resourceSeries(), null);
+ });
+
+ const interactiveResourceIds = createMemo(() => {
+ const ids = new Set<string>();
+ for (const series of resourceSeries()) {
+ if (
+ series.cpu.length >= 1 ||
+ series.memory.length >= 1 ||
+ series.diskio.length >= 1 ||
+ series.network.length >= 1
+ ) {
+ ids.add(series.id);
+ }
+ }
+ return ids;
+ });
+
+ const hasInteractiveResourceId = (value: string | null | undefined): value is string => {
+ const normalized = value?.trim() || '';
+ return normalized !== '' && interactiveResourceIds().has(normalized);
+ };
+
+ const effectiveFocusedResourceId = createMemo<string | null>(() => {
+ return hasInteractiveResourceId(props.focusedResourceId) ? props.focusedResourceId : null;
});
const focusedResourceName = createMemo(() => {
- return getFocusedInfrastructureResourceName(resourceSeries(), props.focusedResourceId);
+ return getFocusedInfrastructureResourceName(resourceSeries(), effectiveFocusedResourceId());
});
const singleDisplayedOnlineResource = createMemo(() => {
@@ -263,15 +287,13 @@ export function useInfrastructureSummaryState(props: InfrastructureSummaryProps)
const hasNetData = createMemo(() => hasInfrastructureSeriesData(displaySeries(), 'network'));
- const diskioSeries = createMemo(() =>
- buildInfrastructureMetricSeries(displaySeries(), 'diskio'),
- );
+ const diskioSeries = createMemo(() => buildInfrastructureMetricSeries(displaySeries(), 'diskio'));
const hasDiskIOData = createMemo(() => hasInfrastructureSeriesData(displaySeries(), 'diskio'));
const avgDiskCapacity = createMemo(() => getAverageDiskCapacity(props.resources));
- const shouldShowNetworkCard = createMemo(
- () => shouldShowInfrastructureNetworkCard(hasNetData(), props.resources),
+ const shouldShowNetworkCard = createMemo(() =>
+ shouldShowInfrastructureNetworkCard(hasNetData(), props.resources),
);
const workloadStats = createMemo(() => buildInfrastructureWorkloadStats(workloads()));
const resourceCounts = createMemo(() => buildInfrastructureResourceCounts(props.resources));
@@ -286,7 +308,9 @@ export function useInfrastructureSummaryState(props: InfrastructureSummaryProps)
isCurrentRangeLoaded,
emptyHistoryLabel,
emptyMessage,
+ effectiveFocusedResourceId,
focusedResourceName,
+ hasInteractiveResourceId,
resourceCounts,
workloadStats,
avgDiskCapacity,
diff --git a/frontend-modern/src/components/Storage/StorageSummary.tsx b/frontend-modern/src/components/Storage/StorageSummary.tsx
index 1cda70c209..c89062272f 100644
--- a/frontend-modern/src/components/Storage/StorageSummary.tsx
+++ b/frontend-modern/src/components/Storage/StorageSummary.tsx
@@ -171,17 +171,8 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
// Series builders
// ---------------------------------------------------------------------------
- const filterFocusedSeries = (
- series: InteractiveSparklineSeries[],
- ): InteractiveSparklineSeries[] => {
- const focusedId = props.focusedResourceId;
- if (!focusedId) return series;
- const match = series.find((entry) => entry.id === focusedId);
- return match ? [match] : series;
- };
-
const getFocusedSeriesName = (series: InteractiveSparklineSeries[]): string | null => {
- const focusedId = props.focusedResourceId;
+ const focusedId = effectiveFocusedResourceId();
if (!focusedId) return null;
return series.find((entry) => entry.id === focusedId)?.name ?? null;
};
@@ -199,7 +190,6 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
data: pool.usage as MetricPoint[],
}));
});
- const displayedPoolUsageSeries = createMemo(() => filterFocusedSeries(poolUsageSeries()));
const poolUsedSeries = createMemo((): InteractiveSparklineSeries[] => {
const d = data();
@@ -214,7 +204,6 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
data: pool.used as MetricPoint[],
}));
});
- const displayedPoolUsedSeries = createMemo(() => filterFocusedSeries(poolUsedSeries()));
const poolAvailSeries = createMemo((): InteractiveSparklineSeries[] => {
const d = data();
@@ -229,7 +218,6 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
data: pool.avail as MetricPoint[],
}));
});
- const displayedPoolAvailSeries = createMemo(() => filterFocusedSeries(poolAvailSeries()));
const diskTempSeries = createMemo((): InteractiveSparklineSeries[] => {
const d = data();
@@ -244,12 +232,36 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
data: disk.temperature as MetricPoint[],
}));
});
- const displayedDiskTempSeries = createMemo(() => filterFocusedSeries(diskTempSeries()));
+ const interactiveResourceIds = createMemo(() => {
+ const ids = new Set<string>();
+ for (const series of [
+ ...poolUsageSeries(),
+ ...poolUsedSeries(),
+ ...poolAvailSeries(),
+ ...diskTempSeries(),
+ ]) {
+ ids.add(series.id);
+ }
+ return ids;
+ });
+
+ const isInteractiveResourceId = (value: string | null | undefined): value is string => {
+ const normalized = value?.trim() || '';
+ return normalized !== '' && interactiveResourceIds().has(normalized);
+ };
+
+ const effectiveHoveredResourceId = createMemo<string | null>(() =>
+ isInteractiveResourceId(props.hoveredResourceId) ? props.hoveredResourceId : null,
+ );
+
+ const effectiveFocusedResourceId = createMemo<string | null>(() =>
+ isInteractiveResourceId(props.focusedResourceId) ? props.focusedResourceId : null,
+ );
- const hasPoolUsage = () => displayedPoolUsageSeries().length > 0;
- const hasDiskTemp = () => displayedDiskTempSeries().length > 0;
- const hasPoolUsed = () => displayedPoolUsedSeries().length > 0;
- const hasPoolAvail = () => displayedPoolAvailSeries().length > 0;
+ const hasPoolUsage = () => poolUsageSeries().length > 0;
+ const hasDiskTemp = () => diskTempSeries().length > 0;
+ const hasPoolUsed = () => poolUsedSeries().length > 0;
+ const hasPoolAvail = () => poolAvailSeries().length > 0;
const emptyLabel = () => (fetchFailed() ? 'Trend data unavailable' : 'No history yet');
@@ -265,14 +277,14 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
};
const activeSeriesId = () =>
resolveSummaryActiveSeriesId({
- hoveredSeriesId: props.hoveredResourceId,
- focusedSeriesId: props.focusedResourceId,
+ hoveredSeriesId: effectiveHoveredResourceId(),
+ focusedSeriesId: effectiveFocusedResourceId(),
});
const interactionStateFor = (series: InteractiveSparklineSeries[]) =>
resolveSummaryCardInteractionState({
series,
- hoveredSeriesId: props.hoveredResourceId,
- focusedSeriesId: props.focusedResourceId,
+ hoveredSeriesId: effectiveHoveredResourceId(),
+ focusedSeriesId: effectiveFocusedResourceId(),
});
return (
@@ -301,16 +313,17 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
loaded={loaded()}
hasData={hasPoolUsage()}
emptyMessage={emptyLabel()}
- interactionState={interactionStateFor(displayedPoolUsageSeries())}
+ interactionState={interactionStateFor(poolUsageSeries())}
>
<InteractiveSparkline
- series={displayedPoolUsageSeries()}
+ series={poolUsageSeries()}
rangeLabel={rangeLabel()}
timeRange={props.timeRange as TimeRange}
+ activeSeriesDisplay="isolate"
yMode="percent"
highlightNearestSeriesOnHover
highlightSeriesId={activeSeriesId()}
- interactionState={interactionStateFor(displayedPoolUsageSeries())}
+ interactionState={interactionStateFor(poolUsageSeries())}
/>
</SummaryMetricCard>
@@ -320,18 +333,19 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
loaded={loaded()}
hasData={hasDiskTemp()}
emptyMessage={emptyLabel()}
- interactionState={interactionStateFor(displayedDiskTempSeries())}
+ interactionState={interactionStateFor(diskTempSeries())}
>
<InteractiveSparkline
- series={displayedDiskTempSeries()}
+ series={diskTempSeries()}
rangeLabel={rangeLabel()}
timeRange={props.timeRange as TimeRange}
+ activeSeriesDisplay="isolate"
yMode="auto"
formatValue={formatTemp}
formatTopLabel={(max) => `${max.toFixed(0)}°C`}
highlightNearestSeriesOnHover
highlightSeriesId={activeSeriesId()}
- interactionState={interactionStateFor(displayedDiskTempSeries())}
+ interactionState={interactionStateFor(diskTempSeries())}
/>
</SummaryMetricCard>
@@ -341,18 +355,19 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
loaded={loaded()}
hasData={hasPoolUsed()}
emptyMessage={emptyLabel()}
- interactionState={interactionStateFor(displayedPoolUsedSeries())}
+ interactionState={interactionStateFor(poolUsedSeries())}
>
<InteractiveSparkline
- series={displayedPoolUsedSeries()}
+ series={poolUsedSeries()}
rangeLabel={rangeLabel()}
timeRange={props.timeRange as TimeRange}
+ activeSeriesDisplay="isolate"
yMode="auto"
formatValue={(v) => formatBytes(v)}
formatTopLabel={(max) => formatBytes(max)}
highlightNearestSeriesOnHover
highlightSeriesId={activeSeriesId()}
- interactionState={interactionStateFor(displayedPoolUsedSeries())}
+ interactionState={interactionStateFor(poolUsedSeries())}
/>
</SummaryMetricCard>
@@ -362,18 +377,19 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
loaded={loaded()}
hasData={hasPoolAvail()}
emptyMessage={emptyLabel()}
- interactionState={interactionStateFor(displayedPoolAvailSeries())}
+ interactionState={interactionStateFor(poolAvailSeries())}
>
<InteractiveSparkline
- series={displayedPoolAvailSeries()}
+ series={poolAvailSeries()}
rangeLabel={rangeLabel()}
timeRange={props.timeRange as TimeRange}
+ activeSeriesDisplay="isolate"
yMode="auto"
formatValue={(v) => formatBytes(v)}
formatTopLabel={(max) => formatBytes(max)}
highlightNearestSeriesOnHover
highlightSeriesId={activeSeriesId()}
- interactionState={interactionStateFor(displayedPoolAvailSeries())}
+ interactionState={interactionStateFor(poolAvailSeries())}
/>
</SummaryMetricCard>
</SummaryPanel>
diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
index aac3240390..8be371e9f7 100644
--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
@@ -847,6 +847,86 @@ describe('Storage', () => {
});
});
+ it('keeps storage summary page-scoped when a focused pool is expanded', async () => {
+ const storageSummarySpy = vi.spyOn(ChartsAPI, 'getStorageSummaryCharts').mockResolvedValue({
+ pools: {
+ 'pool:alpha': {
+ name: 'Alpha-Store',
+ usage: [
+ { timestamp: Date.now() - 60_000, value: 45 },
+ { timestamp: Date.now(), value: 47 },
+ ],
+ used: [
+ ],
+ avail: [
+ ],
+ },
+ 'pool:beta': {
+ name: 'Beta-Store',
+ usage: [
+ { timestamp: Date.now() - 60_000, value: 58 },
+ { timestamp: Date.now(), value: 60 },
+ ],
+ used: [
+ { timestamp: Date.now() - 60_000, value: 680 },
+ { timestamp: Date.now(), value: 700 },
+ ],
+ avail: [
+ { timestamp: Date.now() - 60_000, value: 320 },
+ { timestamp: Date.now(), value: 300 },
+ ],
+ },
+ },
+ disks: {},
+ stats: {
+ oldestDataTimestamp: Date.now() - 60_000,
+ },
+ });
+
+ hookResources = [
+ buildStorageResource('storage-display-alpha', 'Alpha-Store', 'pve1', {
+ metricsTarget: {
+ resourceType: 'storage',
+ resourceId: 'pool:alpha',
+ },
+ }),
+ buildStorageResource('storage-display-beta', 'Beta-Store', 'pve2', {
+ metricsTarget: {
+ resourceType: 'storage',
+ resourceId: 'pool:beta',
+ },
+ }),
+ ];
+
+ render(() => <Storage />);
+
+ const summary = await screen.findByTestId('storage-summary');
+
+ fireEvent.click(screen.getByRole('button', { name: 'Toggle details for Alpha-Store' }));
+
+ await waitFor(() => {
+ expect(
+ summary.querySelectorAll(
+ '[data-highlight-series-active="true"][data-highlight-series-id="pool:alpha"]',
+ ).length,
+ ).toBe(1);
+ expect(
+ screen
+ .getByText('Used Capacity')
+ .closest('[data-summary-card-state]')
+ ?.textContent?.includes('No history yet'),
+ ).toBe(false);
+ expect(
+ screen
+ .getByText('Available Space')
+ .closest('[data-summary-card-state]')
+ ?.textContent?.includes('No history yet'),
+ ).toBe(false);
+ });
+
+ storageSummarySpy.mockRestore();
+ });
+
it('restores canonical TrueNAS source filters from the storage route', async () => {
nodeResources = [
{
diff --git a/frontend-modern/src/components/Storage/__tests__/StorageSummary.test.tsx b/frontend-modern/src/components/Storage/__tests__/StorageSummary.test.tsx
new file mode 100644
index 0000000000..82052a11ea
--- /dev/null
+++ b/frontend-modern/src/components/Storage/__tests__/StorageSummary.test.tsx
@@ -0,0 +1,100 @@
+import { cleanup, render, screen, waitFor } from '@solidjs/testing-library';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import StorageSummary from '../StorageSummary';
+
+const mockGetStorageSummaryCharts = vi.fn();
+
+vi.mock('@/api/charts', async () => {
+ const actual = await vi.importActual<typeof import('@/api/charts')>('@/api/charts');
+ return {
+ ...actual,
+ ChartsAPI: {
+ ...actual.ChartsAPI,
+ getStorageSummaryCharts: (...args: unknown[]) => mockGetStorageSummaryCharts(...args),
+ },
+ };
+});
+
+vi.mock('@/utils/apiClient', async () => {
+ const actual = await vi.importActual<typeof import('@/utils/apiClient')>('@/utils/apiClient');
+ return {
+ ...actual,
+ getOrgID: () => 'default',
+ };
+});
+
+vi.mock('@/components/shared/InteractiveSparkline', () => ({
+ InteractiveSparkline: (props: {
+ series?: Array<{ id?: string; name?: string; data?: Array<unknown> }>;
+ highlightSeriesId?: string | null;
+ interactionState?: string;
+ activeSeriesDisplay?: string;
+ }) => {
+ const series = props.series ?? [];
+ return (
+ <div
+ data-testid="sparkline"
+ data-series-count={series.length}
+ data-series-ids={series.map((current) => current.id || '').join('|')}
+ data-highlight-series-id={props.highlightSeriesId || ''}
+ data-interaction-state={props.interactionState || 'default'}
+ data-active-series-display={props.activeSeriesDisplay || ''}
+ />
+ );
+ },
+}));
+
+describe('StorageSummary', () => {
+ const now = Date.now();
+ const twoPointSeries = [
+ { timestamp: now - 60_000, value: 45 },
+ { timestamp: now, value: 47 },
+ ];
+
+ beforeEach(() => {
+ mockGetStorageSummaryCharts.mockReset();
+ localStorage.clear();
+ });
+
+ afterEach(() => {
+ cleanup();
+ });
+
+ it('keeps storage summary series page-scoped when a focused resource is selected', async () => {
+ mockGetStorageSummaryCharts.mockResolvedValueOnce({
+ pools: {
+ 'pool:alpha': {
+ name: 'Alpha Pool',
+ usage: twoPointSeries,
+ used: twoPointSeries,
+ avail: twoPointSeries,
+ },
+ 'pool:beta': {
+ name: 'Beta Pool',
+ usage: twoPointSeries,
+ used: twoPointSeries,
+ avail: twoPointSeries,
+ },
+ },
+ disks: {},
+ stats: {
+ oldestDataTimestamp: now - 60_000,
+ },
+ });
+
+ render(() => (
+ <StorageSummary poolCount={2} diskCount={0} timeRange="1h" focusedResourceId="pool:alpha" />
+ ));
+
+ await waitFor(() => {
+ const sparklines = screen.getAllByTestId('sparkline');
+ expect(sparklines).toHaveLength(3);
+ for (const sparkline of sparklines) {
+ expect(sparkline.getAttribute('data-series-count')).toBe('2');
+ expect(sparkline.getAttribute('data-highlight-series-id')).toBe('pool:alpha');
+ expect(sparkline.getAttribute('data-active-series-display')).toBe('isolate');
+ }
+ });
+ });
+});
diff --git a/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsx b/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsx
index 1b5f8a37e1..e276cb61c0 100644
--- a/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsx
+++ b/frontend-modern/src/components/Workloads/WorkloadsSummary.test.tsx
@@ -25,6 +25,7 @@ vi.mock('@/components/shared/InteractiveSparkline', () => ({
series?: Array<{ id?: string; name?: string; data?: Array<unknown> }>;
highlightSeriesId?: string | null;
interactionState?: string;
+ activeSeriesDisplay?: string;
}) => {
const series = props.series ?? [];
const maxPoints = series.reduce((max, current) => Math.max(max, current.data?.length ?? 0), 0);
@@ -37,6 +38,7 @@ vi.mock('@/components/shared/InteractiveSparkline', () => ({
data-max-points={maxPoints}
data-highlight-series-id={props.highlightSeriesId || ''}
data-interaction-state={props.interactionState || 'default'}
+ data-active-series-display={props.activeSeriesDisplay || ''}
/>
);
},
@@ -311,6 +313,33 @@ describe('WorkloadsSummary performance behavior', () => {
});
});
+ it('keeps the page summary series page-scoped when a focused workload is selected', async () => {
+ const workloadIds = ['cluster-a:pve1:101', 'cluster-a:pve1:102'];
+ mockGetWorkloadCharts.mockResolvedValueOnce(makeChartsResponse(workloadIds));
+
+ render(() => (
+ <WorkloadsSummary
+ timeRange="1h"
+ fallbackGuestCounts={{ total: workloadIds.length, running: workloadIds.length, stopped: 0 }}
+ fallbackSnapshots={makeSnapshots(workloadIds)}
+ focusedWorkloadId={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-highlight-series-id')).toBe(workloadIds[0]);
+ }
+ const isolated = sparklines.filter(
+ (sparkline) => sparkline.getAttribute('data-active-series-display') === 'isolate',
+ );
+ expect(isolated).toHaveLength(2);
+ });
+ });
+
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 af81b88228..23d5e30d5f 100644
--- a/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx
+++ b/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx
@@ -649,16 +649,38 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {
return merged.sort((a, b) => a.name.localeCompare(b.name));
});
- const displaySeries = createMemo(() => {
- const focused = props.focusedWorkloadId;
- const all = workloadSeries();
- if (!focused) return all;
- const match = all.find((s) => s.id === focused);
- return match ? [match] : all;
+ const displaySeries = createMemo(() => workloadSeries());
+
+ const interactiveWorkloadIds = createMemo(() => {
+ const ids = new Set<string>();
+ for (const series of workloadSeries()) {
+ if (
+ series.cpu.length >= 2 ||
+ series.memory.length >= 2 ||
+ series.diskio.length >= 2 ||
+ series.network.length >= 2
+ ) {
+ ids.add(series.id);
+ }
+ }
+ return ids;
});
+ const isInteractiveWorkloadId = (value: string | null | undefined): value is string => {
+ const normalized = value?.trim() || '';
+ return normalized !== '' && interactiveWorkloadIds().has(normalized);
+ };
+
+ const effectiveHoveredWorkloadId = createMemo<string | null>(() =>
+ isInteractiveWorkloadId(props.hoveredWorkloadId) ? props.hoveredWorkloadId : null,
+ );
+
+ const effectiveFocusedWorkloadId = createMemo<string | null>(() =>
+ isInteractiveWorkloadId(props.focusedWorkloadId) ? props.focusedWorkloadId : null,
+ );
+
const focusedWorkloadName = createMemo(() => {
- const focused = props.focusedWorkloadId;
+ const focused = effectiveFocusedWorkloadId();
if (!focused) return null;
const match = workloadSeries().find((s) => s.id === focused);
return match?.name || null;
@@ -720,14 +742,14 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {
};
const activeSeriesId = () =>
resolveSummaryActiveSeriesId({
- hoveredSeriesId: props.hoveredWorkloadId,
- focusedSeriesId: props.focusedWorkloadId,
+ hoveredSeriesId: effectiveHoveredWorkloadId(),
+ focusedSeriesId: effectiveFocusedWorkloadId(),
});
const interactionStateFor = (series: InteractiveSparklineSeries[]) =>
resolveSummaryCardInteractionState({
series,
- hoveredSeriesId: props.hoveredWorkloadId,
- focusedSeriesId: props.focusedWorkloadId,
+ hoveredSeriesId: effectiveHoveredWorkloadId(),
+ focusedSeriesId: effectiveFocusedWorkloadId(),
});
return (
@@ -762,6 +784,7 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {
series={cpuSeries()}
rangeLabel={selectedRange()}
timeRange={selectedRange()}
+ activeSeriesDisplay="isolate"
yMode="percent"
sortTooltipByValue
maxTooltipRows={8}
@@ -783,6 +806,7 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {
series={memorySeries()}
rangeLabel={selectedRange()}
timeRange={selectedRange()}
+ activeSeriesDisplay="isolate"
yMode="percent"
sortTooltipByValue
maxTooltipRows={8}
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 196dacffc2..c1035c6bd8 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -1093,6 +1093,43 @@ func TestContract_SSOTestRejectsMetadataURLWithUserinfo(t *testing.T) {
}
}
+func TestContract_SSOTestRejectsManualSLOURLWithUserinfo(t *testing.T) {
+ reqBody := SSOTestRequest{
+ Type: "saml",
+ SAML: &SAMLTestConfig{
+ IDPSSOURL: "https://idp.example.com/sso",
+ IDPSLOURL: "https://user:[email protected]/slo",
+ },
+ }
+ body, err := json.Marshal(reqBody)
+ if err != nil {
+ t.Fatalf("marshal request: %v", err)
+ }
+
+ req := httptest.NewRequest(http.MethodPost, "/api/security/sso/providers/test", bytes.NewReader(body))
+ req.Header.Set("Content-Type", "application/json")
+ setTestIP(req)
+ rec := httptest.NewRecorder()
+
+ router := &Router{}
+ router.handleTestSSOProvider(rec, req)
+
+ if rec.Code != http.StatusBadRequest {
+ t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusBadRequest, rec.Body.String())
+ }
+
+ var resp SSOTestResponse
+ if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
+ t.Fatalf("unmarshal response: %v", err)
+ }
+ if resp.Success {
+ t.Fatalf("expected failed response, got success: %+v", resp)
+ }
+ if resp.Message != "Invalid SLO URL format" {
+ t.Fatalf("expected invalid SLO URL message, got %+v", resp)
+ }
+}
+
func TestContract_SSOTestOIDCDiscoveryKeepsIssuerBasePath(t *testing.T) {
var issuerURL string
discoveryServer := newIPv4HTTPServer(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
diff --git a/internal/api/identity_sso_handlers.go b/internal/api/identity_sso_handlers.go
index b29860a436..6d3102cc04 100644
--- a/internal/api/identity_sso_handlers.go
+++ b/internal/api/identity_sso_handlers.go
@@ -668,6 +668,7 @@ type SAMLTestConfig struct {
IDPMetadataURL string `json:"idpMetadataUrl,omitempty"`
IDPMetadataXML string `json:"idpMetadataXml,omitempty"`
IDPSSOURL string `json:"idpSsoUrl,omitempty"`
+ IDPSLOURL string `json:"idpSloUrl,omitempty"`
IDPCertificate string `json:"idpCertificate,omitempty"`
}
diff --git a/internal/api/saml_service.go b/internal/api/saml_service.go
index 58cd27bfb8..c7082268b7 100644
--- a/internal/api/saml_service.go
+++ b/internal/api/saml_service.go
@@ -11,6 +11,7 @@ import (
"fmt"
"io"
"net/http"
+ "net/url"
"os"
"strings"
"sync"
diff --git a/internal/mock/truenas_metrics_identity.go b/internal/mock/truenas_metrics_identity.go
new file mode 100644
index 0000000000..87e5dea689
--- /dev/null
+++ b/internal/mock/truenas_metrics_identity.go
@@ -0,0 +1,18 @@
+package mock
+
+import (
+ "strings"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/truenas"
+)
+
+func trueNASDiskMetricsResourceID(disk truenas.Disk) string {
+ resourceID := strings.TrimSpace(disk.Serial)
+ if resourceID == "" {
+ resourceID = strings.TrimSpace(disk.ID)
+ }
+ if resourceID == "" {
+ resourceID = strings.TrimSpace(disk.Name)
+ }
+ return resourceID
+}
diff --git a/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts b/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts
index 4c25367dbc..a769aadb44 100644
--- a/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts
+++ b/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts
@@ -192,4 +192,38 @@ test.describe.serial("Inline selection scroll stability", () => {
const afterScroll = await page.evaluate(() => window.scrollY);
expect(afterScroll).toBeGreaterThanOrEqual(Math.max(10, beforeScroll - 60));
});
+
+ test("keeps the workloads viewport stable when opening an inline workload drawer", async ({
+ page,
+ }, testInfo) => {
+ test.skip(
+ testInfo.project.name.startsWith("mobile-"),
+ "Desktop-only workload interaction proof",
+ );
+
+ await ensureMockModeEnabled(page);
+
+ await page.goto("/workloads", { waitUntil: "domcontentloaded" });
+ await expect(page.locator("tr[data-guest-id]").first()).toBeVisible();
+
+ const row = page.locator("tr[data-guest-id]").first();
+ const beforeScroll = await scrollSectionIntoView(page, row);
+ expect(beforeScroll).toBeGreaterThan(10);
+
+ const workloadId = (await row.getAttribute("data-guest-id")) ?? "";
+ expect(workloadId).not.toBe("");
+
+ await row.click();
+
+ await expect(page).toHaveURL(/\/workloads\?(?:.*&)?resource=/);
+ await expect(row.locator("xpath=following-sibling::tr[1]")).toContainText(
+ "Overview",
+ );
+
+ const afterScroll = await page.evaluate(() => window.scrollY);
+ expect(afterScroll).toBeGreaterThanOrEqual(Math.max(10, beforeScroll - 60));
+
+ await row.click();
+ await expect.poll(() => page.url()).not.toContain("resource=");
+ });
});