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.

Converge platform integer count values

rcourtman80a77fa85d86
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index aded9f8481..a6239e7a34 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -2636,6 +2636,14 @@ primitive instead of declaring local `numberValue`, `numericValue`,
variants. If a scheduler, service-domain, or inventory count is intentionally
zero-defaulted, the consuming table owns that field/default choice and still
renders through `PlatformTableNumberValue`.
+Locale-formatted integer count labels share the same primitive boundary.
+`formatPlatformTableIntegerValue` owns rounded integer formatting, locale
+grouping, and empty-marker behavior for dense platform table and drawer count
+cells. Kubernetes namespace drawers, Proxmox Backup Server backup counts,
+Ceph pool object counts, and Proxmox Mail Gateway table/drawer counts must
+compose that helper, usually through `PlatformTableNumberValue`, instead of
+declaring local `formatInteger`, `formatLocaleCount`, `formatNumber`, or direct
+`toLocaleString()` count formatting.
`PlatformTableCountRatioValue` owns the companion healthy/total or ready/total
count-ratio skeleton: numerator, slash, muted denominator, tabular styling, and
empty marker behavior. `formatPlatformTableCountRatioValue` owns the same
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index a73d80e21a..8219c61e10 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -136,7 +136,11 @@ derived from real recovery evidence and recent task outcomes, including
explicit uncovered and failed-latest-task states, rather than from source-detail
row counts alone. PBS server/datastore rows may display backup counts, but the
counts must come from the PBS backup API artifact identity, not from a
-datastore-capacity approximation.
+datastore-capacity approximation. The table owns which PBS artifact count is
+meaningful for the backup-health row, while dense integer count presentation
+belongs to `frontend-primitives`: backup count cells must compose
+`PlatformTableNumberValue` with `formatPlatformTableIntegerValue` instead of
+reintroducing local `toLocaleString()` formatting.
Those Proxmox backup workflows own recovery semantics, source-specific
empty-state copy, and retry/filter actions, but their table empty-state frame
must compose the frontend-primitives-owned `PlatformTableEmptyState` shell
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 6b4424b38f..82e019f171 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -271,6 +271,13 @@ and suffix behavior. Tables must not carry local
`diskCountLabel`, or cell-level `tabular-nums` variants for grouped
child/share/service/storage counts, or local ready/total template strings for
endpoint summaries.
+Locale-formatted integer count labels keep that same split:
+unified-resource consumers own which domain count is meaningful and whether an
+absent count should read as zero, while dense platform table and drawer
+rendering must use `formatPlatformTableIntegerValue`, normally through
+`PlatformTableNumberValue`, for rounded integer formatting, locale grouping,
+and unknown empty-cell markers instead of local `formatInteger`,
+`formatLocaleCount`, `formatNumber`, or direct `toLocaleString()` helpers.
Percent and temperature table cells follow the same split: unified-resource
consumers own which usage percentage or temperature source is meaningful for
the row, while dense platform table rendering must use
diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.json
index 820ed3659d..089354e3a2 100644
--- a/frontend-modern/scripts/shared-template-registry.json
+++ b/frontend-modern/scripts/shared-template-registry.json
@@ -1419,6 +1419,49 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "platform-table-integer-value-format",
+ "category": "platform-table-text-value",
+ "summary": "Platform tables and drawers must use the shared integer formatter with PlatformTableNumberValue for locale-formatted count cells instead of recreating local toLocaleString or Math.round helpers.",
+ "canonical": {
+ "path": "src/features/platformPage/sharedPlatformPage.tsx",
+ "export": "formatPlatformTableIntegerValue"
+ },
+ "requiredConsumers": [
+ { "path": "src/components/Kubernetes/K8sNamespacesDrawer.tsx" },
+ { "path": "src/features/proxmox/ProxmoxBackupServersTable.tsx" },
+ { "path": "src/features/proxmox/ProxmoxCephClusterDrawer.tsx" },
+ { "path": "src/features/proxmox/ProxmoxMailGatewayDrawer.tsx" },
+ { "path": "src/features/proxmox/ProxmoxMailGatewayTable.tsx" }
+ ],
+ "forbiddenPatterns": [
+ {
+ "path": "src/components/Kubernetes/K8sNamespacesDrawer.tsx",
+ "patterns": ["const formatInteger", "Math.round(n).toLocaleString()"]
+ },
+ {
+ "path": "src/features/proxmox/ProxmoxBackupServersTable.tsx",
+ "patterns": ["row.backupCount.toLocaleString()"]
+ },
+ {
+ "path": "src/features/proxmox/ProxmoxCephClusterDrawer.tsx",
+ "patterns": ["pool.objects.toLocaleString()"]
+ },
+ {
+ "path": "src/features/proxmox/ProxmoxMailGatewayDrawer.tsx",
+ "patterns": ["function formatNumber", "Math.round(value).toLocaleString()"]
+ },
+ {
+ "path": "src/features/proxmox/ProxmoxMailGatewayTable.tsx",
+ "patterns": ["const formatLocaleCount", "value.toLocaleString()"]
+ }
+ ],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/features/platformPage/__tests__/sharedPlatformPage.test.ts",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "platform-table-number-value-fallback",
"category": "platform-table-text-value",
@@ -2273,6 +2316,46 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "platform-table-local-integer-format-helper",
+ "category": "platform-table-text-value",
+ "summary": "Platform tables and drawers must not recreate local integer format helpers for count labels.",
+ "canonical": {
+ "path": "src/features/platformPage/sharedPlatformPage.tsx",
+ "export": "formatPlatformTableIntegerValue"
+ },
+ "scopes": ["src/components/Kubernetes", "src/features/proxmox"],
+ "extensions": [".tsx"],
+ "allPatterns": ["Math.round(", ".toLocaleString()"],
+ "legacyReason": "Retired migration debt. Dense platform integer count labels must use formatPlatformTableIntegerValue so rounding, locale formatting, and empty markers stay shared.",
+ "allowedPaths": [],
+ "ignoredPaths": [],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/features/platformPage/__tests__/sharedPlatformPage.test.ts",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
+ {
+ "id": "platform-table-local-integer-count-tolocalestring",
+ "category": "platform-table-text-value",
+ "summary": "Platform tables and drawers must not call toLocaleString directly for count cells.",
+ "canonical": {
+ "path": "src/features/platformPage/sharedPlatformPage.tsx",
+ "export": "formatPlatformTableIntegerValue"
+ },
+ "scopes": ["src/components/Kubernetes", "src/features/proxmox"],
+ "extensions": [".tsx"],
+ "allPatterns": ["toLocaleString()"],
+ "legacyReason": "Retired migration debt. Dense platform integer count cells must use formatPlatformTableIntegerValue and PlatformTableNumberValue instead of local count formatting.",
+ "allowedPaths": [],
+ "ignoredPaths": [],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/features/platformPage/__tests__/sharedPlatformPage.test.ts",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "platform-table-local-replica-count-helper",
"category": "platform-table-text-value",
diff --git a/frontend-modern/src/components/Kubernetes/K8sNamespacesDrawer.tsx b/frontend-modern/src/components/Kubernetes/K8sNamespacesDrawer.tsx
index c39e27930b..84a5043ed0 100644
--- a/frontend-modern/src/components/Kubernetes/K8sNamespacesDrawer.tsx
+++ b/frontend-modern/src/components/Kubernetes/K8sNamespacesDrawer.tsx
@@ -18,6 +18,7 @@ import { buildKubernetesPath } from '@/routing/resourceLinks';
import {
PLATFORM_TABLE_BODY_CLASS,
PLATFORM_TABLE_HEADER_ROW_CLASS,
+ formatPlatformTableIntegerValue,
getPlatformTableCellClassForKind,
getPlatformTableHeadClassForKind,
} from '@/features/platformPage/sharedPlatformPage';
@@ -41,12 +42,6 @@ type NamespacesResponse = {
data: NamespaceRow[];
};
-const formatInteger = (value?: number | null): string => {
- const n = Number(value ?? 0);
- if (!Number.isFinite(n)) return '0';
- return Math.round(n).toLocaleString();
-};
-
export const K8sNamespacesDrawer: Component<{
cluster: string;
onOpenDeployments?: (namespace: string | null) => void;
@@ -200,12 +195,14 @@ export const K8sNamespacesDrawer: Component<{
class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}
>
<span class="font-semibold tabular-nums">
- {formatInteger(row.pods.total)}
+ {formatPlatformTableIntegerValue(row.pods.total ?? 0, '0')}
</span>
<span class="ml-2 text-[11px] text-muted">
- {row.pods.offline > 0 ? `${formatInteger(row.pods.offline)} off` : ''}
+ {row.pods.offline > 0
+ ? `${formatPlatformTableIntegerValue(row.pods.offline, '0')} off`
+ : ''}
{row.pods.warning > 0
- ? `${row.pods.offline > 0 ? ' · ' : ''}${formatInteger(row.pods.warning)} warn`
+ ? `${row.pods.offline > 0 ? ' · ' : ''}${formatPlatformTableIntegerValue(row.pods.warning, '0')} warn`
: ''}
</span>
</TableCell>
@@ -213,14 +210,14 @@ export const K8sNamespacesDrawer: Component<{
class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}
>
<span class="font-semibold tabular-nums">
- {formatInteger(row.deployments.total)}
+ {formatPlatformTableIntegerValue(row.deployments.total ?? 0, '0')}
</span>
<span class="ml-2 text-[11px] text-muted">
{row.deployments.warning > 0
- ? `${formatInteger(row.deployments.warning)} warn`
+ ? `${formatPlatformTableIntegerValue(row.deployments.warning, '0')} warn`
: ''}
{row.deployments.offline > 0
- ? `${row.deployments.warning > 0 ? ' · ' : ''}${formatInteger(row.deployments.offline)} off`
+ ? `${row.deployments.warning > 0 ? ' · ' : ''}${formatPlatformTableIntegerValue(row.deployments.offline, '0')} off`
: ''}
</span>
</TableCell>
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 20489519e7..f9bbbff4d2 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -164,7 +164,9 @@ import kubernetesPodsTableSource from '@/features/kubernetes/KubernetesPodsTable
import kubernetesPolicyTableSource from '@/features/kubernetes/KubernetesPolicyTable.tsx?raw';
import kubernetesServicesTableSource from '@/features/kubernetes/KubernetesServicesTable.tsx?raw';
import kubernetesStorageTableSource from '@/features/kubernetes/KubernetesStorageTable.tsx?raw';
+import proxmoxBackupServersTableSource from '@/features/proxmox/ProxmoxBackupServersTable.tsx?raw';
import proxmoxBackupsTableSource from '@/features/proxmox/ProxmoxBackupsTable.tsx?raw';
+import proxmoxCephClusterDrawerSource from '@/features/proxmox/ProxmoxCephClusterDrawer.tsx?raw';
import proxmoxCephTableSource from '@/features/proxmox/ProxmoxCephTable.tsx?raw';
import proxmoxCoverageTableSource from '@/features/proxmox/ProxmoxCoverageTable.tsx?raw';
import proxmoxMailGatewayTableSource from '@/features/proxmox/ProxmoxMailGatewayTable.tsx?raw';
@@ -3879,6 +3881,111 @@ describe('shared primitive guardrails', () => {
expect(vsphereActivityTableSource).toContain('minYear={2000}');
});
+ it('keeps platform table integer count formatting on the shared helper', () => {
+ const registry = JSON.parse(sharedTemplateRegistrySource) as {
+ rules?: Array<{
+ id: string;
+ canonical?: { path?: string; export?: string };
+ requiredConsumers?: Array<{ path?: string }>;
+ forbiddenPatterns?: Array<{ path?: string; patterns?: string[] }>;
+ }>;
+ patternGuards?: Array<{
+ id: string;
+ canonical?: { path?: string; export?: string };
+ allPatterns?: string[];
+ scopes?: string[];
+ allowedPaths?: string[];
+ ignoredPaths?: string[];
+ }>;
+ };
+ const registeredRule = registry.rules?.find(
+ (rule) => rule.id === 'platform-table-integer-value-format',
+ );
+ const localHelperGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'platform-table-local-integer-format-helper',
+ );
+ const localToLocaleGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'platform-table-local-integer-count-tolocalestring',
+ );
+ const platformIntegerConsumers: Array<[string, string]> = [
+ ['src/components/Kubernetes/K8sNamespacesDrawer.tsx', k8sNamespacesDrawerSource],
+ ['src/features/proxmox/ProxmoxBackupServersTable.tsx', proxmoxBackupServersTableSource],
+ ['src/features/proxmox/ProxmoxCephClusterDrawer.tsx', proxmoxCephClusterDrawerSource],
+ ['src/features/proxmox/ProxmoxMailGatewayDrawer.tsx', proxmoxMailGatewayDrawerSource],
+ ['src/features/proxmox/ProxmoxMailGatewayTable.tsx', proxmoxMailGatewayTableSource],
+ ];
+ const platformIntegerConsumerPaths = platformIntegerConsumers.map(([path]) => path);
+
+ expect(registeredRule?.canonical?.path).toBe(
+ 'src/features/platformPage/sharedPlatformPage.tsx',
+ );
+ expect(registeredRule?.canonical?.export).toBe('formatPlatformTableIntegerValue');
+ expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual(
+ platformIntegerConsumerPaths,
+ );
+ expect(registeredRule?.forbiddenPatterns).toEqual([
+ {
+ path: 'src/components/Kubernetes/K8sNamespacesDrawer.tsx',
+ patterns: ['const formatInteger', 'Math.round(n).toLocaleString()'],
+ },
+ {
+ path: 'src/features/proxmox/ProxmoxBackupServersTable.tsx',
+ patterns: ['row.backupCount.toLocaleString()'],
+ },
+ {
+ path: 'src/features/proxmox/ProxmoxCephClusterDrawer.tsx',
+ patterns: ['pool.objects.toLocaleString()'],
+ },
+ {
+ path: 'src/features/proxmox/ProxmoxMailGatewayDrawer.tsx',
+ patterns: ['function formatNumber', 'Math.round(value).toLocaleString()'],
+ },
+ {
+ path: 'src/features/proxmox/ProxmoxMailGatewayTable.tsx',
+ patterns: ['const formatLocaleCount', 'value.toLocaleString()'],
+ },
+ ]);
+ expect(localHelperGuard?.canonical?.path).toBe(
+ 'src/features/platformPage/sharedPlatformPage.tsx',
+ );
+ expect(localHelperGuard?.canonical?.export).toBe('formatPlatformTableIntegerValue');
+ expect(localHelperGuard?.allPatterns).toEqual(['Math.round(', '.toLocaleString()']);
+ expect(localHelperGuard?.scopes).toEqual(['src/components/Kubernetes', 'src/features/proxmox']);
+ expect(localHelperGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(localHelperGuard?.ignoredPaths ?? []).toHaveLength(0);
+ expect(localToLocaleGuard?.canonical?.path).toBe(
+ 'src/features/platformPage/sharedPlatformPage.tsx',
+ );
+ expect(localToLocaleGuard?.canonical?.export).toBe('formatPlatformTableIntegerValue');
+ expect(localToLocaleGuard?.allPatterns).toEqual(['toLocaleString()']);
+ expect(localToLocaleGuard?.scopes).toEqual([
+ 'src/components/Kubernetes',
+ 'src/features/proxmox',
+ ]);
+ expect(localToLocaleGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(localToLocaleGuard?.ignoredPaths ?? []).toHaveLength(0);
+
+ expect(sharedPlatformPageSource).toContain('export const formatPlatformTableIntegerValue');
+ expect(sharedPlatformPageSource).toContain('maximumFractionDigits: 0');
+
+ for (const [path, source] of platformIntegerConsumers) {
+ expect(source).toContain('formatPlatformTableIntegerValue');
+ const forbiddenPatterns =
+ registeredRule?.forbiddenPatterns?.find((entry) => entry.path === path)?.patterns ?? [];
+ for (const pattern of forbiddenPatterns) {
+ expect(source).not.toContain(pattern);
+ }
+ }
+ for (const source of [
+ proxmoxBackupServersTableSource,
+ proxmoxCephClusterDrawerSource,
+ proxmoxMailGatewayDrawerSource,
+ proxmoxMailGatewayTableSource,
+ ]) {
+ expect(source).toContain('PlatformTableNumberValue');
+ }
+ });
+
it('keeps platform table number-value fallbacks on the shared primitive', () => {
const registry = JSON.parse(sharedTemplateRegistrySource) as {
rules?: Array<{
@@ -4059,7 +4166,7 @@ describe('shared primitive guardrails', () => {
expect(source).not.toContain(pattern);
}
}
- expect(proxmoxMailGatewayTableSource).toContain('format={formatLocaleCount}');
+ expect(proxmoxMailGatewayTableSource).toContain('format={formatPlatformTableIntegerValue}');
});
it('keeps platform table count ratios on the shared primitive', () => {
diff --git a/frontend-modern/src/features/platformPage/__tests__/sharedPlatformPage.test.ts b/frontend-modern/src/features/platformPage/__tests__/sharedPlatformPage.test.ts
index e1ee064c8c..d827769ce7 100644
--- a/frontend-modern/src/features/platformPage/__tests__/sharedPlatformPage.test.ts
+++ b/frontend-modern/src/features/platformPage/__tests__/sharedPlatformPage.test.ts
@@ -14,6 +14,7 @@ import {
formatPlatformTableBytesValue,
formatPlatformTableCountRatioValue,
formatPlatformTableDateTimeValue,
+ formatPlatformTableIntegerValue,
formatPlatformTableTitleCaseValue,
formatPlatformTableUptimeValue,
filterPlatformResources,
@@ -362,6 +363,17 @@ describe('PlatformTableDateTimeValue', () => {
});
});
+describe('formatPlatformTableIntegerValue', () => {
+ it('formats rounded integer labels with canonical empty markers', () => {
+ const expected = new Intl.NumberFormat(undefined, { maximumFractionDigits: 0 }).format(1235);
+
+ expect(formatPlatformTableIntegerValue(1234.6)).toBe(expected);
+ expect(formatPlatformTableIntegerValue(0)).toBe('0');
+ expect(formatPlatformTableIntegerValue(Number.NaN, '0')).toBe('0');
+ expect(formatPlatformTableIntegerValue(undefined)).toBe('—');
+ });
+});
+
describe('PlatformTableNumberValue', () => {
it('renders finite numbers with shared tabular styling and empty markers', () => {
const { container } = render(() => PlatformTableNumberValue({ value: 42 }));
diff --git a/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx b/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
index 6eb5971b04..f0f281ef0d 100644
--- a/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
+++ b/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
@@ -266,6 +266,20 @@ export function PlatformTableDateTimeValue(props: {
);
}
+const platformTableIntegerFormatter = new Intl.NumberFormat(undefined, {
+ maximumFractionDigits: 0,
+});
+
+export const formatPlatformTableIntegerValue = (
+ value: number | null | undefined,
+ emptyText = '—',
+): string => {
+ if (typeof value !== 'number' || !Number.isFinite(value)) {
+ return emptyText;
+ }
+ return platformTableIntegerFormatter.format(Math.round(value));
+};
+
export function PlatformTableNumberValue(props: {
value: number | undefined;
emptyText?: string;
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
index e06ac4e40e..3720707593 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
@@ -4,8 +4,10 @@ import { StatusDot } from '@/components/shared/StatusDot';
import { TableCell, TableHead, TableRow } from '@/components/shared/Table';
import { formatBytes, formatUptime } from '@/utils/format';
import {
+ formatPlatformTableIntegerValue,
getPlatformTableCellClassForKind,
getPlatformTableHeadClassForKind,
+ PlatformTableNumberValue,
PlatformTableShell,
} from '@/features/platformPage/sharedPlatformPage';
import type { PBSBackup } from '@/types/api';
@@ -276,10 +278,13 @@ export function ProxmoxBackupServersTable(props: {
</Show>
</TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content tabular-nums`}
+ class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}
>
<Show when={row.datastore} fallback={<span class="text-muted">—</span>}>
- {row.backupCount.toLocaleString()}
+ <PlatformTableNumberValue
+ value={row.backupCount}
+ format={formatPlatformTableIntegerValue}
+ />
</Show>
</TableCell>
<TableCell
diff --git a/frontend-modern/src/features/proxmox/ProxmoxCephClusterDrawer.tsx b/frontend-modern/src/features/proxmox/ProxmoxCephClusterDrawer.tsx
index 0f0ebbd4aa..247f6eac81 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxCephClusterDrawer.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxCephClusterDrawer.tsx
@@ -15,8 +15,10 @@ import {
import {
PLATFORM_TABLE_BODY_CLASS,
PLATFORM_TABLE_HEADER_ROW_CLASS,
+ formatPlatformTableIntegerValue,
getPlatformTableCellClassForKind,
getPlatformTableHeadClassForKind,
+ PlatformTableNumberValue,
} from '@/features/platformPage/sharedPlatformPage';
import type { StatusIndicatorVariant } from '@/utils/status';
import { formatBytes } from '@/utils/format';
@@ -183,9 +185,12 @@ export const ProxmoxCephClusterDrawer: Component<{
{pool.name || '—'}
</TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content tabular-nums`}
+ class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}
>
- {pool.objects.toLocaleString()}
+ <PlatformTableNumberValue
+ value={pool.objects}
+ format={formatPlatformTableIntegerValue}
+ />
</TableCell>
<TableCell
class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content tabular-nums`}
diff --git a/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx b/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx
index daf321d32b..63f7977120 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx
@@ -14,8 +14,10 @@ import {
import {
PLATFORM_TABLE_BODY_CLASS,
PLATFORM_TABLE_HEADER_ROW_CLASS,
+ formatPlatformTableIntegerValue,
getPlatformTableCellClassForKind,
getPlatformTableHeadClassForKind,
+ PlatformTableNumberValue,
} from '@/features/platformPage/sharedPlatformPage';
import type { StatusIndicatorVariant } from '@/utils/status';
import { formatBytes } from '@/utils/format';
@@ -86,11 +88,6 @@ function formatAge(seconds: number): string {
return `${Math.floor(seconds / 86_400)}d`;
}
-function formatNumber(value: number | undefined): string {
- if (typeof value !== 'number' || !Number.isFinite(value)) return '—';
- return Math.round(value).toLocaleString();
-}
-
function queueCell(queue: PMGQueueStatus | undefined): { count: number; label: string } {
if (!queue) return { count: 0, label: '—' };
return {
@@ -129,7 +126,7 @@ function StackedBar(props: { segments: StackedSegment[]; ariaLabel: string }) {
<div
class={seg.tone}
style={{ width: `${(seg.value / total()) * 100}%` }}
- title={`${seg.label}: ${formatNumber(seg.value)}`}
+ title={`${seg.label}: ${formatPlatformTableIntegerValue(seg.value)}`}
/>
)}
</For>
@@ -144,7 +141,7 @@ function StackedBar(props: { segments: StackedSegment[]; ariaLabel: string }) {
<span class={`inline-block h-2 w-2 rounded-sm ${seg.tone}`} aria-hidden="true" />
<span class="text-muted">{seg.label}</span>
<span class="text-base-content font-semibold tabular-nums">
- {formatNumber(seg.value)}
+ {formatPlatformTableIntegerValue(seg.value)}
</span>
<Show when={total() > 0}>
<span class="text-muted tabular-nums text-[10px]">{share.toFixed(1)}%</span>
@@ -183,7 +180,7 @@ function SpamHistogram(props: { buckets: PMGSpamBucket[] }) {
<div
class={`w-full rounded-sm ${tone}`}
style={{ height: `${Math.max(heightPct, 2)}%` }}
- title={`Score ${bucket.score}: ${formatNumber(bucket.count)}`}
+ title={`Score ${bucket.score}: ${formatPlatformTableIntegerValue(bucket.count)}`}
/>
<span class="text-[10px] text-muted font-mono tabular-nums">{bucket.score}</span>
</div>
@@ -204,7 +201,7 @@ function InOutBar(props: {
outValue: number;
format?: (value: number) => string;
}) {
- const format = props.format ?? formatNumber;
+ const format = props.format ?? formatPlatformTableIntegerValue;
const max = Math.max(props.inValue, props.outValue, 1);
const inWidth = (props.inValue / max) * 50;
const outWidth = (props.outValue / max) * 50;
@@ -402,7 +399,8 @@ export const ProxmoxMailGatewayDrawer: Component<{
<div class="flex items-baseline justify-between text-[11px]">
<span class="text-muted">Greylist / Junk in</span>
<span class="font-mono text-[10px] text-base-content font-semibold">
- {formatNumber(stats()!.greylistCount)} / {formatNumber(stats()!.junkIn)}
+ {formatPlatformTableIntegerValue(stats()!.greylistCount)} /{' '}
+ {formatPlatformTableIntegerValue(stats()!.junkIn)}
</span>
</div>
</div>
@@ -410,8 +408,8 @@ export const ProxmoxMailGatewayDrawer: Component<{
<div class="flex items-baseline justify-between text-[11px]">
<span class="text-muted">RBL / Pregreet rejects</span>
<span class="font-mono text-[10px] text-base-content font-semibold">
- {formatNumber(stats()!.rblRejects)} /{' '}
- {formatNumber(stats()!.pregreetRejects)}
+ {formatPlatformTableIntegerValue(stats()!.rblRejects)} /{' '}
+ {formatPlatformTableIntegerValue(stats()!.pregreetRejects)}
</span>
</div>
</div>
@@ -533,9 +531,14 @@ export const ProxmoxMailGatewayDrawer: Component<{
{asTrimmedString(node.loadAvg) || '—'}
</TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} tabular-nums`}
+ class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}
>
- <span class="text-base-content font-semibold">{queue.count}</span>
+ <span class="font-semibold">
+ <PlatformTableNumberValue
+ value={queue.count}
+ format={formatPlatformTableIntegerValue}
+ />
+ </span>
<span
class="ml-1 text-muted text-[10px] font-mono"
title="active/deferred/hold/incoming"
@@ -564,7 +567,9 @@ export const ProxmoxMailGatewayDrawer: Component<{
<h4 class="text-xs font-semibold uppercase tracking-wide text-muted">
Top domains
</h4>
- <span class="text-[10px] text-muted tabular-nums">top {topDomains().length}</span>
+ <span class="text-[10px] text-muted tabular-nums">
+ top {formatPlatformTableIntegerValue(topDomains().length)}
+ </span>
</div>
<Show
when={topDomains().length > 0}
@@ -600,19 +605,28 @@ export const ProxmoxMailGatewayDrawer: Component<{
</span>
</TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content tabular-nums`}
+ class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}
>
- {formatNumber(domain.mailCount)}
+ <PlatformTableNumberValue
+ value={domain.mailCount}
+ format={formatPlatformTableIntegerValue}
+ />
</TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content tabular-nums`}
+ class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}
>
- {formatNumber(domain.spamCount)}
+ <PlatformTableNumberValue
+ value={domain.spamCount}
+ format={formatPlatformTableIntegerValue}
+ />
</TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content tabular-nums`}
+ class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}
>
- {formatNumber(domain.virusCount)}
+ <PlatformTableNumberValue
+ value={domain.virusCount}
+ format={formatPlatformTableIntegerValue}
+ />
</TableCell>
<TableCell
class={`${getPlatformTableCellClassForKind('numeric-value')} text-muted tabular-nums`}
diff --git a/frontend-modern/src/features/proxmox/ProxmoxMailGatewayTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxMailGatewayTable.tsx
index 733c5e7665..3090ceb462 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxMailGatewayTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxMailGatewayTable.tsx
@@ -10,6 +10,7 @@ import {
PlatformTableToolbar,
createPlatformTableFilterState,
filterPlatformResources,
+ formatPlatformTableIntegerValue,
formatPlatformTableUptimeValue,
getPlatformTableCellClassForKind,
getPlatformTableHeadClassForKind,
@@ -28,8 +29,6 @@ import { ProxmoxMailGatewayDrawer } from './ProxmoxMailGatewayDrawer';
// operator columns. This bespoke table reuses canonical shared
// primitives and surfaces those PMG-native columns.
-const formatLocaleCount = (value: number): string => value.toLocaleString();
-
export const ProxmoxMailGatewayTable: Component<{
resources: Resource[];
emptyTitle: string;
@@ -153,7 +152,7 @@ export const ProxmoxMailGatewayTable: Component<{
>
<PlatformTableNumberValue
value={pmg()?.nodeCount}
- format={formatLocaleCount}
+ format={formatPlatformTableIntegerValue}
/>
</TableCell>
<TableCell
@@ -168,7 +167,7 @@ export const ProxmoxMailGatewayTable: Component<{
>
<PlatformTableNumberValue
value={pmg()?.mailCountTotal}
- format={formatLocaleCount}
+ format={formatPlatformTableIntegerValue}
/>
</TableCell>
<TableCell
@@ -176,7 +175,7 @@ export const ProxmoxMailGatewayTable: Component<{
>
<PlatformTableNumberValue
value={pmg()?.spamIn}
- format={formatLocaleCount}
+ format={formatPlatformTableIntegerValue}
/>
</TableCell>
<TableCell
@@ -184,7 +183,7 @@ export const ProxmoxMailGatewayTable: Component<{
>
<PlatformTableNumberValue
value={pmg()?.virusIn}
- format={formatLocaleCount}
+ format={formatPlatformTableIntegerValue}
/>
</TableCell>
<TableCell
@@ -192,7 +191,7 @@ export const ProxmoxMailGatewayTable: Component<{
>
<PlatformTableNumberValue
value={pmg()?.quarantine}
- format={formatLocaleCount}
+ format={formatPlatformTableIntegerValue}
/>
</TableCell>
<TableCell
@@ -200,7 +199,7 @@ export const ProxmoxMailGatewayTable: Component<{
>
<PlatformTableNumberValue
value={pmg()?.queueTotal ?? pmg()?.queueActive}
- format={formatLocaleCount}
+ format={formatPlatformTableIntegerValue}
/>
</TableCell>
<TableCell
@@ -208,7 +207,7 @@ export const ProxmoxMailGatewayTable: Component<{
>
<PlatformTableNumberValue
value={pmg()?.queueDeferred}
- format={formatLocaleCount}
+ format={formatPlatformTableIntegerValue}
/>
</TableCell>
</TableRow>
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
index f22c353588..cd1ec46302 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
@@ -4,6 +4,7 @@ import type { JSX } from 'solid-js';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { ProxmoxBackupsTable } from '../ProxmoxBackupsTable';
+import proxmoxBackupServersTableSource from '../ProxmoxBackupServersTable.tsx?raw';
import proxmoxBackupsTableSource from '../ProxmoxBackupsTable.tsx?raw';
import proxmoxPageSurfaceSource from '../ProxmoxPageSurface.tsx?raw';
import {
@@ -287,6 +288,14 @@ describe('ProxmoxBackupsTable', () => {
);
});
+ it('keeps PBS backup count cells on the shared platform integer primitive', () => {
+ const directLocaleCountCall = 'row.backupCount.' + 'toLocale' + 'String()';
+
+ expect(proxmoxBackupServersTableSource).toContain('PlatformTableNumberValue');
+ expect(proxmoxBackupServersTableSource).toContain('formatPlatformTableIntegerValue');
+ expect(proxmoxBackupServersTableSource).not.toContain(directLocaleCountCall);
+ });
+
it('keeps backup coverage fed by Proxmox VM/LXC guests when Overview demotes app containers', () => {
expect(proxmoxPageSurfaceSource).toContain(
'excludedWorkloadTypes: PROXMOX_WORKLOAD_EXCLUDED_TYPES',