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.

Canonicalize monitored system banner copy

rcourtman15006ce73738
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 2d190cdf4b..6130e3e6bb 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -240,10 +240,12 @@ fallback instead of an unexplained placeholder glyph.
That same billing support boundary now also owns the shared monitored-system
presentation helper. `frontend-modern/src/utils/monitoredSystemPresentation.ts`
is the canonical owner for monitored-system brief/disclosure copy, ledger
-labels, safe fallback summaries, and source/type attribution wording, so the
-settings panel, Pro usage section, and counting-rules disclosure must consume
-that helper instead of redefining customer-facing monitored-system copy inline
-or keeping a parallel copy in generic self-hosted plan utilities.
+labels, safe fallback summaries, source/type attribution wording, and the
+customer-facing monitored-system usage/migration strings reused by the shared
+limit-warning banner, so the settings panel, Pro usage section, counting-rules
+disclosure, and shared warning-banner model must consume that helper instead
+of redefining customer-facing monitored-system copy inline or keeping a
+parallel copy in generic self-hosted plan utilities.
That same helper now also owns the row-status fallback summaries used when
mixed-version payloads omit `status_explanation.summary`. The API client and
settings panel must derive online/warning/offline/unknown fallback text from
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 2902dfac44..c3f3bf6dd8 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -697,9 +697,12 @@ stays the render shell, `frontend-modern/src/components/shared/useMonitoredSyste
owns entitlement load, warning metric emission, migration/upgrade click tracking,
and upgrade-link runtime, and
`frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts`
-owns monitored-system summary, migration copy, overflow summary, and tone/text-class
-policy. Future warning-banner work should extend those owners instead of pushing
-entitlement orchestration, tracking, or naming math back into the shared shell.
+owns monitored-system warning policy, count aggregation, and tone/text-class
+policy while sourcing customer-facing monitored-system copy from the canonical
+`frontend-modern/src/utils/monitoredSystemPresentation.ts` helper. Future
+warning-banner work should extend those owners instead of pushing entitlement
+orchestration, tracking, or naming math back into the shared shell or
+reintroducing banner-local monitored-system copy strings.
Shared frontend label-formatting helpers now also have an explicit owner here.
`frontend-modern/src/utils/textPresentation.ts` is the canonical shared owner
for token humanization, identifier label formatting, title-casing, and
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 786997143e..383e363cf5 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -373,9 +373,21 @@ describe('shared primitive guardrails', () => {
});
it('keeps shared fleet limit banner copy on the monitored-system commercial term', () => {
- expect(monitoredSystemLimitWarningBannerModelSource).toContain('Monitored systems:');
- expect(monitoredSystemLimitWarningBannerModelSource).toContain('monitored-system cap');
- expect(monitoredSystemLimitWarningBannerModelSource).toContain('Install v6 collectors');
+ expect(monitoredSystemLimitWarningBannerModelSource).toContain(
+ "@/utils/monitoredSystemPresentation",
+ );
+ expect(monitoredSystemLimitWarningBannerModelSource).toContain(
+ 'formatMonitoredSystemLimitSummary',
+ );
+ expect(monitoredSystemLimitWarningBannerModelSource).toContain(
+ 'formatMonitoredSystemMigrationMessage',
+ );
+ expect(monitoredSystemLimitWarningBannerModelSource).toContain(
+ 'getMonitoredSystemLimitInstallCollectorsLabel',
+ );
+ expect(monitoredSystemLimitWarningBannerModelSource).not.toContain('Monitored systems:');
+ expect(monitoredSystemLimitWarningBannerModelSource).not.toContain('monitored-system cap');
+ expect(monitoredSystemLimitWarningBannerModelSource).not.toContain('Install v6 collectors');
expect(monitoredSystemLimitWarningBannerModelSource).not.toContain('v6 Unified Agents:');
expect(monitoredSystemLimitWarningBannerModelSource).not.toContain(
'do not count toward Unified Agents.',
@@ -415,10 +427,10 @@ describe('shared primitive guardrails', () => {
'getMonitoredSystemBannerToneClass',
);
expect(monitoredSystemLimitWarningBannerModelSource).toContain(
- 'MONITORED_SYSTEM_LIMIT_UPGRADE_LABEL',
+ 'getMonitoredSystemLimitUpgradeLabel',
);
expect(monitoredSystemLimitWarningBannerModelSource).toContain(
- 'MONITORED_SYSTEM_LIMIT_INSTALL_COLLECTORS_LABEL',
+ 'getMonitoredSystemLimitInstallCollectorsLabel',
);
});
diff --git a/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx b/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
index 34bf157346..4e8dd8201f 100644
--- a/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
@@ -91,6 +91,9 @@ describe('MonitoredSystemLimitWarningBanner', () => {
expect(monitoredSystemLimitWarningBannerStateSource).toContain('legacyConnections');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('handleUpgradeClick');
+ expect(monitoredSystemLimitWarningBannerModelSource).toContain(
+ "@/utils/monitoredSystemPresentation",
+ );
expect(monitoredSystemLimitWarningBannerModelSource).toContain(
'getMonitoredSystemMigrationMessage',
);
@@ -98,11 +101,13 @@ describe('MonitoredSystemLimitWarningBanner', () => {
'getMonitoredSystemBannerToneClass',
);
expect(monitoredSystemLimitWarningBannerModelSource).toContain(
- 'MONITORED_SYSTEM_LIMIT_UPGRADE_LABEL',
+ 'getMonitoredSystemLimitUpgradeLabel',
);
expect(monitoredSystemLimitWarningBannerModelSource).toContain(
- 'MONITORED_SYSTEM_LIMIT_INSTALL_COLLECTORS_LABEL',
+ 'getMonitoredSystemLimitInstallCollectorsLabel',
);
+ expect(monitoredSystemLimitWarningBannerModelSource).not.toContain('Upgrade to add more');
+ expect(monitoredSystemLimitWarningBannerModelSource).not.toContain('Install v6 collectors');
});
it('stays hidden for non-urgent pure v6 installs', async () => {
diff --git a/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts b/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts
index 7feaa09bc7..60e8e2303c 100644
--- a/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts
+++ b/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts
@@ -1,21 +1,27 @@
+import {
+ formatMonitoredSystemLegacyConnectionBreakdown,
+ formatMonitoredSystemLimitSummary,
+ formatMonitoredSystemMigrationMessage,
+ formatMonitoredSystemOverflowSummary,
+ getMonitoredSystemLimitInstallCollectorsLabel,
+ getMonitoredSystemLimitLearnMoreLabel,
+ getMonitoredSystemLimitUpgradeLabel,
+ type MonitoredSystemLegacyConnectionCounts,
+} from '@/utils/monitoredSystemPresentation';
+
type LimitState = {
current: number;
limit: number;
state?: string;
};
-type LegacyConnectionCounts = {
- proxmox_nodes: number;
- docker_hosts: number;
- kubernetes_clusters: number;
-};
-
export const MONITORED_SYSTEM_LIMIT_KEY = 'max_monitored_systems';
export const MONITORED_SYSTEM_LIMIT_BILLING_HREF = '/settings/system/billing';
export const MONITORED_SYSTEM_LIMIT_INSTALL_COLLECTORS_HREF = '/settings';
-export const MONITORED_SYSTEM_LIMIT_LEARN_MORE_LABEL = 'Learn more';
-export const MONITORED_SYSTEM_LIMIT_INSTALL_COLLECTORS_LABEL = 'Install v6 collectors';
-export const MONITORED_SYSTEM_LIMIT_UPGRADE_LABEL = 'Upgrade to add more';
+export const MONITORED_SYSTEM_LIMIT_LEARN_MORE_LABEL = getMonitoredSystemLimitLearnMoreLabel();
+export const MONITORED_SYSTEM_LIMIT_INSTALL_COLLECTORS_LABEL =
+ getMonitoredSystemLimitInstallCollectorsLabel();
+export const MONITORED_SYSTEM_LIMIT_UPGRADE_LABEL = getMonitoredSystemLimitUpgradeLabel();
export function isMonitoredSystemLimitUrgent(limit: LimitState | undefined): boolean {
const state = limit?.state;
@@ -28,49 +34,29 @@ export function shouldShowMonitoredSystemLimitBanner(limit: LimitState | undefin
export function getMonitoredSystemSummary(limit: LimitState | undefined): string {
if (!limit) return '';
- return `Monitored systems: ${limit.current}/${limit.limit}`;
+ return formatMonitoredSystemLimitSummary(limit);
}
-export function getMonitoredSystemLegacyConnectionTotal(counts: LegacyConnectionCounts): number {
+export function getMonitoredSystemLegacyConnectionTotal(
+ counts: MonitoredSystemLegacyConnectionCounts,
+): number {
return counts.proxmox_nodes + counts.docker_hosts + counts.kubernetes_clusters;
}
-export function getMonitoredSystemLegacyBreakdown(counts: LegacyConnectionCounts): string {
- const parts: string[] = [];
-
- if (counts.proxmox_nodes > 0) {
- parts.push(
- `${counts.proxmox_nodes} Proxmox ${counts.proxmox_nodes === 1 ? 'node' : 'nodes'}`,
- );
- }
- if (counts.docker_hosts > 0) {
- parts.push(`${counts.docker_hosts} Docker ${counts.docker_hosts === 1 ? 'host' : 'hosts'}`);
- }
- if (counts.kubernetes_clusters > 0) {
- parts.push(
- `${counts.kubernetes_clusters} Kubernetes ${
- counts.kubernetes_clusters === 1 ? 'cluster' : 'clusters'
- }`,
- );
- }
-
- return parts.join(', ');
+export function getMonitoredSystemLegacyBreakdown(
+ counts: MonitoredSystemLegacyConnectionCounts,
+): string {
+ return formatMonitoredSystemLegacyConnectionBreakdown(counts);
}
-export function getMonitoredSystemMigrationMessage(counts: LegacyConnectionCounts): string {
- const total = getMonitoredSystemLegacyConnectionTotal(counts);
- if (total <= 0) return '';
-
- const noun = total === 1 ? 'resource' : 'resources';
- const breakdown = getMonitoredSystemLegacyBreakdown(counts);
- return `You also have ${total} ${noun} connected via API or legacy collectors${
- breakdown ? ` (${breakdown})` : ''
- } that count once toward your monitored-system cap when the same top-level system is discovered canonically.`;
+export function getMonitoredSystemMigrationMessage(
+ counts: MonitoredSystemLegacyConnectionCounts,
+): string {
+ return formatMonitoredSystemMigrationMessage(counts);
}
export function getMonitoredSystemOverflowSummary(daysRemaining: number | undefined): string {
- if (!daysRemaining) return '';
- return `Includes 1 temporary onboarding slot (${daysRemaining}d remaining)`;
+ return formatMonitoredSystemOverflowSummary(daysRemaining);
}
export function getMonitoredSystemBannerToneClass(isUrgent: boolean): string {
diff --git a/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts b/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
index be597f929a..31a58902d0 100644
--- a/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
@@ -1,8 +1,12 @@
import { describe, expect, it } from 'vitest';
import {
+ formatMonitoredSystemLegacyConnectionBreakdown,
getMonitoredSystemBriefSummary,
+ formatMonitoredSystemLimitSummary,
formatMonitoredSystemLatestIncludedSignalSentence,
+ formatMonitoredSystemMigrationMessage,
+ formatMonitoredSystemOverflowSummary,
formatMonitoredSystemSurfaceAttribution,
getMonitoredSystemCountingDetailsToggleLabel,
getMonitoredSystemDisclosureDefinition,
@@ -10,6 +14,9 @@ import {
getMonitoredSystemExplanationFallbackSummary,
getMonitoredSystemLedgerDescription,
getMonitoredSystemLedgerPresentation,
+ getMonitoredSystemLimitInstallCollectorsLabel,
+ getMonitoredSystemLimitLearnMoreLabel,
+ getMonitoredSystemLimitUpgradeLabel,
getMonitoredSystemSourceLabel,
getMonitoredSystemStatusFallbackSummary,
getMonitoredSystemSurfaceTypeLabel,
@@ -46,6 +53,14 @@ describe('monitoredSystemPresentation', () => {
'At least one included source is offline or disconnected, so Pulse marks this monitored system as offline.',
unknown: 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
},
+ limitBanner: {
+ learnMoreLabel: 'Learn more',
+ installCollectorsLabel: 'Install v6 collectors',
+ upgradeLabel: 'Upgrade to add more',
+ overflowSummaryPrefix: 'Includes 1 temporary onboarding slot',
+ legacyConnectionSuffix:
+ 'that count once toward your monitored-system cap when the same top-level system is discovered canonically.',
+ },
});
expect(getMonitoredSystemBriefSummary()).toBe(
'Billing is based on monitored systems. Child resources are included.',
@@ -75,6 +90,35 @@ describe('monitoredSystemPresentation', () => {
);
});
+ it('returns canonical monitored-system limit warning copy', () => {
+ expect(getMonitoredSystemLimitLearnMoreLabel()).toBe('Learn more');
+ expect(getMonitoredSystemLimitInstallCollectorsLabel()).toBe('Install v6 collectors');
+ expect(getMonitoredSystemLimitUpgradeLabel()).toBe('Upgrade to add more');
+ expect(formatMonitoredSystemLimitSummary({ current: 5, limit: 6 })).toBe(
+ 'Monitored systems: 5/6',
+ );
+ expect(
+ formatMonitoredSystemLegacyConnectionBreakdown({
+ proxmox_nodes: 2,
+ docker_hosts: 1,
+ kubernetes_clusters: 0,
+ }),
+ ).toBe('2 Proxmox nodes, 1 Docker host');
+ expect(
+ formatMonitoredSystemMigrationMessage({
+ proxmox_nodes: 2,
+ docker_hosts: 1,
+ kubernetes_clusters: 0,
+ }),
+ ).toBe(
+ 'You also have 3 resources connected via API or legacy collectors (2 Proxmox nodes, 1 Docker host) that count once toward your monitored-system cap when the same top-level system is discovered canonically.',
+ );
+ expect(formatMonitoredSystemOverflowSummary(14)).toBe(
+ 'Includes 1 temporary onboarding slot (14d remaining)',
+ );
+ expect(formatMonitoredSystemOverflowSummary(undefined)).toBe('');
+ });
+
it('returns customer-facing source and type labels', () => {
expect(getMonitoredSystemSourceLabel('agent')).toBe('Agent');
expect(getMonitoredSystemSourceLabel('pbs')).toBe('PBS');
diff --git a/frontend-modern/src/utils/monitoredSystemPresentation.ts b/frontend-modern/src/utils/monitoredSystemPresentation.ts
index f912c93345..10881b7600 100644
--- a/frontend-modern/src/utils/monitoredSystemPresentation.ts
+++ b/frontend-modern/src/utils/monitoredSystemPresentation.ts
@@ -37,8 +37,22 @@ const MONITORED_SYSTEM_LEDGER_PRESENTATION = {
'At least one included source is offline or disconnected, so Pulse marks this monitored system as offline.',
unknown: 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
},
+ limitBanner: {
+ learnMoreLabel: 'Learn more',
+ installCollectorsLabel: 'Install v6 collectors',
+ upgradeLabel: 'Upgrade to add more',
+ overflowSummaryPrefix: 'Includes 1 temporary onboarding slot',
+ legacyConnectionSuffix:
+ 'that count once toward your monitored-system cap when the same top-level system is discovered canonically.',
+ },
} as const;
+export type MonitoredSystemLegacyConnectionCounts = {
+ proxmox_nodes: number;
+ docker_hosts: number;
+ kubernetes_clusters: number;
+};
+
export function getMonitoredSystemLedgerPresentation() {
return MONITORED_SYSTEM_LEDGER_PRESENTATION;
}
@@ -77,6 +91,69 @@ export function getMonitoredSystemStatusFallbackSummary(
return MONITORED_SYSTEM_LEDGER_PRESENTATION.statusSummaryByStatus[status];
}
+export function getMonitoredSystemLimitLearnMoreLabel(): string {
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION.limitBanner.learnMoreLabel;
+}
+
+export function getMonitoredSystemLimitInstallCollectorsLabel(): string {
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION.limitBanner.installCollectorsLabel;
+}
+
+export function getMonitoredSystemLimitUpgradeLabel(): string {
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION.limitBanner.upgradeLabel;
+}
+
+export function formatMonitoredSystemLimitSummary(limit: {
+ current: number;
+ limit: number;
+}): string {
+ return `Monitored systems: ${limit.current}/${limit.limit}`;
+}
+
+export function formatMonitoredSystemLegacyConnectionBreakdown(
+ counts: MonitoredSystemLegacyConnectionCounts,
+): string {
+ const parts: string[] = [];
+
+ if (counts.proxmox_nodes > 0) {
+ parts.push(
+ `${counts.proxmox_nodes} Proxmox ${counts.proxmox_nodes === 1 ? 'node' : 'nodes'}`,
+ );
+ }
+ if (counts.docker_hosts > 0) {
+ parts.push(`${counts.docker_hosts} Docker ${counts.docker_hosts === 1 ? 'host' : 'hosts'}`);
+ }
+ if (counts.kubernetes_clusters > 0) {
+ parts.push(
+ `${counts.kubernetes_clusters} Kubernetes ${
+ counts.kubernetes_clusters === 1 ? 'cluster' : 'clusters'
+ }`,
+ );
+ }
+
+ return parts.join(', ');
+}
+
+export function formatMonitoredSystemMigrationMessage(
+ counts: MonitoredSystemLegacyConnectionCounts,
+): string {
+ const total = counts.proxmox_nodes + counts.docker_hosts + counts.kubernetes_clusters;
+ if (total <= 0) return '';
+
+ const noun = total === 1 ? 'resource' : 'resources';
+ const breakdown = formatMonitoredSystemLegacyConnectionBreakdown(counts);
+ return `You also have ${total} ${noun} connected via API or legacy collectors${
+ breakdown ? ` (${breakdown})` : ''
+ } ${MONITORED_SYSTEM_LEDGER_PRESENTATION.limitBanner.legacyConnectionSuffix}`;
+}
+
+export function formatMonitoredSystemOverflowSummary(
+ daysRemaining: number | undefined,
+): string {
+ if (!daysRemaining) return '';
+ return `${MONITORED_SYSTEM_LEDGER_PRESENTATION.limitBanner.overflowSummaryPrefix} (${daysRemaining}d remaining)`;
+}
+
export function formatMonitoredSystemLatestIncludedSignalSentence(signal: {
attribution: string;
relative: string;