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.

Add direct AI settings action for Patrol runtime issues

rcourtmand98687a8fcc6
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 48d6287fd7..2522c0c52f 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -155,6 +155,11 @@ estate. When there is exactly one active Patrol runtime finding, that same
assessment copy should name the concrete runtime failure, such as
`Insufficient API credits`, instead of reducing the state to a generic count of
runtime findings.
+That same runtime-owned assessment must expose the fix path directly. When the
+primary Patrol issue is a Patrol runtime/provider problem rather than an
+infrastructure finding, the summary card should offer a direct `Open AI
+Settings` action instead of making the operator dig through the findings list
+to discover where to correct provider configuration.
That same runtime-versus-infrastructure distinction should route through the
shared finding-presentation helper instead of being re-inferred separately by
the summary card and the findings list. The active finding row should surface
diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx
index 91fadaf11b..3ae5e02630 100644
--- a/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx
+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx
@@ -5,6 +5,7 @@ import CheckCircleIcon from 'lucide-solid/icons/check-circle';
import AlertCircleIcon from 'lucide-solid/icons/alert-circle';
import AlertTriangleIcon from 'lucide-solid/icons/alert-triangle';
import {
+ getPatrolAssessmentAction,
getPatrolAssessmentPresentation,
getPatrolRecencyPresentation,
getPatrolScoreChipLabel,
@@ -82,6 +83,11 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStat
activeFindings: state.activePatrolFindings(),
}),
);
+ const assessmentAction = createMemo(() =>
+ getPatrolAssessmentAction({
+ activeFindings: state.activePatrolFindings(),
+ }),
+ );
return (
<>
@@ -159,6 +165,18 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStat
{assessment().title}
</h2>
<p class="mt-1 text-sm text-base-content">{assessment().description}</p>
+ <Show when={assessmentAction()}>
+ {(action) => (
+ <div class="mt-3">
+ <a
+ href={action().href}
+ class="inline-flex items-center rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-semibold text-base-content transition-colors hover:bg-surface-hover"
+ >
+ {action().label}
+ </a>
+ </div>
+ )}
+ </Show>
<div class="mt-3 flex flex-wrap items-center gap-2">
<span class="rounded-full border border-border-subtle bg-base px-2.5 py-1 text-xs font-medium text-base-content">
{scoreChipLabel()} {summary().overall_health.grade} ·{' '}
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index f4f4866854..18decabf47 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -955,6 +955,10 @@ describe('AIIntelligence entitlement gating', () => {
});
expect(screen.getByText(/Assessment C · 60\/100/)).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'Open AI Settings' })).toHaveAttribute(
+ 'href',
+ '/settings/system-ai',
+ );
expect(screen.getByRole('button', { name: 'Findings' }).textContent).toBe('Findings 1');
diff --git a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
index c1500facc0..38eca106c0 100644
--- a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it } from 'vitest';
import {
getPatrolAssessmentPresentation,
+ getPatrolAssessmentAction,
getPatrolRecencyPresentation,
getPatrolScoreChipLabel,
getPatrolVerificationPresentation,
@@ -177,6 +178,41 @@ describe('getPatrolSummaryPresentation', () => {
).toBe('Assessment');
});
+ it('offers a direct AI settings action for Patrol runtime issues', () => {
+ expect(
+ getPatrolAssessmentAction({
+ activeFindings: [
+ {
+ status: 'active',
+ severity: 'warning',
+ resourceId: 'ai-service',
+ resourceName: 'Pulse Patrol Service',
+ title: 'Pulse Patrol: Insufficient API credits',
+ },
+ ] as never,
+ }),
+ ).toEqual({
+ label: 'Open AI Settings',
+ href: '/settings/system-ai',
+ });
+ });
+
+ it('does not offer an AI settings action for infrastructure findings', () => {
+ expect(
+ getPatrolAssessmentAction({
+ activeFindings: [
+ {
+ status: 'active',
+ severity: 'warning',
+ resourceId: 'vm-100',
+ resourceName: 'web-1',
+ title: 'Disk nearly full',
+ },
+ ] as never,
+ }),
+ ).toBeUndefined();
+ });
+
it('keeps health labeling for verified healthy states', () => {
expect(
getPatrolScoreChipLabel({
diff --git a/frontend-modern/src/utils/patrolSummaryPresentation.ts b/frontend-modern/src/utils/patrolSummaryPresentation.ts
index 2d6d298aa5..0a5b6bcc18 100644
--- a/frontend-modern/src/utils/patrolSummaryPresentation.ts
+++ b/frontend-modern/src/utils/patrolSummaryPresentation.ts
@@ -26,6 +26,11 @@ export interface PatrolAssessmentPresentation {
tone: SemanticTone;
}
+export interface PatrolAssessmentAction {
+ label: string;
+ href: string;
+}
+
export interface PatrolVerificationPresentation {
title: string;
description: string;
@@ -159,6 +164,20 @@ export function getPatrolScoreChipLabel(args: {
return 'Health';
}
+export function getPatrolAssessmentAction(args: {
+ activeFindings?: PatrolAssessmentFinding[];
+}): PatrolAssessmentAction | undefined {
+ const classified = classifyActiveFindings(args.activeFindings);
+ if (classified.infrastructureTotal === 0 && classified.runtimeTotal > 0) {
+ return {
+ label: 'Open AI Settings',
+ href: '/settings/system-ai',
+ };
+ }
+
+ return undefined;
+}
+
function joinAssessmentParts(parts: string[]): string {
if (parts.length <= 1) return parts[0] ?? '';
if (parts.length === 2) return `${parts[0]} and ${parts[1]}`;