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
Surface canonical AI intelligence in resource drawer
rcourtman54a398de0b06
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsxindex ce45dae501..3c0ddf9ddf 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx@@ -39,6 +39,7 @@ import { PMGInstanceDrawer } from '@/components/PMG/PMGInstanceDrawer';import { K8sDeploymentsDrawer } from '@/components/Kubernetes/K8sDeploymentsDrawer';import { K8sNamespacesDrawer } from '@/components/Kubernetes/K8sNamespacesDrawer';import { MonitoringAPI } from '@/api/monitoring';+import { AIAPI } from '@/api/ai';import { areSystemSettingsLoaded, shouldHideDockerUpdateActions } from '@/stores/systemSettings';import { SwarmServicesDrawer } from '@/components/Docker/SwarmServicesDrawer';import { WebInterfaceUrlField } from '@/components/shared/WebInterfaceUrlField';@@ -52,6 +53,7 @@ import {getResourceSensitivityLabel,} from '@/utils/resourcePolicyPresentation';import { ResourceFacetSummary } from './ResourceFacetSummary';+import type { ResourceIntelligence } from '@/types/aiIntelligence';interface ResourceDetailDrawerProps {resource: Resource;@@ -263,6 +265,14 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {},{ initialValue: null },);+ const [resourceIntelligence] = createResource(+ resourceFacetRequest,+ async (request) => {+ if (!request?.id) return null;+ return AIAPI.getResourceIntelligence(request.id);+ },+ { initialValue: null as ResourceIntelligence | null },+ );const timelineFacetRequest = createMemo(() => {const id = resourceFacetId();if (!id) return null;@@ -806,9 +816,61 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {)}</Show></div>- </Show>+ </Show><div class="grid gap-3 md:grid-cols-2 lg:grid-cols-3 mt-3">+ <Show when={resourceIntelligence()}>+ {(intel) => (+ <div class="rounded border border-border bg-surface p-3">+ <div class="text-[11px] font-medium uppercase tracking-wide text-base-content mb-2">+ AI Intelligence+ </div>+ <div class="space-y-1.5 text-[11px]">+ <div class="flex items-center justify-between gap-2">+ <span class="text-muted">Health</span>+ <span class="font-medium text-base-content">+ {intel().health.grade} · {Math.round(intel().health.score)}/100+ </span>+ </div>+ <div class="flex items-center justify-between gap-2">+ <span class="text-muted">Trend</span>+ <span class="font-medium text-base-content capitalize">+ {intel().health.trend}+ </span>+ </div>+ <div class="flex items-center justify-between gap-2">+ <span class="text-muted">Notes</span>+ <span class="font-medium text-base-content">{intel().note_count}</span>+ </div>+ <div class="flex items-center justify-between gap-2">+ <span class="text-muted">Recent Changes</span>+ <span class="font-medium text-base-content">+ {intel().recent_changes?.length ?? 0}+ </span>+ </div>+ <Show when={intel().recent_changes?.[0]}>+ <div class="rounded border border-border bg-surface-hover px-2 py-1.5">+ <div class="text-[10px] uppercase tracking-wide text-muted">+ Latest canonical change+ </div>+ <div class="mt-0.5 text-[11px] text-base-content">+ {intel().recent_changes?.[0]?.kind.replace(/_/g, ' ')} ·{' '}+ {intel().recent_changes?.[0]?.reason ||+ intel().recent_changes?.[0]?.resourceId}+ </div>+ <div class="mt-0.5 text-[10px] text-muted">+ {formatRelativeTime(intel().recent_changes?.[0]?.observedAt, {+ compact: true,+ emptyText: 'just now',+ })}+ </div>+ </div>+ </Show>+ </div>+ </div>+ )}+ </Show>+<div class="rounded border border-border bg-surface p-3"><div class="text-[11px] font-medium uppercase tracking-wide text-base-content mb-2">Runtimediff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsxindex c6bfa9ffa6..fd6665f8f7 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx@@ -8,6 +8,21 @@ const facetBundleMock = vi.hoisted(() => ({getFacetBundle: vi.fn(),}));+const aiIntelligenceMock = vi.hoisted(() => ({+ getResourceIntelligence: vi.fn().mockResolvedValue({+ resource_id: 'resource-1',+ health: {+ score: 92,+ grade: 'A',+ trend: 'stable',+ factors: [],+ prediction: 'Stable',+ },+ recent_changes: [],+ note_count: 3,+ }),+}));+vi.mock('@/App', () => ({useWebSocket: () => ({state: { pmg: [] as any[] },@@ -29,6 +44,12 @@ vi.mock('@/api/resources', () => ({},}));+vi.mock('@/api/ai', () => ({+ AIAPI: {+ getResourceIntelligence: aiIntelligenceMock.getResourceIntelligence,+ },+}));+class ResizeObserverMock {constructor(_callback: ResizeObserverCallback) {}observe() {}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 c2e6078157..6803c76b90 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@@ -1,5 +1,5 @@import { describe, expect, it, vi } from 'vitest';-import { render } from '@solidjs/testing-library';+import { render, waitFor } from '@solidjs/testing-library';import type { Resource } from '@/types/resource';import { ResourceDetailDrawer } from '@/components/Infrastructure/ResourceDetailDrawer';@@ -32,6 +32,33 @@ vi.mock('@/api/resources', () => ({},}));+vi.mock('@/api/ai', () => ({+ AIAPI: {+ getResourceIntelligence: vi.fn().mockResolvedValue({+ resource_id: 'resource-1',+ health: {+ score: 92,+ grade: 'A',+ trend: 'stable',+ factors: [],+ prediction: 'Stable',+ },+ recent_changes: [+ {+ id: 'change-1',+ observedAt: '2026-03-01T00:00:00Z',+ resourceId: 'resource-1',+ kind: 'config_update',+ sourceType: 'pulse_diff',+ confidence: 'high',+ reason: 'Updated canonical config',+ },+ ],+ note_count: 3,+ }),+ },+}));+class ResizeObserverMock {constructor(_callback: ResizeObserverCallback) {}observe() {}@@ -259,4 +286,22 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {getByText('restricted host summary safe for remote AI consumption'),).toBeInTheDocument();});++ it('surfaces canonical AI intelligence for the resource overview', async () => {+ const resource = baseResource({});+ const { getByText } = render(() => <ResourceDetailDrawer resource={resource} />);++ await waitFor(() => {+ expect(getByText('AI Intelligence')).toBeInTheDocument();+ });++ expect(getByText(/A · 92\/100/)).toBeInTheDocument();+ expect(getByText('Recent Changes')).toBeInTheDocument();+ expect(getByText('1')).toBeInTheDocument();+ const latestChange = getByText('Latest canonical change').parentElement;+ expect(latestChange).not.toBeNull();+ expect(latestChange).toHaveTextContent('config update');+ expect(latestChange).toHaveTextContent('Updated canonical config');+ expect(latestChange).toHaveTextContent(/just now|m ago|h ago|d ago/);+ });});