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 canonical resource graph summary

rcourtman5c0577da3aa0
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index eef29bce0d..8d6500faf4 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -163,7 +163,10 @@ reconstructed from the drawer or prompt helpers.
The Patrol intelligence page now also fetches the learned correlation list
from the canonical AI correlations endpoint, so the global AI surface and the
resource drawer both expose the same learned edge evidence instead of only
-showing a correlation count.
+showing a correlation count. The same page and drawer now render that list
+through the shared `frontend-modern/src/components/Infrastructure/ResourceGraphSummary.tsx`
+card, so the learned-correlation layout and edge wording stay aligned across
+both surfaces.
The Patrol intelligence seed context now also prefers the canonical
unified-resource timeline before falling back to the patrol-local change
detector, so deterministic patrol context and resource detail context share
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index fd7d79567f..4e41adb654 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -82,6 +82,7 @@ Own canonical runtime payload shapes between backend and frontend.
and the learned-correlation payload loaded into the shared AI intelligence store, so the Patrol intelligence page and the AI summary page consume the same governed correlation slice instead of each page fetching its own copy
and the shared dashboard-load bundle inside `frontend-modern/src/stores/aiIntelligence.ts`, so the page orchestration stays on the store-owned bundle instead of enumerating the AI fetches inline
and the shared `frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx` card, so the AI summary page and resource drawer render the same governed policy-posture counts instead of carrying duplicate posture UI loops
+ and the shared `frontend-modern/src/components/Infrastructure/ResourceGraphSummary.tsx` card, so learned correlations and graph context stay rendered through one governed frontend card instead of separate page-local list loops
8. 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.md
index 14c5b760d1..734c7484bb 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -103,7 +103,10 @@ The Patrol intelligence page now also consumes the learned correlation list
from the canonical AI correlations endpoint through the shared
`frontend-modern/src/stores/aiIntelligence.ts` store, so the global summary
and the resource drawer both reflect the same learned edge evidence instead
-of each page fetching its own copy.
+of each page fetching its own copy. Both surfaces now render that evidence
+through the shared `frontend-modern/src/components/Infrastructure/ResourceGraphSummary.tsx`
+card, so the correlation layout stays governed by one component instead of
+two page-local card implementations.
That same store now owns the Patrol dashboard load bundle as well, so the
page refresh path stays aligned on a single orchestrated AI bundle instead of
repeating the individual summary, findings, approval, and correlation fetches
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 177924703b..4f6a39dcc2 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -105,7 +105,11 @@ helpers or drawer-specific markdown.
The same AI resource-intelligence payload now also carries canonical
correlation evidence from the shared detector, so the drawer can show learned
edge patterns alongside the dependency graph without rebuilding correlation
-reasoning from raw events.
+reasoning from raw events. The Patrol intelligence page now also renders that
+correlation evidence through the shared
+`frontend-modern/src/components/Infrastructure/ResourceGraphSummary.tsx`
+card, so the same learned-edge list stays governed by one frontend surface
+instead of separate page-local implementations.
The change emitter now also classifies canonical restart changes for Docker
and Kubernetes resources when restart counters increase or uptime resets, so
the timeline can distinguish restarts from generic state transitions instead
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
index 95b8791b13..57b91a5c4b 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
@@ -53,13 +53,8 @@ import {
getResourceSensitivityLabel,
} from '@/utils/resourcePolicyPresentation';
import { formatResourceChangeKind } from '@/utils/resourceChangePresentation';
-import {
- formatResourceCorrelationEndpoint,
- formatResourceCorrelationHeadline,
- formatResourceCorrelationPattern,
- formatResourceCorrelationSummary,
-} from '@/utils/resourceCorrelationPresentation';
import { describeResourceRelationship } from '@/utils/resourceRelationshipPresentation';
+import { ResourceGraphSummary } from './ResourceGraphSummary';
import { ResourceFacetSummary } from './ResourceFacetSummary';
import { ResourcePolicySummary } from './ResourcePolicySummary';
import type { ResourceIntelligence } from '@/types/aiIntelligence';
@@ -892,163 +887,14 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
</div>
</Show>
<ResourcePolicySummary posture={policyPosture()} title="Policy posture" />
- <Show
- when={
- resourceDependencies().length > 0 ||
- resourceDependents().length > 0 ||
- resourceCorrelations().length > 0
- }
- >
- <div class="rounded border border-border-subtle bg-base px-2 py-1.5">
- <div class="text-[10px] uppercase tracking-wide text-muted">
- Graph context
- </div>
- <div class="mt-0.5 text-[11px] text-base-content">
- {resourceDependencies().length} dependencies ·{' '}
- {resourceDependents().length} dependents ·{' '}
- {resourceCorrelations().length} correlations
- </div>
- <Show when={resourceDependencies().length > 0}>
- <div class="mt-2">
- <div class="text-[9px] uppercase tracking-wide text-muted">
- Depends on
- </div>
- <div class="mt-1 flex flex-wrap gap-1">
- <For each={resourceDependencies().slice(0, 3)}>
- {(dependency) => {
- const href = buildInfrastructureResourceHref(dependency);
- return href ? (
- <a
- class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px] text-blue-700 hover:underline dark:text-blue-300"
- href={href}
- aria-label={`Open dependency resource ${dependency} in Infrastructure`}
- >
- {dependency}
- </a>
- ) : (
- <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">
- {dependency}
- </span>
- );
- }}
- </For>
- </div>
- </div>
- </Show>
- <Show when={resourceDependents().length > 0}>
- <div class="mt-2">
- <div class="text-[9px] uppercase tracking-wide text-muted">
- Used by
- </div>
- <div class="mt-1 flex flex-wrap gap-1">
- <For each={resourceDependents().slice(0, 3)}>
- {(dependent) => {
- const href = buildInfrastructureResourceHref(dependent);
- return href ? (
- <a
- class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px] text-blue-700 hover:underline dark:text-blue-300"
- href={href}
- aria-label={`Open dependent resource ${dependent} in Infrastructure`}
- >
- {dependent}
- </a>
- ) : (
- <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">
- {dependent}
- </span>
- );
- }}
- </For>
- </div>
- </div>
- </Show>
- <Show when={resourceCorrelations().length > 0}>
- <div class="mt-2">
- <div class="text-[9px] uppercase tracking-wide text-muted">
- Correlations
- </div>
- <div class="mt-1 space-y-1.5">
- <For each={sortedResourceCorrelations().slice(0, 3)}>
- {(correlation) => {
- const sourceHref = buildInfrastructureResourceHref(
- correlation.source_id,
- );
- const targetHref = buildInfrastructureResourceHref(
- correlation.target_id,
- );
- const headline = formatResourceCorrelationHeadline(correlation);
- const summary = formatResourceCorrelationSummary(correlation);
- const sourceLabel = formatResourceCorrelationEndpoint(
- correlation,
- 'source',
- );
- const targetLabel = formatResourceCorrelationEndpoint(
- correlation,
- 'target',
- );
- const patternLabel = formatResourceCorrelationPattern(correlation);
- const lastSeenLabel = correlation.last_seen
- ? formatRelativeTime(correlation.last_seen, {
- compact: true,
- emptyText: 'just now',
- })
- : '';
- return (
- <div class="rounded bg-surface px-2 py-1" title={headline}>
- <div class="flex flex-wrap items-center gap-1 text-[10px] text-base-content">
- {sourceHref ? (
- <a
- class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px] text-blue-700 hover:underline dark:text-blue-300"
- href={sourceHref}
- aria-label={`Open source resource ${sourceLabel} in Infrastructure`}
- >
- {sourceLabel}
- </a>
- ) : (
- <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">
- {sourceLabel}
- </span>
- )}
- <span class="text-muted">→</span>
- {targetHref ? (
- <a
- class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px] text-blue-700 hover:underline dark:text-blue-300"
- href={targetHref}
- aria-label={`Open target resource ${targetLabel} in Infrastructure`}
- >
- {targetLabel}
- </a>
- ) : (
- <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">
- {targetLabel}
- </span>
- )}
- <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-muted">
- {patternLabel}
- </span>
- </div>
- <div class="mt-0.5 text-[10px] text-muted">
- {summary}
- <Show when={lastSeenLabel}>
- <>{' '}· last seen {lastSeenLabel}</>
- </Show>
- </div>
- <Show when={correlation.description}>
- {(description) => (
- <div class="mt-0.5 text-[10px] text-muted">
- {description()}
- </div>
- )}
- </Show>
- </div>
- );
- }}
- </For>
- </div>
- </div>
- </Show>
- </div>
- </Show>
+ <ResourceGraphSummary
+ title="Graph context"
+ dependencies={resourceDependencies()}
+ dependents={resourceDependents()}
+ correlations={sortedResourceCorrelations()}
+ buildResourceHref={buildInfrastructureResourceHref}
+ showLastSeen
+ />
</div>
</div>
)}
diff --git a/frontend-modern/src/components/Infrastructure/ResourceGraphSummary.tsx b/frontend-modern/src/components/Infrastructure/ResourceGraphSummary.tsx
new file mode 100644
index 0000000000..57e0900001
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/ResourceGraphSummary.tsx
@@ -0,0 +1,192 @@
+import { For, Show, type Component } from 'solid-js';
+import type { ResourceCorrelation } from '@/types/aiIntelligence';
+import { formatRelativeTime } from '@/utils/format';
+import {
+ formatResourceCorrelationEndpoint,
+ formatResourceCorrelationHeadline,
+ formatResourceCorrelationPattern,
+ formatResourceCorrelationSummary,
+} from '@/utils/resourceCorrelationPresentation';
+
+interface ResourceGraphSummaryProps {
+ correlations?: ResourceCorrelation[] | null;
+ dependencies?: string[] | null;
+ dependents?: string[] | null;
+ title?: string;
+ summaryText?: string;
+ buildResourceHref: (resourceId: string) => string | null | undefined;
+ showLastSeen?: boolean;
+ class?: string;
+ maxCorrelations?: number;
+}
+
+const formatPluralCount = (count: number, singular: string, plural: string): string =>
+ `${count} ${count === 1 ? singular : plural}`;
+
+const formatSummaryParts = (parts: Array<string | null | undefined>): string =>
+ parts.filter((part): part is string => Boolean(part && part.trim())).join(' · ');
+
+export const ResourceGraphSummary: Component<ResourceGraphSummaryProps> = (props) => {
+ const className = () => props.class?.trim() ?? '';
+ const correlations = () => props.correlations ?? [];
+ const dependencies = () => props.dependencies ?? [];
+ const dependents = () => props.dependents ?? [];
+ const maxCorrelations = () => props.maxCorrelations ?? 3;
+ const hasContent = () =>
+ dependencies().length > 0 || dependents().length > 0 || correlations().length > 0;
+
+ const summaryText = () =>
+ props.summaryText?.trim() ||
+ formatSummaryParts([
+ dependencies().length > 0
+ ? formatPluralCount(dependencies().length, 'dependency', 'dependencies')
+ : null,
+ dependents().length > 0
+ ? formatPluralCount(dependents().length, 'dependent', 'dependents')
+ : null,
+ correlations().length > 0
+ ? formatPluralCount(correlations().length, 'correlation', 'correlations')
+ : null,
+ ]);
+
+ return (
+ <Show when={hasContent()}>
+ <div class={`rounded-md border border-border-subtle bg-base p-4 ${className()}`.trim()}>
+ <div class="flex flex-wrap items-start justify-between gap-2">
+ <div>
+ <h3 class="text-sm font-semibold text-base-content">{props.title ?? 'Graph context'}</h3>
+ <Show when={summaryText()}>
+ {(summary) => <p class="mt-1 text-xs text-muted">{summary()}</p>}
+ </Show>
+ </div>
+ </div>
+
+ <Show when={dependencies().length > 0}>
+ <div class="mt-3">
+ <div class="text-[9px] uppercase tracking-wide text-muted">Depends on</div>
+ <div class="mt-1 flex flex-wrap gap-1">
+ <For each={dependencies().slice(0, maxCorrelations())}>
+ {(dependency) => {
+ const href = props.buildResourceHref(dependency);
+ return href ? (
+ <a
+ class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px] text-blue-700 hover:underline dark:text-blue-300"
+ href={href}
+ aria-label={`Open dependency resource ${dependency} in Infrastructure`}
+ >
+ {dependency}
+ </a>
+ ) : (
+ <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">
+ {dependency}
+ </span>
+ );
+ }}
+ </For>
+ </div>
+ </div>
+ </Show>
+
+ <Show when={dependents().length > 0}>
+ <div class="mt-3">
+ <div class="text-[9px] uppercase tracking-wide text-muted">Used by</div>
+ <div class="mt-1 flex flex-wrap gap-1">
+ <For each={dependents().slice(0, maxCorrelations())}>
+ {(dependent) => {
+ const href = props.buildResourceHref(dependent);
+ return href ? (
+ <a
+ class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px] text-blue-700 hover:underline dark:text-blue-300"
+ href={href}
+ aria-label={`Open dependent resource ${dependent} in Infrastructure`}
+ >
+ {dependent}
+ </a>
+ ) : (
+ <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">
+ {dependent}
+ </span>
+ );
+ }}
+ </For>
+ </div>
+ </div>
+ </Show>
+
+ <Show when={correlations().length > 0}>
+ <div class="mt-3">
+ <div class="text-[9px] uppercase tracking-wide text-muted">Correlations</div>
+ <div class="mt-1 space-y-1.5">
+ <For each={correlations().slice(0, maxCorrelations())}>
+ {(correlation) => {
+ const sourceHref = props.buildResourceHref(correlation.source_id);
+ const targetHref = props.buildResourceHref(correlation.target_id);
+ const headline = formatResourceCorrelationHeadline(correlation);
+ const summary = formatResourceCorrelationSummary(correlation);
+ const sourceLabel = formatResourceCorrelationEndpoint(correlation, 'source');
+ const targetLabel = formatResourceCorrelationEndpoint(correlation, 'target');
+ const patternLabel = formatResourceCorrelationPattern(correlation);
+ const lastSeenLabel = props.showLastSeen && correlation.last_seen
+ ? formatRelativeTime(correlation.last_seen, {
+ compact: true,
+ emptyText: 'just now',
+ })
+ : '';
+ return (
+ <div class="rounded bg-surface px-2 py-1" title={headline}>
+ <div class="flex flex-wrap items-center gap-1 text-[10px] text-base-content">
+ {sourceHref ? (
+ <a
+ class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px] text-blue-700 hover:underline dark:text-blue-300"
+ href={sourceHref}
+ aria-label={`Open source resource ${sourceLabel} in Infrastructure`}
+ >
+ {sourceLabel}
+ </a>
+ ) : (
+ <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">
+ {sourceLabel}
+ </span>
+ )}
+ <span class="text-muted">→</span>
+ {targetHref ? (
+ <a
+ class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px] text-blue-700 hover:underline dark:text-blue-300"
+ href={targetHref}
+ aria-label={`Open target resource ${targetLabel} in Infrastructure`}
+ >
+ {targetLabel}
+ </a>
+ ) : (
+ <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">
+ {targetLabel}
+ </span>
+ )}
+ <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-muted">
+ {patternLabel}
+ </span>
+ </div>
+ <div class="mt-0.5 text-[10px] text-muted">
+ {summary}
+ <Show when={lastSeenLabel}>
+ <>{' '}· last seen {lastSeenLabel}</>
+ </Show>
+ </div>
+ <Show when={correlation.description}>
+ {(description) => (
+ <div class="mt-0.5 text-[10px] text-muted">{description()}</div>
+ )}
+ </Show>
+ </div>
+ );
+ }}
+ </For>
+ </div>
+ </div>
+ </Show>
+ </div>
+ </Show>
+ );
+};
+
+export default ResourceGraphSummary;
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.tsx
index 72a2bdb788..a8f3d1ef32 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
@@ -335,7 +335,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(getByText('Public')).toBeInTheDocument();
expect(getByText('Cloud Summary')).toBeInTheDocument();
expect(getByText('Graph context')).toBeInTheDocument();
- expect(getByText('1 dependencies · 1 dependents · 1 correlations')).toBeInTheDocument();
+ expect(getByText('1 dependency · 1 dependent · 1 correlation')).toBeInTheDocument();
expect(
getByRole('link', {
name: 'Open dependency resource storage-1 in Infrastructure',
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceGraphSummary.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceGraphSummary.test.tsx
new file mode 100644
index 0000000000..9f48b90427
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceGraphSummary.test.tsx
@@ -0,0 +1,82 @@
+import { render, screen } from '@solidjs/testing-library';
+import { describe, expect, it } from 'vitest';
+
+import { ResourceGraphSummary } from '../ResourceGraphSummary';
+
+describe('ResourceGraphSummary', () => {
+ it('renders learned correlations with canonical labels and totals', () => {
+ render(() => (
+ <ResourceGraphSummary
+ title="Learned correlations"
+ correlations={[
+ {
+ source_id: 'storage-1',
+ source_name: 'Storage 1',
+ source_type: 'storage',
+ target_id: 'host-1',
+ target_name: 'Host 1',
+ target_type: 'vm',
+ event_pattern: 'disk_full -> restart',
+ occurrences: 2,
+ avg_delay: 125000000000,
+ confidence: 0.875,
+ last_seen: '2026-03-01T00:15:00Z',
+ description: 'Disk pressure often precedes restarts',
+ },
+ ]}
+ summaryText="5 total"
+ buildResourceHref={(resourceId) => `/infrastructure?resource=${resourceId}`}
+ />
+ ));
+
+ expect(screen.getByText('Learned correlations')).toBeInTheDocument();
+ expect(screen.getByText('5 total')).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'Open source resource Storage 1 in Infrastructure' }))
+ .toHaveAttribute('href', '/infrastructure?resource=storage-1');
+ expect(screen.getByRole('link', { name: 'Open target resource Host 1 in Infrastructure' }))
+ .toHaveAttribute('href', '/infrastructure?resource=host-1');
+ expect(screen.getByText('Disk Full → Restart')).toBeInTheDocument();
+ expect(screen.getByText(/2 occurrences · avg delay 2m · 88% confidence/)).toBeInTheDocument();
+ expect(screen.getByText('Disk pressure often precedes restarts')).toBeInTheDocument();
+ expect(screen.queryByText(/last seen/i)).toBeNull();
+ });
+
+ it('renders graph context with dependency and dependent links', () => {
+ render(() => (
+ <ResourceGraphSummary
+ title="Graph context"
+ dependencies={['storage-1']}
+ dependents={['vm-child']}
+ correlations={[
+ {
+ source_id: 'storage-1',
+ source_name: 'Storage 1',
+ source_type: 'storage',
+ target_id: 'host-1',
+ target_name: 'Host 1',
+ target_type: 'vm',
+ event_pattern: 'disk_full -> restart',
+ occurrences: 2,
+ avg_delay: 125000000000,
+ confidence: 0.875,
+ last_seen: '2026-03-01T00:15:00Z',
+ description: 'Disk pressure often precedes restarts',
+ },
+ ]}
+ buildResourceHref={(resourceId) => `/infrastructure?resource=${resourceId}`}
+ showLastSeen
+ />
+ ));
+
+ expect(screen.getByText('Graph context')).toBeInTheDocument();
+ expect(screen.getByText('1 dependency · 1 dependent · 1 correlation')).toBeInTheDocument();
+ expect(screen.getByText('Depends on')).toBeInTheDocument();
+ expect(screen.getByText('Used by')).toBeInTheDocument();
+ expect(screen.getByText('Correlations')).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'Open dependency resource storage-1 in Infrastructure' }))
+ .toHaveAttribute('href', '/infrastructure?resource=storage-1');
+ expect(screen.getByRole('link', { name: 'Open dependent resource vm-child in Infrastructure' }))
+ .toHaveAttribute('href', '/infrastructure?resource=vm-child');
+ expect(screen.getByText(/last seen/i)).toBeInTheDocument();
+ });
+});
diff --git a/frontend-modern/src/pages/AIIntelligence.tsx b/frontend-modern/src/pages/AIIntelligence.tsx
index 518fe8b735..7dc31f300d 100644
--- a/frontend-modern/src/pages/AIIntelligence.tsx
+++ b/frontend-modern/src/pages/AIIntelligence.tsx
@@ -93,12 +93,8 @@ import {
formatResourceChangeHeadline,
formatResourceChangeKind,
} from '@/utils/resourceChangePresentation';
-import {
- formatResourceCorrelationEndpoint,
- formatResourceCorrelationPattern,
- formatResourceCorrelationSummary,
-} from '@/utils/resourceCorrelationPresentation';
import { ResourcePolicySummary } from '@/components/Infrastructure/ResourcePolicySummary';
+import { ResourceGraphSummary } from '@/components/Infrastructure/ResourceGraphSummary';
import {
getProTrialStartedMessage,
getTrialAlreadyUsedMessage,
@@ -1392,57 +1388,14 @@ export function AIIntelligence() {
</div>
<Show when={correlationHighlights().length > 0}>
- <div class="rounded-md border border-border-subtle bg-base p-4">
- <div class="flex items-center justify-between gap-2">
- <h3 class="text-sm font-semibold text-base-content">
- Learned correlations
- </h3>
- <span class="text-xs text-muted">{correlationTotal()} total</span>
- </div>
-
- <div class="mt-3 space-y-2">
- <For each={correlationHighlights()}>
- {(correlation) => {
- const sourceHref = buildInfrastructurePath({
- resource: correlation.source_id,
- });
- const targetHref = buildInfrastructurePath({
- resource: correlation.target_id,
- });
- return (
- <div class="rounded-md bg-surface px-3 py-2">
- <div class="flex flex-wrap items-center gap-1 text-sm">
- <a
- class="font-medium text-blue-700 hover:underline dark:text-blue-300"
- href={sourceHref}
- >
- {formatResourceCorrelationEndpoint(correlation, 'source')}
- </a>
- <span class="text-muted">→</span>
- <a
- class="font-medium text-blue-700 hover:underline dark:text-blue-300"
- href={targetHref}
- >
- {formatResourceCorrelationEndpoint(correlation, 'target')}
- </a>
- <span class="rounded-full border border-border-subtle bg-base px-2 py-0.5 text-[11px] font-medium text-muted">
- {formatResourceCorrelationPattern(correlation)}
- </span>
- </div>
- <p class="mt-1 text-xs text-muted">
- {formatResourceCorrelationSummary(correlation)}
- </p>
- <Show when={correlation.description}>
- <p class="mt-1 text-xs text-muted">
- {correlation.description}
- </p>
- </Show>
- </div>
- );
- }}
- </For>
- </div>
- </div>
+ <ResourceGraphSummary
+ title="Learned correlations"
+ correlations={correlationHighlights()}
+ summaryText={`${correlationTotal()} total`}
+ buildResourceHref={(resourceId) =>
+ buildInfrastructurePath({ resource: resourceId })
+ }
+ />
</Show>
<ResourcePolicySummary posture={policyPosture()} title="Data Governance" />
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index d1e4242d12..eb1b7930a4 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -414,6 +414,16 @@ describe('AIIntelligence entitlement gating', () => {
});
expect(screen.getByText('1 total')).toBeInTheDocument();
+ expect(
+ screen.getByRole('link', {
+ name: 'Open source resource Storage 1 in Infrastructure',
+ }),
+ ).toHaveAttribute('href', '/infrastructure?resource=storage-1');
+ expect(
+ screen.getByRole('link', {
+ name: 'Open target resource VM 100 in Infrastructure',
+ }),
+ ).toHaveAttribute('href', '/infrastructure?resource=vm-100');
expect(screen.getByText('Storage 1')).toBeInTheDocument();
expect(screen.getByText('VM 100')).toBeInTheDocument();
expect(screen.getByText('Disk Full → Restart')).toBeInTheDocument();