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.

Share facet summaries across resource views

rcourtman4c9ecbd657dc
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 73adaadfb2..fa32e1bf38 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -85,7 +85,10 @@ windowing and mounted-row budget proved by
`UnifiedResourceTable.performance.contract.test.tsx`.
The same facet summary contract applies to the service-resource rows inside
the unified table as well, so PBS and PMG entries must keep the same bounded
-presentation and verification surface as the primary fleet rows.
+presentation and verification surface as the primary fleet rows. The shared
+`ResourceFacetSummary` component now owns that chip rendering path, so any
+future summary changes must preserve the same bounded row budget instead of
+forking separate table-only presentation logic.
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 3a5e382248..b5fa69cce4 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -178,7 +178,10 @@ facet presentation changes must continue to flow through the same governed
resource-row surface rather than inventing a separate ad hoc summary path.
Those chips now appear on both the primary fleet rows and the PBS/PMG service
rows, so the unified consumer surface must remain consistent across the full
-table instead of diverging by resource class.
+table instead of diverging by resource class. The same facet summary now also
+appears in the resource drawer's runtime overview card through a shared
+`ResourceFacetSummary` component, so table and detail views stay aligned on a
+single canonical rendering path for the resource graph counts.
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/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
index 11a4ee3a2f..ba146c1c4e 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
@@ -45,6 +45,7 @@ import {
getResourceRoutingScopeLabel,
getResourceSensitivityLabel,
} from '@/utils/resourcePolicyPresentation';
+import { ResourceFacetSummary } from './ResourceFacetSummary';
interface ResourceDetailDrawerProps {
resource: Resource;
@@ -736,6 +737,22 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
</span>
</div>
</Show>
+ <Show
+ when={
+ resourceCapabilities().length > 0 ||
+ resourceRelationships().length > 0 ||
+ resourceTimeline().length > 0
+ }
+ >
+ <div class="flex flex-col gap-1">
+ <span class="text-muted">Facets</span>
+ <ResourceFacetSummary
+ capabilities={resourceCapabilities()}
+ relationships={resourceRelationships()}
+ recentChanges={resourceTimeline()}
+ />
+ </div>
+ </Show>
<div class="flex items-center justify-between gap-2">
<span class="text-muted">Mode</span>
<span class="font-medium text-base-content">
diff --git a/frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx b/frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx
new file mode 100644
index 0000000000..4efec2f36b
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx
@@ -0,0 +1,83 @@
+import { For, Show, createMemo, type Component } from 'solid-js';
+
+type FacetBadge = {
+ label: string;
+ title: string;
+ className: string;
+};
+
+export interface ResourceFacetSummaryProps {
+ capabilities?: readonly unknown[] | null;
+ relationships?: readonly unknown[] | null;
+ recentChanges?: readonly unknown[] | null;
+ class?: string;
+ testId?: string;
+}
+
+const badgeBase =
+ 'inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium whitespace-nowrap';
+
+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,
+): FacetBadge[] => {
+ const badges: FacetBadge[] = [];
+ const capabilityCount = capabilities?.length ?? 0;
+ const relationshipCount = relationships?.length ?? 0;
+ const changeCount = recentChanges?.length ?? 0;
+
+ if (capabilityCount > 0) {
+ badges.push({
+ label: `Capabilities ${capabilityCount}`,
+ title: countLabel(capabilityCount, 'capability'),
+ className: `${badgeBase} bg-cyan-100 text-cyan-700 dark:bg-cyan-900 dark:text-cyan-300`,
+ });
+ }
+
+ if (relationshipCount > 0) {
+ badges.push({
+ label: `Relationships ${relationshipCount}`,
+ title: countLabel(relationshipCount, 'relationship'),
+ className: `${badgeBase} bg-indigo-100 text-indigo-700 dark:bg-indigo-900 dark:text-indigo-300`,
+ });
+ }
+
+ if (changeCount > 0) {
+ badges.push({
+ label: `Timeline ${changeCount}`,
+ title: countLabel(changeCount, 'timeline event'),
+ className: `${badgeBase} bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-300`,
+ });
+ }
+
+ return badges;
+};
+
+export const ResourceFacetSummary: Component<ResourceFacetSummaryProps> = (props) => {
+ const badges = createMemo(() =>
+ buildFacetBadges(props.capabilities, props.relationships, props.recentChanges),
+ );
+
+ return (
+ <Show when={badges().length > 0}>
+ <div
+ data-testid={props.testId ?? 'resource-facet-summary'}
+ class={`flex flex-wrap gap-1 ${props.class ?? ''}`}
+ >
+ <For each={badges()}>
+ {(badge) => (
+ <span class={badge.className} title={badge.title}>
+ {badge.label}
+ </span>
+ )}
+ </For>
+ </div>
+ </Show>
+ );
+};
+
+export default ResourceFacetSummary;
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx
index f2830741ed..6b533c701c 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx
@@ -40,6 +40,7 @@ import { buildWorkloadsHref } from './workloadsLink';
import { buildServiceDetailLinks } from './serviceDetailLinks';
import { useTableWindowing } from './useTableWindowing';
import { ClusterDeployBanner } from './ClusterDeployBanner';
+import { ResourceFacetSummary } from './ResourceFacetSummary';
interface UnifiedResourceTableProps {
resources: Resource[];
@@ -113,48 +114,6 @@ 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();
@@ -659,7 +618,6 @@ 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 (
@@ -728,17 +686,12 @@ 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>
+ <ResourceFacetSummary
+ capabilities={resource.capabilities}
+ relationships={resource.relationships}
+ recentChanges={resource.recentChanges}
+ class="mt-0.5"
+ />
</div>
<Show when={workloadsHref()}>
{(href) => (
@@ -1105,7 +1058,6 @@ export const UnifiedResourceTable: Component<UnifiedResourceTableProps> = (props
getUnifiedSourceBadges(getUnifiedSources(resource)),
);
const hasUnifiedSources = createMemo(() => unifiedSourceBadges().length > 0);
- const facetBadges = createMemo(() => getResourceFacetBadges(resource));
const healthClass = createMemo(() =>
getServiceHealthSummaryPresentation(resource.status, pbsRow()?.health)
.textClass,
@@ -1186,17 +1138,12 @@ export const UnifiedResourceTable: Component<UnifiedResourceTableProps> = (props
({resource.name})
</span>
</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>
+ <ResourceFacetSummary
+ capabilities={resource.capabilities}
+ relationships={resource.relationships}
+ recentChanges={resource.recentChanges}
+ class="mt-0.5"
+ />
</div>
</TableCell>
@@ -1413,7 +1360,6 @@ export const UnifiedResourceTable: Component<UnifiedResourceTableProps> = (props
getUnifiedSourceBadges(getUnifiedSources(resource)),
);
const hasUnifiedSources = createMemo(() => unifiedSourceBadges().length > 0);
- const facetBadges = createMemo(() => getResourceFacetBadges(resource));
const healthClass = createMemo(() =>
getServiceHealthSummaryPresentation(resource.status, pmgRow()?.health)
.textClass,
@@ -1499,17 +1445,12 @@ export const UnifiedResourceTable: Component<UnifiedResourceTableProps> = (props
({resource.name})
</span>
</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>
+ <ResourceFacetSummary
+ capabilities={resource.capabilities}
+ relationships={resource.relationships}
+ recentChanges={resource.recentChanges}
+ class="mt-0.5"
+ />
</div>
</TableCell>
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
index 5cfdc56793..83af9cafc8 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
@@ -55,6 +55,64 @@ const baseResource = (overrides: Partial<Resource>): Resource => ({
});
describe('ResourceDetailDrawer history tab', () => {
+ it('surfaces compact facet summary chips in the overview runtime card', async () => {
+ facetBundleMock.getFacetBundle.mockResolvedValueOnce({
+ capabilities: [
+ {
+ name: 'restart',
+ type: 'common',
+ 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',
+ occurredAt: '2026-03-18T12:04:00Z',
+ resourceId: 'vm:42',
+ kind: 'restart',
+ from: 'running',
+ to: 'restarting',
+ sourceType: 'platform_event',
+ sourceAdapter: 'proxmox_adapter',
+ confidence: 'high',
+ actor: 'agent:oncall-helper',
+ relatedResources: ['node:pve-1'],
+ reason: 'Routine restart requested',
+ },
+ ],
+ });
+
+ const resource = baseResource({
+ id: 'vm:42',
+ type: 'vm',
+ name: 'vm-42',
+ displayName: 'VM 42',
+ platformId: 'vm-42',
+ platformType: 'proxmox-pve',
+ platformData: { sources: ['proxmox'] },
+ });
+
+ render(() => <ResourceDetailDrawer resource={resource} />);
+
+ expect(await screen.findByText('Capabilities 1')).toBeInTheDocument();
+ expect(screen.getByText('Relationships 1')).toBeInTheDocument();
+ expect(screen.getByText('Timeline 1')).toBeInTheDocument();
+ });
+
it('renders resource capability, relationship, and timeline facets', async () => {
facetBundleMock.getFacetBundle.mockResolvedValueOnce({
capabilities: [
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 674b80e201..0d2be0e7b8 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
@@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import { render, waitFor, within } from '@solidjs/testing-library';
import type { Resource } from '@/types/resource';
import { UnifiedResourceTable } from '@/components/Infrastructure/UnifiedResourceTable';
+import { ResourceFacetSummary } from '@/components/Infrastructure/ResourceFacetSummary';
import {
buildStatusOptions,
filterResources,
@@ -124,6 +125,20 @@ 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' }]}
+ />
+ ));
+
+ expect(getByText('Capabilities 1')).toBeInTheDocument();
+ expect(getByText('Relationships 1')).toBeInTheDocument();
+ expect(getByText('Timeline 1')).toBeInTheDocument();
+ });
+
it('renders facet summary badges without changing the Profile S row budget', async () => {
const resources = makeResources(PROFILES.S, (i) =>
i === 0