Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(frontend): add global pinned resource context
rcourtmanb0e9c3991723
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex 01d3209991..1d68cd10ad 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -507,6 +507,12 @@ theme synchronization, and authenticated runtime startup, andas org switching and kiosk-safe navigation. Future hosted browser bootstrapwork must extend that split rather than pulling org bootstrap and app chromeback into one monolithic route component.+That same authenticated shell split now also owns deliberate global+resource-context bootstrap. `frontend-modern/src/App.tsx` may install the+shared provider, and `frontend-modern/src/AppLayout.tsx` may surface and carry+one shell-level `contextResource` state across tabs, but hosted shell work+must not fork page-local global-context banners, drop shell context on tab+changes, or entangle pinned resource scope with tenant/org bootstrap.That same authenticated shell contract now also has to distinguish backendavailability from websocket-stream liveness. When hosted runtime health staysavailable during a stream reconnect or renegotiation window,diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex b7a87b7d79..8051ddb71f 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -133,6 +133,10 @@ work extends shared components instead of creating new local variants.111. `frontend-modern/src/components/shared/summaryScopePresentation.ts`112. `frontend-modern/src/components/shared/summaryInteractionA11y.ts`113. `frontend-modern/src/components/shared/SummaryRowActionButton.tsx`+114. `frontend-modern/src/features/globalResourceContext/GlobalResourceContext.tsx`+115. `frontend-modern/src/features/globalResourceContext/GlobalResourceContextBar.tsx`+116. `frontend-modern/src/features/globalResourceContext/globalResourceContextModel.ts`+117. `frontend-modern/src/features/globalResourceContext/__tests__/globalResourceContextModel.test.ts`## Shared Boundaries@@ -338,6 +342,19 @@ connections` visible as the API-backed alternative for Proxmox andprops that can collapse functions on the live Solid surface. Docker-onlycontrols in `ThresholdsTableDockerTab.tsx` must remain gated to real`docker-host` resources instead of leaking onto platform-managed runtimes.+31. Keep deliberate cross-page resource scope on one shell-owned context+ contract. Hover preview and page-local group scope must stay local to the+ active surface, but an explicitly pinned resource may promote into the+ shared app-shell `contextResource` route state through+ `frontend-modern/src/features/globalResourceContext/GlobalResourceContext.tsx`,+ `frontend-modern/src/features/globalResourceContext/globalResourceContextModel.ts`,+ `frontend-modern/src/features/globalResourceContext/GlobalResourceContextBar.tsx`,+ `frontend-modern/src/AppLayout.tsx`, and+ `frontend-modern/src/routing/resourceLinks.ts`. That shell-owned context+ must render once in shared chrome, survive tab navigation, refresh,+ copy-paste, and back/forward navigation, and clear through one canonical+ action instead of reviving per-page scope badges, page-local query names,+ or hidden route-only filters.## Current State@@ -360,6 +377,16 @@ The subsystem registry now also requires explicit proof-policy coverage for allshared runtime files, and shared-component guardrails fail if raw tablecomposition is reintroduced in new shared components outside the canonicalallowlist.+The app shell now also owns one explicit global pinned-resource context.+`frontend-modern/src/features/globalResourceContext/GlobalResourceContext.tsx`,+`frontend-modern/src/features/globalResourceContext/GlobalResourceContextBar.tsx`,+`frontend-modern/src/features/globalResourceContext/globalResourceContextModel.ts`,+`frontend-modern/src/AppLayout.tsx`, and+`frontend-modern/src/routing/resourceLinks.ts` must keep that context limited+to deliberate resource pins, visible once in shared chrome, and preserved+across platform navigation. Page-local hover preview and group scope remain+local interaction state; they must not silently escalate into shell-wide+context.The settings reporting shell now also owns a deliberate split betweenhistorical performance reports and current-state VM inventory export.`frontend-modern/src/components/Settings/ReportingPanel.tsx`,diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 8db4c374b9..2f701334b8 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -176,6 +176,15 @@ regression protection.branches, focusable-row toggles, or touch-hostile synthetic hover behaviorinside individual row renderers.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.+29. Keep deliberate global resource pinning off the hot-path filter model.+ Infrastructure summary-linked rows may expose a deliberate global-context+ pin through `frontend-modern/src/components/shared/SummaryRowActionButton.tsx`,+ but that pin must route through the shell-owned `contextResource`+ contract instead of becoming another per-page selector or hot-path table+ filter. Infrastructure row renderers should reuse the shared action+ control plus app-shell context owner rather than introducing provider-+ local pin buttons or route writes that add extra hover/focus work to the+ hot table path.## Forbidden Pathsdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex c0ebd62c31..f4abb4a8ae 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -247,6 +247,16 @@ querying, and the operator-facing storage health presentation layer.`createRouteStateNavigateScheduler` helper so back-to-back storage filterchanges coalesce against the current location instead of reintroducing astorage-local timeout queue.+20. Keep storage and recovery global resource context route-backed and+ lossless. When the shared shell carries `contextResource`, storage and+ recovery route builders may add their own canonical node, platform, or tab+ filters, but `frontend-modern/src/routing/resourceLinks.ts`,+ `frontend-modern/src/features/recovery/useRecoverySurfaceState.ts`, and+ storage route state must preserve that shell-owned context on rewrites,+ refresh, and deep links instead of dropping it when a feature-local route+ writer rebuilds query state. Clearing the shell context must also return+ these surfaces to their canonical base routes rather than leaving orphaned+ node or platform filters behind.## Current Statediff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 5e9cfb9135..fe3891c1ef 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -244,6 +244,15 @@ assembly branch.provider-reported storage `pool` metadata alongside path and ZFS health sostorage consumers do not have to recover backing-pool identity from namesor path heuristics.+17. Keep global app context on canonical unified-resource IDs. When an+ operator deliberately pins a resource into the shared shell context,+ `frontend-modern/src/routing/resourceLinks.ts`,+ `frontend-modern/src/features/globalResourceContext/globalResourceContextModel.ts`,+ infrastructure route state, and any cross-surface handoff must preserve+ that scope as `contextResource=<canonical-resource-id>` and derive page+ scoping from the same unified-resource identity plus governed display+ label, rather than provider-native node names, hostnames, or page-local+ aliases.## Current Statediff --git a/frontend-modern/src/App.tsx b/frontend-modern/src/App.tsxindex 9f4bad9d5f..550f8fa070 100644--- a/frontend-modern/src/App.tsx+++ b/frontend-modern/src/App.tsx@@ -42,6 +42,7 @@ import {} from './routing/resourceLinks';import { AppLayout } from '@/AppLayout';import { useAppRuntimeState } from '@/useAppRuntimeState';+import { GlobalResourceContextProvider } from '@/features/globalResourceContext/GlobalResourceContext';function isPublicRoutePath(pathname: string): boolean {// Public routes must be viewable without authentication.@@ -324,24 +325,26 @@ function App() {<divclass={`app-scroll-shell flex-1 min-w-0 overflow-y-scroll bg-base text-base-content font-sans py-4 sm:py-6 transition-all duration-300`}>- <AppLayout- connectionStatus={runtime.connectionStatus}- dataUpdated={runtime.dataUpdated}- lastUpdateText={runtime.lastUpdateText}- versionInfo={runtime.versionInfo}- hasAuth={runtime.hasAuth}- needsAuth={runtime.needsAuth}- proxyAuthInfo={runtime.proxyAuthInfo}- handleLogout={runtime.handleLogout}- state={runtime.state}- tokenScopes={() => runtime.securityStatus()?.tokenScopes}- organizations={runtime.organizations}- activeOrgID={runtime.activeOrgID}- orgsLoading={runtime.orgsLoading}- onSwitchOrg={runtime.handleOrgSwitch}- >- {props.children}- </AppLayout>+ <GlobalResourceContextProvider>+ <AppLayout+ connectionStatus={runtime.connectionStatus}+ dataUpdated={runtime.dataUpdated}+ lastUpdateText={runtime.lastUpdateText}+ versionInfo={runtime.versionInfo}+ hasAuth={runtime.hasAuth}+ needsAuth={runtime.needsAuth}+ proxyAuthInfo={runtime.proxyAuthInfo}+ handleLogout={runtime.handleLogout}+ state={runtime.state}+ tokenScopes={() => runtime.securityStatus()?.tokenScopes}+ organizations={runtime.organizations}+ activeOrgID={runtime.activeOrgID}+ orgsLoading={runtime.orgsLoading}+ onSwitchOrg={runtime.handleOrgSwitch}+ >+ {props.children}+ </AppLayout>+ </GlobalResourceContextProvider></div>{/* AI Panel - slides in from right, pushes content */}<AIChat onClose={() => aiChatStore.close()} />diff --git a/frontend-modern/src/AppLayout.tsx b/frontend-modern/src/AppLayout.tsxindex 52e949aa72..4aa728c053 100644--- a/frontend-modern/src/AppLayout.tsx+++ b/frontend-modern/src/AppLayout.tsx@@ -30,8 +30,7 @@ import { useKioskMode } from '@/hooks/useKioskMode';import { layoutStore } from '@/utils/layout';import { getActiveTabForPath } from '@/routing/navigation';import {- buildInfrastructurePath,- buildWorkloadsPath,+ buildPathWithGlobalResourceContext,DASHBOARD_PATH,} from '@/routing/resourceLinks';import { buildStorageRecoveryTabSpecs } from '@/routing/platformTabs';@@ -40,9 +39,8 @@ import { updateStore } from '@/stores/updates';import { aiChatStore } from '@/stores/aiChat';import { isMultiTenantEnabled, isPro } from '@/stores/license';import type { AppConnectionStatus } from '@/useAppRuntimeState';--const ROOT_INFRASTRUCTURE_PATH = buildInfrastructurePath();-const ROOT_WORKLOADS_PATH = buildWorkloadsPath();+import { useGlobalResourceContext } from '@/features/globalResourceContext/GlobalResourceContext';+import { GlobalResourceContextBar } from '@/features/globalResourceContext/GlobalResourceContextBar';type PlatformTab = {id: string;@@ -160,6 +158,7 @@ export function AppLayout(props: AppLayoutProps) {const navigate = useNavigate();const location = useLocation();const kioskMode = useKioskMode();+ const globalContext = useGlobalResourceContext();const [headerVisible, setHeaderVisible] = createSignal(true);let headerEl: HTMLDivElement | undefined;@@ -280,7 +279,7 @@ export function AppLayout(props: AppLayoutProps) {{id: 'dashboard',label: 'Dashboard',- route: DASHBOARD_PATH,+ route: globalContext.buildPlatformRoute('dashboard'),settingsRoute: '/settings',tooltip: 'Environment overview and command center',enabled: true,@@ -291,7 +290,7 @@ export function AppLayout(props: AppLayoutProps) {{id: 'infrastructure',label: 'Infrastructure',- route: ROOT_INFRASTRUCTURE_PATH,+ route: globalContext.buildPlatformRoute('infrastructure'),settingsRoute: '/settings',tooltip: 'All agents and nodes across platforms',enabled: true,@@ -302,7 +301,7 @@ export function AppLayout(props: AppLayoutProps) {{id: 'workloads',label: 'Workloads',- route: ROOT_WORKLOADS_PATH,+ route: globalContext.buildPlatformRoute('workloads'),settingsRoute: '/settings/workloads/docker',tooltip: 'VMs, containers, and Kubernetes workloads',enabled: true,@@ -312,6 +311,7 @@ export function AppLayout(props: AppLayoutProps) {},...buildStorageRecoveryTabSpecs().map((tab) => ({...tab,+ route: globalContext.buildPlatformRoute(tab.id),enabled: true,live: true,icon: tab.id.startsWith('storage') ? (@@ -331,7 +331,7 @@ export function AppLayout(props: AppLayoutProps) {{id: 'dashboard',label: 'Dashboard',- route: DASHBOARD_PATH,+ route: globalContext.buildPlatformRoute('dashboard'),settingsRoute: '/settings',tooltip: 'Environment overview and command center',enabled: true,@@ -342,7 +342,7 @@ export function AppLayout(props: AppLayoutProps) {{id: 'infrastructure',label: 'Infrastructure',- route: ROOT_INFRASTRUCTURE_PATH,+ route: globalContext.buildPlatformRoute('infrastructure'),settingsRoute: '/settings',tooltip: 'All agents and nodes across platforms',enabled: true,@@ -353,7 +353,7 @@ export function AppLayout(props: AppLayoutProps) {{id: 'workloads',label: 'Workloads',- route: ROOT_WORKLOADS_PATH,+ route: globalContext.buildPlatformRoute('workloads'),settingsRoute: '/settings/workloads/docker',tooltip: 'VMs, containers, and Kubernetes workloads',enabled: true,@@ -363,6 +363,7 @@ export function AppLayout(props: AppLayoutProps) {},...buildStorageRecoveryTabSpecs().map((tab) => ({...tab,+ route: globalContext.buildPlatformRoute(tab.id),enabled: true,live: true,icon: tab.id.startsWith('storage') ? (@@ -402,7 +403,7 @@ export function AppLayout(props: AppLayoutProps) {{id: 'alerts',label: 'Alerts',- route: '/alerts',+ route: buildPathWithGlobalResourceContext('/alerts', globalContext.contextResourceId()),tooltip: 'Review active alerts and automation rules',badge: null,count: activeAlertCount,@@ -412,7 +413,7 @@ export function AppLayout(props: AppLayoutProps) {{id: 'ai',label: 'Patrol',- route: '/ai',+ route: buildPathWithGlobalResourceContext('/ai', globalContext.contextResourceId()),tooltip: 'Pulse Patrol monitoring and analysis',badge: null,count: undefined,@@ -422,7 +423,10 @@ export function AppLayout(props: AppLayoutProps) {{id: 'operations',label: 'Operations',- route: '/operations',+ route: buildPathWithGlobalResourceContext(+ '/operations',+ globalContext.contextResourceId(),+ ),tooltip: 'System operations, diagnostics, and reporting',badge: null,count: undefined,@@ -435,7 +439,10 @@ export function AppLayout(props: AppLayoutProps) {tabs.push({id: 'settings',label: 'Settings',- route: '/settings',+ route: buildPathWithGlobalResourceContext(+ '/settings',+ globalContext.contextResourceId(),+ ),tooltip: 'Configure Pulse preferences and integrations',badge: updateStore.isUpdateVisible() ? 'update' : null,count: undefined,@@ -451,7 +458,12 @@ export function AppLayout(props: AppLayoutProps) {if (platform.enabled) {navigate(platform.route);} else {- navigate(platform.settingsRoute);+ navigate(+ buildPathWithGlobalResourceContext(+ platform.settingsRoute,+ globalContext.contextResourceId(),+ ),+ );}};@@ -743,6 +755,7 @@ export function AppLayout(props: AppLayoutProps) {class="tab-content block bg-surface rounded-b rounded-tr rounded-tl shadow mb-2"><div class="pulse-panel">+ <GlobalResourceContextBar class="border-b border-border px-4 py-2" /><Suspense fallback={<div class="p-6 text-sm text-muted">Loading view...</div>}>{props.children}</Suspense>diff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.tsindex c4ec7cf044..1d0f3c9124 100644--- a/frontend-modern/src/__tests__/App.architecture.test.ts+++ b/frontend-modern/src/__tests__/App.architecture.test.ts@@ -7,6 +7,9 @@ describe('App architecture', () => {it('keeps App as the entry shell that delegates runtime and chrome ownership', () => {expect(appSource).toContain('DASHBOARD_PATH,');expect(appSource).toContain("import { AppLayout } from '@/AppLayout';");+ expect(appSource).toContain(+ "import { GlobalResourceContextProvider } from '@/features/globalResourceContext/GlobalResourceContext';",+ );expect(appSource).toContain("import { useAppRuntimeState } from '@/useAppRuntimeState';");expect(appSource).toContain('const runtime = useAppRuntimeState();');expect(appSource).toContain('const ROOT_DASHBOARD_PATH = DASHBOARD_PATH;');@@ -23,10 +26,18 @@ describe('App architecture', () => {expect(appSource).not.toContain('const [organizations, setOrganizations] = createSignal(');expect(appSource).not.toContain('const [themePreference, setThemePreference] =');expect(appSource).not.toContain('const [activeOrgID, setActiveOrgID] = createSignal(');+ expect(appSource).toContain('<GlobalResourceContextProvider>');+ expect(appSource).toContain('</GlobalResourceContextProvider>');});it('keeps authenticated chrome in AppLayout and hosted bootstrap in useAppRuntimeState', () => {expect(appLayoutSource).toContain('export function AppLayout(props: AppLayoutProps)');+ expect(appLayoutSource).toContain(+ "import { useGlobalResourceContext } from '@/features/globalResourceContext/GlobalResourceContext';",+ );+ expect(appLayoutSource).toContain(+ "import { GlobalResourceContextBar } from '@/features/globalResourceContext/GlobalResourceContextBar';",+ );expect(appLayoutSource).toContain('<OrgSwitcher');expect(appLayoutSource).toContain('const status = () => props.connectionStatus();');expect(appLayoutSource).toContain("status().kind === 'sync-reconnecting' || status().kind === 'reconnecting'");@@ -42,6 +53,14 @@ describe('App architecture', () => {expect(appSource).not.toContain("apiFetch('/api/security/status')");expect(appLayoutSource).not.toContain("eventBus.on('theme_changed'");expect(appLayoutSource).not.toContain("apiFetch('/api/security/status')");+ expect(appLayoutSource).toContain('const globalContext = useGlobalResourceContext();');+ expect(appLayoutSource).toContain("route: globalContext.buildPlatformRoute('infrastructure')");+ expect(appLayoutSource).toContain(+ "route: buildPathWithGlobalResourceContext('/alerts', globalContext.contextResourceId())",+ );+ expect(appLayoutSource).toContain(+ '<GlobalResourceContextBar class="border-b border-border px-4 py-2" />',+ );expect(appRuntimeStateSource).toContain('export const useAppRuntimeState = () =>');expect(appRuntimeStateSource).toContain('const connectionStatus = createMemo<AppConnectionStatus>(() => {');expect(appRuntimeStateSource).toContain('const beginAuthenticatedRuntime = async () =>');diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsxindex 4408560898..2533bf78dc 100644--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx@@ -38,6 +38,7 @@ import {createSummaryInteractiveRowPreviewHandlers,} from '@/components/shared/summaryInteractionA11y';import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';+import { useGlobalResourceContext } from '@/features/globalResourceContext/GlobalResourceContext';import {type UnifiedResourceTableProps,type UnifiedResourceTableState,@@ -54,6 +55,7 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCarprops,) => {const { table, tableProps } = props;+ const globalContext = useGlobalResourceContext();return (<Show when={table.showHostTable()}>@@ -305,6 +307,12 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCargetResourcePolicyTableBadges(resource.policy),);const workloadsHref = createMemo(() => buildWorkloadsHref(resource));+ const supportsGlobalContext = createMemo(() =>+ globalContext.canPinResource(resource),+ );+ const isGlobalContextPinned = createMemo(() =>+ globalContext.isPinnedGlobalResource(resource.id),+ );const resourceRowInteraction = createSummaryInteractiveRowPreviewHandlers({onPreview: () => tableProps.onHoverChange?.(resource.id),onPreviewClear: () => tableProps.onHoverChange?.(null),@@ -336,6 +344,19 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCaronAction={() => table.toggleExpand(resource.id)}onPreviewClear={() => tableProps.onHoverChange?.(null)}/>+ <Show when={supportsGlobalContext()}>+ <SummaryRowActionButton+ kind="context"+ subjectLabel={displayName()}+ pressed={isGlobalContextPinned()}+ onAction={() =>+ globalContext.setGlobalResourceContext(+ isGlobalContextPinned() ? null : resource,+ )+ }+ onPreviewClear={() => tableProps.onHoverChange?.(null)}+ />+ </Show><StatusDotvariant={statusIndicator().variant}title={statusIndicator().label}diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsxindex 96bc3e2afa..aa43fdbb64 100644--- a/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx@@ -7,6 +7,7 @@ import {createSummaryInteractiveRowPreviewHandlers,} from '@/components/shared/summaryInteractionA11y';import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';+import { useGlobalResourceContext } from '@/features/globalResourceContext/GlobalResourceContext';import {Table,TableBody,@@ -42,6 +43,7 @@ export const UnifiedResourcePBSTableSection: Component<UnifiedResourcePBSTableSeprops,) => {const { table, tableProps } = props;+ const globalContext = useGlobalResourceContext();return (<Show when={table.sortedPBSResources().length > 0}>@@ -140,6 +142,12 @@ export const UnifiedResourcePBSTableSection: Component<UnifiedResourcePBSTableSeonPreview: () => tableProps.onHoverChange?.(resource.id),onPreviewClear: () => tableProps.onHoverChange?.(null),});+ const supportsGlobalContext = createMemo(() =>+ globalContext.canPinResource(resource),+ );+ const isGlobalContextPinned = createMemo(() =>+ globalContext.isPinnedGlobalResource(resource.id),+ );return (<>@@ -166,6 +174,19 @@ export const UnifiedResourcePBSTableSection: Component<UnifiedResourcePBSTableSeonAction={() => table.toggleExpand(resource.id)}onPreviewClear={() => tableProps.onHoverChange?.(null)}/>+ <Show when={supportsGlobalContext()}>+ <SummaryRowActionButton+ kind="context"+ subjectLabel={displayName()}+ pressed={isGlobalContextPinned()}+ onAction={() =>+ globalContext.setGlobalResourceContext(+ isGlobalContextPinned() ? null : resource,+ )+ }+ onPreviewClear={() => tableProps.onHoverChange?.(null)}+ />+ </Show><StatusDotvariant={statusIndicator().variant}title={statusIndicator().label}diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsxindex 4e77e53a15..6821866163 100644--- a/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx@@ -7,6 +7,7 @@ import {createSummaryInteractiveRowPreviewHandlers,} from '@/components/shared/summaryInteractionA11y';import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';+import { useGlobalResourceContext } from '@/features/globalResourceContext/GlobalResourceContext';import {Table,TableBody,@@ -42,6 +43,7 @@ export const UnifiedResourcePMGTableSection: Component<UnifiedResourcePMGTableSeprops,) => {const { table, tableProps } = props;+ const globalContext = useGlobalResourceContext();return (<Show when={table.sortedPMGResources().length > 0}>@@ -157,6 +159,12 @@ export const UnifiedResourcePMGTableSection: Component<UnifiedResourcePMGTableSeonPreview: () => tableProps.onHoverChange?.(resource.id),onPreviewClear: () => tableProps.onHoverChange?.(null),});+ const supportsGlobalContext = createMemo(() =>+ globalContext.canPinResource(resource),+ );+ const isGlobalContextPinned = createMemo(() =>+ globalContext.isPinnedGlobalResource(resource.id),+ );return (<>@@ -183,6 +191,19 @@ export const UnifiedResourcePMGTableSection: Component<UnifiedResourcePMGTableSeonAction={() => table.toggleExpand(resource.id)}onPreviewClear={() => tableProps.onHoverChange?.(null)}/>+ <Show when={supportsGlobalContext()}>+ <SummaryRowActionButton+ kind="context"+ subjectLabel={displayName()}+ pressed={isGlobalContextPinned()}+ onAction={() =>+ globalContext.setGlobalResourceContext(+ isGlobalContextPinned() ? null : resource,+ )+ }+ onPreviewClear={() => tableProps.onHoverChange?.(null)}+ />+ </Show><StatusDotvariant={statusIndicator().variant}title={statusIndicator().label}diff --git a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsxindex 4272ba1fb8..19f8199f26 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx@@ -229,6 +229,20 @@ describe('UnifiedResourceTable performance contract', () => {);});+ it('keeps infrastructure global resource pinning on the shared row action and shell context contract', () => {+ expect(summaryRowActionButtonSource).toContain("kind: 'context'");++ for (const source of [+ unifiedResourceHostTableCardSource,+ unifiedResourcePBSTableSectionSource,+ unifiedResourcePMGTableSectionSource,+ ]) {+ expect(source).toContain('useGlobalResourceContext');+ expect(source).toContain('SummaryRowActionButton');+ expect(source).toContain('kind="context"');+ }+ });+it('keeps infrastructure summary fetch runtime out of the render shell', () => {expect(infrastructureSummarySource).toContain('useInfrastructureSummaryState');expect(infrastructureSummarySource).not.toContain('fetchInfrastructureSummaryAndCache');diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsxindex ccfeab131a..a0c2dc7ad5 100644--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx@@ -785,6 +785,21 @@ describe('Recovery', () => {expect(within(detailsPanel as HTMLTableCellElement).getByText('Finance')).toBeInTheDocument();});+ it('preserves the shell global resource context when focusing recovery history', async () => {+ mockLocationSearch = '?contextResource=agent%3Apve-01';+ render(() => <Recovery />);++ const item = await screen.findByText('VM 123');+ fireEvent.click(item);++ await waitFor(() => {+ expect(navigateSpy).toHaveBeenCalledWith(+ '/recovery?rollupId=res%3Avm-123&contextResource=agent%3Apve-01',+ ROUTE_STATE_REPLACE_OPTIONS,+ );+ });+ });+it('keeps optional history placement columns on the neutral recovery vocabulary', async () => {facetsPayload.clusters = ['lab-cluster'];facetsPayload.nodesAgents = ['pve-01'];diff --git a/frontend-modern/src/components/Storage/DiskList.tsx b/frontend-modern/src/components/Storage/DiskList.tsxindex cac9c074d6..dc086dfa3e 100644--- a/frontend-modern/src/components/Storage/DiskList.tsx+++ b/frontend-modern/src/components/Storage/DiskList.tsx@@ -5,6 +5,7 @@ import {createSummaryInteractiveRowPreviewHandlers,} from '@/components/shared/summaryInteractionA11y';import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';+import { useGlobalResourceContext } from '@/features/globalResourceContext/GlobalResourceContext';import { resolvePhysicalDiskMetricResourceId } from '@/features/storageBackups/storageMetricsIdentity';import {Table,@@ -84,6 +85,7 @@ interface DiskListProps {}export const DiskList: Component<DiskListProps> = (props) => {+ const globalContext = useGlobalResourceContext();const model = useDiskListModel({disks: () => props.disks,nodes: () => props.nodes,@@ -172,6 +174,9 @@ export const DiskList: Component<DiskListProps> = (props) => {const isSummaryHighlighted = () =>props.highlightedSummarySeriesId === summarySeriesId;const detailControlsId = buildSummaryDisclosureControlsId(summarySeriesId);+ const supportsGlobalContext = () => globalContext.canPinResourceId(disk.id);+ const isGlobalContextPinned = () =>+ globalContext.isPinnedGlobalResource(disk.id);const interactiveRowHandlers = createSummaryInteractiveRowPreviewHandlers({onPreview: () => props.onHoverChange?.(disk.id),onPreviewClear: () => props.onHoverChange?.(null),@@ -204,6 +209,19 @@ export const DiskList: Component<DiskListProps> = (props) => {onAction={() => model.toggleSelectedDisk(disk)}onPreviewClear={() => props.onHoverChange?.(null)}/>+ <Show when={supportsGlobalContext()}>+ <SummaryRowActionButton+ kind="context"+ subjectLabel={data.model || 'disk'}+ pressed={isGlobalContextPinned()}+ onAction={() =>+ globalContext.setGlobalResourceContextById(+ isGlobalContextPinned() ? null : disk.id,+ )+ }+ onPreviewClear={() => props.onHoverChange?.(null)}+ />+ </Show><spanclass={PHYSICAL_DISK_NAME_TEXT_CLASS}title={data.devPath || data.model || disk.name || 'Unknown Disk'}diff --git a/frontend-modern/src/components/Storage/StoragePoolRow.tsx b/frontend-modern/src/components/Storage/StoragePoolRow.tsxindex 4a962e567a..3ca3c7af92 100644--- a/frontend-modern/src/components/Storage/StoragePoolRow.tsx+++ b/frontend-modern/src/components/Storage/StoragePoolRow.tsx@@ -36,6 +36,7 @@ import {createSummaryInteractiveRowPreviewHandlers,} from '@/components/shared/summaryInteractionA11y';import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';+import { useGlobalResourceContext } from '@/features/globalResourceContext/GlobalResourceContext';interface StoragePoolRowProps {record: StorageRecord;@@ -56,10 +57,18 @@ interface StoragePoolRowProps {}export const StoragePoolRow: Component<StoragePoolRowProps> = (props) => {+ const globalContext = useGlobalResourceContext();const row = createMemo(() => buildStoragePoolRowModel(props.record));const detailControlsId = createMemo(() =>buildSummaryDisclosureControlsId(props.summarySeriesId),);+ const globalContextResourceId = createMemo(() => props.record.refs?.resourceId || props.record.id);+ const supportsGlobalContext = createMemo(() =>+ globalContext.canPinResourceId(globalContextResourceId()),+ );+ const isGlobalContextPinned = createMemo(() =>+ globalContext.isPinnedGlobalResource(globalContextResourceId()),+ );const interactiveRowHandlers = createSummaryInteractiveRowPreviewHandlers({onPreview: () => props.onHoverChange?.(props.summarySeriesId),onPreviewClear: () => props.onHoverChange?.(null),@@ -86,6 +95,19 @@ export const StoragePoolRow: Component<StoragePoolRowProps> = (props) => {onAction={props.onToggleExpand}onPreviewClear={() => props.onHoverChange?.(null)}/>+ <Show when={supportsGlobalContext()}>+ <SummaryRowActionButton+ kind="context"+ subjectLabel={props.record.name}+ pressed={isGlobalContextPinned()}+ onAction={() =>+ globalContext.setGlobalResourceContextById(+ isGlobalContextPinned() ? null : globalContextResourceId(),+ )+ }+ onPreviewClear={() => props.onHoverChange?.(null)}+ />+ </Show><span class={STORAGE_POOL_ROW_NAME_TEXT_CLASS} title={props.record.name}>{props.record.name}</span>diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsxindex 8e35e9a219..92f4fd7cdf 100644--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx@@ -3,6 +3,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { ChartsAPI } from '@/api/charts';import StorageSummary from '@/components/Storage/StorageSummary';import storageSummarySource from '@/components/Storage/StorageSummary.tsx?raw';+import storagePoolRowSource from '@/components/Storage/StoragePoolRow.tsx?raw';+import diskListSource from '@/components/Storage/DiskList.tsx?raw';import type { Alert } from '@/types/api';import type { Resource, ResourceType } from '@/types/resource';import Storage from '@/components/Storage/Storage';@@ -380,6 +382,15 @@ describe('Storage', () => {expect(screen.queryByText('Local-LVM-PVE2')).not.toBeInTheDocument();});+ it('keeps storage global resource pinning on the shared row action contract', () => {+ expect(storagePoolRowSource).toContain('useGlobalResourceContext');+ expect(storagePoolRowSource).toContain('SummaryRowActionButton');+ expect(storagePoolRowSource).toContain('kind="context"');+ expect(diskListSource).toContain('useGlobalResourceContext');+ expect(diskListSource).toContain('SummaryRowActionButton');+ expect(diskListSource).toContain('kind="context"');+ });+it('routes hovered pool rows into the shared summary highlight contract and keeps the summary sticky', async () => {const storageSummarySpy = vi.spyOn(ChartsAPI, 'getStorageSummaryCharts').mockResolvedValue({pools: {diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 2ace8f4031..648824957d 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -415,10 +415,13 @@ describe('shared primitive guardrails', () => {expect(summaryRowActionButtonSource).toContain('SummaryRowActionButton');expect(summaryRowActionButtonSource).toContain("kind: 'disclosure'");expect(summaryRowActionButtonSource).toContain("kind: 'scope'");+ expect(summaryRowActionButtonSource).toContain("kind: 'context'");expect(summaryRowActionButtonSource).toContain('aria-controls');expect(summaryRowActionButtonSource).toContain('aria-expanded');expect(summaryRowActionButtonSource).toContain('aria-pressed');expect(summaryRowActionButtonSource).toContain('data-row-action="true"');+ expect(summaryRowActionButtonSource).toContain('Set global context to');+ expect(summaryRowActionButtonSource).toContain('Clear global context for');for (const source of [workloadPanelSource,@@ -434,6 +437,17 @@ describe('shared primitive guardrails', () => {expect(source).toContain('SummaryRowActionButton');}+ for (const source of [+ storagePoolRowSource,+ diskListSource,+ unifiedResourceHostTableCardSource,+ unifiedResourcePBSTableSectionSource,+ unifiedResourcePMGTableSectionSource,+ ]) {+ expect(source).toContain('useGlobalResourceContext');+ expect(source).toContain('kind="context"');+ }+expect(nodeGroupHeaderSource).toContain('event.stopPropagation()');});diff --git a/frontend-modern/src/components/shared/SummaryRowActionButton.tsx b/frontend-modern/src/components/shared/SummaryRowActionButton.tsxindex 4208fad038..647ae1cd77 100644--- a/frontend-modern/src/components/shared/SummaryRowActionButton.tsx+++ b/frontend-modern/src/components/shared/SummaryRowActionButton.tsx@@ -23,6 +23,14 @@ type SummaryRowActionButtonProps =activeLabel?: string;onAction: () => void;onPreviewClear?: () => void;+ }+ | {+ kind: 'context';+ pressed: boolean;+ subjectLabel: string;+ class?: string;+ onAction: () => void;+ onPreviewClear?: () => void;};const DISCLOSURE_BUTTON_CLASS = [@@ -37,6 +45,12 @@ const SCOPE_BUTTON_CLASS = [SUMMARY_ROW_ACTION_BUTTON_FOCUS_CLASS,].join(' ');+const CONTEXT_BUTTON_CLASS = [+ 'inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted transition-colors',+ 'hover:bg-surface hover:text-sky-700 dark:hover:text-sky-300',+ SUMMARY_ROW_ACTION_BUTTON_FOCUS_CLASS,+].join(' ');+export const SummaryRowActionButton: Component<SummaryRowActionButtonProps> = (props) => {const disclosureLabel = () =>props.expanded ? `Collapse ${props.subjectLabel}` : `Expand ${props.subjectLabel}`;@@ -44,17 +58,33 @@ export const SummaryRowActionButton: Component<SummaryRowActionButtonProps> = (pprops.pressed? `Unpin summary scope for ${props.subjectLabel}`: `Pin summary scope for ${props.subjectLabel}`;+ const contextLabel = () =>+ props.pressed+ ? `Clear global context for ${props.subjectLabel}`+ : `Set global context to ${props.subjectLabel}`;return (<buttontype="button"data-row-action="true"- class={`${props.kind === 'disclosure' ? DISCLOSURE_BUTTON_CLASS : SCOPE_BUTTON_CLASS} ${props.class ?? ''}`.trim()}- aria-label={props.kind === 'disclosure' ? disclosureLabel() : scopeLabel()}+ class={`${props.kind === 'disclosure' ? DISCLOSURE_BUTTON_CLASS : props.kind === 'scope' ? SCOPE_BUTTON_CLASS : CONTEXT_BUTTON_CLASS} ${props.class ?? ''}`.trim()}+ aria-label={+ props.kind === 'disclosure'+ ? disclosureLabel()+ : props.kind === 'scope'+ ? scopeLabel()+ : contextLabel()+ }aria-expanded={props.kind === 'disclosure' ? props.expanded : undefined}aria-controls={props.kind === 'disclosure' ? props.controlsId : undefined}- aria-pressed={props.kind === 'scope' ? props.pressed : undefined}- title={props.kind === 'disclosure' ? disclosureLabel() : scopeLabel()}+ aria-pressed={props.kind !== 'disclosure' ? props.pressed : undefined}+ title={+ props.kind === 'disclosure'+ ? disclosureLabel()+ : props.kind === 'scope'+ ? scopeLabel()+ : contextLabel()+ }onClick={(event) => {event.stopPropagation();props.onAction();@@ -65,7 +95,7 @@ export const SummaryRowActionButton: Component<SummaryRowActionButtonProps> = (p})}><Show- when={props.kind === 'scope'}+ when={props.kind !== 'disclosure'}fallback={<svgclass={`h-3.5 w-3.5 transition-transform duration-150 ${props.expanded ? 'rotate-90 text-base-content' : ''}`.trim()}@@ -83,11 +113,31 @@ export const SummaryRowActionButton: Component<SummaryRowActionButtonProps> = (p</svg>}>- <span- class={`whitespace-nowrap ${props.pressed ? 'border-sky-200 bg-sky-50 px-0 py-0 text-sky-700 dark:border-sky-900/60 dark:bg-sky-950/40 dark:text-sky-300' : ''}`.trim()}+ <Show+ when={props.kind === 'scope'}+ fallback={+ <svg+ class={`h-3.5 w-3.5 ${props.pressed ? 'text-sky-600 dark:text-sky-300' : ''}`.trim()}+ fill={props.pressed ? 'currentColor' : 'none'}+ viewBox="0 0 24 24"+ stroke="currentColor"+ stroke-width="1.8"+ aria-hidden="true"+ >+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M12 17.25V21m0-3.75L8.25 13.5m3.75 3.75L15.75 13.5M6 3.75h12a.75.75 0 01.75.75v1.086a3 3 0 01-.879 2.121l-3.242 3.243a3 3 0 00-.879 2.12V15a.75.75 0 01-.75.75h-2.5a.75.75 0 01-.75-.75v-1.257a3 3 0 00-.879-2.12L5.629 7.707A3 3 0 014.75 5.586V4.5A.75.75 0 015.5 3.75z"+ />+ </svg>+ }>- {props.pressed ? (props.activeLabel ?? 'Pinned') : (props.inactiveLabel ?? 'Scope')}- </span>+ <span+ class={`whitespace-nowrap ${props.pressed ? 'border-sky-200 bg-sky-50 px-0 py-0 text-sky-700 dark:border-sky-900/60 dark:bg-sky-950/40 dark:text-sky-300' : ''}`.trim()}+ >+ {props.pressed ? (props.activeLabel ?? 'Pinned') : (props.inactiveLabel ?? 'Scope')}+ </span>+ </Show></Show></button>);diff --git a/frontend-modern/src/components/shared/__tests__/SummaryRowActionButton.test.tsx b/frontend-modern/src/components/shared/__tests__/SummaryRowActionButton.test.tsxindex c4a221b76c..8ce3743a9a 100644--- a/frontend-modern/src/components/shared/__tests__/SummaryRowActionButton.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/SummaryRowActionButton.test.tsx@@ -44,6 +44,26 @@ describe('SummaryRowActionButton', () => {expect(onAction).toHaveBeenCalledTimes(1);});+ it('owns global context pin semantics with aria-pressed', () => {+ const onAction = vi.fn();+ render(() => (+ <SummaryRowActionButton+ kind="context"+ subjectLabel="pve1"+ pressed={false}+ onAction={onAction}+ />+ ));++ const button = screen.getByRole('button', {+ name: 'Set global context to pve1',+ });+ expect(button).toHaveAttribute('aria-pressed', 'false');++ fireEvent.click(button);+ expect(onAction).toHaveBeenCalledTimes(1);+ });+it('clears preview and blurs on Escape', () => {const onPreviewClear = vi.fn();render(() => (diff --git a/frontend-modern/src/features/globalResourceContext/GlobalResourceContext.tsx b/frontend-modern/src/features/globalResourceContext/GlobalResourceContext.tsxnew file mode 100644index 0000000000..3330a25e24--- /dev/null+++ b/frontend-modern/src/features/globalResourceContext/GlobalResourceContext.tsx@@ -0,0 +1,204 @@+import {+ createContext,+ createEffect,+ createMemo,+ onCleanup,+ untrack,+ useContext,+ type Accessor,+ type JSX,+} from 'solid-js';+import { useLocation, useNavigate } from '@solidjs/router';++import {+ buildPathWithGlobalResourceContext,+ parseGlobalResourceContextSearch,+} from '@/routing/resourceLinks';+import { useStorageRecoveryResources, useUnifiedResources } from '@/hooks/useUnifiedResources';+import type { Resource } from '@/types/resource';+import { getPreferredResourceDisplayName } from '@/utils/resourceIdentity';+import { createRouteStateNavigateScheduler } from '@/utils/routeStateNavigation';+import {+ buildGlobalResourceContextBasePath,+ buildSurfacePathWithGlobalResourceContext,+ resolveGlobalResourceContextClearTarget,+ resolveGlobalResourceContextSurface,+} from './globalResourceContextModel';++export interface GlobalResourceContextValue {+ canPinResource: (resource: Resource | null | undefined) => boolean;+ canPinResourceId: (resourceId: string | null | undefined) => boolean;+ clearGlobalResourceContext: () => void;+ contextLabel: Accessor<string | null>;+ contextResource: Accessor<Resource | null>;+ contextResourceId: Accessor<string | null>;+ hasGlobalResourceContext: Accessor<boolean>;+ isPinnedGlobalResource: (resourceId: string | null | undefined) => boolean;+ setGlobalResourceContext: (resource: Resource | null | undefined) => void;+ setGlobalResourceContextById: (resourceId: string | null | undefined) => void;+ buildPlatformRoute: (+ surface: 'dashboard' | 'infrastructure' | 'workloads' | 'storage' | 'recovery',+ ) => string;+}++const EMPTY_CONTEXT_ACCESSOR = () => null;+const EMPTY_FALSE_ACCESSOR = () => false;++const DEFAULT_GLOBAL_RESOURCE_CONTEXT: GlobalResourceContextValue = {+ canPinResource: () => false,+ canPinResourceId: () => false,+ clearGlobalResourceContext: () => undefined,+ contextLabel: EMPTY_CONTEXT_ACCESSOR,+ contextResource: EMPTY_CONTEXT_ACCESSOR,+ contextResourceId: EMPTY_CONTEXT_ACCESSOR,+ hasGlobalResourceContext: EMPTY_FALSE_ACCESSOR,+ isPinnedGlobalResource: () => false,+ setGlobalResourceContext: () => undefined,+ setGlobalResourceContextById: () => undefined,+ buildPlatformRoute: (surface) => buildGlobalResourceContextBasePath(surface),+};++const GlobalResourceContext = createContext<GlobalResourceContextValue>(+ DEFAULT_GLOBAL_RESOURCE_CONTEXT,+);++export const useGlobalResourceContext = (): GlobalResourceContextValue =>+ useContext(GlobalResourceContext) ?? DEFAULT_GLOBAL_RESOURCE_CONTEXT;++export function GlobalResourceContextProvider(props: { children: JSX.Element }) {+ const location = useLocation();+ const navigate = useNavigate();+ const routeStateNavigate = createRouteStateNavigateScheduler(+ navigate,+ () => `${untrack(() => location.pathname)}${untrack(() => location.search || '')}`,+ );++ const shellResources = useUnifiedResources();+ const storageRecoveryResources = useStorageRecoveryResources();++ const resourcesById = createMemo(() => {+ const resources = new Map<string, Resource>();+ for (const resource of shellResources.resources() || []) {+ if (resource?.id) resources.set(resource.id, resource);+ }+ for (const resource of storageRecoveryResources.resources() || []) {+ if (resource?.id) resources.set(resource.id, resource);+ }+ return resources;+ });++ const contextResourceId = createMemo<string | null>(() => {+ const parsed = parseGlobalResourceContextSearch(location.search || '');+ return parsed.resource || null;+ });++ const contextResource = createMemo<Resource | null>(() => {+ const resourceId = contextResourceId();+ if (!resourceId) return null;+ return resourcesById().get(resourceId) ?? null;+ });++ const contextLabel = createMemo(() => {+ const resource = contextResource();+ if (resource) {+ return getPreferredResourceDisplayName(resource) || resource.id;+ }+ return contextResourceId();+ });++ const hasGlobalResourceContext = createMemo(() => Boolean(contextResourceId()));++ const scheduleCurrentPathWithContext = (resourceId: string | null) => {+ const currentPath = `${location.pathname}${location.search || ''}`;+ const nextPath = buildPathWithGlobalResourceContext(currentPath, resourceId);+ if (nextPath === currentPath) {+ return;+ }+ routeStateNavigate.schedule(nextPath);+ };++ const clearGlobalResourceContext = () => {+ const currentPath = `${location.pathname}${location.search || ''}`;+ const nextPath = resolveGlobalResourceContextClearTarget({+ currentPath,+ resource: contextResource(),+ });+ if (!nextPath || nextPath === currentPath) {+ return;+ }+ routeStateNavigate.schedule(nextPath);+ };++ const setGlobalResourceContext = (resource: Resource | null | undefined) => {+ scheduleCurrentPathWithContext(resource?.id ?? null);+ };+ const setGlobalResourceContextById = (resourceId: string | null | undefined) => {+ const normalizedResourceId = resourceId?.trim() || null;+ if (!normalizedResourceId || !resourcesById().has(normalizedResourceId)) {+ scheduleCurrentPathWithContext(null);+ return;+ }+ scheduleCurrentPathWithContext(normalizedResourceId);+ };++ const buildPlatformRoute: GlobalResourceContextValue['buildPlatformRoute'] = (surface) => {+ const resource = contextResource();+ if (!resource) {+ return buildGlobalResourceContextBasePath(surface);+ }+ return buildSurfacePathWithGlobalResourceContext(surface, resource);+ };++ const canPinResource = (resource: Resource | null | undefined): boolean =>+ Boolean(resource?.id?.trim() && resourcesById().has(resource.id.trim()));+ const canPinResourceId = (resourceId: string | null | undefined): boolean =>+ Boolean(resourceId?.trim() && resourcesById().has(resourceId.trim()));++ const isPinnedGlobalResource = (resourceId: string | null | undefined): boolean =>+ Boolean(resourceId && contextResourceId() === resourceId.trim());++ createEffect(() => {+ const resource = contextResource();+ if (!resource) {+ return;+ }+ const currentPath = `${location.pathname}${location.search || ''}`;+ const surface = resolveGlobalResourceContextSurface(location.pathname);+ if (!surface) {+ return;+ }++ const targetBasePath = buildGlobalResourceContextBasePath(surface);+ const pathWithoutContext = buildPathWithGlobalResourceContext(currentPath, null);+ if (pathWithoutContext !== targetBasePath) {+ return;+ }++ const nextPath = buildPlatformRoute(surface);+ if (nextPath !== currentPath) {+ routeStateNavigate.schedule(nextPath);+ }+ });++ onCleanup(() => {+ routeStateNavigate.cleanup();+ });++ const value: GlobalResourceContextValue = {+ canPinResource,+ canPinResourceId,+ clearGlobalResourceContext,+ contextLabel,+ contextResource,+ contextResourceId,+ hasGlobalResourceContext,+ isPinnedGlobalResource,+ setGlobalResourceContext,+ setGlobalResourceContextById,+ buildPlatformRoute,+ };++ return (+ <GlobalResourceContext.Provider value={value}>{props.children}</GlobalResourceContext.Provider>+ );+}diff --git a/frontend-modern/src/features/globalResourceContext/GlobalResourceContextBar.tsx b/frontend-modern/src/features/globalResourceContext/GlobalResourceContextBar.tsxnew file mode 100644index 0000000000..63427fefda--- /dev/null+++ b/frontend-modern/src/features/globalResourceContext/GlobalResourceContextBar.tsx@@ -0,0 +1,38 @@+import { Show, type Component } from 'solid-js';+import { useGlobalResourceContext } from './GlobalResourceContext';++export const GlobalResourceContextBar: Component<{ class?: string }> = (props) => {+ const globalContext = useGlobalResourceContext();++ return (+ <Show when={globalContext.hasGlobalResourceContext()}>+ <div+ class={`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 px-1 py-1 ${props.class ?? ''}`.trim()}+ data-global-resource-context="true"+ >+ <span class="shrink-0 text-[11px] font-semibold tracking-[0.01em] text-sky-700 dark:text-sky-300">+ Context+ </span>+ <span+ class="min-w-0 truncate text-sm font-medium text-base-content"+ title={globalContext.contextLabel() ?? undefined}+ >+ {globalContext.contextLabel()}+ </span>+ <span class="min-w-0 truncate text-xs text-muted">+ Scoped across platform views+ </span>+ <button+ type="button"+ aria-label="Clear global context"+ class="ml-auto shrink-0 text-xs font-medium text-muted transition-colors hover:text-base-content focus-visible:text-base-content"+ onClick={() => globalContext.clearGlobalResourceContext()}+ >+ Clear+ </button>+ </div>+ </Show>+ );+};++export default GlobalResourceContextBar;diff --git a/frontend-modern/src/features/globalResourceContext/__tests__/globalResourceContextModel.test.ts b/frontend-modern/src/features/globalResourceContext/__tests__/globalResourceContextModel.test.tsnew file mode 100644index 0000000000..df016c4651--- /dev/null+++ b/frontend-modern/src/features/globalResourceContext/__tests__/globalResourceContextModel.test.ts@@ -0,0 +1,88 @@+import { describe, expect, it } from 'vitest';++import type { Resource } from '@/types/resource';+import {+ areGlobalResourceContextPathsEquivalent,+ buildGlobalResourceContextBasePath,+ buildGlobalResourceContextScopedPath,+ buildSurfacePathWithGlobalResourceContext,+ resolveGlobalResourceContextClearTarget,+ resolveGlobalResourceContextSurface,+} from '@/features/globalResourceContext/globalResourceContextModel';++const makeAgent = (overrides: Partial<Resource> = {}): Resource =>+ ({+ id: 'pve-1',+ type: 'agent',+ name: 'pve1',+ displayName: 'pve1',+ platformId: 'pve-1',+ platformType: 'proxmox-pve',+ sourceType: 'agent',+ status: 'online',+ lastSeen: Date.now(),+ ...overrides,+ }) as Resource;++describe('globalResourceContextModel', () => {+ it('resolves canonical surfaces from platform paths', () => {+ expect(resolveGlobalResourceContextSurface('/dashboard')).toBe('dashboard');+ expect(resolveGlobalResourceContextSurface('/infrastructure')).toBe('infrastructure');+ expect(resolveGlobalResourceContextSurface('/workloads')).toBe('workloads');+ expect(resolveGlobalResourceContextSurface('/storage')).toBe('storage');+ expect(resolveGlobalResourceContextSurface('/ceph')).toBe('storage');+ expect(resolveGlobalResourceContextSurface('/recovery')).toBe('recovery');+ expect(resolveGlobalResourceContextSurface('/settings')).toBeNull();+ });++ it('builds scoped platform paths from a canonical pinned resource', () => {+ const resource = makeAgent();+ expect(buildGlobalResourceContextBasePath('storage')).toBe('/storage');+ expect(buildGlobalResourceContextScopedPath('infrastructure', resource)).toBe(+ '/infrastructure?resource=pve-1',+ );+ expect(buildGlobalResourceContextScopedPath('workloads', resource)).toBe(+ '/workloads?agent=pve1',+ );+ expect(buildGlobalResourceContextScopedPath('storage', resource)).toBe(+ '/storage?source=proxmox-pve&node=pve-1',+ );+ expect(buildGlobalResourceContextScopedPath('recovery', resource)).toBe(+ '/recovery?platform=proxmox-pve&node=pve-1',+ );+ });++ it('adds the canonical global context query param to scoped surface routes', () => {+ expect(buildSurfacePathWithGlobalResourceContext('dashboard', makeAgent())).toBe(+ '/dashboard?contextResource=pve-1',+ );+ expect(buildSurfacePathWithGlobalResourceContext('storage', makeAgent())).toBe(+ '/storage?source=proxmox-pve&node=pve-1&contextResource=pve-1',+ );+ });++ it('treats paths with equivalent local filters as equal when only query ordering differs', () => {+ expect(+ areGlobalResourceContextPathsEquivalent(+ '/storage?source=proxmox-pve&node=pve-1&contextResource=pve-1',+ '/storage?node=pve-1&contextResource=pve-1&source=proxmox-pve',+ ),+ ).toBe(true);+ });++ it('clears back to the base platform path when the current route is only context-derived', () => {+ const target = resolveGlobalResourceContextClearTarget({+ currentPath: '/storage?source=proxmox-pve&node=pve-1&contextResource=pve-1',+ resource: makeAgent(),+ });+ expect(target).toBe('/storage');+ });++ it('only strips the context param when the page has diverged from the derived scoped path', () => {+ const target = resolveGlobalResourceContextClearTarget({+ currentPath: '/storage?source=proxmox-pve&node=pve-1&q=tank&contextResource=pve-1',+ resource: makeAgent(),+ });+ expect(target).toBe('/storage?source=proxmox-pve&node=pve-1&q=tank');+ });+});diff --git a/frontend-modern/src/features/globalResourceContext/globalResourceContextModel.ts b/frontend-modern/src/features/globalResourceContext/globalResourceContextModel.tsnew file mode 100644index 0000000000..f1379c3e8e--- /dev/null+++ b/frontend-modern/src/features/globalResourceContext/globalResourceContextModel.ts@@ -0,0 +1,122 @@+import { DASHBOARD_PATH } from '@/routing/resourceLinks';+import {+ buildInfrastructurePath,+ buildInfrastructureResourceHref,+ buildPathWithGlobalResourceContext,+ buildRecoveryHrefForResource,+ buildRecoveryPath,+ buildStorageHrefForResource,+ buildStoragePath,+ buildWorkloadsHrefForResource,+ buildWorkloadsPath,+ stripGlobalResourceContextFromPath,+} from '@/routing/resourceLinks';+import type { Resource } from '@/types/resource';+import { areSearchParamsEquivalent } from '@/utils/searchParams';++export type GlobalResourceContextSurface =+ | 'dashboard'+ | 'infrastructure'+ | 'workloads'+ | 'storage'+ | 'recovery';++const normalizePath = (path: string): string => {+ const url = new URL(path, 'http://pulse.local');+ const search = url.searchParams.toString();+ return `${url.pathname}${search ? `?${search}` : ''}`;+};++export const resolveGlobalResourceContextSurface = (+ pathname: string,+): GlobalResourceContextSurface | null => {+ if (pathname.startsWith('/dashboard')) return 'dashboard';+ if (pathname.startsWith('/infrastructure')) return 'infrastructure';+ if (pathname.startsWith('/workloads')) return 'workloads';+ if (pathname.startsWith('/storage') || pathname.startsWith('/ceph')) return 'storage';+ if (pathname.startsWith('/recovery')) return 'recovery';+ return null;+};++export const buildGlobalResourceContextBasePath = (+ surface: GlobalResourceContextSurface,+): string => {+ switch (surface) {+ case 'dashboard':+ return DASHBOARD_PATH;+ case 'infrastructure':+ return buildInfrastructurePath();+ case 'workloads':+ return buildWorkloadsPath();+ case 'storage':+ return buildStoragePath();+ case 'recovery':+ return buildRecoveryPath();+ }+};++export const buildGlobalResourceContextScopedPath = (+ surface: GlobalResourceContextSurface,+ resource: Resource | null | undefined,+): string => {+ if (!resource) {+ return buildGlobalResourceContextBasePath(surface);+ }++ switch (surface) {+ case 'dashboard':+ return DASHBOARD_PATH;+ case 'infrastructure':+ return buildInfrastructureResourceHref(resource.id) ?? buildInfrastructurePath();+ case 'workloads':+ return buildWorkloadsHrefForResource(resource) ?? buildWorkloadsPath();+ case 'storage':+ return buildStorageHrefForResource(resource) ?? buildStoragePath();+ case 'recovery':+ return buildRecoveryHrefForResource(resource) ?? buildRecoveryPath();+ }+};++export const buildSurfacePathWithGlobalResourceContext = (+ surface: GlobalResourceContextSurface,+ resource: Resource | null | undefined,+): string =>+ buildPathWithGlobalResourceContext(+ buildGlobalResourceContextScopedPath(surface, resource),+ resource?.id ?? null,+ );++export const areGlobalResourceContextPathsEquivalent = (+ leftPath: string,+ rightPath: string,+): boolean => {+ const leftUrl = new URL(stripGlobalResourceContextFromPath(leftPath), 'http://pulse.local');+ const rightUrl = new URL(stripGlobalResourceContextFromPath(rightPath), 'http://pulse.local');+ if (leftUrl.pathname !== rightUrl.pathname) {+ return false;+ }+ return areSearchParamsEquivalent(leftUrl.searchParams, rightUrl.searchParams);+};++export const resolveGlobalResourceContextClearTarget = (options: {+ currentPath: string;+ resource: Resource | null | undefined;+}): string | null => {+ const surface = resolveGlobalResourceContextSurface(+ new URL(options.currentPath, 'http://pulse.local').pathname,+ );+ if (!surface) {+ const stripped = stripGlobalResourceContextFromPath(options.currentPath);+ return normalizePath(stripped) === normalizePath(options.currentPath) ? null : stripped;+ }++ const strippedCurrentPath = stripGlobalResourceContextFromPath(options.currentPath);+ const scopedPath = buildGlobalResourceContextScopedPath(surface, options.resource);+ if (areGlobalResourceContextPathsEquivalent(strippedCurrentPath, scopedPath)) {+ return buildGlobalResourceContextBasePath(surface);+ }++ return normalizePath(strippedCurrentPath) === normalizePath(options.currentPath)+ ? null+ : strippedCurrentPath;+};diff --git a/frontend-modern/src/features/recovery/useRecoverySurfaceState.ts b/frontend-modern/src/features/recovery/useRecoverySurfaceState.tsindex ce2cf19cd8..7156dc4d1a 100644--- a/frontend-modern/src/features/recovery/useRecoverySurfaceState.ts+++ b/frontend-modern/src/features/recovery/useRecoverySurfaceState.ts@@ -6,7 +6,12 @@ import { useRecoveryRollups } from '@/hooks/useRecoveryRollups';import { useRecoveryPoints } from '@/hooks/useRecoveryPoints';import { useRecoveryPointsFacets } from '@/hooks/useRecoveryPointsFacets';import { useRecoveryPointsSeries } from '@/hooks/useRecoveryPointsSeries';-import { buildRecoveryPath, parseRecoveryLinkSearch } from '@/routing/resourceLinks';+import {+ buildPathWithGlobalResourceContext,+ buildRecoveryPath,+ parseGlobalResourceContextSearch,+ parseRecoveryLinkSearch,+} from '@/routing/resourceLinks';import type { ProtectionRollup, RecoveryOutcome } from '@/types/recovery';import type { Resource } from '@/types/resource';import { createRouteStateNavigateScheduler } from '@/utils/routeStateNavigation';@@ -406,7 +411,8 @@ export function useRecoverySurfaceState() {const currentPath = `${location.pathname}${location.search || ''}`;if (hydratedLocationKey() !== currentPath) return;- const nextPath = buildRecoveryPath({+ const nextPath = buildPathWithGlobalResourceContext(+ buildRecoveryPath({rollupId: rid || null,view: workspaceView() !== defaultView ? workspaceView() : null,query: queryFilter().trim() || null,@@ -422,7 +428,9 @@ export function useRecoverySurfaceState() {scope: scopeFilter() === 'workload' ? 'workload' : null,node: nodeFilter() !== 'all' ? nodeFilter() : null,namespace: namespaceFilter() !== 'all' ? namespaceFilter() : null,- });+ }),+ parseGlobalResourceContextSearch(location.search || '').resource || null,+ );if (nextPath !== currentPath) {routeStateNavigate.schedule(nextPath);diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.tsindex 7a970582ca..6484972740 100644--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts@@ -1,8 +1,10 @@import { describe, expect, it } from 'vitest';import type { WorkloadGuest } from '@/types/workloads';import {+ GLOBAL_CONTEXT_QUERY_PARAMS,PMG_THRESHOLDS_PATH,RECOVERY_QUERY_PARAMS,+ buildPathWithGlobalResourceContext,buildInfrastructureResourceLink,buildInfrastructureHrefForWorkload,buildRecoveryPath,@@ -15,11 +17,13 @@ import {buildStoragePath,buildWorkloadsHrefForResource,buildWorkloadsPath,+ parseGlobalResourceContextSearch,parseRecoveryLinkSearch,INFRASTRUCTURE_QUERY_PARAMS,parseStorageLinkSearch,parseInfrastructureLinkSearch,parseWorkloadsLinkSearch,+ stripGlobalResourceContextFromPath,STORAGE_QUERY_PARAMS,WORKLOADS_QUERY_PARAMS,} from '@/routing/resourceLinks';@@ -84,6 +88,16 @@ describe('resource link routing contract', () => {expect(WORKLOADS_QUERY_PARAMS.summaryGroup).toBe('summaryGroup');});+ it('builds and parses the canonical global resource context query param', () => {+ const scoped = buildPathWithGlobalResourceContext('/workloads?type=vm', 'agent:pve1');+ expect(scoped).toBe('/workloads?type=vm&contextResource=agent%3Apve1');+ expect(parseGlobalResourceContextSearch(scoped.slice('/workloads'.length))).toEqual({+ resource: 'agent:pve1',+ });+ expect(stripGlobalResourceContextFromPath(scoped)).toBe('/workloads?type=vm');+ expect(GLOBAL_CONTEXT_QUERY_PARAMS.resource).toBe('contextResource');+ });+it('canonicalizes legacy workloads type aliases when building links', () => {expect(buildWorkloadsPath({ type: 'docker', platform: 'docker', agent: 'runtime-1' })).toBe('/workloads?type=app-container&platform=docker&agent=runtime-1',@@ -329,6 +343,22 @@ describe('resource link routing contract', () => {expect(href).toBe('/storage?source=truenas&node=truenas-main');});+ it('builds storage deep links for proxmox agent resources', () => {+ const href = buildStorageHrefForResource({+ id: 'pve-1',+ type: 'agent',+ name: 'pve1',+ displayName: 'pve1',+ platformId: 'pve-1',+ platformType: 'proxmox-pve',+ sourceType: 'agent',+ status: 'online',+ lastSeen: Date.now(),+ } as any);++ expect(href).toBe('/storage?source=proxmox-pve&node=pve-1');+ });+it('builds storage deep links for hybrid agent resources with merged truenas sources', () => {const href = buildStorageHrefForResource({id: 'truenas-main',@@ -383,6 +413,22 @@ describe('resource link routing contract', () => {expect(href).toBe('/recovery?platform=truenas&node=truenas-main');});+ it('builds recovery deep links for proxmox agent resources', () => {+ const href = buildRecoveryHrefForResource({+ id: 'pve-1',+ type: 'agent',+ name: 'pve1',+ displayName: 'pve1',+ platformId: 'pve-1',+ platformType: 'proxmox-pve',+ sourceType: 'agent',+ status: 'online',+ lastSeen: Date.now(),+ } as any);++ expect(href).toBe('/recovery?platform=proxmox-pve&node=pve-1');+ });+it('builds canonical shared surface links for top-level truenas systems', () => {expect(buildResourceSurfaceLinksForResource(diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.tsindex 2dbe89d7e9..160cf15030 100644--- a/frontend-modern/src/routing/resourceLinks.ts+++ b/frontend-modern/src/routing/resourceLinks.ts@@ -84,6 +84,10 @@ export const RECOVERY_QUERY_PARAMS = {query: 'q',} as const;+export const GLOBAL_CONTEXT_QUERY_PARAMS = {+ resource: 'contextResource',+} as const;+const normalizeQueryValue = (value: string | null | undefined): string => (value || '').trim();const normalizeQueryBooleanFlag = (value: string | null | undefined): string => {const normalized = normalizeQueryValue(value).toLowerCase();@@ -192,6 +196,31 @@ export const parseWorkloadsLinkSearch = (search: string) => {};};+export const parseGlobalResourceContextSearch = (search: string) => {+ const params = new URLSearchParams(search);+ return {+ resource: normalizeQueryValue(params.get(GLOBAL_CONTEXT_QUERY_PARAMS.resource)),+ };+};++export const buildPathWithGlobalResourceContext = (+ path: string,+ resourceId: string | null | undefined,+): string => {+ const url = new URL(path, 'http://pulse.local');+ const normalizedResourceId = normalizeQueryValue(resourceId);+ if (normalizedResourceId) {+ url.searchParams.set(GLOBAL_CONTEXT_QUERY_PARAMS.resource, normalizedResourceId);+ } else {+ url.searchParams.delete(GLOBAL_CONTEXT_QUERY_PARAMS.resource);+ }+ const nextSearch = url.searchParams.toString();+ return `${url.pathname}${nextSearch ? `?${nextSearch}` : ''}`;+};++export const stripGlobalResourceContextFromPath = (path: string): string =>+ buildPathWithGlobalResourceContext(path, null);+export const buildWorkloadsPath = (options: WorkloadsLinkOptions = {}): string => {const params = new URLSearchParams();const type = normalizeWorkloadsType(options.type);@@ -477,6 +506,16 @@ export const buildStorageHrefForResource = (resource: Resource): string | null =});}+ if (+ resource.type === 'agent' &&+ (source === 'proxmox-pve' || source === 'proxmox-pbs' || source === 'truenas')+ ) {+ return buildStoragePath({+ source,+ node: resource.id,+ });+ }+return null;};@@ -522,6 +561,16 @@ export const buildRecoveryHrefForResource = (resource: Resource): string | null});}+ if (+ (resource.type === 'agent' || resource.type === 'pbs') &&+ (platform === 'proxmox-pve' || platform === 'proxmox-pbs')+ ) {+ return buildRecoveryPath({+ platform,+ node: resource.id,+ });+ }+return null;};diff --git a/tests/integration/tests/50-global-resource-context.spec.ts b/tests/integration/tests/50-global-resource-context.spec.tsnew file mode 100644index 0000000000..89a1dfccae--- /dev/null+++ b/tests/integration/tests/50-global-resource-context.spec.ts@@ -0,0 +1,126 @@+import fs from "node:fs";+import path from "node:path";+import { fileURLToPath } from "node:url";+import { expect, test as base } from "@playwright/test";++import {+ createAuthenticatedStorageState,+ getMockMode,+ setMockMode,+} from "./helpers";++const __dirname = path.dirname(fileURLToPath(import.meta.url));++type WorkerFixtures = {+ authStorageStatePath: string;+};++let mockModeWasEnabled: boolean | null = null;++const escapeRegExp = (value: string): string =>+ value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");++const test = base.extend<Record<string, never>, WorkerFixtures>({+ storageState: async ({ authStorageStatePath }, use) => {+ await use(authStorageStatePath);+ },+ authStorageStatePath: [+ async ({ browser }, use, workerInfo) => {+ const storageStatePath = path.resolve(+ __dirname,+ "..",+ "..",+ "tmp",+ "playwright-auth",+ `global-resource-context-${workerInfo.project.name}.json`,+ );+ fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });+ await createAuthenticatedStorageState(browser, storageStatePath);+ try {+ await use(storageStatePath);+ } finally {+ fs.rmSync(storageStatePath, { force: true });+ }+ },+ { scope: "worker" },+ ],+});++async function ensureMockModeEnabled(+ page: import("@playwright/test").Page,+): Promise<void> {+ const state = await getMockMode(page);+ if (mockModeWasEnabled === null) {+ mockModeWasEnabled = state.enabled;+ }+ if (!state.enabled) {+ await setMockMode(page, true);+ }+}++test.afterAll(async ({ browser }) => {+ if (mockModeWasEnabled === false) {+ const page = await browser.newPage();+ try {+ await setMockMode(page, false);+ } finally {+ await page.close();+ }+ }+ mockModeWasEnabled = null;+});++test("pins a resource context in infrastructure and carries it across platform views", async ({+ page,+}) => {+ await ensureMockModeEnabled(page);++ await page.goto("/infrastructure");+ await expect(page).toHaveURL(/\/infrastructure/);++ const pinButtons = page.getByRole("button", {+ name: /Set global context to/i,+ });+ await expect(pinButtons.first()).toBeAttached();++ const pinButton = pinButtons.first();+ await pinButton.scrollIntoViewIfNeeded();++ const pinButtonLabel = await pinButton.getAttribute("aria-label");+ expect(pinButtonLabel).toBeTruthy();+ const subjectLabel = pinButtonLabel?.replace(/^Set global context to\s+/i, "").trim() || "";+ expect(subjectLabel.length).toBeGreaterThan(0);++ const row = pinButton.locator("xpath=ancestor::tr[1]");+ const resourceId = await row.getAttribute("data-row-id");+ expect(resourceId).toBeTruthy();+ const escapedResourceId = escapeRegExp(resourceId || "");++ await pinButton.click();++ const contextBar = page.locator('[data-global-resource-context="true"]');+ await expect(contextBar).toContainText(subjectLabel);+ await expect(page).toHaveURL(new RegExp(`contextResource=${escapedResourceId}`));++ await page.getByRole("tab", { name: /Workloads/i }).click();+ await expect(page).toHaveURL(/\/workloads\?/);+ await expect(page).toHaveURL(new RegExp(`contextResource=${escapedResourceId}`));+ await expect(page).toHaveURL(/agent=/);+ await expect(contextBar).toContainText(subjectLabel);++ await page.getByRole("tab", { name: /^Storage$/ }).click();+ await expect(page).toHaveURL(/\/storage\?/);+ await expect(page).toHaveURL(new RegExp(`contextResource=${escapedResourceId}`));+ await expect(page).toHaveURL(new RegExp(`node=${escapedResourceId}`));+ await expect(page).toHaveURL(/source=proxmox-pve/);++ await page.getByRole("tab", { name: /^Recovery$/ }).click();+ await expect(page).toHaveURL(/\/recovery\?/);+ await expect(page).toHaveURL(new RegExp(`contextResource=${escapedResourceId}`));+ await expect(page).toHaveURL(new RegExp(`node=${escapedResourceId}`));+ await expect(page).toHaveURL(/platform=proxmox-pve/);++ await page.getByRole("button", { name: "Clear global context" }).click();+ await expect(contextBar).toHaveCount(0);+ await expect(page).toHaveURL(/\/recovery$/);+});