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 Workloads empty state source detection
rcourtmanaa5472553f46
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 0a8d9b180f..e5ca14a810 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -581,7 +581,7 @@ frontend primitive boundary.10. Keep summary chart interaction identity on one shared helper. Summary surfaces that expose row-hover, group-hover, chart-hover, or route-focus-driven chart emphasis must derive page/group/entity scope through `frontend-modern/src/components/shared/summaryCardInteraction.ts` and pass that same resolved scope into card-state, sparkline, and density-map primitives, rather than letting cards read `hovered || focused` while charts listen to a different page-local ID source. Hovering one summary chart must promote that series into the shared active entity so sibling cards highlight the same object instead of keeping chart-local hover islands, and hovering or pinning a workload group header, infrastructure cluster header, or storage pool-group header must scope the matching summary cards through that same shared contract instead of forking a page-local summary filter path. Sibling cards should surface that synchronized hover as one compact header readout through the shared summary-card contract, while the chart under the pointer keeps the only floating tooltip. `frontend-modern/src/components/Recovery/RecoverySummary.tsx` is explicitly outside this interaction dialect: recovery posture cards may share summary framing, but they must not silently grow row/group/chart hover behavior without a separate governed product decision.11. 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.12. Keep contextual row focus on the shared summary primitive. Summary surfaces and same-route table drill-ins must reuse `frontend-modern/src/components/shared/contextualFocus.ts` for interactive-series filtering, focused-name lookup, active-series derivation, local scroll preservation, and deliberate inline-detail reveal instead of rebuilding page-local `Set` filters, focused-label scans, drawer-aware scroll math, or ad hoc scroll restoration in each surface.-13. Keep summary-to-table coordination deliberate, explicit, and reversible. Shared summary hover may highlight the matching table row when it is already visible, but transient chart hover must not auto-filter tables, auto-scroll the page, or reshuffle table ordering. Pinned page/group/entity scope on workloads, infrastructure, or storage must stay row-first: the pinned row or group header is the visible scoped state, not a second strip or search-row widget. Page shells therefore must not reintroduce always-on scope banners, preview bars, page-local chips, breadcrumbs, or search/filter-row scope accessories just to explain pinned state. When the active row is off-screen, page owners must still route through `frontend-modern/src/components/shared/summaryTableFocus.ts` and surface a lightweight `Jump to row` affordance that reveals and scrolls only on explicit user action. That same shared table-focus owner now also owns reversible clearing: pinned scope may clear only from governed neutral interaction-surface space or the shared `Escape` path, with page owners binding a broader clear-surface root separately from the row-lookup table root when needed and supplying one page-level reset callback for filters plus summary-linked selections. Row cells, group headers, inline detail, summary cards, and explicit controls must not accidentally clear pinned scope, while governed table/card clear surfaces must still allow real user clicks on neutral whitespace to clear it. Deliberate row focus may reveal inline detail automatically, but that reveal must be drawer-aware: infrastructure and workload row toggles that already have the row in view must hand the current `.app-scroll-shell` position through `frontend-modern/src/utils/appShellScrollRestoration.ts` so the remounted shell in `frontend-modern/src/App.tsx` can reopen the inline detail without looking like a page refresh, and then still route through the shared reveal helper whenever the opened drawer would otherwise land below the fold. Same-route drawers must therefore scroll only enough to keep the row header plus the top of the inline detail visible, never hard-center the row just because the route state changed.+13. Keep summary-to-table coordination deliberate, explicit, and reversible. Shared summary hover may highlight the matching table row when it is already visible, but transient chart hover must not auto-filter tables, auto-scroll the page, or reshuffle table ordering. Pinned page/group/entity scope on workloads, infrastructure, or storage must stay row-first: the pinned row or group header is the visible scoped state, not a second strip or search-row widget. Page shells therefore must not reintroduce always-on scope banners, preview bars, page-local chips, breadcrumbs, or search/filter-row scope accessories just to explain pinned state. When the active row is off-screen, page owners must still route through `frontend-modern/src/components/shared/summaryTableFocus.ts` and surface a lightweight `Jump to row` affordance that reveals and scrolls only on explicit user action. That same shared table-focus owner now also owns reversible clearing: pinned scope may clear only from governed neutral interaction-surface space or the shared `Escape` path, with page owners binding a broader clear-surface root separately from the row-lookup table root when needed and supplying one page-level reset callback for filters plus summary-linked selections. Row cells, group headers, inline detail, summary cards, and explicit controls must not accidentally clear pinned scope, while governed table/card clear surfaces must still allow real user clicks on neutral whitespace to clear it. Deliberate row focus may reveal inline detail automatically, but that reveal must be drawer-aware: infrastructure and workload row toggles that already have the row in view must hand the current `.app-scroll-shell` position through `frontend-modern/src/utils/appShellScrollRestoration.ts` so the remounted shell in `frontend-modern/src/App.tsx` can reopen the inline detail without looking like a page refresh, and then still route through the shared reveal helper whenever the opened drawer would otherwise land below the fold. Same-route drawers must therefore scroll only enough to keep the row header plus the top of the inline detail visible, never hard-center the row just because the route state changed. The same-route state scheduler owns the lifecycle for its deferred scroll-restore timers and animation frames; page owners must clean it up on unmount instead of leaving replay work attached to a torn-down route.Shared summary-linked rows and group headers must also route their previewsemantics through`frontend-modern/src/components/shared/summaryInteractionA11y.ts`.@@ -837,7 +837,12 @@ frontend primitive boundary.`/settings/infrastructure?add=pick` source picker, describe platform APIinventory and Pulse Agent telemetry as equal source strategies, and avoidfalling back to either passive “nothing here yet” wording or the retired- install-first / `Platform connections` split.+ install-first / `Platform connections` split. Workloads routes that already+ have canonical unified-resource infrastructure sources but no workload+ inventory must use a distinct no-inventory presentation that points+ operators at credentials, permissions, and collection status in the+ canonical infrastructure workspace instead of reusing first-run onboarding+ copy.15. Keep cross-surface investigation handoffs on shared route ownership.Feature shells such as Alerts and Patrol may decide which governeddestination chips to render, but canonical href, label, dedupe, anddiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex f85e3d7b3d..956010691f 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -627,7 +627,10 @@ context, but they must now also surface focused-entity detail inside the samecard instead of dimming the rest of the map into unusable background noise orswapping the hot path into a transient single-series chart. Line-cardisolation must still flow through the shared sparkline runtime instead of a-page-local focus overlay.+page-local focus overlay. The shared same-path scheduler must also own cleanup+for every deferred scroll-restore timeout and animation frame it creates, so+route-state cleanup cannot leave hot-path replay work running after the owning+surface unmounts.That same hot-path rule now also covers infrastructure drawer hydration. Rowfocus may mount drawer-local facet and intelligence fetches, but thoserequests must retain the mounted page shell through the shared non-suspending@@ -677,10 +680,15 @@ storage-page `/api/storage-charts` payload or an N+1 per-pool`/api/metrics-store/history` fan-out.That same Workloads shell boundary also owns empty-state action routing in`frontend-modern/src/components/Workloads/WorkloadsStateCards.tsx`. When the-Workloads route has no connected infrastructure, the CTA must hand operators-directly to the canonical infrastructure install route via-`buildInfrastructureWorkspacePath('install')` instead of bouncing through a-generic settings landing page.+Workloads route has no connected infrastructure sources, the CTA must hand+operators directly to the canonical source picker through+`buildInfrastructureOnboardingPath('pick')` instead of bouncing through a generic+settings landing page. When canonical unified-resource source presence shows+that infrastructure exists but no workload inventory is available, the route+must not reuse the first-run no-source state; it must send operators to the+canonical infrastructure workspace through `buildInfrastructureWorkspacePath()`+so credential, permission, and collection status can be reviewed from the source+of truth.That workload route now also treats readiness as a route-owned contract insteadof a raw websocket proxy signal: `frontend-modern/src/components/Workloads/WorkloadsSurface.tsx`and `frontend-modern/src/components/Workloads/useWorkloadsState.ts` must keepdiff --git a/frontend-modern/src/components/Workloads/WorkloadsStateCards.tsx b/frontend-modern/src/components/Workloads/WorkloadsStateCards.tsxindex f206831146..0e2292c765 100644--- a/frontend-modern/src/components/Workloads/WorkloadsStateCards.tsx+++ b/frontend-modern/src/components/Workloads/WorkloadsStateCards.tsx@@ -1,6 +1,9 @@import { Show } from 'solid-js';-import { buildInfrastructureOnboardingPath } from '@/components/Settings/infrastructureWorkspaceModel';+import {+ buildInfrastructureOnboardingPath,+ buildInfrastructureWorkspacePath,+} from '@/components/Settings/infrastructureWorkspaceModel';import { Card } from '@/components/shared/Card';import { EmptyState } from '@/components/shared/EmptyState';@@ -14,15 +17,16 @@ type WorkloadsStateCardsProps = Pick<| 'workloadsGuestsEmptyState'| 'workloadsInfrastructureEmptyState'| 'workloadsLoadingState'+ | 'workloadsNoInventoryState'| 'filteredGuests'+ | 'hasInfrastructureSources'+ | 'infrastructureSourceStateReady'| 'initialDataReceived'| 'kioskMode'| 'navigate'| 'reconnect'| 'workloads'-> & {- nodeCount: number;-};+>;export function WorkloadsStateCards(props: WorkloadsStateCardsProps) {return (@@ -62,7 +66,8 @@ export function WorkloadsStateCards(props: WorkloadsStateCardsProps) {props.connected() &&props.initialDataReceived() &&!props.workloads.loading() &&- props.nodeCount === 0 &&+ props.infrastructureSourceStateReady() &&+ !props.hasInfrastructureSources() &&props.allGuests().length === 0}>@@ -100,6 +105,50 @@ export function WorkloadsStateCards(props: WorkloadsStateCardsProps) {</Card></Show>+ <Show+ when={+ props.connected() &&+ props.initialDataReceived() &&+ !props.workloads.loading() &&+ props.infrastructureSourceStateReady() &&+ props.hasInfrastructureSources() &&+ props.allGuests().length === 0+ }+ >+ <Card padding="lg">+ <EmptyState+ icon={+ <svg+ class="h-12 w-12 text-amber-500"+ fill="none"+ viewBox="0 0 24 24"+ stroke="currentColor"+ >+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="M12 9v4m0 4h.01M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"+ />+ </svg>+ }+ title={props.workloadsNoInventoryState().title}+ description={props.workloadsNoInventoryState().description}+ actions={+ !props.kioskMode() ? (+ <button+ type="button"+ onClick={() => props.navigate(buildInfrastructureWorkspacePath())}+ class="inline-flex items-center px-3 py-1.5 border border-transparent text-xs font-medium rounded-md text-white bg-amber-600 hover:bg-amber-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-amber-500"+ >+ {props.workloadsNoInventoryState().actionLabel}+ </button>+ ) : undefined+ }+ />+ </Card>+ </Show>+<Show when={!props.connected()}><Card padding="lg" tone="danger"><EmptyStatediff --git a/frontend-modern/src/components/Workloads/WorkloadsSurface.tsx b/frontend-modern/src/components/Workloads/WorkloadsSurface.tsxindex 69ed22cca1..0879fb58dc 100644--- a/frontend-modern/src/components/Workloads/WorkloadsSurface.tsx+++ b/frontend-modern/src/components/Workloads/WorkloadsSurface.tsx@@ -14,11 +14,7 @@ export function WorkloadsSurface(props: WorkloadsSurfaceProps) {const state = useWorkloadsState(props);return (- <div- ref={state.setClearSurfaceRootRef}- class="space-y-3"- data-testid="workloads-page"- >+ <div ref={state.setClearSurfaceRootRef} class="space-y-3" data-testid="workloads-page"><PageHeadertitle="Workloads"description="Inspect live workloads, filter by platform and status, and drill into compute, memory, and I/O posture."@@ -61,11 +57,13 @@ export function WorkloadsSurface(props: WorkloadsSurfaceProps) {workloadsGuestsEmptyState={state.workloadsGuestsEmptyState}workloadsInfrastructureEmptyState={state.workloadsInfrastructureEmptyState}workloadsLoadingState={state.workloadsLoadingState}+ workloadsNoInventoryState={state.workloadsNoInventoryState}filteredGuests={state.filteredGuests}+ hasInfrastructureSources={state.hasInfrastructureSources}+ infrastructureSourceStateReady={state.infrastructureSourceStateReady}initialDataReceived={state.surfaceInitialDataReceived}kioskMode={state.kioskMode}navigate={state.navigate}- nodeCount={props.nodes.length}reconnect={state.reconnectSurface}workloads={state.workloads}/>@@ -93,7 +91,9 @@ export function WorkloadsSurface(props: WorkloadsSurfaceProps) {setSortDirection={state.setSortDirection}onBeforeAutoFocus={state.handleBeforeAutoFocus}columnVisibility={state.workloadsFilterColumnVisibility()}- chartsCollapsed={state.isWorkloadsRoute() ? state.workloadsSummaryCollapsed : undefined}+ chartsCollapsed={+ state.isWorkloadsRoute() ? state.workloadsSummaryCollapsed : undefined+ }onChartsToggle={state.isWorkloadsRoute()? () => state.setWorkloadsSummaryCollapsed((collapsed) => !collapsed)diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsStateCards.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsStateCards.test.tsxindex ef7229b0a8..8cf908f469 100644--- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsStateCards.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsStateCards.test.tsx@@ -29,11 +29,18 @@ describe('WorkloadsStateCards', () => {title: 'Loading workloads...',description: 'Connecting to monitoring service',})}+ workloadsNoInventoryState={() => ({+ title: 'No workload inventory available',+ description:+ 'Pulse has infrastructure sources, but no VM, container, or pod inventory is available right now. Review source credentials, permissions, and collection status in Settings → Infrastructure.',+ actionLabel: 'Review infrastructure sources',+ })}filteredGuests={() => []}+ hasInfrastructureSources={() => false}+ infrastructureSourceStateReady={() => true}initialDataReceived={() => true}kioskMode={() => false}navigate={navigate}- nodeCount={0}reconnect={() => undefined}workloads={{workloads: [] as any,@@ -49,4 +56,60 @@ describe('WorkloadsStateCards', () => {expect(navigate).toHaveBeenCalledWith('/settings/infrastructure?add=pick');});++ it('routes the no-inventory action to existing infrastructure sources', () => {+ const navigate = vi.fn();++ render(() => (+ <WorkloadsStateCards+ allGuests={() => []}+ connected={() => true}+ workloadsDisconnectedState={() => ({+ title: 'Connection lost',+ description: 'Unable to connect to the backend server',+ actionLabel: 'Reconnect now',+ })}+ workloadsGuestsEmptyState={() => ({+ title: 'No guests found',+ description: 'No guests match your current filters',+ })}+ workloadsInfrastructureEmptyState={() => ({+ title: 'No infrastructure sources connected',+ description:+ 'Start in Settings → Infrastructure by choosing a source strategy. Connect a platform API for inventory and health, install Pulse Agent for host telemetry, or use both when you want full coverage.',+ actionLabel: 'Add infrastructure source',+ })}+ workloadsLoadingState={() => ({+ title: 'Loading workloads...',+ description: 'Connecting to monitoring service',+ })}+ workloadsNoInventoryState={() => ({+ title: 'No workload inventory available',+ description:+ 'Pulse has infrastructure sources, but no VM, container, or pod inventory is available right now. Review source credentials, permissions, and collection status in Settings → Infrastructure.',+ actionLabel: 'Review infrastructure sources',+ })}+ filteredGuests={() => []}+ hasInfrastructureSources={() => true}+ infrastructureSourceStateReady={() => true}+ initialDataReceived={() => true}+ kioskMode={() => false}+ navigate={navigate}+ reconnect={() => undefined}+ workloads={{+ workloads: [] as any,+ loading: () => false,+ refetch: async () => [],+ mutate: (value) => (Array.isArray(value) ? value : value([])),+ error: () => null,+ }}+ />+ ));++ expect(screen.queryByText('No infrastructure sources connected')).not.toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: 'Review infrastructure sources' }));++ expect(navigate).toHaveBeenCalledWith('/settings/infrastructure');+ });});diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.k8s.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.k8s.test.tsxindex 9017aea8fa..792118910c 100644--- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.k8s.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.k8s.test.tsx@@ -85,6 +85,17 @@ vi.mock('@/hooks/useWorkloads', () => ({}),}));+vi.mock('@/hooks/useUnifiedResources', () => ({+ useUnifiedResources: () => ({+ resources: () => [],+ policyPosture: () => null,+ refetch: vi.fn(),+ mutate: vi.fn(),+ loading: () => false,+ error: () => null,+ }),+}));+vi.mock('@/api/guestMetadata', () => ({GuestMetadataAPI: {getAllMetadata: vi.fn().mockResolvedValue({}),diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsxindex c027d26cd8..8bd5b2558d 100644--- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx@@ -74,6 +74,8 @@ if (typeof globalThis.ResizeObserver === 'undefined') {let mockLocationSearch = '';let mockWorkloads: Array<Record<string, unknown>> = [];+let mockInfrastructureResources: Resource[] = [];+let mockUnifiedResourcesQuery = '';let setMockWorkloadsSignal: ((next: Array<Record<string, unknown>>) => void) | null = null;const workloadsRefetchMock = vi.fn();let guestRowMountCount = 0;@@ -156,6 +158,21 @@ vi.mock('@/hooks/useWorkloads', () => ({},}));+vi.mock('@/hooks/useUnifiedResources', () => ({+ useUnifiedResources: (options?: { query?: string }) => {+ mockUnifiedResourcesQuery = options?.query ?? '';+ const [resources] = createSignal(mockInfrastructureResources);+ return {+ resources,+ policyPosture: () => null,+ refetch: vi.fn(),+ mutate: vi.fn(),+ loading: () => false,+ error: () => null,+ };+ },+}));+vi.mock('@/api/guestMetadata', () => ({GuestMetadataAPI: { getAllMetadata: vi.fn().mockResolvedValue({}) },}));@@ -322,6 +339,8 @@ describe('Workloads performance contract', () => {localStorage.clear();mockLocationSearch = '';mockWorkloads = [];+ mockInfrastructureResources = [];+ mockUnifiedResourcesQuery = '';setMockWorkloadsSignal = null;setWsConnectedSignal = null;workloadsRefetchMock.mockReset();@@ -387,6 +406,28 @@ describe('Workloads performance contract', () => {expect(document.body).not.toHaveTextContent('Attempting to reconnect…');});+ it('does not label an empty workload resource list as missing infrastructure when sources exist', async () => {+ mockLocationSearch = '?type=all';+ mockWorkloads = [];+ mockInfrastructureResources = [+ makeResource({+ id: 'agent:pve-hrc-dev-proxmox1',+ type: 'agent',+ name: 'hrc-dev-proxmox1',+ sourceType: 'api',+ status: 'offline',+ }),+ ];++ render(() => <WorkloadsSurface vms={[]} containers={[]} nodes={[]} useWorkloads />);++ await waitFor(() => {+ expect(document.body).toHaveTextContent('No workload inventory available');+ });+ expect(document.body).not.toHaveTextContent('No infrastructure sources connected');+ expect(mockUnifiedResourcesQuery).toContain('type=agent');+ });+it('keeps governed resource search aligned with the preferred display label', () => {const resources = [makeResource()];diff --git a/frontend-modern/src/components/Workloads/useWorkloadsState.ts b/frontend-modern/src/components/Workloads/useWorkloadsState.tsindex 34619b7277..3b80ca66ce 100644--- a/frontend-modern/src/components/Workloads/useWorkloadsState.ts+++ b/frontend-modern/src/components/Workloads/useWorkloadsState.ts@@ -5,6 +5,7 @@ import type { WorkloadGuest } from '@/types/workloads';import { useWebSocket } from '@/contexts/appRuntime';import { useAlertsActivation } from '@/stores/alertsActivation';import { usePersistentSignal } from '@/hooks/usePersistentSignal';+import { useUnifiedResources } from '@/hooks/useUnifiedResources';import { useWorkloads } from '@/hooks/useWorkloads';import { useKioskMode } from '@/hooks/useKioskMode';import {@@ -12,6 +13,7 @@ import {getWorkloadsGuestsEmptyState,getWorkloadsInfrastructureEmptyState,getWorkloadsLoadingState,+ getWorkloadsNoInventoryState,} from '@/utils/workloadEmptyStatePresentation';import { getCanonicalWorkloadId } from '@/utils/workloads';import {@@ -20,15 +22,16 @@ import {filterWorkloads,type FilterWorkloadsParams,} from './workloadSelectors';-import {- type WorkloadsSortKey,-} from './workloadsFilterModel';+import { type WorkloadsSortKey } from './workloadsFilterModel';import { useWorkloadsControlsState } from './useWorkloadsControlsState';import { useWorkloadGuestMetadataState } from './useWorkloadGuestMetadataState';import { useWorkloadSelectionState } from './useWorkloadSelectionState';import { useWorkloadsDerivedState } from './useWorkloadsDerivedState';import { useWorkloadRouteState } from './useWorkloadRouteState';+const WORKLOADS_INFRASTRUCTURE_SOURCES_QUERY =+ 'type=agent,docker-host,k8s-cluster,k8s-node,pbs,pmg,storage,physical_disk,ceph';+export interface WorkloadsSurfaceProps {vms: VM[];containers: Container[];@@ -51,6 +54,11 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {const workloadsEnabled = createMemo(() => props.useWorkloads === true);const workloads = useWorkloads(workloadsEnabled);+ const infrastructureSources = useUnifiedResources({+ query: WORKLOADS_INFRASTRUCTURE_SOURCES_QUERY,+ cacheKey: 'workloads-infrastructure-sources',+ enabled: workloadsEnabled,+ });const dedupeGuests = (guests: WorkloadGuest[]): WorkloadGuest[] => {const seen = new Set<string>();@@ -142,11 +150,24 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {viewMode,});- const workloadsInfrastructureEmptyState = createMemo(() => getWorkloadsInfrastructureEmptyState());+ const workloadsInfrastructureEmptyState = createMemo(() =>+ getWorkloadsInfrastructureEmptyState(),+ );const workloadsGuestsEmptyState = createMemo(() => getWorkloadsGuestsEmptyState(search()));const workloadsLoadingState = createMemo(() => getWorkloadsLoadingState(reconnecting()));- const workloadsDisconnectedState = createMemo(() => getWorkloadsDisconnectedState(reconnecting()));+ const workloadsNoInventoryState = createMemo(() => getWorkloadsNoInventoryState());+ const workloadsDisconnectedState = createMemo(() =>+ getWorkloadsDisconnectedState(reconnecting()),+ );const hasWorkloadsData = createMemo(() => allGuests().length > 0);+ const hasInfrastructureSources = createMemo(() =>+ workloadsEnabled()+ ? props.nodes.length > 0 || infrastructureSources.resources().length > 0+ : props.nodes.length > 0,+ );+ const infrastructureSourceStateReady = createMemo(() =>+ workloadsEnabled() ? hasInfrastructureSources() || !infrastructureSources.loading() : true,+ );const surfaceConnected = createMemo(() =>workloadsEnabled()? workloads.loading() || hasWorkloadsData() || !workloads.error()@@ -154,7 +175,8 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {);const surfaceInitialDataReceived = createMemo(() =>workloadsEnabled()- ? hasWorkloadsData() || !workloads.loading() || Boolean(workloads.error())+ ? hasWorkloadsData() ||+ ((!workloads.loading() || Boolean(workloads.error())) && infrastructureSourceStateReady()): initialDataReceived(),);@@ -298,9 +320,11 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {handleNodeSelect,handleSort,handleTagClick,+ hasInfrastructureSources,hostFilterConfig,hoveredSummaryWorkloadGroupScope,hoveredWorkloadId,+ infrastructureSourceStateReady,initialDataReceived,isMobile,isSearchLocked,@@ -368,6 +392,7 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {workloadsSummaryFallbackSnapshots,workloadsSummaryRange,workloadsSummaryVisibleIds,+ workloadsNoInventoryState,ws,groupingMode,} as const;diff --git a/frontend-modern/src/utils/__tests__/routeStateNavigation.test.ts b/frontend-modern/src/utils/__tests__/routeStateNavigation.test.tsindex edbe523b6b..0659cd9fbe 100644--- a/frontend-modern/src/utils/__tests__/routeStateNavigation.test.ts+++ b/frontend-modern/src/utils/__tests__/routeStateNavigation.test.ts@@ -62,6 +62,27 @@ describe('routeStateNavigation', () => {ROUTE_STATE_REPLACE_OPTIONS,);expect(scrollToSpy).toHaveBeenCalledWith(24, 320);+ scheduler.cleanup();+ });++ it('cancels deferred same-path scroll restoration when cleaned up', () => {+ const navigate = vi.fn();+ let currentPath = '/infrastructure?source=proxmox-pve';+ const scheduler = createRouteStateNavigateScheduler(navigate, () => currentPath);++ scheduler.schedule('/infrastructure?source=proxmox-pve&resource=agent-123');+ vi.advanceTimersByTime(0);++ expect(navigate).toHaveBeenCalledWith(+ '/infrastructure?source=proxmox-pve&resource=agent-123',+ ROUTE_STATE_REPLACE_OPTIONS,+ );+ expect(scrollToSpy).toHaveBeenCalledTimes(1);++ scheduler.cleanup();+ vi.runAllTimers();++ expect(scrollToSpy).toHaveBeenCalledTimes(1);});it('captures the app scroll shell before same-path route state navigation', () => {@@ -92,6 +113,7 @@ describe('routeStateNavigation', () => {expect(navigate).not.toHaveBeenCalled();expect(scrollToSpy).not.toHaveBeenCalled();+ scheduler.cleanup();});it('stops replaying preserved scroll after a later deliberate scroll change', () => {diff --git a/frontend-modern/src/utils/__tests__/workloadEmptyStatePresentation.test.ts b/frontend-modern/src/utils/__tests__/workloadEmptyStatePresentation.test.tsindex 2a1096e98d..c3be844f1d 100644--- a/frontend-modern/src/utils/__tests__/workloadEmptyStatePresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/workloadEmptyStatePresentation.test.ts@@ -6,6 +6,7 @@ import {getWorkloadsInfrastructureEmptyState,getWorkloadsLoadingState,getWorkloadsNoResourcesState,+ getWorkloadsNoInventoryState,getWorkloadsUnavailableState,} from '@/utils/workloadEmptyStatePresentation';@@ -79,6 +80,12 @@ describe('workloadEmptyStatePresentation', () => {description: 'Real-time workload data is currently unavailable. Reconnect to try again.',actionLabel: 'Reconnect',});+ expect(getWorkloadsNoInventoryState()).toEqual({+ title: 'No workload inventory available',+ description:+ 'Pulse has infrastructure sources, but no VM, container, or pod inventory is available right now. Review source credentials, permissions, and collection status in Settings → Infrastructure.',+ actionLabel: 'Review infrastructure sources',+ });expect(getWorkloadsNoResourcesState()).toEqual({title: 'Connect your first infrastructure source',description:diff --git a/frontend-modern/src/utils/routeStateNavigation.ts b/frontend-modern/src/utils/routeStateNavigation.tsindex 4e3abea5c6..d1bd185dc6 100644--- a/frontend-modern/src/utils/routeStateNavigation.ts+++ b/frontend-modern/src/utils/routeStateNavigation.ts@@ -34,6 +34,44 @@ export const createRouteStateNavigateScheduler = () => {let pendingHandle: number | null = null;let pendingPath: string | null = null;+ let scrollRestoreTimeoutHandles: number[] = [];+ let scrollRestoreFrameHandles: number[] = [];++ const clearScrollRestoreWork = () => {+ scrollRestoreTimeoutHandles.forEach((handle) => {+ if (typeof window !== 'undefined') {+ window.clearTimeout(handle);+ } else {+ clearTimeout(handle);+ }+ });+ scrollRestoreTimeoutHandles = [];++ if (typeof window !== 'undefined') {+ scrollRestoreFrameHandles.forEach((handle) => window.cancelAnimationFrame(handle));+ }+ scrollRestoreFrameHandles = [];+ };++ const scheduleScrollRestoreTimeout = (callback: () => void, delay: number) => {+ const handle = window.setTimeout(() => {+ scrollRestoreTimeoutHandles = scrollRestoreTimeoutHandles.filter(+ (candidate) => candidate !== handle,+ );+ callback();+ }, delay);+ scrollRestoreTimeoutHandles.push(handle);+ };++ const scheduleScrollRestoreFrame = (callback: () => void) => {+ const handle = window.requestAnimationFrame(() => {+ scrollRestoreFrameHandles = scrollRestoreFrameHandles.filter(+ (candidate) => candidate !== handle,+ );+ callback();+ });+ scrollRestoreFrameHandles.push(handle);+ };const schedule = (nextPath: string) => {pendingPath = nextPath;@@ -41,6 +79,10 @@ export const createRouteStateNavigateScheduler = (pendingHandle = window.setTimeout(() => {pendingHandle = null;+ if (typeof window === 'undefined') {+ pendingPath = null;+ return;+ }const target = pendingPath;pendingPath = null;if (!target) return;@@ -52,6 +94,7 @@ export const createRouteStateNavigateScheduler = (: null;if (restoreScroll) {+ clearScrollRestoreWork();const previousScrollRestoration = window.history.scrollRestoration;window.history.scrollRestoration = 'manual';const shell = document.querySelector<HTMLElement>('.app-scroll-shell');@@ -59,6 +102,7 @@ export const createRouteStateNavigateScheduler = (schedulePendingAppShellRestoreTop(shell.scrollTop);}const applyScrollRestore = () => {+ if (typeof window === 'undefined') return;if (/jsdom/i.test(window.navigator.userAgent)) return;if (routeStateDeliberateScrollSuppressedUntil > Date.now()) {return;@@ -73,15 +117,16 @@ export const createRouteStateNavigateScheduler = (};navigate(target, ROUTE_STATE_REPLACE_OPTIONS);applyScrollRestore();- window.setTimeout(applyScrollRestore, 0);- window.requestAnimationFrame(() => {+ scheduleScrollRestoreTimeout(applyScrollRestore, 0);+ scheduleScrollRestoreFrame(() => {applyScrollRestore();- window.requestAnimationFrame(() => {+ scheduleScrollRestoreFrame(() => {applyScrollRestore();});});- window.setTimeout(() => {+ scheduleScrollRestoreTimeout(() => {applyScrollRestore();+ if (typeof window === 'undefined') return;window.history.scrollRestoration = previousScrollRestoration;}, 120);return;@@ -92,9 +137,11 @@ export const createRouteStateNavigateScheduler = (};const cleanup = () => {- if (pendingHandle === null) return;- window.clearTimeout(pendingHandle);- pendingHandle = null;+ clearScrollRestoreWork();+ if (pendingHandle !== null) {+ window.clearTimeout(pendingHandle);+ pendingHandle = null;+ }pendingPath = null;};diff --git a/frontend-modern/src/utils/workloadEmptyStatePresentation.ts b/frontend-modern/src/utils/workloadEmptyStatePresentation.tsindex 601e304098..c1d76a8e4f 100644--- a/frontend-modern/src/utils/workloadEmptyStatePresentation.ts+++ b/frontend-modern/src/utils/workloadEmptyStatePresentation.ts@@ -19,6 +19,15 @@ export function getWorkloadsGuestsEmptyState(search: string) {} as const;}+export function getWorkloadsNoInventoryState() {+ return {+ title: 'No workload inventory available',+ description:+ 'Pulse has infrastructure sources, but no VM, container, or pod inventory is available right now. Review source credentials, permissions, and collection status in Settings → Infrastructure.',+ actionLabel: 'Review infrastructure sources',+ } as const;+}+export function getWorkloadsLoadingState(reconnecting: boolean) {return {title: 'Loading workloads...',