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.

Enhance calm-day Patrol empty state with coverage context

rcourtman18b3342d02fe
diff --git a/frontend-modern/src/utils/__tests__/patrolEmptyStatePresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolEmptyStatePresentation.test.ts
index 92a4c12cb9..e432924504 100644
--- a/frontend-modern/src/utils/__tests__/patrolEmptyStatePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/patrolEmptyStatePresentation.test.ts
@@ -89,7 +89,7 @@ describe('patrolEmptyStatePresentation', () => {
status: 'error',
error_count: 1,
resources_checked: 72,
- } as PatrolRunRecord,
+ } as unknown as PatrolRunRecord,
],
}),
).toEqual({
@@ -241,4 +241,51 @@ describe('patrolEmptyStatePresentation', () => {
tone: 'warning',
});
});
+
+ it('includes latest-run coverage context in the healthy empty state body', () => {
+ const result = getPatrolFindingsEmptyState({
+ filter: 'active',
+ overallHealth: {
+ score: 100,
+ grade: 'A',
+ trend: 'stable',
+ factors: [],
+ prediction: 'Infrastructure is healthy with no significant issues detected.',
+ },
+ runtimeState: 'active',
+ runs: [
+ {
+ id: 'run-1',
+ started_at: '2026-06-27T10:00:00Z',
+ status: 'no_issues',
+ error_count: 0,
+ resources_checked: 42,
+ scope_resource_ids: [],
+ effective_scope_resource_ids: [],
+ finding_ids: [],
+ } as unknown as PatrolRunRecord,
+ ],
+ });
+ expect(result.title).toBe('No current issues');
+ expect(result.body).toContain('Checked 42 resources');
+ expect(result.body).toContain('No action needed');
+ expect(result.tone).toBe('success');
+ });
+
+ it('omits coverage context when no runs are available', () => {
+ const result = getPatrolFindingsEmptyState({
+ filter: 'active',
+ overallHealth: {
+ score: 100,
+ grade: 'A',
+ trend: 'stable',
+ factors: [],
+ prediction: 'Infrastructure is healthy with no significant issues detected.',
+ },
+ runtimeState: 'active',
+ });
+ expect(result.body).toBe(
+ 'No action needed from the latest Patrol check. Run Patrol any time to check again.',
+ );
+ });
});
diff --git a/frontend-modern/src/utils/patrolEmptyStatePresentation.ts b/frontend-modern/src/utils/patrolEmptyStatePresentation.ts
index e0f2d34e84..b0a4e39da2 100644
--- a/frontend-modern/src/utils/patrolEmptyStatePresentation.ts
+++ b/frontend-modern/src/utils/patrolEmptyStatePresentation.ts
@@ -142,6 +142,20 @@ function hasHistoricalRegressions(count: number | undefined): boolean {
return typeof count === 'number' && Number.isFinite(count) && count > 0;
}
+function getLatestRunCoverageContext(
+ runs: PatrolRunRecord[] | undefined,
+): string | undefined {
+ if (!runs || runs.length === 0) {
+ return undefined;
+ }
+ const latestRun = runs[0];
+ const coverageSummary = getPatrolRunCoverageSummary(latestRun);
+ if (!coverageSummary) {
+ return undefined;
+ }
+ return `${coverageSummary}.`;
+}
+
function getPatrolRunSnapshotEmptyState(
run: PatrolRunSnapshotEmptyStateArgs,
): PatrolFindingsEmptyStateCopy {
@@ -237,9 +251,12 @@ export function getPatrolFindingsEmptyState(args: {
};
}
+ const coverageContext = getLatestRunCoverageContext(args.runs);
return {
title: PATROL_QUEUE_CLEAR_TITLE,
- body: HEALTHY_PATROL_EMPTY_STATE_BODY,
+ body: coverageContext
+ ? `${coverageContext} ${HEALTHY_PATROL_EMPTY_STATE_BODY}`
+ : HEALTHY_PATROL_EMPTY_STATE_BODY,
tone: 'success',
};
}