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.

Centralize monitored system ledger presentation copy

rcourtman3b1917b16a15
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index a82d07310f..3ec66a7453 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -232,7 +232,9 @@ customer-facing rather than exposing raw monitored-system type/source slugs in
the settings table or included-surface details. When the row expands to show
status reasoning, it should also restate the freshest included surface and
timestamp there so a degraded reason and a fresher grouped signal remain
-readable together.
+readable together. When mixed-version payloads omit that canonical freshest
+signal entirely, the settings surface should degrade to a safe customer-facing
+fallback instead of an unexplained placeholder glyph.
Frontend billing/admin surfaces must not synthesize `plan_version` from
subscription lifecycle state. When a hosted billing record lacks a plan label,
the UI must preserve that absence instead of fabricating values like `active`
diff --git a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
index ccc00933b8..6273311606 100644
--- a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
+++ b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
@@ -22,7 +22,14 @@ import {
getMonitoredSystemLedgerLoadingState,
} from '@/utils/unifiedAgentInventoryPresentation';
import { PulseLogoIcon } from '@/components/icons/PulseLogoIcon';
-import { formatMonitoredSystemSurfaceAttribution } from '@/utils/monitoredSystemPresentation';
+import {
+ formatMonitoredSystemLatestIncludedSignalSentence,
+ formatMonitoredSystemSurfaceAttribution,
+ getMonitoredSystemCountingDetailsToggleLabel,
+ getMonitoredSystemExplanationFallbackSummary,
+ getMonitoredSystemLedgerPresentation,
+ getMonitoredSystemStatusFallbackSummary,
+} from '@/utils/monitoredSystemPresentation';
import {
SELF_HOSTED_MONITORED_SYSTEM_LEDGER_DESCRIPTION,
} from '@/utils/selfHostedPlans';
@@ -39,9 +46,7 @@ function usagePercent(total: number, limit: number): number {
function systemExplanation(system: MonitoredSystemLedgerEntry): MonitoredSystemLedgerExplanation {
return {
- summary:
- system.explanation?.summary ??
- 'Pulse counts this top-level collection path as one monitored system.',
+ summary: system.explanation?.summary ?? getMonitoredSystemExplanationFallbackSummary(),
reasons: system.explanation?.reasons ?? [],
surfaces: system.explanation?.surfaces ?? [],
};
@@ -49,9 +54,7 @@ function systemExplanation(system: MonitoredSystemLedgerEntry): MonitoredSystemL
function systemStatusExplanation(system: MonitoredSystemLedgerEntry): MonitoredSystemLedgerStatusExplanation {
return {
- summary:
- system.status_explanation?.summary ??
- 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
+ summary: system.status_explanation?.summary ?? getMonitoredSystemStatusFallbackSummary(),
reasons: system.status_explanation?.reasons ?? [],
};
}
@@ -72,6 +75,7 @@ function latestIncludedSignalSummary(system: MonitoredSystemLedgerEntry): {
export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProps = {}) {
const [ledger, { refetch }] = createResource(() => MonitoredSystemLedgerAPI.getLedger());
const [expandedSystemKey, setExpandedSystemKey] = createSignal<string | null>(null);
+ const presentation = getMonitoredSystemLedgerPresentation();
const total = () => ledger()?.total ?? 0;
const limit = () => ledger()?.limit ?? 0;
@@ -91,7 +95,7 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
<div class="space-y-1">
<div class="flex items-center justify-between">
<div class="space-y-1">
- <h3 class="text-sm font-semibold text-base-content">Monitored Systems</h3>
+ <h3 class="text-sm font-semibold text-base-content">{presentation.sectionTitle}</h3>
<MonitoredSystemDefinitionDisclosure
buttonClass="text-xs font-medium text-muted underline-offset-2 transition-colors hover:text-base-content hover:underline"
detailClass="max-w-xl text-xs text-muted"
@@ -151,14 +155,14 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
<Show
when={systems().length > 0}
- fallback={<p class="text-sm text-muted py-4 text-center">No monitored systems counted.</p>}
+ fallback={<p class="text-sm text-muted py-4 text-center">{presentation.emptyState}</p>}
>
<Table>
<TableHeader>
<TableRow>
- <TableHead>Name</TableHead>
- <TableHead>Status</TableHead>
- <TableHead>Latest Included Signal</TableHead>
+ <TableHead>{presentation.tableNameLabel}</TableHead>
+ <TableHead>{presentation.tableStatusLabel}</TableHead>
+ <TableHead>{presentation.tableLatestIncludedSignalLabel}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
@@ -183,7 +187,7 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
aria-controls={explanationID}
onClick={() => toggleSystemExplanation(key)}
>
- {expanded() ? 'Hide counting details' : 'View counting details'}
+ {getMonitoredSystemCountingDetailsToggleLabel(expanded())}
</button>
<Show when={expanded()}>
<div
@@ -191,14 +195,18 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
class="space-y-2 rounded-md border border-border bg-surface px-3 py-2 text-xs text-muted"
>
<div class="space-y-1">
- <p class="font-medium text-base-content">Current status</p>
+ <p class="font-medium text-base-content">
+ {presentation.currentStatusHeading}
+ </p>
<p class="whitespace-normal text-base-content">
{statusExplanation.summary}
</p>
<Show when={latestSignal}>
{(signal) => (
<p class="whitespace-normal text-base-content">
- Latest included signal: {signal().attribution}, reported {signal().relative}.
+ {formatMonitoredSystemLatestIncludedSignalSentence(
+ signal(),
+ )}
</p>
)}
</Show>
@@ -222,7 +230,9 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
</Show>
<Show when={explanation.surfaces.length > 0}>
<div class="space-y-1">
- <p class="font-medium text-base-content">Included collection paths</p>
+ <p class="font-medium text-base-content">
+ {presentation.includedCollectionPathsHeading}
+ </p>
<ul class="space-y-1 whitespace-normal">
<For each={explanation.surfaces}>
{(surface) => (
@@ -245,7 +255,11 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
<TableCell>
<Show
when={latestSignal}
- fallback={<span class="text-xs text-muted">—</span>}
+ fallback={
+ <span class="text-xs text-muted">
+ {presentation.noIncludedSignalLabel}
+ </span>
+ }
>
{(signal) => (
<div class="space-y-0.5">
@@ -274,7 +288,7 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
return (
<SettingsPanel
- title="Monitored System Ledger"
+ title={presentation.panelTitle}
description={SELF_HOSTED_MONITORED_SYSTEM_LEDGER_DESCRIPTION}
icon={<PulseLogoIcon class="w-5 h-5" />}
bodyClass="space-y-4"
diff --git a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
index f923fefc26..53684b31ea 100644
--- a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
@@ -324,4 +324,31 @@ describe('MonitoredSystemLedgerPanel', () => {
).toBeInTheDocument();
expect(screen.queryByText('Included collection paths')).not.toBeInTheDocument();
});
+
+ it('shows a customer-facing fallback when no included signal is available', async () => {
+ getLedgerMock.mockResolvedValue({
+ systems: [
+ {
+ name: 'server-c',
+ type: 'host',
+ status: 'unknown',
+ status_explanation: {
+ summary: 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
+ reasons: [],
+ },
+ source: 'agent',
+ },
+ ],
+ total: 1,
+ limit: 10,
+ } as MonitoredSystemLedgerResponse);
+
+ render(() => <MonitoredSystemLedgerPanel />);
+
+ await waitFor(() => {
+ expect(screen.getByText('server-c')).toBeInTheDocument();
+ });
+
+ expect(screen.getByText('No included signal yet.')).toBeInTheDocument();
+ });
});
diff --git a/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts b/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
new file mode 100644
index 0000000000..5b26492fa7
--- /dev/null
+++ b/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
@@ -0,0 +1,75 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ formatMonitoredSystemLatestIncludedSignalSentence,
+ formatMonitoredSystemSurfaceAttribution,
+ getMonitoredSystemCountingDetailsToggleLabel,
+ getMonitoredSystemExplanationFallbackSummary,
+ getMonitoredSystemLedgerPresentation,
+ getMonitoredSystemSourceLabel,
+ getMonitoredSystemStatusFallbackSummary,
+ getMonitoredSystemSurfaceTypeLabel,
+} from '@/utils/monitoredSystemPresentation';
+
+describe('monitoredSystemPresentation', () => {
+ it('returns canonical ledger labels and fallback copy', () => {
+ expect(getMonitoredSystemLedgerPresentation()).toEqual({
+ sectionTitle: 'Monitored Systems',
+ panelTitle: 'Monitored System Ledger',
+ tableNameLabel: 'Name',
+ tableStatusLabel: 'Status',
+ tableLatestIncludedSignalLabel: 'Latest Included Signal',
+ countingDetailsCollapsedLabel: 'View counting details',
+ countingDetailsExpandedLabel: 'Hide counting details',
+ currentStatusHeading: 'Current status',
+ latestIncludedSignalSummaryLabel: 'Latest included signal',
+ includedCollectionPathsHeading: 'Included collection paths',
+ emptyState: 'No monitored systems counted.',
+ noIncludedSignalLabel: 'No included signal yet.',
+ fallbackExplanationSummary: 'Pulse counts this top-level collection path as one monitored system.',
+ fallbackStatusSummary:
+ 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
+ });
+ expect(getMonitoredSystemCountingDetailsToggleLabel(false)).toBe('View counting details');
+ expect(getMonitoredSystemCountingDetailsToggleLabel(true)).toBe('Hide counting details');
+ expect(getMonitoredSystemExplanationFallbackSummary()).toBe(
+ 'Pulse counts this top-level collection path as one monitored system.',
+ );
+ expect(getMonitoredSystemStatusFallbackSummary()).toBe(
+ 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
+ );
+ });
+
+ it('returns customer-facing source and type labels', () => {
+ expect(getMonitoredSystemSourceLabel('agent')).toBe('Agent');
+ expect(getMonitoredSystemSourceLabel('pbs')).toBe('PBS');
+ expect(getMonitoredSystemSourceLabel('')).toBe('');
+ expect(getMonitoredSystemSurfaceTypeLabel('docker-host')).toBe('Docker Host');
+ expect(getMonitoredSystemSurfaceTypeLabel('proxmox-node')).toBe('Proxmox Node');
+ expect(getMonitoredSystemSurfaceTypeLabel(undefined)).toBe('System');
+ expect(getMonitoredSystemSurfaceTypeLabel('custom_cluster')).toBe('Custom Cluster');
+ });
+
+ it('formats included signal attribution and summary sentences', () => {
+ expect(
+ formatMonitoredSystemSurfaceAttribution({
+ name: 'tower',
+ type: 'pbs-server',
+ source: 'pbs',
+ }),
+ ).toBe('tower (PBS Server via PBS)');
+ expect(
+ formatMonitoredSystemSurfaceAttribution({
+ name: 'tower',
+ type: 'host',
+ source: 'host',
+ }),
+ ).toBe('tower (Host)');
+ expect(
+ formatMonitoredSystemLatestIncludedSignalSentence({
+ attribution: 'tower (PBS Server via PBS)',
+ relative: '2m ago',
+ }),
+ ).toBe('Latest included signal: tower (PBS Server via PBS), reported 2m ago.');
+ });
+});
diff --git a/frontend-modern/src/utils/monitoredSystemPresentation.ts b/frontend-modern/src/utils/monitoredSystemPresentation.ts
index 6ad940849e..72e5583024 100644
--- a/frontend-modern/src/utils/monitoredSystemPresentation.ts
+++ b/frontend-modern/src/utils/monitoredSystemPresentation.ts
@@ -8,6 +8,49 @@ const titleCaseWords = (value: string): string =>
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
.join(' ');
+const MONITORED_SYSTEM_LEDGER_PRESENTATION = {
+ sectionTitle: 'Monitored Systems',
+ panelTitle: 'Monitored System Ledger',
+ tableNameLabel: 'Name',
+ tableStatusLabel: 'Status',
+ tableLatestIncludedSignalLabel: 'Latest Included Signal',
+ countingDetailsCollapsedLabel: 'View counting details',
+ countingDetailsExpandedLabel: 'Hide counting details',
+ currentStatusHeading: 'Current status',
+ latestIncludedSignalSummaryLabel: 'Latest included signal',
+ includedCollectionPathsHeading: 'Included collection paths',
+ emptyState: 'No monitored systems counted.',
+ noIncludedSignalLabel: 'No included signal yet.',
+ fallbackExplanationSummary: 'Pulse counts this top-level collection path as one monitored system.',
+ fallbackStatusSummary:
+ 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
+} as const;
+
+export function getMonitoredSystemLedgerPresentation() {
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION;
+}
+
+export function getMonitoredSystemCountingDetailsToggleLabel(expanded: boolean): string {
+ return expanded
+ ? MONITORED_SYSTEM_LEDGER_PRESENTATION.countingDetailsExpandedLabel
+ : MONITORED_SYSTEM_LEDGER_PRESENTATION.countingDetailsCollapsedLabel;
+}
+
+export function getMonitoredSystemExplanationFallbackSummary(): string {
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION.fallbackExplanationSummary;
+}
+
+export function getMonitoredSystemStatusFallbackSummary(): string {
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION.fallbackStatusSummary;
+}
+
+export function formatMonitoredSystemLatestIncludedSignalSentence(signal: {
+ attribution: string;
+ relative: string;
+}): string {
+ return `${MONITORED_SYSTEM_LEDGER_PRESENTATION.latestIncludedSignalSummaryLabel}: ${signal.attribution}, reported ${signal.relative}.`;
+}
+
export function getMonitoredSystemSourceLabel(source: string | undefined): string {
switch (normalizeMonitoredSystemValue(source)) {
case 'agent':