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 canonical resource change formatting
rcourtmanaf05d195b964
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 00bc597ffc..d5b1c02f76 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -76,6 +76,7 @@ Own canonical runtime payload shapes between backend and frontend.5. Route unified-resource action, lifecycle, and export audit reads through `internal/api/activity_audit_handlers.go`, `internal/api/router_routes_licensing.go`, and `internal/api/contract_test.go` together so the control-plane execution trail stays on a governed API contract instead of a store-only shape6. Route dedicated unified-resource capability, relationship, timeline, and facet-bundle reads through `frontend-modern/src/api/resources.ts`, `internal/api/resources.go`, and `internal/api/contract_test.go` together so the backend facet contract and the frontend client stay aligned on one governed surface, including the backend-provided facet counts needed to distinguish loaded slices from total history7. Route canonical AI intelligence summary and resource-intelligence reads through `frontend-modern/src/api/ai.ts`, `frontend-modern/src/stores/aiIntelligence.ts`, `frontend-modern/src/pages/AIIntelligence.tsx`, `internal/api/ai_handlers.go`, and `internal/api/contract_test.go` together so the summary card, store state, and backend payload stay aligned on one governed surface, including the canonical recent-changes slice+ and the shared `frontend-modern/src/utils/resourceChangePresentation.ts` formatter used by the summary page and resource drawer, so canonical change wording does not drift across surfaces8. Route frontend API-client parsed error propagation, API-error-status fallback handling, allowed-status handling, custom status-specific error handling, command-trigger success envelope handling, shared response parsing pipelines, missing-resource lookup handling, metadata CRUD routing, stream event consumption, response status, collection normalization, scalar payload coercion, and structured error normalization through canonical shared helpers under `frontend-modern/src/api/`9. Add or change API token scope, assignment, and revocation presentation through `frontend-modern/src/components/Settings/APITokenManager.tsx`10. Add or change infrastructure operations token generation, lookup, assignment, and reporting/install presentation through `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 348014d82f..87b0d3c046 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -84,3 +84,7 @@ unified-resource timeline.The Patrol page also now renders the canonical intelligence summary cardthrough the governed AI client and store, so the visible page summary and theresource/timeline sections stay aligned on the same shared backend slice.+The Patrol page and resource drawer now also share the canonical+`frontend-modern/src/utils/resourceChangePresentation.ts` formatter so+recent-change kind and headline wording stays aligned wherever the canonical+timeline is surfaced.diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsxindex 3c0ddf9ddf..f76cd225c2 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx@@ -52,6 +52,7 @@ import {getResourceRoutingScopeLabel,getResourceSensitivityLabel,} from '@/utils/resourcePolicyPresentation';+import { formatResourceChangeKind } from '@/utils/resourceChangePresentation';import { ResourceFacetSummary } from './ResourceFacetSummary';import type { ResourceIntelligence } from '@/types/aiIntelligence';@@ -854,7 +855,10 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {Latest canonical change</div><div class="mt-0.5 text-[11px] text-base-content">- {intel().recent_changes?.[0]?.kind.replace(/_/g, ' ')} ·{' '}+ {formatResourceChangeKind(+ intel().recent_changes?.[0]?.kind as ResourceChangeKind,+ )}{' '}+ ·{' '}{intel().recent_changes?.[0]?.reason ||intel().recent_changes?.[0]?.resourceId}</div>diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsxindex 6803c76b90..1c45cbd55e 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx@@ -300,7 +300,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {expect(getByText('1')).toBeInTheDocument();const latestChange = getByText('Latest canonical change').parentElement;expect(latestChange).not.toBeNull();- expect(latestChange).toHaveTextContent('config update');+ expect(latestChange).toHaveTextContent('Config update');expect(latestChange).toHaveTextContent('Updated canonical config');expect(latestChange).toHaveTextContent(/just now|m ago|h ago|d ago/);});diff --git a/frontend-modern/src/pages/AIIntelligence.tsx b/frontend-modern/src/pages/AIIntelligence.tsxindex db53799b00..e4fe8f0cf8 100644--- a/frontend-modern/src/pages/AIIntelligence.tsx+++ b/frontend-modern/src/pages/AIIntelligence.tsx@@ -89,48 +89,18 @@ import {} from '@/utils/patrolFormat';import { getAIQuickstartCreditsPresentation } from '@/utils/aiQuickstartPresentation';import { buildPatrolScheduleOptions } from '@/utils/aiPatrolSchedulePresentation';+import {+ formatResourceChangeHeadline,+ formatResourceChangeKind,+} from '@/utils/resourceChangePresentation';import {getProTrialStartedMessage,getTrialAlreadyUsedMessage,getTrialStartErrorMessage,getTrialTryAgainLaterMessage,} from '@/utils/upgradePresentation';-import type { ResourceChange } from '@/types/resource';-type PatrolTab = 'findings' | 'history';-function formatRecentChangeKind(kind: ResourceChange['kind']): string {- switch (kind) {- case 'state_transition':- return 'State transition';- case 'restart':- return 'Restart';- case 'config_update':- return 'Config change';- case 'metric_anomaly':- return 'Metric anomaly';- case 'relationship_change':- return 'Relationship change';- case 'capability_change':- return 'Capability change';- default:- return String(kind).replace(/_/g, ' ');- }-}--function formatRecentChangeHeadline(change: ResourceChange): string {- if (change.kind === 'state_transition' && change.from && change.to) {- return `${formatRecentChangeKind(change.kind)}: ${change.from} → ${change.to}`;- }- if (change.kind === 'restart' && change.from && change.to) {- return `${formatRecentChangeKind(change.kind)}: ${change.from} → ${change.to}`;- }- if (change.reason) {- return `${formatRecentChangeKind(change.kind)}: ${change.reason}`;- }- return `${formatRecentChangeKind(change.kind)}: ${change.resourceId}`;-}-export function AIIntelligence() {const [activeTab, setActiveTab] = createSignal<PatrolTab>('findings');const [findingsFilterOverride, setFindingsFilterOverride] = createSignal<@@ -1321,7 +1291,7 @@ export function AIIntelligence() {<div class="flex flex-wrap items-start justify-between gap-3"><div class="min-w-0"><p class="text-sm font-medium text-base-content">- {formatRecentChangeHeadline(change)}+ {formatResourceChangeHeadline(change)}</p><p class="mt-1 text-xs text-muted"><span class="font-mono">{change.resourceId}</span>@@ -1335,7 +1305,7 @@ export function AIIntelligence() {<div class="flex flex-wrap items-center gap-1.5"><span class="rounded-full border border-border-subtle bg-surface px-2 py-0.5 text-[11px] font-medium text-muted">- {formatRecentChangeKind(change.kind)}+ {formatResourceChangeKind(change.kind)}</span><span class="rounded-full border border-border-subtle bg-surface px-2 py-0.5 text-[11px] font-medium text-muted">{change.sourceType}diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsxindex 34769ffe8d..f0ab3e7533 100644--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx@@ -408,7 +408,7 @@ describe('AIIntelligence entitlement gating', () => {expect(screen.getByText(/Health A · 91\/100/)).toBeInTheDocument();expect(screen.getByText(/Recent changes 1/)).toBeInTheDocument();- expect(screen.getByText('Config change: Updated guest configuration')).toBeInTheDocument();+ expect(screen.getByText('Config update: Updated guest configuration')).toBeInTheDocument();expect(screen.getByText('vm-100')).toBeInTheDocument();expect(screen.getByText('proxmox_adapter')).toBeInTheDocument();expect(screen.getByText('Learning signals')).toBeInTheDocument();diff --git a/frontend-modern/src/utils/__tests__/resourceChangePresentation.test.ts b/frontend-modern/src/utils/__tests__/resourceChangePresentation.test.tsnew file mode 100644index 0000000000..0903b5ea15--- /dev/null+++ b/frontend-modern/src/utils/__tests__/resourceChangePresentation.test.ts@@ -0,0 +1,37 @@+import { describe, expect, it } from 'vitest';++import {+ formatResourceChangeHeadline,+ formatResourceChangeKind,+} from '@/utils/resourceChangePresentation';++describe('resourceChangePresentation utils', () => {+ it('formats canonical resource change kinds', () => {+ expect(formatResourceChangeKind('config_update')).toBe('Config update');+ expect(formatResourceChangeKind('metric_anomaly')).toBe('Metric anomaly');+ expect(formatResourceChangeKind('relationship_change')).toBe('Relationship change');+ });++ it('formats canonical resource change headlines', () => {+ expect(+ formatResourceChangeHeadline({+ id: 'change-1',+ resourceId: 'vm:42',+ kind: 'state_transition',+ from: 'running',+ to: 'restarting',+ observedAt: '2026-03-18T12:00:00Z',+ } as never),+ ).toBe('State transition: running → restarting');++ expect(+ formatResourceChangeHeadline({+ id: 'change-2',+ resourceId: 'vm:42',+ kind: 'config_update',+ reason: 'Updated canonical config',+ observedAt: '2026-03-18T12:00:00Z',+ } as never),+ ).toBe('Config update: Updated canonical config');+ });+});diff --git a/frontend-modern/src/utils/resourceChangePresentation.ts b/frontend-modern/src/utils/resourceChangePresentation.tsnew file mode 100644index 0000000000..25d9049b1d--- /dev/null+++ b/frontend-modern/src/utils/resourceChangePresentation.ts@@ -0,0 +1,33 @@+import type { ResourceChange } from '@/types/resource';++export function formatResourceChangeKind(kind: ResourceChange['kind']): string {+ switch (kind) {+ case 'state_transition':+ return 'State transition';+ case 'restart':+ return 'Restart';+ case 'config_update':+ return 'Config update';+ case 'metric_anomaly':+ return 'Metric anomaly';+ case 'relationship_change':+ return 'Relationship change';+ case 'capability_change':+ return 'Capability change';+ default:+ return String(kind).replace(/_/g, ' ');+ }+}++export function formatResourceChangeHeadline(change: ResourceChange): string {+ if (change.kind === 'state_transition' && change.from && change.to) {+ return `${formatResourceChangeKind(change.kind)}: ${change.from} → ${change.to}`;+ }+ if (change.kind === 'restart' && change.from && change.to) {+ return `${formatResourceChangeKind(change.kind)}: ${change.from} → ${change.to}`;+ }+ if (change.reason) {+ return `${formatResourceChangeKind(change.kind)}: ${change.reason}`;+ }+ return `${formatResourceChangeKind(change.kind)}: ${change.resourceId}`;+}