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.

Use Patrol source loading for findings panel

rcourtman5465852be04f
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 2c4fe5e2ee..1fbac0bc40 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -80,6 +80,10 @@ Patrol-specific presentation helpers.
may remain available to cross-product AI surfaces, but the Patrol page,
selected-run findings panel, badges, and active-finding summaries must not
infer current Patrol evidence by filtering the unified threshold/AI feed.
+ The same source boundary owns loading and error state: Patrol findings must
+ render from `patrolFindings`, `patrolFindingsLoading`, and
+ `patrolFindingsError` instead of letting a pending unified findings request
+ mask direct Patrol evidence that has already loaded.
2. Keep Patrol-specific copy and badge logic inside the governed Patrol presentation helpers instead of page-local branches
Patrol assessment copy must not present an all-clear health prediction while
active Patrol findings or Patrol runtime issues are still present. The
diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx
index bbc07bd86d..b807d1aaf1 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -165,6 +165,16 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
const sourceFindings = createMemo(() =>
isPatrolFindingsSource() ? aiIntelligenceStore.patrolFindings : aiIntelligenceStore.findings,
);
+ const sourceFindingsLoading = createMemo(() =>
+ isPatrolFindingsSource()
+ ? aiIntelligenceStore.patrolFindingsLoading
+ : aiIntelligenceStore.findingsLoading,
+ );
+ const sourceFindingsError = createMemo(() =>
+ isPatrolFindingsSource()
+ ? aiIntelligenceStore.patrolFindingsError
+ : aiIntelligenceStore.findingsError,
+ );
const sourceFindingsNeedingAttention = createMemo(() =>
isPatrolFindingsSource()
? aiIntelligenceStore.patrolFindingsNeedingAttention
@@ -1796,20 +1806,20 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
</Show>
{/* Loading/Error states */}
- <Show when={aiIntelligenceStore.findingsLoading}>
+ <Show when={sourceFindingsLoading()}>
<div class="p-4 text-sm text-muted flex items-center gap-2">
<span class="h-4 w-4 border-2 border-current border-t-transparent rounded-full animate-spin" />
Loading findings...
</div>
</Show>
- <Show when={aiIntelligenceStore.findingsError && !aiIntelligenceStore.findingsLoading}>
+ <Show when={sourceFindingsError() && !sourceFindingsLoading()}>
<div class="p-4 text-sm text-red-600 dark:text-red-400">
- {aiIntelligenceStore.findingsError}
+ {sourceFindingsError()}
</div>
</Show>
- <Show when={!aiIntelligenceStore.findingsLoading}>
+ <Show when={!sourceFindingsLoading()}>
<Card padding="none" class="overflow-hidden">
{/* Content */}
<div class="divide-y divide-border-subtle">
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx b/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx
index a111399fe4..9e61e0b6ed 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx
@@ -66,7 +66,11 @@ const mockState = vi.hoisted(() => {
return {
findings,
+ findingsError: null as string | null,
+ findingsLoading: false,
patrolFindings,
+ patrolFindingsError: null as string | null,
+ patrolFindingsLoading: false,
getResource,
getRemediationPlans,
loadFindings,
@@ -123,19 +127,19 @@ vi.mock('@/stores/aiIntelligence', () => ({
return mockState.findings;
},
get findingsLoading() {
- return false;
+ return mockState.findingsLoading;
},
get findingsError() {
- return null;
+ return mockState.findingsError;
},
get patrolFindings() {
return mockState.patrolFindings;
},
get patrolFindingsLoading() {
- return false;
+ return mockState.patrolFindingsLoading;
},
get patrolFindingsError() {
- return null;
+ return mockState.patrolFindingsError;
},
get findingsNeedingAttention() {
return [];
@@ -178,6 +182,10 @@ describe('FindingsPanel resource links', () => {
mockState.loadPatrolFindings.mockClear();
mockState.getRemediationPlans.mockClear();
mockState.getResource.mockClear();
+ mockState.findingsLoading = false;
+ mockState.findingsError = null;
+ mockState.patrolFindingsLoading = false;
+ mockState.patrolFindingsError = null;
if (typeof window.requestAnimationFrame !== 'function') {
window.requestAnimationFrame = ((callback: FrameRequestCallback) =>
@@ -217,4 +225,16 @@ describe('FindingsPanel resource links', () => {
expect(mockState.loadFindings).not.toHaveBeenCalled();
expect(screen.getByText('Provider connection issue')).toBeInTheDocument();
});
+
+ it('renders Patrol findings while the unified findings request is still loading', async () => {
+ mockState.findingsLoading = true;
+ mockState.patrolFindingsLoading = false;
+
+ render(() => <FindingsPanel findingsSource="patrol" />);
+
+ await waitFor(() => expect(mockState.loadPatrolFindings).toHaveBeenCalled());
+
+ expect(screen.queryByText('Loading findings...')).not.toBeInTheDocument();
+ expect(screen.getByText('Provider connection issue')).toBeInTheDocument();
+ });
});
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
index 72a0184deb..ca70d89262 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
@@ -675,6 +675,8 @@ describe('aiFindingPresentation', () => {
expect(findingsPanelSource).toContain("findingsSource?: 'unified' | 'patrol'");
expect(findingsPanelSource).toContain('aiIntelligenceStore.loadPatrolFindings()');
expect(findingsPanelSource).toContain('aiIntelligenceStore.patrolFindings');
+ expect(findingsPanelSource).toContain('aiIntelligenceStore.patrolFindingsLoading');
+ expect(findingsPanelSource).toContain('aiIntelligenceStore.patrolFindingsError');
expect(findingsPanelSource).toContain('aiIntelligenceStore.patrolFindingsSignal()');
expect(findingsPanelSource).toContain('aiIntelligenceStore.patrolFindingsNeedingAttention');
expect(findingsPanelSource).toContain(