Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Scope platform-page workload inventory counts to the forced platform

rcourtman86d0af497910
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index 1b5ae3027f..fd732cb890 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,20 +1,20 @@
{
"version": 1,
- "base_sha": "74873e2b558e4f0984c8edd86e51cd7b9dbac012",
- "verified_at": "2026-08-20T19:44:49Z",
+ "base_sha": "ba4d48b4e604f31da815de4403afb62322d2694d",
+ "verified_at": "2026-08-20T19:59:00Z",
"result": "passed",
"changed_paths": [
- "frontend-modern/src/api/agentDiagnostics.ts",
- "frontend-modern/src/components/Settings/InfrastructureAgentDoctorPage.tsx",
- "frontend-modern/src/components/Settings/infrastructureAgentUpdateCommandsModel.ts"
+ "frontend-modern/src/components/Workloads/useWorkloadsState.ts",
+ "frontend-modern/src/components/Workloads/workloadSelectors.ts"
],
"content_sha256": {
- "frontend-modern/src/api/agentDiagnostics.ts": "f6ff4e1d6c29a0d141b973618d68263aad8e05a454c048469d0b5e3eb3cbb7ab",
- "frontend-modern/src/components/Settings/InfrastructureAgentDoctorPage.tsx": "f4334238aea3d20bd1b602b6313555fe9b8855d8e9aa344cd7be3fa8f9b86334",
- "frontend-modern/src/components/Settings/infrastructureAgentUpdateCommandsModel.ts": "5300b2ad75a3223d520a392df463ce9e9096c8f29cf1c543a60c7327904c58ad"
+ "frontend-modern/src/components/Workloads/useWorkloadsState.ts": "333dcef3a4316afab0fb62514f4741469aaff1bb22477ba80c22c4a7313d982d",
+ "frontend-modern/src/components/Workloads/workloadSelectors.ts": "8b0a8724bfe79bba0b573eb1da5c725adeda1e3e6443f011ba41fd3b786e8a49"
},
"routes": [
- "/settings/infrastructure/agent-doctor"
+ "/proxmox/overview",
+ "/vsphere (via nav tab)",
+ "/kubernetes (via nav tab)"
],
"viewports": [
{
@@ -27,17 +27,17 @@
}
],
"states": [
- "Agent Doctor with a live non-root agent report: the expanded agent row's metadata line reads 'Privilege: least privilege (rcourtman) · SMART helper active', derived end-to-end from a real pulse-agent process (built from this tree) running as an unprivileged user with PULSE_SMARTCTL_PATH set, reporting into the sidecar-built backend",
- "The agent's 'Needs attention' status comes from genuine unrelated reasons (dev version not comparable to update target, docker module retrying because this Mac has no Docker socket) — the privilege profile itself raises no reason, matching the non-degrading contract",
- "Mobile viewport 375x812: the privilege line wraps cleanly inside the expanded row with no horizontal overflow (documentElement.scrollWidth == 375); desktop 1280 same check passes",
- "Backend /api/agents/diagnostics returns privilege {runningAsRoot:false, serviceUser:'rcourtman', smartctlHelper:true} for the reporting agent"
+ "Proxmox Overview chips scoped to platform inventory: All 25 / VMs 10 / LXCs 15 and All 25 / Running 23 / Attention 0 / Stopped 2, matching the nodes table (10 VMs + 15 CTs); pre-fix estate-wide counts (All 55, Attention 1) no longer appear",
+ "Attention filter active on Proxmox Overview: chip count 0 and 'No guests found' empty state are now consistent (count and table read the same platform-scoped set)",
+ "Add filter node dropdown on Proxmox Overview lists only pve1/pve2/pve3 (no off-platform hosts)",
+ "vSphere Overview chips scoped: All 18 / Powered on 18 / Attention 0 / Powered off 0",
+ "Kubernetes Overview still surfaces the Pending cron-nightly-backfill pod as '1 workload needs attention' (the workload whose degraded status previously leaked into the Proxmox Attention chip)",
+ "Mobile viewport (375x812) Proxmox Overview renders nodes table, Filters button with active-count badge, and honest empty state while the persisted Attention filter was active"
],
"interactions": [
- "Rebuilt the scratch backend and pulse-agent from this tree, started the stack (backend :7811, vite :5487)",
- "Minted a host-agent install token via POST /api/agent-install-command from the logged-in page and started pulse-agent as the unprivileged rcourtman user with --agent-id least-priv-verify and PULSE_SMARTCTL_PATH set",
- "Opened Settings > Infrastructure > Agent Doctor, expanded the agent row, and located the rendered privilege line via DOM text walk at 1280x720 and 375x812",
- "Read /api/agents/diagnostics from the page to confirm the wire payload carries the privilege block",
- "Receipt hash for infrastructureAgentUpdateCommandsModel.ts re-pinned after the pre-commit prettier pass reformatted the staged blob; the change is formatting-only relative to the exercised content",
- "Captured the mobile screenshot of the expanded row; stopped the scratch agent and both preview servers afterwards"
+ "Clicked the Attention status chip on Proxmox Overview and observed chip count 0 with the consistent 'No guests found' empty state",
+ "Opened the Add filter dropdown options on Proxmox Overview and read the node list",
+ "Navigated Proxmox -> vSphere -> Kubernetes nav tabs and read each overview's chip counts",
+ "Reset the persisted status filter back to All and confirmed the guest table renders 25 workloads grouped by node"
]
}
diff --git a/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.ts b/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.ts
index 49c8beb8f4..876ab5fac6 100644
--- a/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.ts
+++ b/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
-import type { WorkloadGuest } from '@/types/workloads';
+import type { WorkloadGuest, WorkloadType } from '@/types/workloads';
import {
computeWorkloadIOEmphasis,
computeWorkloadStats,
@@ -10,6 +10,7 @@ import {
getWorkloadGroupLabel,
buildWorkloadSummaryGroupScopeMap,
groupWorkloads,
+ selectVisibleWorkloadInventory,
} from '@/components/Workloads/workloadSelectors';
import { workloadNodeScopeId } from '@/components/Workloads/workloadTopology';
@@ -707,6 +708,87 @@ describe('workloadSelectors', () => {
});
});
+ describe('selectVisibleWorkloadInventory', () => {
+ const noExclusions: ReadonlySet<WorkloadType> = new Set();
+
+ it('returns the input list when no scope or exclusions apply', () => {
+ const guests = [makeGuest(1), makeGuest(2)];
+ expect(
+ selectVisibleWorkloadInventory({ guests, excludedTypes: noExclusions }),
+ ).toBe(guests);
+ expect(
+ selectVisibleWorkloadInventory({
+ guests,
+ excludedTypes: noExclusions,
+ platformScope: 'all',
+ }),
+ ).toBe(guests);
+ });
+
+ it('drops excluded workload types', () => {
+ const vm = makeGuest(1, { type: 'vm', workloadType: 'vm' });
+ const appContainer = makeGuest(2, { type: 'app-container', workloadType: 'app-container' });
+ expect(
+ selectVisibleWorkloadInventory({
+ guests: [vm, appContainer],
+ excludedTypes: new Set<WorkloadType>(['app-container']),
+ }),
+ ).toEqual([vm]);
+ });
+
+ it('scopes the inventory to the forced platform', () => {
+ const pveGuest = makeGuest(1, {
+ type: 'vm',
+ workloadType: 'vm',
+ platformType: 'proxmox-pve',
+ platformScopes: ['proxmox-pve'],
+ });
+ const vsphereGuest = makeGuest(2, {
+ type: 'vm',
+ workloadType: 'vm',
+ platformType: 'vmware-vsphere',
+ platformScopes: ['vmware-vsphere'],
+ });
+
+ expect(
+ selectVisibleWorkloadInventory({
+ guests: [pveGuest, vsphereGuest],
+ excludedTypes: noExclusions,
+ platformScope: 'proxmox-all',
+ }),
+ ).toEqual([pveGuest]);
+ });
+
+ it('keeps a degraded off-platform workload out of platform-page inventory counts', () => {
+ // Regression: the Proxmox page's Attention chip counted a degraded
+ // workload on another platform while the platform-scoped table could
+ // never show it, so clicking Attention rendered "No guests found".
+ const runningPveGuest = makeGuest(1, {
+ type: 'vm',
+ workloadType: 'vm',
+ status: 'running',
+ platformType: 'proxmox-pve',
+ platformScopes: ['proxmox-pve'],
+ });
+ const degradedVsphereGuest = makeGuest(2, {
+ type: 'vm',
+ workloadType: 'vm',
+ status: 'warning',
+ platformType: 'vmware-vsphere',
+ platformScopes: ['vmware-vsphere'],
+ });
+
+ const inventory = selectVisibleWorkloadInventory({
+ guests: [runningPveGuest, degradedVsphereGuest],
+ excludedTypes: noExclusions,
+ platformScope: 'proxmox-all',
+ });
+
+ expect(computeWorkloadStats(inventory).degraded).toBe(0);
+ expect(computeWorkloadStats(inventory).total).toBe(1);
+ });
+ });
+
describe('getDiskUsagePercent', () => {
it('handles ratio and percentage disk usage with clamping', () => {
expect(
diff --git a/frontend-modern/src/components/Workloads/useWorkloadsState.ts b/frontend-modern/src/components/Workloads/useWorkloadsState.ts
index 3a247157d3..95aa943471 100644
--- a/frontend-modern/src/components/Workloads/useWorkloadsState.ts
+++ b/frontend-modern/src/components/Workloads/useWorkloadsState.ts
@@ -23,12 +23,13 @@ import {
getWorkloadsLoadingState,
getWorkloadsNoInventoryState,
} from '@/utils/workloadEmptyStatePresentation';
-import { getCanonicalWorkloadId, resolveWorkloadType } from '@/utils/workloads';
+import { getCanonicalWorkloadId } from '@/utils/workloads';
import { nodeFromResource } from '@/utils/resourceStateAdapters';
import {
buildWorkloadSummaryGroupScopeMap,
createWorkloadSortComparator,
filterWorkloads,
+ selectVisibleWorkloadInventory,
type FilterWorkloadsParams,
} from './workloadSelectors';
import {
@@ -186,15 +187,17 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {
const rawGuests = createMemo<WorkloadGuest[]>(() =>
workloadsEnabled() ? workloads.workloads() : [],
);
- const allGuests = createMemo<WorkloadGuest[]>(() => {
- if (!workloadsEnabled()) return [];
- const excludedTypes = excludedWorkloadTypeSet();
- const visibleGuests =
- excludedTypes.size === 0
- ? rawGuests()
- : rawGuests().filter((guest) => !excludedTypes.has(resolveWorkloadType(guest)));
- return dedupeGuests(visibleGuests);
- });
+ const allGuests = createMemo<WorkloadGuest[]>(() =>
+ workloadsEnabled()
+ ? dedupeGuests(
+ selectVisibleWorkloadInventory({
+ guests: rawGuests(),
+ excludedTypes: excludedWorkloadTypeSet(),
+ platformScope: props.forcedPlatform,
+ }),
+ )
+ : [],
+ );
const nestedWorkloadContextByGuestId = createMemo<NestedWorkloadContextByGuestId>(() =>
props.showNestedExcludedWorkloads
? buildNestedWorkloadContextByGuestId({
diff --git a/frontend-modern/src/components/Workloads/workloadSelectors.ts b/frontend-modern/src/components/Workloads/workloadSelectors.ts
index 482dd69764..96b1009c9c 100644
--- a/frontend-modern/src/components/Workloads/workloadSelectors.ts
+++ b/frontend-modern/src/components/Workloads/workloadSelectors.ts
@@ -1,5 +1,5 @@
import type { Node } from '@/types/api';
-import type { WorkloadGuest, ViewMode } from '@/types/workloads';
+import type { WorkloadGuest, ViewMode, WorkloadType } from '@/types/workloads';
import type { WorkloadIOEmphasis } from './guestRowModel';
import { computeIOScale } from '@/components/Infrastructure/infrastructureSelectors';
import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
@@ -120,6 +120,31 @@ const matchesWorkloadTextSearch = (guest: WorkloadGuest, term: string): boolean
.some((value) => String(value).toLowerCase().includes(needle));
};
+export interface SelectVisibleWorkloadInventoryParams {
+ guests: WorkloadGuest[];
+ excludedTypes: ReadonlySet<WorkloadType>;
+ platformScope?: string | null;
+}
+
+// A surface's forced platform (Proxmox, vSphere) is the page's identity, not
+// a user-applied filter, so it scopes the inventory itself: chip counts,
+// search suggestions, and availability detection must describe the same guest
+// set the table can ever render.
+export const selectVisibleWorkloadInventory = ({
+ guests,
+ excludedTypes,
+ platformScope,
+}: SelectVisibleWorkloadInventoryParams): WorkloadGuest[] => {
+ const normalizedScope = normalizeSourcePlatformQueryValue(platformScope);
+ const scopeActive = Boolean(normalizedScope && normalizedScope !== 'all');
+ if (excludedTypes.size === 0 && !scopeActive) return guests;
+ return guests.filter(
+ (guest) =>
+ !excludedTypes.has(resolveWorkloadType(guest)) &&
+ (!scopeActive || workloadMatchesPlatformScope(guest, normalizedScope)),
+ );
+};
+
export const filterWorkloads = ({
guests: allGuests,
viewMode,