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.

Govern diagnostics presentation helper

rcourtmaneee1e4876265
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 3424092642..985bd50b71 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -42,21 +42,22 @@ work extends shared components instead of creating new local variants.
20. `frontend-modern/src/components/Settings/diagnosticsModel.ts`
21. `frontend-modern/src/components/Settings/DiagnosticsPanel.tsx`
22. `frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx`
-23. `frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx`
-24. `frontend-modern/src/components/Settings/NetworkSettingsPanel.tsx`
-25. `frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx`
-26. `frontend-modern/src/components/Settings/SecurityAuthPanel.tsx`
-27. `frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx`
-28. `frontend-modern/src/components/Settings/settingsHeaderMeta.ts`
-29. `frontend-modern/src/components/Settings/SSOProvidersPanel.tsx`
-30. `frontend-modern/src/components/Settings/useAISettingsState.ts`
-31. `frontend-modern/src/components/Settings/useDiagnosticsPanelState.ts`
-32. `frontend-modern/src/components/Settings/useSettingsShellState.ts`
-33. `frontend-modern/src/components/Settings/useSSOProvidersState.ts`
-34. `frontend-modern/src/components/Settings/ssoProvidersModel.ts`
-35. `frontend-modern/src/utils/ssoProviderPresentation.ts`
-36. `frontend-modern/src/utils/systemSettingsPresentation.ts`
-37. `frontend-modern/src/utils/aiSettingsPresentation.ts`
+23. `frontend-modern/src/utils/diagnosticsPresentation.ts`
+24. `frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx`
+25. `frontend-modern/src/components/Settings/NetworkSettingsPanel.tsx`
+26. `frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx`
+27. `frontend-modern/src/components/Settings/SecurityAuthPanel.tsx`
+28. `frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx`
+29. `frontend-modern/src/components/Settings/settingsHeaderMeta.ts`
+30. `frontend-modern/src/components/Settings/SSOProvidersPanel.tsx`
+31. `frontend-modern/src/components/Settings/useAISettingsState.ts`
+32. `frontend-modern/src/components/Settings/useDiagnosticsPanelState.ts`
+33. `frontend-modern/src/components/Settings/useSettingsShellState.ts`
+34. `frontend-modern/src/components/Settings/useSSOProvidersState.ts`
+35. `frontend-modern/src/components/Settings/ssoProvidersModel.ts`
+36. `frontend-modern/src/utils/ssoProviderPresentation.ts`
+37. `frontend-modern/src/utils/systemSettingsPresentation.ts`
+38. `frontend-modern/src/utils/aiSettingsPresentation.ts`
37. `frontend-modern/src/components/Settings/UpdateInstallGuide.tsx`
38. `frontend-modern/src/components/Settings/updatesSettingsModel.ts`
39. `frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx`
@@ -448,11 +449,13 @@ The diagnostics settings surface now follows that same owner split.
`frontend-modern/src/components/Settings/DiagnosticsPanel.tsx` stays the
top-level diagnostics shell, while
`frontend-modern/src/components/Settings/useDiagnosticsPanelState.ts`,
-`frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx`, and
-`frontend-modern/src/components/Settings/diagnosticsModel.ts` own the
-diagnostics run/export lifecycle, results rendering, and sanitization/model
-helpers. The shell must not re-accumulate inline API calls, export-download
-plumbing, or diagnostics-card composition.
+`frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx`,
+`frontend-modern/src/components/Settings/diagnosticsModel.ts`, and
+`frontend-modern/src/utils/diagnosticsPresentation.ts` own the diagnostics
+run/export lifecycle, results rendering, sanitization/model helpers, and
+customer-facing diagnostics copy. The shell must not re-accumulate inline API
+calls, export-download plumbing, diagnostics-card composition, or diagnostics
+surface copy.
The settings shell registry now also treats extracted feature prop contracts as
canonical shell inputs instead of reaching back into feature panels for type
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 860016865f..2bcc414106 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -2097,6 +2097,7 @@
"frontend-modern/src/features/operations/OperationsPageSurface.tsx",
"frontend-modern/src/pages/Operations.tsx",
"frontend-modern/src/utils/aiSettingsPresentation.ts",
+ "frontend-modern/src/utils/diagnosticsPresentation.ts",
"frontend-modern/src/utils/reportingPresentation.ts",
"frontend-modern/src/utils/ssoProviderPresentation.ts",
"frontend-modern/src/utils/systemLogsPresentation.ts",
@@ -2237,6 +2238,19 @@
"frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts"
]
},
+ {
+ "id": "diagnostics-presentation-helper",
+ "label": "diagnostics presentation helper proof",
+ "match_prefixes": [],
+ "match_files": [
+ "frontend-modern/src/utils/diagnosticsPresentation.ts"
+ ],
+ "allow_same_subsystem_tests": false,
+ "test_prefixes": [],
+ "exact_files": [
+ "frontend-modern/src/utils/__tests__/diagnosticsPresentation.test.ts"
+ ]
+ },
{
"id": "system-logs-presentation-helper",
"label": "system logs presentation helper proof",
diff --git a/frontend-modern/src/components/Settings/DiagnosticsPanel.tsx b/frontend-modern/src/components/Settings/DiagnosticsPanel.tsx
index db1030c948..6ee1784630 100644
--- a/frontend-modern/src/components/Settings/DiagnosticsPanel.tsx
+++ b/frontend-modern/src/components/Settings/DiagnosticsPanel.tsx
@@ -6,6 +6,7 @@ import Download from 'lucide-solid/icons/download';
import { DiagnosticsResultsPanel } from '@/components/Settings/DiagnosticsResultsPanel';
import { useDiagnosticsPanelState } from '@/components/Settings/useDiagnosticsPanelState';
import { formatUptime } from '@/components/Settings/diagnosticsModel';
+import { DIAGNOSTICS_PANEL_COPY } from '@/utils/diagnosticsPresentation';
export const DiagnosticsPanel: Component = () => {
const { diagnosticsData, exportDiagnostics, exportLoading, loading, runDiagnostics } =
@@ -14,15 +15,20 @@ export const DiagnosticsPanel: Component = () => {
return (
<div class="space-y-6">
<OperationsPanel
- title="System Diagnostics"
- description="Connection health, configuration status, and troubleshooting tools"
+ title={DIAGNOSTICS_PANEL_COPY.title}
+ description={DIAGNOSTICS_PANEL_COPY.description}
icon={<Activity class="w-5 h-5 sm:w-5 sm:h-5" />}
action={
<div class="flex items-center justify-between sm:justify-end gap-3 flex-wrap">
<Show when={diagnosticsData()}>
<div class="text-left sm:text-right text-xs text-muted">
- <div>Version {diagnosticsData()?.version}</div>
- <div>Uptime: {formatUptime(diagnosticsData()?.uptime || 0)}</div>
+ <div>
+ {DIAGNOSTICS_PANEL_COPY.versionLabel} {diagnosticsData()?.version}
+ </div>
+ <div>
+ {DIAGNOSTICS_PANEL_COPY.uptimeLabel}:{' '}
+ {formatUptime(diagnosticsData()?.uptime || 0)}
+ </div>
</div>
</Show>
<button
@@ -32,14 +38,22 @@ export const DiagnosticsPanel: Component = () => {
class="flex min-h-10 sm:min-h-9 min-w-10 items-center gap-2 px-3 sm:px-4 py-2.5 rounded-md font-medium text-sm transition-colors whitespace-nowrap bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50 disabled:bg-surface disabled:text-muted"
>
<RefreshCw class={`w-4 h-4 ${loading() ? 'animate-spin' : ''}`} />
- <span class="sm:hidden">{loading() ? '...' : 'Run'}</span>
- <span class="hidden sm:inline">{loading() ? 'Running...' : 'Run Diagnostics'}</span>
+ <span class="sm:hidden">
+ {loading()
+ ? DIAGNOSTICS_PANEL_COPY.runningActionLabel
+ : DIAGNOSTICS_PANEL_COPY.runShortLabel}
+ </span>
+ <span class="hidden sm:inline">
+ {loading()
+ ? DIAGNOSTICS_PANEL_COPY.runningActionLabel
+ : DIAGNOSTICS_PANEL_COPY.runActionLabel}
+ </span>
</button>
</div>
}
>
<div class="px-4 sm:px-6 py-3 sm:py-4 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
- <p class="text-xs text-muted">Test all connections and inspect runtime configuration</p>
+ <p class="text-xs text-muted">{DIAGNOSTICS_PANEL_COPY.summary}</p>
<Show when={diagnosticsData()}>
<div class="flex items-center gap-2 flex-wrap">
<button
@@ -49,7 +63,7 @@ export const DiagnosticsPanel: Component = () => {
class="flex min-h-10 sm:min-h-9 items-center gap-1.5 px-3 py-2 text-sm font-medium text-base-content bg-surface border border-border rounded-md hover:bg-surface-hover transition-colors"
>
<Download class="w-3.5 h-3.5" />
- Full
+ {DIAGNOSTICS_PANEL_COPY.exportFullLabel}
</button>
<button
type="button"
@@ -58,7 +72,7 @@ export const DiagnosticsPanel: Component = () => {
class="flex min-h-10 sm:min-h-9 items-center gap-1.5 px-3 py-2 text-sm font-medium text-green-700 dark:text-green-300 bg-green-50 dark:bg-green-900 border border-green-200 dark:border-green-800 rounded-md hover:bg-green-100 dark:hover:bg-green-900 transition-colors"
>
<Download class="w-3.5 h-3.5" />
- GitHub
+ {DIAGNOSTICS_PANEL_COPY.exportGithubLabel}
</button>
</div>
</Show>
diff --git a/frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx b/frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx
index dfed404b9e..3d38345fa9 100644
--- a/frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx
+++ b/frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx
@@ -17,7 +17,11 @@ import XCircle from 'lucide-solid/icons/x-circle';
import { StatusDot } from '@/components/shared/StatusDot';
import { getSimpleStatusIndicator, getStatusIndicatorBadgeToneClasses } from '@/utils/status';
import { getSemanticTonePresentation } from '@/utils/semanticTonePresentation';
-import { DIAGNOSTICS_EMPTY_PBS_MESSAGE } from '@/utils/diagnosticsPresentation';
+import {
+ DIAGNOSTICS_EMPTY_PBS_MESSAGE,
+ DIAGNOSTICS_EMPTY_STATE_COPY,
+ DIAGNOSTICS_PANEL_COPY,
+} from '@/utils/diagnosticsPresentation';
import type { DiagnosticsData } from '@/components/Settings/diagnosticsModel';
const DiagnosticCard: Component<{
@@ -89,9 +93,11 @@ export const DiagnosticsResultsPanel: Component<DiagnosticsResultsPanelProps> =
<Card padding="lg" class="text-center">
<div class="py-12">
<Activity class="mx-auto mb-4 h-12 w-12 text-muted" />
- <h3 class="mb-2 text-lg font-medium text-base-content">No diagnostics data yet</h3>
+ <h3 class="mb-2 text-lg font-medium text-base-content">
+ {DIAGNOSTICS_EMPTY_STATE_COPY.title}
+ </h3>
<p class="mb-6 text-sm text-muted">
- Click "Run Diagnostics" above to test connections and inspect system status
+ {DIAGNOSTICS_EMPTY_STATE_COPY.description}
</p>
<button
type="button"
@@ -100,7 +106,7 @@ export const DiagnosticsResultsPanel: Component<DiagnosticsResultsPanelProps> =
class="inline-flex min-h-10 items-center gap-2 rounded-md bg-blue-600 px-5 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50 sm:min-h-9"
>
<RefreshCw class={`h-4 w-4 ${props.loading ? 'animate-spin' : ''}`} />
- Run Diagnostics
+ {DIAGNOSTICS_EMPTY_STATE_COPY.actionLabel}
</button>
</div>
</Card>
@@ -356,7 +362,8 @@ export const DiagnosticsResultsPanel: Component<DiagnosticsResultsPanelProps> =
</div>
<Show when={props.diagnosticsData?.dockerAgents?.recommendedAgentVersion}>
<div class="mt-3 border-t border-border-subtle pt-2 text-xs text-muted">
- Recommended version: {props.diagnosticsData?.dockerAgents?.recommendedAgentVersion}
+ {DIAGNOSTICS_PANEL_COPY.recommendedVersionLabel}:{' '}
+ {props.diagnosticsData?.dockerAgents?.recommendedAgentVersion}
</div>
</Show>
</Card>
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 71192aa306..5a876c7bc8 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -946,11 +946,14 @@ describe('Settings architecture guardrails', () => {
it('keeps the diagnostics shell behind extracted runtime and results owners', () => {
expect(diagnosticsPanelSource).toContain('@/components/Settings/DiagnosticsResultsPanel');
expect(diagnosticsPanelSource).toContain('@/components/Settings/useDiagnosticsPanelState');
+ expect(diagnosticsPanelSource).toContain('DIAGNOSTICS_PANEL_COPY');
expect(diagnosticsPanelSource).toContain('formatUptime');
expect(diagnosticsPanelSource).not.toContain("apiFetchJSON('/api/diagnostics')");
expect(diagnosticsPanelSource).not.toContain('URL.createObjectURL');
expect(diagnosticsPanelSource).not.toContain('sanitizeDiagnosticsData');
+ expect(diagnosticsPanelSource).not.toContain('System Diagnostics');
expect(diagnosticsResultsPanelSource).toContain('DIAGNOSTICS_EMPTY_PBS_MESSAGE');
+ expect(diagnosticsResultsPanelSource).toContain('DIAGNOSTICS_EMPTY_STATE_COPY');
expect(diagnosticsResultsPanelSource).toContain('getStatusIndicatorBadgeToneClasses(');
expect(diagnosticsStateSource).toContain('export const useDiagnosticsPanelState =');
expect(diagnosticsStateSource).toContain("apiFetchJSON('/api/diagnostics')");
diff --git a/frontend-modern/src/utils/__tests__/diagnosticsPresentation.test.ts b/frontend-modern/src/utils/__tests__/diagnosticsPresentation.test.ts
index 8701bc1d59..f066a0e208 100644
--- a/frontend-modern/src/utils/__tests__/diagnosticsPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/diagnosticsPresentation.test.ts
@@ -1,8 +1,35 @@
import { describe, expect, it } from 'vitest';
-import { DIAGNOSTICS_EMPTY_PBS_MESSAGE } from '@/utils/diagnosticsPresentation';
+import {
+ DIAGNOSTICS_EMPTY_PBS_MESSAGE,
+ DIAGNOSTICS_EMPTY_STATE_COPY,
+ DIAGNOSTICS_PANEL_COPY,
+} from '@/utils/diagnosticsPresentation';
describe('diagnosticsPresentation', () => {
+ it('exports canonical diagnostics panel framing copy', () => {
+ expect(DIAGNOSTICS_PANEL_COPY).toEqual({
+ title: 'System Diagnostics',
+ description: 'Review connection health, configuration status, and troubleshooting tools.',
+ summary: 'Test all connections and inspect runtime configuration.',
+ runActionLabel: 'Run Diagnostics',
+ runShortLabel: 'Run',
+ runningActionLabel: 'Running...',
+ exportFullLabel: 'Full',
+ exportGithubLabel: 'GitHub',
+ versionLabel: 'Version',
+ uptimeLabel: 'Uptime',
+ recommendedVersionLabel: 'Recommended version',
+ });
+ });
+
it('exports canonical diagnostics empty-state copy', () => {
- expect(DIAGNOSTICS_EMPTY_PBS_MESSAGE).toBe('No PBS configured');
+ expect(DIAGNOSTICS_EMPTY_STATE_COPY).toEqual({
+ title: 'No diagnostics data available',
+ description: 'Run diagnostics to test connections and inspect system status.',
+ actionLabel: 'Run Diagnostics',
+ });
+ expect(DIAGNOSTICS_EMPTY_PBS_MESSAGE).toBe(
+ 'No Proxmox Backup Server instances configured.',
+ );
});
});
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 851833cb61..e4518b98f1 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -4193,8 +4193,11 @@ describe('frontend resource type boundaries', () => {
expect(auditLogPresentationSource).toContain('export const AUDIT_VERIFY_ROW_BUTTON_CLASS');
expect(diagnosticsPanelSource).toContain('@/components/Settings/DiagnosticsResultsPanel');
expect(diagnosticsPanelSource).toContain('@/components/Settings/useDiagnosticsPanelState');
+ expect(diagnosticsPanelSource).toContain('DIAGNOSTICS_PANEL_COPY');
expect(diagnosticsPanelSource).toContain('formatUptime');
expect(diagnosticsPanelSource).not.toContain('No PBS configured');
+ expect(diagnosticsPanelSource).not.toContain('System Diagnostics');
+ expect(diagnosticsPanelSource).not.toContain('Run Diagnostics');
expect(diagnosticsPanelSource).not.toContain("apiFetchJSON('/api/diagnostics')");
expect(diagnosticsPanelSource).not.toContain('URL.createObjectURL');
expect(diagnosticsPanelSource).not.toContain(
@@ -4205,10 +4208,13 @@ describe('frontend resource type boundaries', () => {
);
expect(diagnosticsResultsPanelSource).toContain('getStatusIndicatorBadgeToneClasses(');
expect(diagnosticsResultsPanelSource).toContain('DIAGNOSTICS_EMPTY_PBS_MESSAGE');
+ expect(diagnosticsResultsPanelSource).toContain('DIAGNOSTICS_EMPTY_STATE_COPY');
expect(diagnosticsStateSource).toContain('export const useDiagnosticsPanelState =');
expect(diagnosticsStateSource).toContain("apiFetchJSON('/api/diagnostics')");
expect(diagnosticsStateSource).toContain('URL.createObjectURL');
expect(diagnosticsModelSource).toContain('export function sanitizeDiagnosticsData');
+ expect(diagnosticsPresentationSource).toContain('export const DIAGNOSTICS_PANEL_COPY');
+ expect(diagnosticsPresentationSource).toContain('export const DIAGNOSTICS_EMPTY_STATE_COPY');
expect(diagnosticsPresentationSource).toContain('export const DIAGNOSTICS_EMPTY_PBS_MESSAGE');
expect(updatesSettingsPanelSource).toContain('getUpdateBuildBadges');
expect(updatesSettingsPanelSource).toContain('getUpdateAvailabilityHeading');
diff --git a/frontend-modern/src/utils/diagnosticsPresentation.ts b/frontend-modern/src/utils/diagnosticsPresentation.ts
index d77a38843c..6cbb2ebe88 100644
--- a/frontend-modern/src/utils/diagnosticsPresentation.ts
+++ b/frontend-modern/src/utils/diagnosticsPresentation.ts
@@ -1 +1,21 @@
-export const DIAGNOSTICS_EMPTY_PBS_MESSAGE = 'No PBS configured';
+export const DIAGNOSTICS_PANEL_COPY = {
+ title: 'System Diagnostics',
+ description: 'Review connection health, configuration status, and troubleshooting tools.',
+ summary: 'Test all connections and inspect runtime configuration.',
+ runActionLabel: 'Run Diagnostics',
+ runShortLabel: 'Run',
+ runningActionLabel: 'Running...',
+ exportFullLabel: 'Full',
+ exportGithubLabel: 'GitHub',
+ versionLabel: 'Version',
+ uptimeLabel: 'Uptime',
+ recommendedVersionLabel: 'Recommended version',
+} as const;
+
+export const DIAGNOSTICS_EMPTY_STATE_COPY = {
+ title: 'No diagnostics data available',
+ description: 'Run diagnostics to test connections and inspect system status.',
+ actionLabel: 'Run Diagnostics',
+} as const;
+
+export const DIAGNOSTICS_EMPTY_PBS_MESSAGE = 'No Proxmox Backup Server instances configured.';