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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Converge platform replica count cells
rcourtman3fc5e17d285b
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 9f92ea1fd0..c745757856 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -2619,9 +2619,12 @@ Platform table numeric fallback rendering is registry-backed too.`PlatformTableNumberValue` owns finite-number checking, tabular-number styling,custom empty-marker support, and caller-owned number formatting for denseoptional numeric table cells. Docker / Podman native count helpers, Kubernetes-optional count cells, and Proxmox Mail Gateway count columns must compose that-primitive instead of declaring local `numberValue`, `numericValue`, or-`countCell` helpers.+optional count cells, Docker Swarm service desired/running counts, Kubernetes+Deployment replica counts, and Proxmox Mail Gateway count columns must compose+that primitive instead of declaring local `numberValue`, `numericValue`,+`replicaCount`, or `countCell` helpers. If a scheduler or service-domain count+is intentionally zero-defaulted, the consuming table owns that field/default+choice and still renders through `PlatformTableNumberValue`.Platform table metric fallback rendering is also shared.`PlatformTableMetricFallback` owns the centered muted empty marker used inmetric bar cells plus optional caller-owned fallback label/title text, anddiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 973777a79b..0a10350725 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -251,11 +251,12 @@ right source-specific value, while dense platform table cells must usenon-positive empty-cell markers instead of carrying table-local `formatBytes`wrappers.Optional numeric table cells follow the same split: unified-resource consumers-own which count or replica field is meaningful and whether a domain-specific+own which count or replica field is meaningful, whether the domain should+zero-default an absent scheduler/service count, and whether a domain-specificformatter is needed, while dense platform table cells must use`PlatformTableNumberValue` for finite-number validation, tabular styling, andunknown empty-cell markers instead of carrying local `numberValue`,-`numericValue`, or `countCell` helpers.+`numericValue`, `replicaCount`, or `countCell` helpers.Metric bar fallbacks follow that split as well: unified-resource consumers ownwhich CPU or memory value is selected, plus any source-specific fallback reasonsuch as outdated standalone agent telemetry, while platform tables must usediff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.jsonindex 6287a6a3fd..c802562f92 100644--- a/frontend-modern/scripts/shared-template-registry.json+++ b/frontend-modern/scripts/shared-template-registry.json@@ -1384,8 +1384,11 @@},"requiredConsumers": [{ "path": "src/features/docker/DockerNativeTableShared.tsx" },+ { "path": "src/features/docker/DockerServicesTable.tsx" },+ { "path": "src/components/Docker/SwarmServicesDrawer.tsx" },{ "path": "src/features/kubernetes/KubernetesAutoscalingTable.tsx" },{ "path": "src/features/kubernetes/KubernetesControllersTable.tsx" },+ { "path": "src/features/kubernetes/KubernetesDeploymentsTable.tsx" },{ "path": "src/features/kubernetes/KubernetesEventsTable.tsx" },{ "path": "src/features/kubernetes/KubernetesPodsTable.tsx" },{ "path": "src/features/proxmox/ProxmoxMailGatewayTable.tsx" }@@ -1397,6 +1400,17 @@"typeof value === 'number' ? <span class=\"tabular-nums\">{value}</span> : <span>—</span>"]},+ {+ "path": "src/features/docker/DockerServicesTable.tsx",+ "patterns": ["const replicaCount", "<span class=\"tabular-nums\">{value ?? 0}</span>"]+ },+ {+ "path": "src/components/Docker/SwarmServicesDrawer.tsx",+ "patterns": [+ "<span class=\"tabular-nums\">{desired()}</span>",+ "<span class=\"tabular-nums\">{running()}</span>"+ ]+ },{"path": "src/features/kubernetes/KubernetesAutoscalingTable.tsx","patterns": [@@ -1411,6 +1425,10 @@"typeof value === 'number' ? <span class=\"tabular-nums\">{value}</span> : <span>—</span>"]},+ {+ "path": "src/features/kubernetes/KubernetesDeploymentsTable.tsx",+ "patterns": ["const replicaCount", "<span class=\"tabular-nums\">{value ?? 0}</span>"]+ },{"path": "src/features/kubernetes/KubernetesEventsTable.tsx","patterns": [@@ -2072,6 +2090,46 @@"scripts/shared-template-audit.mjs"]},+ {+ "id": "platform-table-local-replica-count-helper",+ "category": "platform-table-text-value",+ "summary": "Platform tables must not recreate local replicaCount helpers for scheduler/service count columns.",+ "canonical": {+ "path": "src/features/platformPage/sharedPlatformPage.tsx",+ "export": "PlatformTableNumberValue"+ },+ "scopes": ["src/features/docker", "src/features/kubernetes"],+ "extensions": [".tsx"],+ "allPatterns": ["const replicaCount", "<span class=\"tabular-nums\">{value ?? 0}</span>"],+ "legacyReason": "Retired migration debt. Scheduler and service count cells must compose PlatformTableNumberValue with caller-owned zero-default semantics instead of local tabular span helpers.",+ "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-swarm-count-spans",+ "category": "platform-table-text-value",+ "summary": "Docker Swarm table drawers must not render desired/running service counts with local tabular spans.",+ "canonical": {+ "path": "src/features/platformPage/sharedPlatformPage.tsx",+ "export": "PlatformTableNumberValue"+ },+ "scopes": ["src/components/Docker"],+ "extensions": [".tsx"],+ "allPatterns": ["desiredTasks", "runningTasks", "class=\"tabular-nums\""],+ "legacyReason": "Retired migration debt. Swarm desired/running count cells must route through PlatformTableNumberValue so drawer tables and platform tables share numeric cell rendering.",+ "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-metric-fallback-helper","category": "platform-table-metric",diff --git a/frontend-modern/src/components/Docker/SwarmServicesDrawer.tsx b/frontend-modern/src/components/Docker/SwarmServicesDrawer.tsxindex 3e116662c9..9dd4f85513 100644--- a/frontend-modern/src/components/Docker/SwarmServicesDrawer.tsx+++ b/frontend-modern/src/components/Docker/SwarmServicesDrawer.tsx@@ -18,6 +18,7 @@ import { asTrimmedString } from '@/utils/stringUtils';import {PLATFORM_TABLE_BODY_CLASS,PLATFORM_TABLE_HEADER_ROW_CLASS,+ PlatformTableNumberValue,getPlatformTableCellClassForKind,getPlatformTableHeadClassForKind,} from '@/features/platformPage/sharedPlatformPage';@@ -351,12 +352,12 @@ export const SwarmServicesDrawer: Component<{ cluster: string; swarm?: SwarmInfo<TableCellclass={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}>- <span class="tabular-nums">{desired()}</span>+ <PlatformTableNumberValue value={desired()} /></TableCell><TableCellclass={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}>- <span class="tabular-nums">{running()}</span>+ <PlatformTableNumberValue value={running()} /></TableCell><TableCellclass={`${getPlatformTableCellClassForKind('text')} text-base-content`}diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 0480999370..b0d0a78227 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -130,6 +130,7 @@ import selfHostedCommercialRecoverySectionSource from '@/components/Settings/Selimport suggestProfileModalSource from '@/components/Settings/SuggestProfileModal.tsx?raw';import alertAppriseDestinationsSectionSource from '@/features/alerts/AlertAppriseDestinationsSection.tsx?raw';import dockerPageSurfaceSource from '@/features/docker/DockerPageSurface.tsx?raw';+import dockerServicesTableSource from '@/features/docker/DockerServicesTable.tsx?raw';import kubernetesPageSurfaceSource from '@/features/kubernetes/KubernetesPageSurface.tsx?raw';import proxmoxPageSurfaceSource from '@/features/proxmox/ProxmoxPageSurface.tsx?raw';import standalonePageSurfaceSource from '@/features/standalone/StandalonePageSurface.tsx?raw';@@ -3780,10 +3781,19 @@ describe('shared primitive guardrails', () => {const localCountGuard = registry.patternGuards?.find((guard) => guard.id === 'platform-table-local-count-cell-helper',);+ const localReplicaCountGuard = registry.patternGuards?.find(+ (guard) => guard.id === 'platform-table-local-replica-count-helper',+ );+ const localSwarmCountGuard = registry.patternGuards?.find(+ (guard) => guard.id === 'platform-table-local-swarm-count-spans',+ );const platformNumberValueConsumers: Array<[string, string]> = [['src/features/docker/DockerNativeTableShared.tsx', dockerNativeTableSharedSource],+ ['src/features/docker/DockerServicesTable.tsx', dockerServicesTableSource],+ ['src/components/Docker/SwarmServicesDrawer.tsx', swarmServicesDrawerSource],['src/features/kubernetes/KubernetesAutoscalingTable.tsx', kubernetesAutoscalingTableSource],['src/features/kubernetes/KubernetesControllersTable.tsx', kubernetesControllersTableSource],+ ['src/features/kubernetes/KubernetesDeploymentsTable.tsx', kubernetesDeploymentsTableSource],['src/features/kubernetes/KubernetesEventsTable.tsx', kubernetesEventsTableSource],['src/features/kubernetes/KubernetesPodsTable.tsx', kubernetesPodsTableSource],['src/features/proxmox/ProxmoxMailGatewayTable.tsx', proxmoxMailGatewayTableSource],@@ -3804,6 +3814,17 @@ describe('shared primitive guardrails', () => {path: 'src/features/docker/DockerNativeTableShared.tsx',patterns: [optionalNumberMarkupPattern],},+ {+ path: 'src/features/docker/DockerServicesTable.tsx',+ patterns: ['const replicaCount', '<span class="tabular-nums">{value ?? 0}</span>'],+ },+ {+ path: 'src/components/Docker/SwarmServicesDrawer.tsx',+ patterns: [+ '<span class="tabular-nums">{desired()}</span>',+ '<span class="tabular-nums">{running()}</span>',+ ],+ },{path: 'src/features/kubernetes/KubernetesAutoscalingTable.tsx',patterns: ['const numberValue', optionalNumberMarkupPattern],@@ -3812,6 +3833,10 @@ describe('shared primitive guardrails', () => {path: 'src/features/kubernetes/KubernetesControllersTable.tsx',patterns: ['const numberValue', optionalNumberMarkupPattern],},+ {+ path: 'src/features/kubernetes/KubernetesDeploymentsTable.tsx',+ patterns: ['const replicaCount', '<span class="tabular-nums">{value ?? 0}</span>'],+ },{path: 'src/features/kubernetes/KubernetesEventsTable.tsx',patterns: ['const numberValue', optionalNumberMarkupPattern],@@ -3847,6 +3872,32 @@ describe('shared primitive guardrails', () => {expect(localCountGuard?.scopes).toEqual(['src/features/proxmox']);expect(localCountGuard?.allowedPaths ?? []).toHaveLength(0);expect(localCountGuard?.ignoredPaths ?? []).toHaveLength(0);+ expect(localReplicaCountGuard?.canonical?.path).toBe(+ 'src/features/platformPage/sharedPlatformPage.tsx',+ );+ expect(localReplicaCountGuard?.canonical?.export).toBe('PlatformTableNumberValue');+ expect(localReplicaCountGuard?.allPatterns).toEqual([+ 'const replicaCount',+ '<span class="tabular-nums">{value ?? 0}</span>',+ ]);+ expect(localReplicaCountGuard?.scopes).toEqual([+ 'src/features/docker',+ 'src/features/kubernetes',+ ]);+ expect(localReplicaCountGuard?.allowedPaths ?? []).toHaveLength(0);+ expect(localReplicaCountGuard?.ignoredPaths ?? []).toHaveLength(0);+ expect(localSwarmCountGuard?.canonical?.path).toBe(+ 'src/features/platformPage/sharedPlatformPage.tsx',+ );+ expect(localSwarmCountGuard?.canonical?.export).toBe('PlatformTableNumberValue');+ expect(localSwarmCountGuard?.allPatterns).toEqual([+ 'desiredTasks',+ 'runningTasks',+ 'class="tabular-nums"',+ ]);+ expect(localSwarmCountGuard?.scopes).toEqual(['src/components/Docker']);+ expect(localSwarmCountGuard?.allowedPaths ?? []).toHaveLength(0);+ expect(localSwarmCountGuard?.ignoredPaths ?? []).toHaveLength(0);expect(sharedPlatformPageSource).toContain('export function PlatformTableNumberValue');expect(sharedPlatformPageSource).toContain('Number.isFinite(value)');diff --git a/frontend-modern/src/features/docker/DockerServicesTable.tsx b/frontend-modern/src/features/docker/DockerServicesTable.tsxindex 4add5d4cc6..438783498c 100644--- a/frontend-modern/src/features/docker/DockerServicesTable.tsx+++ b/frontend-modern/src/features/docker/DockerServicesTable.tsx@@ -4,6 +4,7 @@ import { TableCell, TableHead, TableRow } from '@/components/shared/Table';import { asTrimmedString } from '@/utils/stringUtils';import {PLATFORM_HEALTH_FILTER_OPTIONS,+ PlatformTableNumberValue,PlatformTableToolbar,PlatformTableEmptyState,createPlatformTableFilterState,@@ -52,10 +53,6 @@ const formatPorts = (ports: Resource['docker'] extends infer T ? T : never): str);};-const replicaCount = (value: number | undefined): JSX.Element => (- <span class="tabular-nums">{value ?? 0}</span>-);-const formatServiceUpdate = (update: NonNullable<Resource['docker']>['serviceUpdate'],): { label: string; title: string } => {@@ -233,12 +230,12 @@ export const DockerServicesTable: Component<{<TableCellclass={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-base-content md:table-cell`}>- {replicaCount(service.docker?.desiredTasks)}+ <PlatformTableNumberValue value={service.docker?.desiredTasks ?? 0} /></TableCell><TableCellclass={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}>- {replicaCount(service.docker?.runningTasks)}+ <PlatformTableNumberValue value={service.docker?.runningTasks ?? 0} /></TableCell><TableCellclass={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}diff --git a/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsxindex 444702b709..16199172ae 100644--- a/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx+++ b/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx@@ -5,6 +5,7 @@ import { asTrimmedString } from '@/utils/stringUtils';import { formatRelativeTime } from '@/utils/format';import {PLATFORM_HEALTH_FILTER_OPTIONS,+ PlatformTableNumberValue,PlatformTableToolbar,PlatformTableEmptyState,createPlatformTableFilterState,@@ -39,10 +40,6 @@ import {// observedGeneration is deliberately not a column: without the spec// generation beside it the raw number is unactionable.-const replicaCount = (value: number | undefined): JSX.Element => (- <span class="tabular-nums">{value ?? 0}</span>-);-const formatAge = (createdAt: string | undefined): string =>formatRelativeTime(createdAt, { compact: true, emptyText: '—' }) || '—';@@ -206,22 +203,30 @@ export const KubernetesDeploymentsTable: Component<{<TableCellclass={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-base-content md:table-cell`}>- {replicaCount(deployment.kubernetes?.desiredReplicas)}+ <PlatformTableNumberValue+ value={deployment.kubernetes?.desiredReplicas ?? 0}+ /></TableCell><TableCellclass={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-base-content md:table-cell`}>- {replicaCount(deployment.kubernetes?.updatedReplicas)}+ <PlatformTableNumberValue+ value={deployment.kubernetes?.updatedReplicas ?? 0}+ /></TableCell><TableCellclass={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}>- {replicaCount(deployment.kubernetes?.readyReplicas)}+ <PlatformTableNumberValue+ value={deployment.kubernetes?.readyReplicas ?? 0}+ /></TableCell><TableCellclass={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}>- {replicaCount(deployment.kubernetes?.availableReplicas)}+ <PlatformTableNumberValue+ value={deployment.kubernetes?.availableReplicas ?? 0}+ /></TableCell><TableCellclass={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}