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.

Surface facet counts in resource rows

rcourtmandc67b50fdbc1
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 f26bb69cf7..1db8237f62 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -79,6 +79,10 @@ performance-owned runtime, with shared ownership against the unified-resource
consumer boundary. The remaining performance work is no longer top-level
ownership ambiguity on the main dashboard or infrastructure tables.
That hot-path contract now includes policy badge rendering on resource rows.
+It now also includes the compact resource-facet summary chips rendered next
+to policy metadata, and those chips must stay within the same bounded
+windowing and mounted-row budget proved by
+`UnifiedResourceTable.performance.contract.test.tsx`.
Governance metadata such as sensitivity and routing scope may be visible in
the table, but it must remain on the same bounded row-windowing and mounted-row
budget proved by `UnifiedResourceTable.performance.contract.test.tsx` rather
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 8d8d12c7fd..0c9d52ed3e 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -172,7 +172,10 @@ The infrastructure table, selector, and detail-mapper frontend consumers are
now governed as explicit shared boundaries with the performance lane rather
than implicit downstream usage. That means future fleet-scale table changes
must preserve both canonical unified-resource semantics and the table
-performance proof route.
+performance proof route. The shared resource table now also surfaces compact
+facet summary chips for capabilities, relationships, and timeline events, so
+facet presentation changes must continue to flow through the same governed
+resource-row surface rather than inventing a separate ad hoc summary path.
The Connected infrastructure settings surface now also depends on a backend
owned `connectedInfrastructure` projection derived from unified resources plus
reporting-ignore state. That projection is now also the only v6 client
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx
index bc67d96cea..d6cf548d3f 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx
@@ -113,6 +113,48 @@ type HostTableItem = HostTableHeaderItem | HostTableResourceItem;
const HOST_TABLE_ESTIMATED_ROW_HEIGHT = 40;
const HOST_TABLE_WINDOW_SIZE = 137;
+const facetBadgeBase =
+ 'inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium whitespace-nowrap';
+
+type ResourceFacetBadge = {
+ label: string;
+ classes: string;
+ title: string;
+};
+
+const describeCount = (count: number, singular: string, plural = `${singular}s`) =>
+ `${count} ${count === 1 ? singular : plural}`;
+
+const getResourceFacetBadges = (resource: Resource): ResourceFacetBadge[] => {
+ const capabilities = resource.capabilities?.length ?? 0;
+ const relationships = resource.relationships?.length ?? 0;
+ const changes = resource.recentChanges?.length ?? 0;
+ const badges: ResourceFacetBadge[] = [];
+
+ if (capabilities > 0) {
+ badges.push({
+ label: `Capabilities ${capabilities}`,
+ classes: `${facetBadgeBase} bg-cyan-100 text-cyan-700 dark:bg-cyan-900 dark:text-cyan-300`,
+ title: describeCount(capabilities, 'capability', 'capabilities'),
+ });
+ }
+ if (relationships > 0) {
+ badges.push({
+ label: `Relationships ${relationships}`,
+ classes: `${facetBadgeBase} bg-indigo-100 text-indigo-700 dark:bg-indigo-900 dark:text-indigo-300`,
+ title: describeCount(relationships, 'relationship'),
+ });
+ }
+ if (changes > 0) {
+ badges.push({
+ label: `Timeline ${changes}`,
+ classes: `${facetBadgeBase} bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-300`,
+ title: describeCount(changes, 'timeline event'),
+ });
+ }
+
+ return badges;
+};
const isResourceOnline = (resource: Resource) => {
const status = resource.status?.toLowerCase();
@@ -617,6 +659,7 @@ export const UnifiedResourceTable: Component<UnifiedResourceTableProps> = (props
);
const hasUnifiedSources = createMemo(() => unifiedSourceBadges().length > 0);
const policyBadges = createMemo(() => getResourcePolicyBadges(resource.policy));
+ const facetBadges = createMemo(() => getResourceFacetBadges(resource));
const workloadsHref = createMemo(() => buildWorkloadsHref(resource));
return (
@@ -685,6 +728,17 @@ export const UnifiedResourceTable: Component<UnifiedResourceTableProps> = (props
</For>
</div>
</Show>
+ <Show when={facetBadges().length > 0}>
+ <div class="mt-0.5 flex flex-wrap gap-1">
+ <For each={facetBadges()}>
+ {(badge) => (
+ <span class={badge.classes} title={badge.title}>
+ {badge.label}
+ </span>
+ )}
+ </For>
+ </div>
+ </Show>
</div>
<Show when={workloadsHref()}>
{(href) => (
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 9250523589..725fef5b9a 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
@@ -123,6 +123,65 @@ describe('UnifiedResourceTable performance contract', () => {
expect(getBodyRowCount(container)).toBe(PROFILES.S);
});
});
+
+ it('renders facet summary badges without changing the Profile S row budget', async () => {
+ const resources = makeResources(PROFILES.S, (i) =>
+ i === 0
+ ? {
+ capabilities: [
+ {
+ name: 'restart',
+ type: 'native',
+ description: 'Restart the host',
+ minimumApprovalLevel: 'admin',
+ },
+ ],
+ relationships: [
+ {
+ sourceId: 'resource-0',
+ targetId: 'storage-1',
+ type: 'depends_on',
+ confidence: 0.91,
+ active: true,
+ discoverer: 'proxmox_adapter',
+ observedAt: new Date().toISOString(),
+ lastSeenAt: new Date().toISOString(),
+ },
+ ],
+ recentChanges: [
+ {
+ id: 'change-0',
+ observedAt: new Date().toISOString(),
+ resourceId: 'resource-0',
+ kind: 'state_transition',
+ sourceType: 'pulse_diff',
+ confidence: 'high',
+ },
+ ],
+ }
+ : {},
+ );
+ const { container, getByText } = render(() => (
+ <UnifiedResourceTable
+ resources={resources}
+ expandedResourceId={null}
+ onExpandedResourceChange={vi.fn()}
+ groupingMode="flat"
+ />
+ ));
+
+ await waitFor(() => {
+ expect(container.querySelector('table')).toBeInTheDocument();
+ });
+ await waitFor(() => {
+ expect(getByText('Capabilities 1')).toBeInTheDocument();
+ expect(getByText('Relationships 1')).toBeInTheDocument();
+ expect(getByText('Timeline 1')).toBeInTheDocument();
+ });
+ await waitFor(() => {
+ expect(getBodyRowCount(container)).toBe(PROFILES.S);
+ });
+ });
});
describe('Row windowing contracts', () => {
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.policy-governance.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.policy-governance.test.tsx
index f9166f975e..55f1bf5e2e 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.policy-governance.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.policy-governance.test.tsx
@@ -46,6 +46,42 @@ const resource: Resource = {
redact: ['hostname', 'alias'],
},
},
+ capabilities: [
+ {
+ name: 'restart',
+ type: 'native',
+ description: 'Restart the host',
+ minimumApprovalLevel: 'admin',
+ },
+ {
+ name: 'drain',
+ type: 'common',
+ description: 'Drain services safely',
+ minimumApprovalLevel: 'dry_run_only',
+ },
+ ],
+ relationships: [
+ {
+ sourceId: 'resource-1',
+ targetId: 'storage-1',
+ type: 'depends_on',
+ confidence: 0.94,
+ active: true,
+ discoverer: 'proxmox_adapter',
+ observedAt: new Date().toISOString(),
+ lastSeenAt: new Date().toISOString(),
+ },
+ ],
+ recentChanges: [
+ {
+ id: 'change-1',
+ observedAt: new Date().toISOString(),
+ resourceId: 'resource-1',
+ kind: 'state_transition',
+ sourceType: 'pulse_diff',
+ confidence: 'high',
+ },
+ ],
};
describe('UnifiedResourceTable governance presentation', () => {
@@ -62,4 +98,19 @@ describe('UnifiedResourceTable governance presentation', () => {
expect(getByText('Restricted')).toBeInTheDocument();
expect(getByText('Local Only')).toBeInTheDocument();
});
+
+ it('surfaces resource facet counts in the resource row', () => {
+ const { getByText } = render(() => (
+ <UnifiedResourceTable
+ resources={[resource]}
+ expandedResourceId={null}
+ onExpandedResourceChange={vi.fn()}
+ groupingMode="flat"
+ />
+ ));
+
+ expect(getByText('Capabilities 2')).toBeInTheDocument();
+ expect(getByText('Relationships 1')).toBeInTheDocument();
+ expect(getByText('Timeline 1')).toBeInTheDocument();
+ });
});