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.

Align Patrol footer countdown semantics

rcourtmanc6b0ea8b20bf
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 50f1834cce..6f107caa32 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -146,6 +146,13 @@ recent-activity strip, not a second health verdict: when Patrol is active it
should report recent run activity, run kind, latest run result, and run-count
context instead of emitting another green/amber all-clear headline that can
drift from the governed assessment summary above it.
+That same Patrol-owned timing contract also applies to the findings empty
+state footer. `frontend-modern/src/components/AI/FindingsPanel.tsx` must use
+the canonical Patrol countdown semantics for `next_patrol_at` instead of
+formatting future schedule timestamps through generic relative-time helpers;
+otherwise the findings footer can contradict the header by rendering the same
+next scheduled patrol as `just now` while the main Patrol shell correctly
+shows a multi-hour countdown.
When Patrol is currently running, that strip should still stay factual rather
than switching to another verdict label: the runtime may add an explicit
in-progress indicator, but the primary activity label remains recent activity
diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx
index 7b025f177b..3c2b2cd09d 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -16,7 +16,7 @@ import { Card } from '@/components/shared/Card';
import { aiIntelligenceStore, type UnifiedFinding } from '@/stores/aiIntelligence';
import { notificationStore } from '@/stores/notifications';
import { aiChatStore } from '@/stores/aiChat';
-import { InvestigationSection, ApprovalSection } from '@/components/patrol';
+import { InvestigationSection, ApprovalSection, CountdownTimer } from '@/components/patrol';
import { AIAPI, type RemediationPlan } from '@/api/ai';
import type { PatrolRuntimeState } from '@/api/patrol';
import { getApprovalRiskPresentation } from '@/utils/approvalRiskPresentation';
@@ -1179,7 +1179,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
d="M13 10V3L4 14h7v7l9-11h-7z"
/>
</svg>
- <span>Next: {formatTime(props.nextPatrolAt!)}</span>
+ <CountdownTimer targetDate={props.nextPatrolAt!} prefix="Next: " />
</div>
</Show>
<Show
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
index 0fc3893d3b..14aaff4fff 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
@@ -1,3 +1,5 @@
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
import {
buildFindingFilterOptions,
@@ -25,6 +27,11 @@ import {
doesFindingNeedAttention,
} from '@/utils/aiFindingPresentation';
+const findingsPanelSource = readFileSync(
+ resolve(__dirname, '..', 'FindingsPanel.tsx'),
+ 'utf-8',
+);
+
describe('aiFindingPresentation', () => {
describe('severity presentation', () => {
it('has correct sort order for critical', () => {
@@ -151,6 +158,13 @@ describe('aiFindingPresentation', () => {
});
});
+ describe('patrol schedule presentation', () => {
+ it('keeps the next patrol footer on the canonical countdown timer', () => {
+ expect(findingsPanelSource).toContain('<CountdownTimer targetDate={props.nextPatrolAt!} prefix="Next: " />');
+ expect(findingsPanelSource).not.toContain('Next: {formatTime(props.nextPatrolAt!)}');
+ });
+ });
+
describe('sourceColors', () => {
it('has threshold color', () => {
expect(getFindingSourceBadgeClasses('threshold')).toContain('orange');