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
feat(patrol): enhance patrol UI with licensing checks and auto-fix controls
rcourtmanf6e1b92c8b75
diff --git a/frontend-modern/src/components/AI/Chat/ChatMessages.tsx b/frontend-modern/src/components/AI/Chat/ChatMessages.tsxindex d5484acc5e..76b932b0df 100644--- a/frontend-modern/src/components/AI/Chat/ChatMessages.tsx+++ b/frontend-modern/src/components/AI/Chat/ChatMessages.tsx@@ -89,7 +89,7 @@ export const ChatMessages: Component<ChatMessagesProps> = (props) => {</svg></div>- <h3 class="text-base font-semibold text-slate-900 dark:text-slate-100 mb-1">+ <h3 class="text-base font-semibold text-slate-900 dark:text-slate-100 mb-6">{props.emptyState!.title}</h3><Show when={props.emptyState!.subtitle}>@@ -99,37 +99,7 @@ export const ChatMessages: Component<ChatMessagesProps> = (props) => {</Show><div class="w-full max-w-xs space-y-6">- {/* Recent Sessions */}- <Show when={props.recentSessions && props.recentSessions.length > 0}>- <div class="space-y-2">- <div class="text-xs font-medium text-slate-400 dark:text-slate-500 text-left uppercase tracking-wider pl-1">- Resume conversation- </div>- <For each={props.recentSessions}>- {(session) => (- <button- type="button"- onClick={() => props.onLoadSession?.(session.id)}- class="w-full text-left px-4 py-3 rounded-xl bg-white dark:bg-slate-800/50 hover:bg-blue-50 dark:hover:bg-blue-900/10 border border-slate-200 dark:border-slate-700 hover:border-blue-200 dark:hover:border-blue-800 transition-all group flex items-center gap-3"- >- <div class="p-1.5 rounded-lg bg-slate-100 dark:bg-slate-700 text-slate-500 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z" />- </svg>- </div>- <div class="flex-1 min-w-0">- <div class="text-sm font-medium text-slate-700 dark:text-slate-200 truncate group-hover:text-blue-700 dark:group-hover:text-blue-300">- {session.title || 'Untitled Conversation'}- </div>- <div class="text-[11px] text-slate-400 dark:text-slate-500 truncate">- {new Date(session.updated_at).toLocaleDateString()} · {session.message_count} messages- </div>- </div>- </button>- )}- </For>- </div>- </Show>+{/* Suggestions */}<Show when={props.emptyState!.suggestions && props.emptyState!.suggestions!.length > 0}>diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsxindex 534df20b6c..596e8e7f4e 100644--- a/frontend-modern/src/components/AI/FindingsPanel.tsx+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx@@ -59,7 +59,7 @@ const sourceColors: Record<string, string> = {// Investigation status badge colorsconst investigationStatusColors: Record<InvestigationStatus, string> = {pending: 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400',- running: 'bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300',+ running: 'bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300',completed: 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300',failed: 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300',needs_attention: 'bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300',@@ -148,7 +148,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {// Fetch legacy remediation plansAIAPI.getRemediationPlans().then((response: { plans: RemediationPlan[] }) => setRemediationPlans(response.plans))- .catch(() => {}); // Silently ignore errors+ .catch(() => { }); // Silently ignore errors});createEffect(() => {@@ -449,11 +449,10 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {const renderFindingItem = (finding: UnifiedFinding, showSourceBadge: boolean = false) => (<divid={`finding-${finding.id}`}- class={`p-3 cursor-pointer transition-colors ${- finding.status === 'active'- ? 'hover:bg-gray-50 dark:hover:bg-gray-800/50'- : 'opacity-60 bg-gray-50/50 dark:bg-gray-800/30 hover:opacity-80'- }`}+ class={`p-3 cursor-pointer transition-colors ${finding.status === 'active'+ ? 'hover:bg-gray-50 dark:hover:bg-gray-800/50'+ : 'opacity-60 bg-gray-50/50 dark:bg-gray-800/30 hover:opacity-80'+ }`}onClick={() => {if (expandedId() === finding.id) {setExpandedId(null);@@ -469,13 +468,12 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {<div class="flex items-center gap-2 flex-wrap">{/* Status badge for non-active findings */}<Show when={finding.status !== 'active'}>- <span class={`px-1.5 py-0.5 text-[10px] font-medium rounded ${- finding.status === 'resolved'- ? 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300'- : finding.status === 'snoozed'+ <span class={`px-1.5 py-0.5 text-[10px] font-medium rounded ${finding.status === 'resolved'+ ? 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300'+ : finding.status === 'snoozed'? 'bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300': 'bg-gray-200 text-gray-600 dark:bg-gray-600 dark:text-gray-300'- }`}>+ }`}>{finding.status === 'resolved' ? 'Resolved' : finding.status === 'snoozed' ? 'Snoozed' : 'Dismissed'}</span></Show>@@ -525,11 +523,10 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {</span></Show>{/* Title */}- <span class={`font-medium text-sm truncate ${- finding.status === 'active'- ? 'text-gray-900 dark:text-gray-100'- : 'text-gray-500 dark:text-gray-400'- }`}>+ <span class={`font-medium text-sm truncate ${finding.status === 'active'+ ? 'text-gray-900 dark:text-gray-100'+ : 'text-gray-500 dark:text-gray-400'+ }`}>{finding.title}</span></div>@@ -832,6 +829,10 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {<ApprovalSectionfindingId={finding.id}investigationOutcome={finding.investigationOutcome}+ findingTitle={finding.title}+ resourceName={finding.resourceName}+ resourceType={finding.resourceType}+ resourceId={finding.resourceId}/></Show>@@ -844,20 +845,18 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4" /></svg><span class="text-sm font-medium text-gray-900 dark:text-gray-100">Remediation Plan</span>- <span class={`px-1.5 py-0.5 text-[10px] font-medium rounded ${- plan().risk_level === 'high' ? 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300' :+ <span class={`px-1.5 py-0.5 text-[10px] font-medium rounded ${plan().risk_level === 'high' ? 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300' :plan().risk_level === 'medium' ? 'bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300' :- 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300'- }`}>+ 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300'+ }`}>{plan().risk_level} risk</span>- <span class={`px-1.5 py-0.5 text-[10px] font-medium rounded ${- plan().status === 'completed' ? 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300' :+ <span class={`px-1.5 py-0.5 text-[10px] font-medium rounded ${plan().status === 'completed' ? 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300' :plan().status === 'approved' ? 'bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300' :- plan().status === 'executing' ? 'bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300' :- plan().status === 'failed' ? 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300' :- 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400'- }`}>+ plan().status === 'executing' ? 'bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300' :+ plan().status === 'failed' ? 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300' :+ 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400'+ }`}>{plan().status}</span></div>@@ -1023,15 +1022,15 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {<Show when={!aiIntelligenceStore.findingsLoading}><Card padding="none" class="overflow-hidden">{/* Header */}- <div class="bg-gradient-to-r from-purple-50 to-purple-100 dark:from-purple-900/20 dark:to-purple-900/30 px-4 py-3 border-b border-gray-200 dark:border-gray-700">+ <div class="bg-gradient-to-r from-blue-50 to-blue-100 dark:from-blue-900/20 dark:to-blue-900/30 px-4 py-3 border-b border-gray-200 dark:border-gray-700"><div class="flex items-center justify-between"><div class="flex items-center gap-2">- <svg class="w-5 h-5 text-purple-600 dark:text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <svg class="w-5 h-5 text-blue-600 dark:text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg><span class="font-medium text-gray-900 dark:text-gray-100">Pulse Patrol Findings</span><Show when={patrolFindings().length > 0}>- <span class="px-2 py-0.5 text-xs font-medium bg-purple-200 dark:bg-purple-700 text-purple-800 dark:text-purple-200 rounded-full">+ <span class="px-2 py-0.5 text-xs font-medium bg-blue-200 dark:bg-blue-700 text-blue-800 dark:text-blue-200 rounded-full">{patrolFindings().length}</span></Show>@@ -1064,7 +1063,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {</div></Show><Show when={props.nextPatrolAt}>- <div class="flex items-center gap-1.5 text-purple-600 dark:text-purple-400">+ <div class="flex items-center gap-1.5 text-blue-600 dark:text-blue-400"><svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" /></svg>diff --git a/frontend-modern/src/components/patrol/ApprovalSection.tsx b/frontend-modern/src/components/patrol/ApprovalSection.tsxindex 4f7be68522..9a7a762b32 100644--- a/frontend-modern/src/components/patrol/ApprovalSection.tsx+++ b/frontend-modern/src/components/patrol/ApprovalSection.tsx@@ -8,12 +8,18 @@import { Component, Show, createSignal, createResource, createMemo } from 'solid-js';import { aiIntelligenceStore } from '@/stores/aiIntelligence';import { notificationStore } from '@/stores/notifications';+import { aiChatStore } from '@/stores/aiChat';+import { hasFeature } from '@/stores/license';import { AIAPI, type ApprovalRequest, type ApprovalExecutionResult } from '@/api/ai';import { RemediationStatus } from './RemediationStatus';interface ApprovalSectionProps {findingId: string;investigationOutcome?: string;+ findingTitle?: string;+ resourceName?: string;+ resourceType?: string;+ resourceId?: string;}export const ApprovalSection: Component<ApprovalSectionProps> = (props) => {@@ -27,6 +33,30 @@ export const ApprovalSection: Component<ApprovalSectionProps> = (props) => {) ?? null;});+ const canAutoFix = createMemo(() => hasFeature('ai_autofix'));++ const handleFixWithAssistant = (approval: ApprovalRequest | null, fix: { description?: string; commands?: string[]; target_host?: string; risk_level?: string; rationale?: string } | null, e: Event) => {+ e.stopPropagation();+ const desc = approval?.context || fix?.description || 'No description available';+ const command = approval?.command || (fix?.commands && fix.commands.length > 0 ? fix.commands[0] : undefined);+ const targetHost = approval?.targetName || fix?.target_host;+ const riskLevel = approval?.riskLevel || fix?.risk_level || 'unknown';+ const rationale = fix?.rationale;++ let prompt = `Patrol investigated a finding and proposed a fix. Please help me execute it.\n\n**Finding:** ${props.findingTitle || 'Unknown finding'} on ${props.resourceName || 'unknown resource'}\n**Proposed fix:** ${desc}`;+ if (command) prompt += `\n**Command:** \`${command}\``;+ if (targetHost) prompt += `\n**Target:** ${targetHost}`;+ prompt += `\n**Risk level:** ${riskLevel}`;+ if (rationale) prompt += `\n**Rationale:** ${rationale}`;+ prompt += `\n\nPlease execute this fix on the target host.`;++ aiChatStore.openWithPrompt(prompt, {+ targetType: props.resourceType,+ targetId: props.resourceId,+ findingId: props.findingId,+ });+ };+// Load investigation details when outcome indicates a fix was proposed/executedconst fixRelatedOutcomes = new Set(['fix_queued', 'fix_executed', 'fix_failed', 'fix_verified', 'fix_verification_failed']);const [investigation] = createResource(@@ -154,30 +184,44 @@ export const ApprovalSection: Component<ApprovalSectionProps> = (props) => {</div></div><div class="flex items-center gap-2 mt-3 pt-3 border-t border-gray-100 dark:border-gray-700">- <button- type="button"- onClick={(e) => handleApprove(approval, e)}- disabled={actionLoading() === approval.id}- class="flex-1 px-3 py-1.5 bg-green-600 hover:bg-green-700 disabled:bg-green-400 text-white text-xs font-medium rounded flex items-center justify-center gap-1.5"- >- <Show when={actionLoading() === approval.id}>- <span class="h-3 w-3 border-2 border-white border-t-transparent rounded-full animate-spin" />- </Show>- <Show when={actionLoading() !== approval.id}>+ <Show when={canAutoFix()}>+ <button+ type="button"+ onClick={(e) => handleApprove(approval, e)}+ disabled={actionLoading() === approval.id}+ class="flex-1 px-3 py-1.5 bg-green-600 hover:bg-green-700 disabled:bg-green-400 text-white text-xs font-medium rounded flex items-center justify-center gap-1.5"+ >+ <Show when={actionLoading() === approval.id}>+ <span class="h-3 w-3 border-2 border-white border-t-transparent rounded-full animate-spin" />+ </Show>+ <Show when={actionLoading() !== approval.id}>+ <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />+ </svg>+ </Show>+ Approve & Execute+ </button>+ <button+ type="button"+ onClick={(e) => handleDeny(approval, e)}+ disabled={actionLoading() === approval.id}+ class="px-3 py-1.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 disabled:opacity-50 text-gray-600 dark:text-gray-400 text-xs font-medium rounded"+ >+ Deny+ </button>+ </Show>+ <Show when={!canAutoFix()}>+ <button+ type="button"+ onClick={(e) => handleFixWithAssistant(approval, null, e)}+ class="flex-1 px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white text-xs font-medium rounded flex items-center justify-center gap-1.5"+ ><svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" /></svg>- </Show>- Approve & Execute- </button>- <button- type="button"- onClick={(e) => handleDeny(approval, e)}- disabled={actionLoading() === approval.id}- class="px-3 py-1.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 disabled:opacity-50 text-gray-600 dark:text-gray-400 text-xs font-medium rounded"- >- Deny- </button>+ Fix with Assistant+ </button>+ </Show></div></>);@@ -214,22 +258,36 @@ export const ApprovalSection: Component<ApprovalSectionProps> = (props) => {</Show></div><div class="flex items-center gap-2 mt-3 pt-3 border-t border-gray-100 dark:border-gray-700">- <button- type="button"- onClick={handleReapprove}- disabled={actionLoading() === 'reapprove'}- class="flex-1 px-3 py-1.5 bg-amber-600 hover:bg-amber-700 disabled:bg-amber-400 text-white text-xs font-medium rounded flex items-center justify-center gap-1.5"- >- <Show when={actionLoading() === 'reapprove'}>- <span class="h-3 w-3 border-2 border-white border-t-transparent rounded-full animate-spin" />- </Show>- <Show when={actionLoading() !== 'reapprove'}>+ <Show when={canAutoFix()}>+ <button+ type="button"+ onClick={handleReapprove}+ disabled={actionLoading() === 'reapprove'}+ class="flex-1 px-3 py-1.5 bg-amber-600 hover:bg-amber-700 disabled:bg-amber-400 text-white text-xs font-medium rounded flex items-center justify-center gap-1.5"+ >+ <Show when={actionLoading() === 'reapprove'}>+ <span class="h-3 w-3 border-2 border-white border-t-transparent rounded-full animate-spin" />+ </Show>+ <Show when={actionLoading() !== 'reapprove'}>+ <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />+ </svg>+ </Show>+ Re-approve & Execute+ </button>+ </Show>+ <Show when={!canAutoFix()}>+ <button+ type="button"+ onClick={(e) => handleFixWithAssistant(null, fix, e)}+ class="flex-1 px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white text-xs font-medium rounded flex items-center justify-center gap-1.5"+ ><svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" /></svg>- </Show>- Re-approve & Execute- </button>+ Fix with Assistant+ </button>+ </Show></div></>);diff --git a/frontend-modern/src/components/patrol/InvestigationSection.tsx b/frontend-modern/src/components/patrol/InvestigationSection.tsxindex 70cdddf2eb..7d7b8daaff 100644--- a/frontend-modern/src/components/patrol/InvestigationSection.tsx+++ b/frontend-modern/src/components/patrol/InvestigationSection.tsx@@ -29,7 +29,7 @@ interface InvestigationSectionProps {const statusColors: Record<string, string> = {pending: 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400',- running: 'bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300',+ running: 'bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300',completed: 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300',failed: 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300',needs_attention: 'bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300',@@ -189,7 +189,7 @@ export const InvestigationSection: Component<InvestigationSectionProps> = (props<buttontype="button"onClick={(e) => { e.stopPropagation(); setShowThread(!showThread()); }}- class="text-xs text-purple-600 dark:text-purple-400 hover:underline flex items-center gap-1"+ class="text-xs text-blue-600 dark:text-blue-400 hover:underline flex items-center gap-1">{showThread() ? 'Hide investigation thread' : 'Show investigation thread'}<svg