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.

Resolve related resource labels in timeline cards

rcourtmana5b1c6135496
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 b6be08d8a0..51ba777101 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -124,6 +124,10 @@ alternate name when policy requires governed handling. That keeps the
policy-aware label path inside the same hot-row rendering budget instead of
adding a second display branch for redacted fleets, and the proof for that
behavior lives in `UnifiedResourceTable.performance.contract.test.tsx`.
+The shared table now also passes the same canonical resource-label resolver
+into the detail drawer so related-resource chips in the timeline/history path
+can resolve through the canonical catalog without adding a separate
+detail-only lookup branch to the hot-row path.
The shared infrastructure selector search path now also routes through that
same policy-aware display contract, so governed resources do not reappear via
raw-name search candidates while the selector stays on the same hot-path
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index e20ec4f3fd..e633c2a052 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -399,6 +399,10 @@ and `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.ts
cards from the Patrol page, resource drawer, and problem-resource dashboard
panels, so canonical resource-filter path construction stays owned by the
shared summary cards rather than being duplicated per surface.
+The unified resource table now also supplies a canonical resource-label
+resolver into the resource drawer, so related-resource timeline chips can use
+the same governed display labels as the table without adding a new
+detail-local lookup path.
The same timeline and facet-bundle reads now also accept governed `kind` and
`sourceType` filters, plus a governed `sourceAdapter` filter for adapter-level
provenance drill-down, so history can narrow by canonical change class and
diff --git a/frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx b/frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx
index b2cbf48e12..8698d239c1 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx
@@ -16,6 +16,7 @@ interface ResourceChangeSummaryProps {
subtitle?: string;
emptyText?: string;
buildResourceHref?: (resourceId: string) => string | null | undefined;
+ resolveResourceLabel?: (resourceId: string) => string | null | undefined;
maxChanges?: number;
compact?: boolean;
class?: string;
@@ -28,6 +29,7 @@ export const ResourceChangeSummary: Component<ResourceChangeSummaryProps> = (pro
const hasChanges = () => visibleChanges().length > 0;
const compact = () => props.compact ?? false;
const buildResourceHref = props.buildResourceHref ?? buildInfrastructureResourceHref;
+ const resolveResourceLabel = props.resolveResourceLabel;
const itemPadding = () => (compact() ? 'p-2.5' : 'p-3');
const itemText = () => (compact() ? 'text-[11px]' : 'text-xs');
const headlineText = () => (compact() ? 'text-[11px]' : 'text-sm');
@@ -35,6 +37,7 @@ export const ResourceChangeSummary: Component<ResourceChangeSummaryProps> = (pro
const gapSize = () => (compact() ? 'gap-2' : 'gap-3');
const renderRelatedResource = (resourceId: string) => {
+ const label = resolveResourceLabel?.(resourceId)?.trim() || resourceId;
const href = buildResourceHref(resourceId);
const className =
'rounded-full border border-border-subtle bg-surface px-2 py-0.5 font-medium text-muted transition-colors hover:border-border hover:text-base-content';
@@ -43,12 +46,12 @@ export const ResourceChangeSummary: Component<ResourceChangeSummaryProps> = (pro
<a
href={href}
class={className}
- aria-label={`Open related resource ${resourceId} in Infrastructure`}
+ aria-label={`Open related resource ${label} in Infrastructure`}
>
- {resourceId}
+ {label}
</a>
) : (
- <span class={className}>{resourceId}</span>
+ <span class={className}>{label}</span>
);
};
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
index a424aa2e7d..a47397839a 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
@@ -78,6 +78,7 @@ import { buildInfrastructureResourceHref } from '@/routing/resourceLinks';
interface ResourceDetailDrawerProps {
resource: Resource;
onClose?: () => void;
+ resolveResourceLabel?: (resourceId: string) => string | null | undefined;
}
import {
@@ -140,6 +141,8 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
const [showReportModal, setShowReportModal] = createSignal(false);
const displayName = createMemo(() => getPreferredResourceDisplayName(props.resource));
+ const resolveResourceLabel = (resourceId: string): string =>
+ props.resolveResourceLabel?.(resourceId)?.trim() || resourceId;
const statusIndicator = createMemo(() =>
getAgentStatusIndicator({ status: props.resource.status }),
);
@@ -812,6 +815,7 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
class="space-y-0"
title="Latest canonical change"
changes={intel().recent_changes}
+ resolveResourceLabel={resolveResourceLabel}
maxChanges={1}
compact
/>
@@ -1631,18 +1635,19 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
<span>Related:</span>
<For each={change.relatedResources ?? []}>
{(relatedResource) => {
+ const label = resolveResourceLabel(relatedResource);
const href = buildInfrastructureResourceHref(relatedResource);
return href ? (
<a
class="inline-flex rounded bg-surface px-1.5 py-0.5 text-[10px] text-blue-700 hover:underline dark:text-blue-300"
href={href}
- aria-label={`Open related resource ${relatedResource} in Infrastructure`}
+ aria-label={`Open related resource ${label} in Infrastructure`}
>
- {relatedResource}
+ {label}
</a>
) : (
<span class="inline-flex rounded bg-surface px-1.5 py-0.5 text-[10px] text-base-content">
- {relatedResource}
+ {label}
</span>
);
}}
@@ -1880,7 +1885,13 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
};
export const ResourceDetailDrawer: Component<ResourceDetailDrawerProps> = (props) => {
- return <DrawerContent resource={props.resource} onClose={props.onClose} />;
+ return (
+ <DrawerContent
+ resource={props.resource}
+ onClose={props.onClose}
+ resolveResourceLabel={props.resolveResourceLabel}
+ />
+ );
};
export default ResourceDetailDrawer;
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx
index 823e8f99f0..d27b7d5041 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx
@@ -236,6 +236,15 @@ export const UnifiedResourceTable: Component<UnifiedResourceTableProps> = (props
const sortedResources = createMemo(() =>
sortResources(primaryResources(), sortKey(), sortDirection()),
);
+ const resourceLabelById = createMemo(() => {
+ const map = new Map<string, string>();
+ for (const resource of props.resources) {
+ map.set(resource.id, getPreferredResourceDisplayName(resource));
+ }
+ return map;
+ });
+ const resolveResourceLabel = (resourceId: string): string | undefined =>
+ resourceLabelById().get(resourceId);
const groupedResources = createMemo<ResourceGroup[]>(() =>
groupResources(sortedResources(), props.groupingMode ?? 'grouped'),
@@ -954,6 +963,7 @@ export const UnifiedResourceTable: Component<UnifiedResourceTableProps> = (props
>
<ResourceDetailDrawer
resource={resource}
+ resolveResourceLabel={resolveResourceLabel}
onClose={() => setExpandedResourceId(null)}
/>
</TableCell>
@@ -1260,6 +1270,7 @@ export const UnifiedResourceTable: Component<UnifiedResourceTableProps> = (props
>
<ResourceDetailDrawer
resource={resource}
+ resolveResourceLabel={resolveResourceLabel}
onClose={() => setExpandedResourceId(null)}
/>
</TableCell>
@@ -1595,6 +1606,7 @@ export const UnifiedResourceTable: Component<UnifiedResourceTableProps> = (props
>
<ResourceDetailDrawer
resource={resource}
+ resolveResourceLabel={resolveResourceLabel}
onClose={() => setExpandedResourceId(null)}
/>
</TableCell>
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceChangeSummary.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceChangeSummary.test.tsx
index 1aab4bfc0f..7ad3b28fa7 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceChangeSummary.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceChangeSummary.test.tsx
@@ -10,6 +10,9 @@ describe('ResourceChangeSummary', () => {
class="mt-2"
title="Recent changes"
subtitle="Canonical 24h timeline"
+ resolveResourceLabel={(resourceId) =>
+ resourceId === 'vm-200' ? 'VM 200' : resourceId === 'vm-300' ? 'VM 300' : resourceId
+ }
changes={[
{
id: 'older-change',
@@ -50,8 +53,9 @@ describe('ResourceChangeSummary', () => {
screen.getByRole('link', { name: 'Open resource storage-2 in Infrastructure' }),
).toHaveAttribute('href', '/infrastructure?resource=storage-2');
expect(
- screen.getByRole('link', { name: 'Open related resource vm-200 in Infrastructure' }),
+ screen.getByRole('link', { name: 'Open related resource VM 200 in Infrastructure' }),
).toHaveAttribute('href', '/infrastructure?resource=vm-200');
+ expect(screen.getByText('VM 200')).toBeInTheDocument();
expect(screen.getByText('By agent:ops-helper')).toBeInTheDocument();
expect(screen.getByText('Restart after maintenance')).toBeInTheDocument();
expect(screen.queryByRole('link', { name: 'Open resource storage-1 in Infrastructure' })).toBeNull();
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 c84fe777d3..7eebd2e11b 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
@@ -150,7 +150,14 @@ describe('ResourceDetailDrawer history tab', () => {
platformData: { sources: ['proxmox'] },
});
- render(() => <ResourceDetailDrawer resource={resource} />);
+ render(() => (
+ <ResourceDetailDrawer
+ resource={resource}
+ resolveResourceLabel={(resourceId) =>
+ resourceId === 'node:pve-1' ? 'PVE Node 1' : resourceId
+ }
+ />
+ ));
await screen.findByText('History loaded');
expect(screen.getAllByText('Timeline 3')).toHaveLength(2);
@@ -244,7 +251,14 @@ describe('ResourceDetailDrawer history tab', () => {
platformData: { sources: ['proxmox'] },
});
- render(() => <ResourceDetailDrawer resource={resource} />);
+ render(() => (
+ <ResourceDetailDrawer
+ resource={resource}
+ resolveResourceLabel={(resourceId) =>
+ resourceId === 'node:pve-1' ? 'PVE Node 1' : resourceId
+ }
+ />
+ ));
fireEvent.click(screen.getByRole('button', { name: 'History' }));
@@ -260,8 +274,9 @@ describe('ResourceDetailDrawer history tab', () => {
expect(panel.getByText('Docker adapter 1')).toBeInTheDocument();
expect(panel.getByText('Proxmox adapter 2')).toBeInTheDocument();
expect(
- panel.getByRole('link', { name: 'Open related resource node:pve-1 in Infrastructure' }),
+ panel.getByRole('link', { name: 'Open related resource PVE Node 1 in Infrastructure' }),
).toHaveAttribute('href', '/infrastructure?resource=node%3Apve-1');
+ expect(panel.getByText('PVE Node 1')).toBeInTheDocument();
expect(panel.getByText('Routine restart requested')).toBeInTheDocument();
expect(panel.getByText('Confidence')).toBeInTheDocument();
expect(panel.getByText('Adapter')).toBeInTheDocument();
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 05836267ad..b6fef7cb57 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
@@ -14,6 +14,7 @@ import {
splitPrimaryAndServiceResources,
computeIOScale,
} from '@/components/Infrastructure/infrastructureSelectors';
+const resourceDetailDrawerMock = vi.hoisted(() => vi.fn());
// Stub ResizeObserver for jsdom
if (typeof globalThis.ResizeObserver === 'undefined') {
globalThis.ResizeObserver = class ResizeObserver {
@@ -22,6 +23,9 @@ if (typeof globalThis.ResizeObserver === 'undefined') {
disconnect() {}
} as unknown as typeof ResizeObserver;
}
+if (typeof Element.prototype.scrollIntoView !== 'function') {
+ Element.prototype.scrollIntoView = vi.fn();
+}
vi.mock('@/hooks/useBreakpoint', () => ({
useBreakpoint: () => ({
@@ -35,7 +39,10 @@ vi.mock('@/components/shared/responsive', () => ({
}));
vi.mock('@/components/Infrastructure/ResourceDetailDrawer', () => ({
- ResourceDetailDrawer: () => <div data-testid="resource-drawer">drawer</div>,
+ ResourceDetailDrawer: (props: Record<string, unknown>) => {
+ resourceDetailDrawerMock(props);
+ return <div data-testid="resource-drawer">drawer</div>;
+ },
}));
const makeResource = (i: number, overrides?: Partial<Resource>): Resource => ({
@@ -347,6 +354,38 @@ describe('UnifiedResourceTable performance contract', () => {
expect(row.queryByText('Relationships 1')).toBeNull();
}
});
+
+ it('passes the canonical resource-label resolver into the drawer for related-resource chips', async () => {
+ resourceDetailDrawerMock.mockClear();
+ const resources = [
+ makeResource(0, {
+ id: 'resource-0',
+ displayName: 'Host 0',
+ name: 'host-0',
+ }),
+ ];
+ const { container } = render(() => (
+ <UnifiedResourceTable
+ resources={resources}
+ expandedResourceId="resource-0"
+ onExpandedResourceChange={vi.fn()}
+ groupingMode="flat"
+ />
+ ));
+
+ await waitFor(() => {
+ expect(container.querySelector('table')).toBeInTheDocument();
+ });
+ await waitFor(() => {
+ expect(resourceDetailDrawerMock).toHaveBeenCalled();
+ });
+
+ const drawerProps = resourceDetailDrawerMock.mock.calls.at(-1)?.[0] as {
+ resolveResourceLabel?: (resourceId: string) => string | undefined;
+ };
+
+ expect(drawerProps.resolveResourceLabel?.('resource-0')).toBe('Host 0');
+ });
});
describe('Row windowing contracts', () => {