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.

Harden settings state copy

rcourtman814fd12ea345
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 22de868910..d90bb0d09d 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -335,6 +335,10 @@ customer terms: monitored systems, plan limits, subscription status, and
license status. They must not revive legacy `installed-agent` wording or vague
internal nouns like `allocation` once the monitored-system billing model is the
canonical product truth.
+Loading, empty, and temporary-unavailable states on monitored-system usage
+surfaces follow that same rule: they should use calm customer-facing status
+language such as usage loading or usage unavailable with a clear retry action,
+not raw transport phrasing like `failed to load`.
The self-hosted pricing page should therefore stay focused on plan cards,
upgrade paths, and the comparison table rather than rendering a separate
counted-unit explainer card beneath the tier grid.
diff --git a/docs/release-control/v6/internal/subsystems/organization-settings.md b/docs/release-control/v6/internal/subsystems/organization-settings.md
index 04d6f81bbc..b1680c1ec3 100644
--- a/docs/release-control/v6/internal/subsystems/organization-settings.md
+++ b/docs/release-control/v6/internal/subsystems/organization-settings.md
@@ -124,6 +124,11 @@ sharing views stay aligned with the shared multi-tenant org context contract.
The organization sharing surface now also sources resource quick-pick labels
from the shared preferred resource display helper, so governed resources do
not fall back to raw names inside share creation.
+Organization settings empty, unavailable, and load-error states are part of
+that same presentation boundary: the shared organization presentation helpers
+must describe server capability and settings availability directly, rather than
+falling back to generic `feature not available` or transport-style `failed to
+load` copy.
The organization access surface now follows that extracted-owner pattern too:
the panel is the shell, `useOrganizationAccessPanelState.ts` owns the
membership runtime, and the loading, management, and members views each live
diff --git a/frontend-modern/src/components/AI/__tests__/AICostDashboard.test.tsx b/frontend-modern/src/components/AI/__tests__/AICostDashboard.test.tsx
index 8b0f212399..3439bdbaef 100644
--- a/frontend-modern/src/components/AI/__tests__/AICostDashboard.test.tsx
+++ b/frontend-modern/src/components/AI/__tests__/AICostDashboard.test.tsx
@@ -487,10 +487,12 @@ describe('AICostDashboard', () => {
);
renderDashboard();
- // While loading, we see "Loading usage…"
- expect(screen.getByText('Loading usage…')).toBeInTheDocument();
- // The "No usage data yet" message should NOT appear while loading
- expect(screen.queryByText('No usage data yet.')).not.toBeInTheDocument();
+ // While loading, we see the shared usage-loading copy.
+ expect(screen.getByText('Loading usage data…')).toBeInTheDocument();
+ // The empty state should not appear while loading.
+ expect(
+ screen.queryByText('Usage data will appear here once activity is recorded.'),
+ ).not.toBeInTheDocument();
// Now resolve — data appears
resolvePromise!(baseSummary());
@@ -711,11 +713,13 @@ describe('AICostDashboard', () => {
expect(svgs.length).toBeGreaterThanOrEqual(2);
});
- it('shows "No daily token trend yet" when less than 2 daily totals', async () => {
+ it('shows the shared daily token empty state when less than 2 daily totals', async () => {
getCostSummaryMock.mockResolvedValue(baseSummary({ daily_totals: [] }));
renderDashboard();
await waitFor(() => {
- expect(screen.getByText('No daily token trend yet.')).toBeInTheDocument();
+ expect(
+ screen.getByText('Daily token trend will appear here once activity is recorded.'),
+ ).toBeInTheDocument();
});
});
diff --git a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
index 86e7bfdb29..24aec51691 100644
--- a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
@@ -53,10 +53,10 @@ describe('MonitoredSystemLedgerPanel', () => {
render(() => <MonitoredSystemLedgerPanel />);
await waitFor(() => {
- expect(screen.getByText('Failed to load monitored system ledger.')).toBeInTheDocument();
+ expect(screen.getByText('Monitored system usage is temporarily unavailable.')).toBeInTheDocument();
});
- expect(screen.getByRole('button', { name: 'Retry' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Try again' })).toBeInTheDocument();
});
it('recovers from error when Retry is clicked and API succeeds', async () => {
@@ -65,7 +65,7 @@ describe('MonitoredSystemLedgerPanel', () => {
render(() => <MonitoredSystemLedgerPanel />);
await waitFor(() => {
- expect(screen.getByText('Failed to load monitored system ledger.')).toBeInTheDocument();
+ expect(screen.getByText('Monitored system usage is temporarily unavailable.')).toBeInTheDocument();
});
// Now make API succeed on retry
@@ -95,13 +95,15 @@ describe('MonitoredSystemLedgerPanel', () => {
limit: 5,
});
- fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Try again' }));
await waitFor(() => {
expect(screen.getByText('host-1')).toBeInTheDocument();
});
- expect(screen.queryByText('Failed to load monitored system ledger.')).not.toBeInTheDocument();
+ expect(
+ screen.queryByText('Monitored system usage is temporarily unavailable.'),
+ ).not.toBeInTheDocument();
});
it('keeps Retry button visible on repeated failures', async () => {
@@ -110,19 +112,19 @@ describe('MonitoredSystemLedgerPanel', () => {
render(() => <MonitoredSystemLedgerPanel />);
await waitFor(() => {
- expect(screen.getByText('Failed to load monitored system ledger.')).toBeInTheDocument();
+ expect(screen.getByText('Monitored system usage is temporarily unavailable.')).toBeInTheDocument();
});
const callsBefore = getLedgerMock.mock.calls.length;
- fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Try again' }));
await waitFor(() => {
- expect(screen.getByText('Failed to load monitored system ledger.')).toBeInTheDocument();
+ expect(screen.getByText('Monitored system usage is temporarily unavailable.')).toBeInTheDocument();
});
expect(getLedgerMock.mock.calls.length).toBeGreaterThan(callsBefore);
- expect(screen.getByRole('button', { name: 'Retry' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Try again' })).toBeInTheDocument();
});
it('renders ledger data on successful load', async () => {
@@ -207,7 +209,9 @@ describe('MonitoredSystemLedgerPanel', () => {
).toBeInTheDocument();
expect(screen.getByText('Included collection paths')).toBeInTheDocument();
expect(screen.getByText('server-b host (host, agent)')).toBeInTheDocument();
- expect(screen.queryByText('Failed to load monitored system ledger.')).not.toBeInTheDocument();
+ expect(
+ screen.queryByText('Monitored system usage is temporarily unavailable.'),
+ ).not.toBeInTheDocument();
});
it('does not crash when explanation payload is missing', async () => {
diff --git a/frontend-modern/src/utils/__tests__/aiCostPresentation.test.ts b/frontend-modern/src/utils/__tests__/aiCostPresentation.test.ts
index bacf1c7633..fc647b8a43 100644
--- a/frontend-modern/src/utils/__tests__/aiCostPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/aiCostPresentation.test.ts
@@ -15,11 +15,15 @@ describe('aiCostPresentation', () => {
});
it('exports canonical AI cost empty-state copy', () => {
- expect(AI_COST_EMPTY_STATE).toBe('No usage data yet.');
- expect(AI_COST_DAILY_USD_EMPTY_STATE).toBe('No daily USD trend yet.');
- expect(AI_COST_DAILY_TOKEN_EMPTY_STATE).toBe('No daily token trend yet.');
+ expect(AI_COST_EMPTY_STATE).toBe('Usage data will appear here once activity is recorded.');
+ expect(AI_COST_DAILY_USD_EMPTY_STATE).toBe(
+ 'Daily cost trend will appear here once activity is recorded.',
+ );
+ expect(AI_COST_DAILY_TOKEN_EMPTY_STATE).toBe(
+ 'Daily token trend will appear here once activity is recorded.',
+ );
expect(getAICostLoadingState()).toEqual({
- text: 'Loading usage…',
+ text: 'Loading usage data…',
});
});
});
diff --git a/frontend-modern/src/utils/__tests__/organizationSettingsPresentation.test.ts b/frontend-modern/src/utils/__tests__/organizationSettingsPresentation.test.ts
index ff7c830233..086f18c008 100644
--- a/frontend-modern/src/utils/__tests__/organizationSettingsPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/organizationSettingsPresentation.test.ts
@@ -34,23 +34,25 @@ import {
describe('organizationSettingsPresentation', () => {
it('returns canonical multi-tenant fallback presentation', () => {
- expect(ORGANIZATION_SETTINGS_UNAVAILABLE_MESSAGE).toBe('This feature is not available.');
+ expect(ORGANIZATION_SETTINGS_UNAVAILABLE_MESSAGE).toBe(
+ 'Organization settings are not available on this server.',
+ );
expect(ORGANIZATION_SETTINGS_UNAVAILABLE_CLASS).toContain('text-slate-500');
});
it('normalizes organization settings load errors', () => {
expect(getOrganizationSettingsLoadErrorMessage('request failed 402', 'access')).toBe(
- 'Multi-tenant requires an Enterprise license',
+ 'Organization settings require an Enterprise license.',
);
expect(getOrganizationSettingsLoadErrorMessage('request failed 501', 'access')).toBe(
- 'Multi-tenant is not enabled on this server',
+ 'Organization settings are not enabled on this server.',
);
const expectedFallbacks: Record<OrganizationSettingsLoadContext, string> = {
- access: 'Failed to load organization access settings',
- overview: 'Failed to load organization details',
- sharing: 'Failed to load organization sharing details',
- billing: 'Failed to load billing and plan details',
- 'billing-admin': 'Failed to list organizations',
+ access: 'Unable to load organization access settings.',
+ overview: 'Unable to load organization details.',
+ sharing: 'Unable to load organization sharing details.',
+ billing: 'Unable to load billing and plan details.',
+ 'billing-admin': 'Unable to load the organization list.',
};
for (const [context, fallback] of Object.entries(expectedFallbacks)) {
diff --git a/frontend-modern/src/utils/__tests__/unifiedAgentInventoryPresentation.test.ts b/frontend-modern/src/utils/__tests__/unifiedAgentInventoryPresentation.test.ts
index bcf49c2842..318f7c9697 100644
--- a/frontend-modern/src/utils/__tests__/unifiedAgentInventoryPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/unifiedAgentInventoryPresentation.test.ts
@@ -44,12 +44,12 @@ describe('unifiedAgentInventoryPresentation', () => {
it('returns canonical monitored-system ledger loading and error copy', () => {
expect(getMonitoredSystemLedgerLoadingState()).toEqual({
- text: 'Loading monitored system ledger...',
+ text: 'Loading monitored system usage…',
});
expect(getMonitoredSystemLedgerErrorState()).toEqual({
- title: 'Failed to load monitored system ledger.',
- retryingLabel: 'Retrying…',
- retryLabel: 'Retry',
+ title: 'Monitored system usage is temporarily unavailable.',
+ retryingLabel: 'Trying again…',
+ retryLabel: 'Try again',
});
});
diff --git a/frontend-modern/src/utils/aiCostPresentation.ts b/frontend-modern/src/utils/aiCostPresentation.ts
index 1d569805ff..444f871d0e 100644
--- a/frontend-modern/src/utils/aiCostPresentation.ts
+++ b/frontend-modern/src/utils/aiCostPresentation.ts
@@ -1,12 +1,14 @@
import { segmentedButtonClass } from '@/utils/segmentedButton';
-export const AI_COST_EMPTY_STATE = 'No usage data yet.';
-export const AI_COST_DAILY_USD_EMPTY_STATE = 'No daily USD trend yet.';
-export const AI_COST_DAILY_TOKEN_EMPTY_STATE = 'No daily token trend yet.';
+export const AI_COST_EMPTY_STATE = 'Usage data will appear here once activity is recorded.';
+export const AI_COST_DAILY_USD_EMPTY_STATE =
+ 'Daily cost trend will appear here once activity is recorded.';
+export const AI_COST_DAILY_TOKEN_EMPTY_STATE =
+ 'Daily token trend will appear here once activity is recorded.';
export function getAICostLoadingState() {
return {
- text: 'Loading usage…',
+ text: 'Loading usage data…',
} as const;
}
diff --git a/frontend-modern/src/utils/organizationSettingsPresentation.ts b/frontend-modern/src/utils/organizationSettingsPresentation.ts
index a850b5b391..87aa9b4003 100644
--- a/frontend-modern/src/utils/organizationSettingsPresentation.ts
+++ b/frontend-modern/src/utils/organizationSettingsPresentation.ts
@@ -1,6 +1,7 @@
import type { OrganizationRole } from '@/api/orgs';
-export const ORGANIZATION_SETTINGS_UNAVAILABLE_MESSAGE = 'This feature is not available.';
+export const ORGANIZATION_SETTINGS_UNAVAILABLE_MESSAGE =
+ 'Organization settings are not available on this server.';
export const ORGANIZATION_SETTINGS_UNAVAILABLE_CLASS = 'p-4 text-sm text-slate-500';
export type OrganizationSettingsLoadContext =
@@ -11,11 +12,11 @@ export type OrganizationSettingsLoadContext =
| 'billing-admin';
const ORGANIZATION_SETTINGS_LOAD_FALLBACKS: Record<OrganizationSettingsLoadContext, string> = {
- access: 'Failed to load organization access settings',
- overview: 'Failed to load organization details',
- sharing: 'Failed to load organization sharing details',
- billing: 'Failed to load billing and plan details',
- 'billing-admin': 'Failed to list organizations',
+ access: 'Unable to load organization access settings.',
+ overview: 'Unable to load organization details.',
+ sharing: 'Unable to load organization sharing details.',
+ billing: 'Unable to load billing and plan details.',
+ 'billing-admin': 'Unable to load the organization list.',
};
export function getOrganizationSettingsLoadErrorMessage(
@@ -23,10 +24,10 @@ export function getOrganizationSettingsLoadErrorMessage(
context: OrganizationSettingsLoadContext,
): string {
if (message.includes('402')) {
- return 'Multi-tenant requires an Enterprise license';
+ return 'Organization settings require an Enterprise license.';
}
if (message.includes('501')) {
- return 'Multi-tenant is not enabled on this server';
+ return 'Organization settings are not enabled on this server.';
}
return ORGANIZATION_SETTINGS_LOAD_FALLBACKS[context];
}
diff --git a/frontend-modern/src/utils/unifiedAgentInventoryPresentation.ts b/frontend-modern/src/utils/unifiedAgentInventoryPresentation.ts
index 0891cb31bb..266bb9cae2 100644
--- a/frontend-modern/src/utils/unifiedAgentInventoryPresentation.ts
+++ b/frontend-modern/src/utils/unifiedAgentInventoryPresentation.ts
@@ -47,15 +47,15 @@ export function getMonitoringStoppedEmptyState(hasFilters: boolean): string {
export function getMonitoredSystemLedgerLoadingState() {
return {
- text: 'Loading monitored system ledger...',
+ text: 'Loading monitored system usage…',
} as const;
}
export function getMonitoredSystemLedgerErrorState() {
return {
- title: 'Failed to load monitored system ledger.',
- retryingLabel: 'Retrying…',
- retryLabel: 'Retry',
+ title: 'Monitored system usage is temporarily unavailable.',
+ retryingLabel: 'Trying again…',
+ retryLabel: 'Try again',
} as const;
}