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.

Keep Patrol findings visible during refresh

rcourtmanbb04bf9042bc
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 1fbac0bc40..0a657fdec9 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -83,7 +83,9 @@ Patrol-specific presentation helpers.
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.
+ mask direct Patrol evidence that has already loaded. Background Patrol
+ refreshes must preserve already-loaded findings instead of replacing the
+ workspace with a blocking loading state.
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 b807d1aaf1..44e519f144 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -165,11 +165,15 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
const sourceFindings = createMemo(() =>
isPatrolFindingsSource() ? aiIntelligenceStore.patrolFindings : aiIntelligenceStore.findings,
);
+ const sourceHasFindings = createMemo(() => sourceFindings().length > 0);
const sourceFindingsLoading = createMemo(() =>
isPatrolFindingsSource()
? aiIntelligenceStore.patrolFindingsLoading
: aiIntelligenceStore.findingsLoading,
);
+ const shouldShowLoadingState = createMemo(
+ () => sourceFindingsLoading() && !sourceHasFindings(),
+ );
const sourceFindingsError = createMemo(() =>
isPatrolFindingsSource()
? aiIntelligenceStore.patrolFindingsError
@@ -1806,7 +1810,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
</Show>
{/* Loading/Error states */}
- <Show when={sourceFindingsLoading()}>
+ <Show when={shouldShowLoadingState()}>
<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...
@@ -1819,7 +1823,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
</div>
</Show>
- <Show when={!sourceFindingsLoading()}>
+ <Show when={!shouldShowLoadingState()}>
<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 9e61e0b6ed..a5c6737e8b 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx
@@ -237,4 +237,15 @@ describe('FindingsPanel resource links', () => {
expect(screen.queryByText('Loading findings...')).not.toBeInTheDocument();
expect(screen.getByText('Provider connection issue')).toBeInTheDocument();
});
+
+ it('keeps loaded Patrol findings visible during a Patrol refresh', async () => {
+ mockState.patrolFindingsLoading = true;
+
+ 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 ca70d89262..36290361b2 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('const sourceHasFindings = createMemo(');
+ expect(findingsPanelSource).toContain('const shouldShowLoadingState = createMemo(');
expect(findingsPanelSource).toContain('aiIntelligenceStore.patrolFindingsLoading');
expect(findingsPanelSource).toContain('aiIntelligenceStore.patrolFindingsError');
expect(findingsPanelSource).toContain('aiIntelligenceStore.patrolFindingsSignal()');