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.

Centralize dashboard row identity helper

rcourtman32351661f81b
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 390828d02e..a6e16f01ba 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -48,6 +48,7 @@ regression protection.
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`
+7. Render dashboard row identity directly from the shared canonical workload helper so row selection, hover, and fallback metadata lookup stay aligned with the same workload contract
## Forbidden Paths
diff --git a/frontend-modern/src/components/Dashboard/Dashboard.tsx b/frontend-modern/src/components/Dashboard/Dashboard.tsx
index e4306c9fc5..0665f19e9f 100644
--- a/frontend-modern/src/components/Dashboard/Dashboard.tsx
+++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx
@@ -1694,10 +1694,7 @@ export function Dashboard(props: DashboardProps) {
{/* Inner <Index> tracks by position — updates props reactively instead of recreating DOM */}
<Index each={groupGuests()} fallback={<></>}>
{(guest) => {
- const guestId = () => {
- const g = guest();
- return getCanonicalWorkloadId(g);
- };
+ const guestId = createMemo(() => getCanonicalWorkloadId(guest()));
const getMetadata = () =>
guestMetadata()[guestId()] ||
guestMetadata()[
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 f3425e901c..61ef8d2d1d 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
@@ -8,7 +8,7 @@ import {
groupWorkloads,
computeWorkloadStats,
} from '../workloadSelectors';
-import { normalizeWorkloadViewModeParam } from '@/utils/workloads';
+import { getCanonicalWorkloadId, normalizeWorkloadViewModeParam } from '@/utils/workloads';
// Stub ResizeObserver for jsdom
if (typeof globalThis.ResizeObserver === 'undefined') {
@@ -389,6 +389,9 @@ describe('Dashboard performance contract', () => {
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 canonicalId = getCanonicalWorkloadId(
+ makeGuest(1, { id: 'raw-a', instance: 'shared', node: 'node-x', vmid: 42 }) as any,
+ );
const { container } = render(() => <Dashboard vms={[]} containers={[]} nodes={[]} useWorkloads />);
@@ -398,6 +401,7 @@ describe('Dashboard performance contract', () => {
await waitFor(() => {
expect(getGuestRowCount(container)).toBe(1);
});
+ expect(canonicalId).toBe('shared:node-x:42');
});
it('filterWorkloads returns all guests when no filters active', () => {
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 47151cb970..28c0dd093f 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -316,6 +316,8 @@ describe('frontend resource type boundaries', () => {
expect(dashboardSource).toContain('normalizeWorkloadViewModeParam');
expect(dashboardSource).not.toContain('function normalizeViewModeParam');
expect(dashboardSource).not.toContain('workloadSummaryGuestId');
+ expect(dashboardSource).toContain('createMemo(() => getCanonicalWorkloadId(guest()))');
+ expect(dashboardSource).not.toContain('const guestId = () => {');
expect(guestRowSource).toContain('getCanonicalWorkloadId');
expect(guestRowSource).not.toContain('buildGuestId');
expect(guestDrawerSource).toContain('getCanonicalWorkloadId');