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 policy posture card between AI views

rcourtmandc4788a042ad
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index a3110d15ee..fd7d79567f 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -81,6 +81,7 @@ Own canonical runtime payload shapes between backend and frontend.
and the resource-intelligence payload carried by the drawer AI card, so the governed posture snapshot remains visible on the resource-detail surface without introducing a separate posture endpoint
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
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`
@@ -188,6 +189,10 @@ resource drawer's graph evidence instead of being fetched as page-local state.
That store now also owns the dashboard load bundle used by the Patrol page,
so the page refresh path stays aligned on one store-owned orchestration layer
instead of re-encoding the AI bundle inline.
+The AI summary page and resource drawer now also share the canonical
+`frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx`
+card for policy posture, so sensitivity, routing, and redaction counts are
+presented through one governed frontend component instead of two copies.
The unified action, lifecycle, and export audit reads now also clamp oversized
`limit` requests to the governed maximum of `1000`, so the control-plane audit
surface stays bounded even when callers ask for arbitrarily large history
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index c086ac041e..14c5b760d1 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -108,6 +108,10 @@ 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
inline.
+The Patrol intelligence page and resource drawer now also share the canonical
+`frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx`
+card, so the data-governance posture counts stay rendered from one governed
+frontend component across both surfaces.
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
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
index de07b01e83..95b8791b13 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
@@ -5,9 +5,6 @@ import type {
ResourceChangeKind,
ResourceChangeSourceAdapter,
ResourceChangeSourceType,
- ResourceRedactionHint,
- ResourceRoutingScope,
- ResourceSensitivity,
} from '@/types/resource';
import { getDisplayName } from '@/types/resource';
import { formatUptime, formatRelativeTime, formatAbsoluteTime } from '@/utils/format';
@@ -52,7 +49,6 @@ import { buildInfrastructurePath } from '@/routing/resourceLinks';
import {
getResourcePolicyBadges,
getResourcePolicyRedactionLabels,
- getResourceRedactionHintLabel,
getResourceRoutingScopeLabel,
getResourceSensitivityLabel,
} from '@/utils/resourcePolicyPresentation';
@@ -65,6 +61,7 @@ import {
} from '@/utils/resourceCorrelationPresentation';
import { describeResourceRelationship } from '@/utils/resourceRelationshipPresentation';
import { ResourceFacetSummary } from './ResourceFacetSummary';
+import { ResourcePolicySummary } from './ResourcePolicySummary';
import type { ResourceIntelligence } from '@/types/aiIntelligence';
interface ResourceDetailDrawerProps {
@@ -122,23 +119,6 @@ const timelineSourceAdapterOptions: Array<{ label: string; value: ResourceChange
{ label: 'Ops agent', value: 'agent:ops-helper' },
];
-const policySensitivityOrder: ResourceSensitivity[] = [
- 'public',
- 'internal',
- 'sensitive',
- 'restricted',
-];
-
-const policyRoutingOrder: ResourceRoutingScope[] = ['cloud-summary', 'local-first', 'local-only'];
-
-const policyRedactionOrder: ResourceRedactionHint[] = [
- 'hostname',
- 'ip-address',
- 'platform-id',
- 'alias',
- 'path',
-];
-
const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
type DrawerTab =
| 'overview'
@@ -911,65 +891,7 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
</div>
</div>
</Show>
- <Show when={policyPosture()}>
- {(posture) => (
- <div class="rounded border border-border-subtle bg-base px-2 py-1.5">
- <div class="text-[10px] uppercase tracking-wide text-muted">
- Policy posture
- </div>
- <div class="mt-0.5 text-[11px] text-base-content">
- {posture().total_resources} governed resources
- </div>
- <div class="mt-2 grid grid-cols-2 gap-1.5">
- <For each={policySensitivityOrder}>
- {(sensitivity) => (
- <div class="rounded bg-surface px-2 py-1">
- <div class="text-[9px] uppercase tracking-wide text-muted">
- {getResourceSensitivityLabel(sensitivity)}
- </div>
- <div class="font-medium text-base-content">
- {posture().sensitivity_counts?.[sensitivity] ?? 0}
- </div>
- </div>
- )}
- </For>
- </div>
- <div class="mt-2 grid grid-cols-3 gap-1.5">
- <For each={policyRoutingOrder}>
- {(scope) => (
- <div class="rounded bg-surface px-2 py-1">
- <div class="text-[9px] uppercase tracking-wide text-muted">
- {getResourceRoutingScopeLabel(scope)}
- </div>
- <div class="font-medium text-base-content">
- {posture().routing_counts?.[scope] ?? 0}
- </div>
- </div>
- )}
- </For>
- </div>
- <Show
- when={policyRedactionOrder.some(
- (hint) => (posture().redaction_counts?.[hint] ?? 0) > 0,
- )}
- >
- <div class="mt-2 flex flex-wrap gap-1">
- <For each={policyRedactionOrder}>
- {(hint) => {
- const count = posture().redaction_counts?.[hint] ?? 0;
- if (!count) return null;
- return (
- <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">
- {getResourceRedactionHintLabel(hint)} {count}
- </span>
- );
- }}
- </For>
- </div>
- </Show>
- </div>
- )}
- </Show>
+ <ResourcePolicySummary posture={policyPosture()} title="Policy posture" />
<Show
when={
resourceDependencies().length > 0 ||
diff --git a/frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx b/frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx
new file mode 100644
index 0000000000..bffc862cd9
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx
@@ -0,0 +1,106 @@
+import { For, Show, type Component } from 'solid-js';
+import type { IntelligencePolicyPostureSummary } from '@/types/aiIntelligence';
+import type {
+ ResourceRedactionHint,
+ ResourceRoutingScope,
+ ResourceSensitivity,
+} from '@/types/resource';
+import {
+ getResourceRedactionHintLabel,
+ getResourceRoutingScopeLabel,
+ getResourceSensitivityLabel,
+} from '@/utils/resourcePolicyPresentation';
+
+const policySensitivityOrder: ResourceSensitivity[] = [
+ 'public',
+ 'internal',
+ 'sensitive',
+ 'restricted',
+];
+
+const policyRoutingOrder: ResourceRoutingScope[] = ['cloud-summary', 'local-first', 'local-only'];
+
+const policyRedactionOrder: ResourceRedactionHint[] = [
+ 'hostname',
+ 'ip-address',
+ 'platform-id',
+ 'alias',
+ 'path',
+];
+
+interface ResourcePolicySummaryProps {
+ posture?: IntelligencePolicyPostureSummary | null;
+ title?: string;
+ class?: string;
+}
+
+export const ResourcePolicySummary: Component<ResourcePolicySummaryProps> = (props) => {
+ const posture = () => props.posture;
+ const className = () => props.class?.trim() ?? '';
+
+ return (
+ <Show when={posture()}>
+ {(value) => (
+ <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 ?? 'Data Governance'}
+ </h3>
+ <p class="mt-1 text-xs text-muted">{value().total_resources} governed resources</p>
+ </div>
+ </div>
+
+ <dl class="mt-3 grid grid-cols-2 gap-2 text-sm">
+ <For each={policySensitivityOrder}>
+ {(sensitivity) => {
+ const count = () => value().sensitivity_counts?.[sensitivity] ?? 0;
+ return (
+ <div class="rounded-md bg-surface px-3 py-2">
+ <dt class="text-xs uppercase tracking-wide text-muted">
+ {getResourceSensitivityLabel(sensitivity)}
+ </dt>
+ <dd class="mt-1 font-semibold text-base-content">{count()}</dd>
+ </div>
+ );
+ }}
+ </For>
+ <For each={policyRoutingOrder}>
+ {(scope) => {
+ const count = () => value().routing_counts?.[scope] ?? 0;
+ return (
+ <div class="rounded-md bg-surface px-3 py-2">
+ <dt class="text-xs uppercase tracking-wide text-muted">
+ {getResourceRoutingScopeLabel(scope)}
+ </dt>
+ <dd class="mt-1 font-semibold text-base-content">{count()}</dd>
+ </div>
+ );
+ }}
+ </For>
+ </dl>
+
+ <Show
+ when={policyRedactionOrder.some((hint) => (value().redaction_counts?.[hint] ?? 0) > 0)}
+ >
+ <div class="mt-2 flex flex-wrap gap-1">
+ <For each={policyRedactionOrder}>
+ {(hint) => {
+ const count = value().redaction_counts?.[hint] ?? 0;
+ if (!count) return null;
+ return (
+ <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">
+ {getResourceRedactionHintLabel(hint)} {count}
+ </span>
+ );
+ }}
+ </For>
+ </div>
+ </Show>
+ </div>
+ )}
+ </Show>
+ );
+};
+
+export default ResourcePolicySummary;
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourcePolicySummary.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourcePolicySummary.test.tsx
new file mode 100644
index 0000000000..20e26c07f5
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourcePolicySummary.test.tsx
@@ -0,0 +1,38 @@
+import { render, screen } from '@solidjs/testing-library';
+import { describe, expect, it } from 'vitest';
+
+import { ResourcePolicySummary } from '../ResourcePolicySummary';
+
+describe('ResourcePolicySummary', () => {
+ it('renders governed resource posture counts and redaction hints', () => {
+ render(() => (
+ <ResourcePolicySummary
+ posture={{
+ total_resources: 5,
+ sensitivity_counts: {
+ public: 1,
+ internal: 2,
+ sensitive: 1,
+ restricted: 1,
+ },
+ routing_counts: {
+ 'cloud-summary': 2,
+ 'local-first': 2,
+ 'local-only': 1,
+ },
+ redaction_counts: {
+ hostname: 3,
+ 'ip-address': 1,
+ },
+ }}
+ />
+ ));
+
+ expect(screen.getByText('Data Governance')).toBeInTheDocument();
+ expect(screen.getByText('5 governed resources')).toBeInTheDocument();
+ expect(screen.getByText('Public')).toBeInTheDocument();
+ expect(screen.getByText('Local Only')).toBeInTheDocument();
+ expect(screen.getByText('Hostname 3')).toBeInTheDocument();
+ expect(screen.getByText('IP Address 1')).toBeInTheDocument();
+ });
+});
diff --git a/frontend-modern/src/pages/AIIntelligence.tsx b/frontend-modern/src/pages/AIIntelligence.tsx
index 1bad16d93e..518fe8b735 100644
--- a/frontend-modern/src/pages/AIIntelligence.tsx
+++ b/frontend-modern/src/pages/AIIntelligence.tsx
@@ -98,11 +98,7 @@ import {
formatResourceCorrelationPattern,
formatResourceCorrelationSummary,
} from '@/utils/resourceCorrelationPresentation';
-import {
- getResourceRedactionHintLabel,
- getResourceRoutingScopeLabel,
- getResourceSensitivityLabel,
-} from '@/utils/resourcePolicyPresentation';
+import { ResourcePolicySummary } from '@/components/Infrastructure/ResourcePolicySummary';
import {
getProTrialStartedMessage,
getTrialAlreadyUsedMessage,
@@ -110,30 +106,8 @@ import {
getTrialTryAgainLaterMessage,
} from '@/utils/upgradePresentation';
import { buildInfrastructurePath } from '@/routing/resourceLinks';
-import type {
- ResourceRedactionHint,
- ResourceRoutingScope,
- ResourceSensitivity,
-} from '@/types/resource';
type PatrolTab = 'findings' | 'history';
-const policySensitivityOrder: ResourceSensitivity[] = [
- 'public',
- 'internal',
- 'sensitive',
- 'restricted',
-];
-
-const policyRoutingOrder: ResourceRoutingScope[] = ['cloud-summary', 'local-first', 'local-only'];
-
-const policyRedactionOrder: ResourceRedactionHint[] = [
- 'hostname',
- 'ip-address',
- 'platform-id',
- 'alias',
- 'path',
-];
-
export function AIIntelligence() {
const [activeTab, setActiveTab] = createSignal<PatrolTab>('findings');
const [findingsFilterOverride, setFindingsFilterOverride] = createSignal<
@@ -1471,72 +1445,7 @@ export function AIIntelligence() {
</div>
</Show>
- <Show when={policyPosture()}>
- {(posture) => (
- <div class="rounded-md border border-border-subtle bg-base p-4">
- <div class="flex flex-wrap items-start justify-between gap-2">
- <div>
- <h3 class="text-sm font-semibold text-base-content">Data Governance</h3>
- <p class="mt-1 text-xs text-muted">
- {posture().total_resources} governed resources
- </p>
- </div>
- </div>
-
- <dl class="mt-3 grid grid-cols-2 gap-2 text-sm">
- <For each={policySensitivityOrder}>
- {(sensitivity) => {
- const count = () => posture().sensitivity_counts?.[sensitivity] ?? 0;
- return (
- <div class="rounded-md bg-surface px-3 py-2">
- <dt class="text-xs uppercase tracking-wide text-muted">
- {getResourceSensitivityLabel(sensitivity)}
- </dt>
- <dd class="mt-1 font-semibold text-base-content">
- {count()}
- </dd>
- </div>
- );
- }}
- </For>
- </dl>
-
- <div class="mt-3 grid grid-cols-3 gap-2 text-sm">
- <For each={policyRoutingOrder}>
- {(scope) => {
- const count = () => posture().routing_counts?.[scope] ?? 0;
- return (
- <div class="rounded-md bg-surface px-3 py-2">
- <dt class="text-xs uppercase tracking-wide text-muted">
- {getResourceRoutingScopeLabel(scope)}
- </dt>
- <dd class="mt-1 font-semibold text-base-content">
- {count()}
- </dd>
- </div>
- );
- }}
- </For>
- </div>
-
- <Show when={policyRedactionOrder.some((hint) => (posture().redaction_counts?.[hint] ?? 0) > 0)}>
- <div class="mt-3 flex flex-wrap gap-1.5">
- <For each={policyRedactionOrder}>
- {(hint) => {
- const count = posture().redaction_counts?.[hint] ?? 0;
- if (!count) return null;
- return (
- <span class="rounded-full border border-border-subtle bg-surface px-2 py-0.5 text-[11px] font-medium text-muted">
- {getResourceRedactionHintLabel(hint)} {count}
- </span>
- );
- }}
- </For>
- </div>
- </Show>
- </div>
- )}
- </Show>
+ <ResourcePolicySummary posture={policyPosture()} title="Data Governance" />
</div>
</div>
</section>
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index af86c4f9a9..d1e4242d12 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -564,8 +564,11 @@ describe('AIIntelligence entitlement gating', () => {
expect(screen.getByText('Data Governance')).toBeInTheDocument();
expect(screen.getByText('4 governed resources')).toBeInTheDocument();
expect(screen.getByText('Public')).toBeInTheDocument();
+ expect(screen.getByText('Internal')).toBeInTheDocument();
+ expect(screen.getByText('Sensitive')).toBeInTheDocument();
expect(screen.getByText('Restricted')).toBeInTheDocument();
expect(screen.getByText('Cloud Summary')).toBeInTheDocument();
+ expect(screen.getByText('Local First')).toBeInTheDocument();
expect(screen.getByText('Local Only')).toBeInTheDocument();
expect(screen.getByText('Hostname 2')).toBeInTheDocument();
expect(screen.getByText('IP Address 1')).toBeInTheDocument();