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.

Remove dashboard workload summary wrapper

rcourtman70c764f202b7
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 74171fc6f0..390828d02e 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -47,6 +47,7 @@ regression protection.
3. Optimize hot paths only when backed by benchmarks or proven query issues
4. Extend dashboard hot-path selectors through `frontend-modern/src/components/Dashboard/workloadSelectors.ts` rather than duplicating filtering/grouping logic in `frontend-modern/src/components/Dashboard/Dashboard.tsx`
5. Normalize dashboard workload view-mode aliases through `frontend-modern/src/utils/workloads.ts` instead of keeping local URL/storage parsing in `frontend-modern/src/components/Dashboard/Dashboard.tsx`
+6. Deduplicate dashboard workload rows by canonical workload ID from `frontend-modern/src/utils/workloads.ts` rather than via local pass-through wrappers in `frontend-modern/src/components/Dashboard/Dashboard.tsx`
## Forbidden Paths
diff --git a/frontend-modern/src/components/Dashboard/Dashboard.tsx b/frontend-modern/src/components/Dashboard/Dashboard.tsx
index baa870ec59..e4306c9fc5 100644
--- a/frontend-modern/src/components/Dashboard/Dashboard.tsx
+++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx
@@ -125,8 +125,6 @@ const workloadMetricPercent = (value: number | null | undefined): number => {
return Math.max(0, value);
};
-const workloadSummaryGuestId = (guest: WorkloadGuest): string => getCanonicalWorkloadId(guest);
-
const readGuestMetadataCache = (storageKey: string): GuestMetadataRecord => {
if (cachedGuestMetadata && cachedGuestMetadataStorageKey === storageKey) {
return cachedGuestMetadata;
@@ -1079,7 +1077,7 @@ export function Dashboard(props: DashboardProps) {
});
const workloadsSummaryVisibleIds = createMemo<string[]>(() =>
- filteredGuests().map((guest) => workloadSummaryGuestId(guest)),
+ filteredGuests().map((guest) => getCanonicalWorkloadId(guest)),
);
const workloadsSummaryFallbackCounts = createMemo(() => {
@@ -1096,7 +1094,7 @@ export function Dashboard(props: DashboardProps) {
const workloadsSummaryFallbackSnapshots = createMemo<WorkloadSummarySnapshot[]>(() =>
filteredGuests().map((guest) => {
- const guestId = workloadSummaryGuestId(guest);
+ const guestId = getCanonicalWorkloadId(guest);
const memoryUsage = workloadMetricPercent(guest.memory?.usage);
let diskUsage = workloadMetricPercent(guest.disk?.usage);
if (
@@ -1127,7 +1125,7 @@ export function Dashboard(props: DashboardProps) {
createEffect(() => {
const hoveredId = hoveredWorkloadId();
if (!hoveredId) return;
- const exists = filteredGuests().some((guest) => workloadSummaryGuestId(guest) === hoveredId);
+ const exists = filteredGuests().some((guest) => getCanonicalWorkloadId(guest) === hoveredId);
if (!exists) {
setHoveredWorkloadId(null);
}
diff --git a/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx b/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx
index cd32bb2dc0..f3425e901c 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx
+++ b/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx
@@ -383,6 +383,23 @@ describe('Dashboard performance contract', () => {
expect(normalizeWorkloadViewModeParam('host')).toBeNull();
});
+ it('deduplicates workloads by canonical workload ID before rendering rows', async () => {
+ mockLocationSearch = '?type=all';
+ mockWorkloads = [
+ makeGuest(1, { id: 'raw-a', instance: 'shared', node: 'node-x', vmid: 42 }),
+ makeGuest(2, { id: 'raw-b', instance: 'shared', node: 'node-x', vmid: 42 }),
+ ];
+
+ const { container } = render(() => <Dashboard vms={[]} containers={[]} nodes={[]} useWorkloads />);
+
+ await waitFor(() => {
+ expect(container.querySelector('table')).toBeInTheDocument();
+ });
+ await waitFor(() => {
+ expect(getGuestRowCount(container)).toBe(1);
+ });
+ });
+
it('filterWorkloads returns all guests when no filters active', () => {
const guests = makeGuests(PROFILES.S);
const result = filterWorkloads({
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 08b85d24c2..4723b20756 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -315,6 +315,7 @@ describe('frontend resource type boundaries', () => {
expect(workloadsSource).toContain('export const normalizeWorkloadViewModeParam');
expect(dashboardSource).toContain('normalizeWorkloadViewModeParam');
expect(dashboardSource).not.toContain('function normalizeViewModeParam');
+ expect(dashboardSource).not.toContain('workloadSummaryGuestId');
expect(emptyStateSource).toContain('getEmptyStatePresentation');
expect(emptyStateSource).not.toContain('const iconBgClass: Record<EmptyStateTone, string> =');
expect(emptyStateSource).not.toContain(