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.

Tighten shared facet summary types

rcourtman606f193b0570
diff --git a/frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx b/frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx
index 4efec2f36b..8a1bfd5235 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx
@@ -1,4 +1,9 @@
import { For, Show, createMemo, type Component } from 'solid-js';
+import type {
+ ResourceCapability,
+ ResourceChange,
+ ResourceRelationship,
+} from '@/types/resource';
type FacetBadge = {
label: string;
@@ -7,9 +12,9 @@ type FacetBadge = {
};
export interface ResourceFacetSummaryProps {
- capabilities?: readonly unknown[] | null;
- relationships?: readonly unknown[] | null;
- recentChanges?: readonly unknown[] | null;
+ capabilities?: readonly ResourceCapability[] | null;
+ relationships?: readonly ResourceRelationship[] | null;
+ recentChanges?: readonly ResourceChange[] | null;
class?: string;
testId?: string;
}
@@ -21,9 +26,9 @@ const countLabel = (count: number, singular: string, plural = `${singular}s`) =>
`${count} ${count === 1 ? singular : plural}`;
const buildFacetBadges = (
- capabilities?: readonly unknown[] | null,
- relationships?: readonly unknown[] | null,
- recentChanges?: readonly unknown[] | null,
+ capabilities?: readonly ResourceCapability[] | null,
+ relationships?: readonly ResourceRelationship[] | null,
+ recentChanges?: readonly ResourceChange[] | null,
): FacetBadge[] => {
const badges: FacetBadge[] = [];
const capabilityCount = capabilities?.length ?? 0;
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.tsx
index 0d2be0e7b8..757c526c76 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
@@ -128,9 +128,36 @@ describe('UnifiedResourceTable performance contract', () => {
it('renders the shared facet summary component for canonical resource counts', async () => {
const { getByText } = render(() => (
<ResourceFacetSummary
- capabilities={[{ id: 'capability-1' }]}
- relationships={[{ id: 'relationship-1' }]}
- recentChanges={[{ id: 'change-1' }]}
+ capabilities={[
+ {
+ name: 'restart',
+ type: 'native',
+ description: 'Restart the resource safely.',
+ minimumApprovalLevel: 'admin',
+ },
+ ]}
+ relationships={[
+ {
+ sourceId: 'node:pve-1',
+ targetId: 'vm:42',
+ type: 'runs_on',
+ confidence: 1,
+ active: true,
+ discoverer: 'proxmox_adapter',
+ observedAt: '2026-03-18T12:00:00Z',
+ lastSeenAt: '2026-03-18T12:05:00Z',
+ },
+ ]}
+ recentChanges={[
+ {
+ id: 'change-1',
+ observedAt: '2026-03-18T12:06:00Z',
+ resourceId: 'vm:42',
+ kind: 'restart',
+ sourceType: 'platform_event',
+ confidence: 'high',
+ },
+ ]}
/>
));