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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Share frontend resource relationship presentation
rcourtmana4a4f1752f42
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 9fbc041b7a..8b230dc30a 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -92,6 +92,10 @@ The Patrol page and resource drawer now also share the canonical`frontend-modern/src/utils/resourceChangePresentation.ts` formatter sorecent-change kind and headline wording stays aligned wherever the canonicaltimeline is surfaced.+The Patrol page and resource drawer now also share a frontend relationship+presentation helper for graph labels and provenance wording, so the same+canonical relationship semantics render consistently across the resource and+intelligence surfaces.The backend Patrol and AI runtime summaries now also share`internal/unifiedresources/change_presentation.go` for the canonicalchange-kind and provenance mapping, so the same resource-model semanticsdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 19634de241..c91256eb53 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -127,6 +127,10 @@ The frontend now also consumes those facet reads through`frontend-modern/src/api/resources.ts` and the dedicated resource detaildrawer, which keeps the presentation surface aligned with the governed APIcontract instead of rebuilding the graph and timeline inline.+That drawer now also uses a shared frontend relationship-presentation helper+for graph labels and provenance wording, so the UI stays aligned with the+canonical relationship semantics instead of keeping drawer-local token+humanization.The same facet bundle now also returns grouped recent-change counts bycanonical change kind, so the detail drawer can surface the distribution ofstate transitions, restarts, config updates, anomalies, relationships, anddiff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsxindex f76cd225c2..6e6ac038af 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx@@ -53,6 +53,7 @@ import {getResourceSensitivityLabel,} from '@/utils/resourcePolicyPresentation';import { formatResourceChangeKind } from '@/utils/resourceChangePresentation';+import { describeResourceRelationship } from '@/utils/resourceRelationshipPresentation';import { ResourceFacetSummary } from './ResourceFacetSummary';import type { ResourceIntelligence } from '@/types/aiIntelligence';@@ -1726,7 +1727,9 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {><div class="space-y-2"><For each={historyRelationships()}>- {(relationship) => (+ {(relationship) => {+ const presentation = describeResourceRelationship(relationship);+ return (<div class="rounded border border-border bg-surface-hover px-2 py-1.5 text-[10px]"><div class="flex items-center justify-between gap-2"><span class="font-medium text-base-content">@@ -1760,7 +1763,7 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {)}</Show></span>- <span class="text-muted">{humanizeFacetToken(relationship.type)}</span>+ <span class="text-muted">{presentation.typeLabel}</span></div><div class="mt-1 grid gap-1 sm:grid-cols-2"><div class="flex items-center justify-between gap-2">@@ -1778,7 +1781,7 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {<div class="flex items-center justify-between gap-2"><span class="text-muted">Discoverer</span><span class="font-medium text-base-content">- {relationship.discoverer || '—'}+ {presentation.provenance || '—'}</span></div><div class="flex items-center justify-between gap-2">@@ -1808,7 +1811,8 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {</details></Show></div>- )}+ );+ }}</For></div></Show>diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsxindex fd6665f8f7..746c646287 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx@@ -259,6 +259,7 @@ describe('ResourceDetailDrawer history tab', () => {expect(panel.getAllByText('Relationships')).toHaveLength(2);expect(panel.getByText('Timeline')).toBeInTheDocument();expect(panel.getByText('Timeline 3')).toBeInTheDocument();+ expect(panel.getByText('Runs on')).toBeInTheDocument();expect(panel.getByText('Docker adapter 1')).toBeInTheDocument();expect(panel.getByText('Proxmox adapter 2')).toBeInTheDocument();expect(diff --git a/frontend-modern/src/utils/__tests__/resourceRelationshipPresentation.test.ts b/frontend-modern/src/utils/__tests__/resourceRelationshipPresentation.test.tsnew file mode 100644index 0000000000..918979907f--- /dev/null+++ b/frontend-modern/src/utils/__tests__/resourceRelationshipPresentation.test.ts@@ -0,0 +1,40 @@+import { describe, expect, it } from 'vitest';++import { describeResourceRelationship, formatResourceRelationshipType } from '@/utils/resourceRelationshipPresentation';++describe('resourceRelationshipPresentation', () => {+ it('formats canonical relationship type labels', () => {+ expect(formatResourceRelationshipType('runs_on')).toBe('Runs on');+ expect(formatResourceRelationshipType('depends_on')).toBe('Depends on');+ expect(formatResourceRelationshipType('mounted_to')).toBe('Mounted to');+ expect(formatResourceRelationshipType('exposed_by')).toBe('Exposed by');+ expect(formatResourceRelationshipType('owned_by')).toBe('Owned by');+ expect(formatResourceRelationshipType('custom_link')).toBe('Custom link');+ expect(formatResourceRelationshipType('')).toBe('Related to');+ });++ it('describes canonical relationship context fragments', () => {+ const presentation = describeResourceRelationship({+ sourceId: 'node-1',+ targetId: 'vm-1',+ type: 'runs_on',+ confidence: 0.85,+ active: false,+ discoverer: 'proxmox_adapter',+ observedAt: '2026-03-18T12:00:00Z',+ lastSeenAt: '2026-03-18T12:05:00Z',+ metadata: {+ region: 'lab',+ },+ });++ expect(presentation).toMatchObject({+ typeLabel: 'Runs on',+ direction: 'node-1 → vm-1',+ provenance: 'proxmox_adapter',+ stateLabel: 'Historical',+ confidence: '85%',+ hasMetadata: true,+ });+ });+});diff --git a/frontend-modern/src/utils/resourceRelationshipPresentation.ts b/frontend-modern/src/utils/resourceRelationshipPresentation.tsnew file mode 100644index 0000000000..fe70021f5e--- /dev/null+++ b/frontend-modern/src/utils/resourceRelationshipPresentation.ts@@ -0,0 +1,46 @@+import type { ResourceRelationship, ResourceRelationshipType } from '@/types/resource';++export interface ResourceRelationshipPresentation {+ typeLabel: string;+ direction: string;+ provenance: string;+ stateLabel: string;+ confidence: string;+ hasMetadata: boolean;+}++export function formatResourceRelationshipType(type: ResourceRelationshipType | string): string {+ switch (type) {+ case 'runs_on':+ return 'Runs on';+ case 'depends_on':+ return 'Depends on';+ case 'mounted_to':+ return 'Mounted to';+ case 'exposed_by':+ return 'Exposed by';+ case 'owned_by':+ return 'Owned by';+ default: {+ const raw = String(type).trim().replace(/_/g, ' ');+ if (!raw) {+ return 'Related to';+ }+ return raw[0].toUpperCase() + raw.slice(1);+ }+ }+}++export function describeResourceRelationship(+ relationship: ResourceRelationship,+): ResourceRelationshipPresentation {+ return {+ typeLabel: formatResourceRelationshipType(relationship.type),+ direction: `${relationship.sourceId.trim()} → ${relationship.targetId.trim()}`,+ provenance: relationship.discoverer.trim(),+ stateLabel: relationship.active ? 'Active' : 'Historical',+ confidence:+ relationship.confidence > 0 ? `${Math.round(relationship.confidence * 100)}%` : '',+ hasMetadata: Boolean(relationship.metadata && Object.keys(relationship.metadata).length > 0),+ };+}