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 metric empty fallbacks

rcourtman0af3a2d420ce
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index b540204469..b010266b2d 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -2613,9 +2613,10 @@ Platform table metric fallback rendering is also shared.
`PlatformTableMetricFallback` owns the centered muted empty marker used in
metric bar cells plus optional caller-owned fallback label/title text, and
`getPlatformTableFiniteMetric` owns finite-number normalization for CPU and
-memory values. Docker / Podman, Kubernetes, Standalone, TrueNAS, and vSphere
-platform tables must compose those helpers instead of declaring local
-`metricFallback` or `finiteMetric` helpers.
+memory, disk, and capacity values. Docker / Podman, Kubernetes, Proxmox,
+Standalone, TrueNAS, and vSphere platform tables must compose those helpers
+instead of declaring local `metricFallback` / `finiteMetric` helpers or
+inlining centered muted dash fallback markup in metric cells.
Platform load-failure states are registry-backed as well.
`PlatformErrorState` owns the repeated table-card error shell, warning icon,
and Refresh action for platform page and table load failures; platform
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 4e50ce227e..6525f46da4 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -247,8 +247,9 @@ tables, including Standalone machines, must use
Metric bar fallbacks follow that split as well: unified-resource consumers own
which CPU or memory value is selected, plus any source-specific fallback reason
such as outdated standalone agent telemetry, while platform tables must use
-`PlatformTableMetricFallback` and `getPlatformTableFiniteMetric` instead of
-recreating local fallback markup or `Number.isFinite` wrappers.
+`PlatformTableMetricFallback` and `getPlatformTableFiniteMetric` for CPU,
+memory, disk, and capacity metric cells instead of recreating local fallback
+markup or `Number.isFinite` wrappers.
Platform filter option semantics follow that split too: unified-resource
consumers own the source-specific status buckets and labels, while the repeated
FilterBar chip leading-dot presentation must use the frontend-primitives-owned
diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.json
index 81185b9067..59cb10f20c 100644
--- a/frontend-modern/scripts/shared-template-registry.json
+++ b/frontend-modern/scripts/shared-template-registry.json
@@ -1349,9 +1349,11 @@
{ "path": "src/features/docker/DockerHostsTable.tsx" },
{ "path": "src/features/kubernetes/KubernetesClustersTable.tsx" },
{ "path": "src/features/kubernetes/KubernetesNodesTable.tsx" },
+ { "path": "src/features/proxmox/ProxmoxNodesTable.tsx" },
{ "path": "src/features/standalone/AgentsMachinesTable.tsx" },
{ "path": "src/features/truenas/TrueNASAppsTable.tsx" },
{ "path": "src/features/truenas/TrueNASSystemsTable.tsx" },
+ { "path": "src/features/vmware/VsphereDatastoresTable.tsx" },
{ "path": "src/features/vmware/VsphereHostsTable.tsx" }
],
"forbiddenPatterns": [
@@ -1371,6 +1373,10 @@
"path": "src/features/kubernetes/KubernetesNodesTable.tsx",
"patterns": ["const finiteMetric", "const metricFallback"]
},
+ {
+ "path": "src/features/proxmox/ProxmoxNodesTable.tsx",
+ "patterns": ["const finiteMetric", "const metricFallback"]
+ },
{
"path": "src/features/standalone/AgentsMachinesTable.tsx",
"patterns": ["const finiteMetric", "const metricFallback"]
@@ -1383,6 +1389,10 @@
"path": "src/features/truenas/TrueNASSystemsTable.tsx",
"patterns": ["const finiteMetric", "const metricFallback"]
},
+ {
+ "path": "src/features/vmware/VsphereDatastoresTable.tsx",
+ "patterns": ["const finiteMetric", "const metricFallback"]
+ },
{
"path": "src/features/vmware/VsphereHostsTable.tsx",
"patterns": ["const finiteMetric", "const metricFallback"]
@@ -1913,6 +1923,7 @@
"scopes": [
"src/features/docker",
"src/features/kubernetes",
+ "src/features/proxmox",
"src/features/standalone",
"src/features/truenas",
"src/features/vmware"
@@ -1928,6 +1939,33 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "platform-table-local-metric-empty-marker",
+ "category": "platform-table-metric",
+ "summary": "Platform metric cells must not recreate centered muted dash fallback markup inline.",
+ "canonical": {
+ "path": "src/features/platformPage/sharedPlatformPage.tsx",
+ "export": "PlatformTableMetricFallback"
+ },
+ "scopes": [
+ "src/features/docker",
+ "src/features/kubernetes",
+ "src/features/proxmox",
+ "src/features/standalone",
+ "src/features/truenas",
+ "src/features/vmware"
+ ],
+ "extensions": [".tsx"],
+ "allPatterns": ["flex justify-center", "text-xs text-muted", "aria-hidden=\"true\""],
+ "legacyReason": "Retired migration debt. Platform metric cells must compose PlatformTableMetricFallback instead of carrying inline centered dash fallback markup.",
+ "allowedPaths": [],
+ "ignoredPaths": [],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/features/platformPage/__tests__/sharedPlatformPage.test.ts",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "platform-section-tabs-local-nav",
"category": "platform-section-tabs",
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 3762331526..5ccf704789 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -3773,17 +3773,27 @@ describe('shared primitive guardrails', () => {
const localHelperGuard = registry.patternGuards?.find(
(guard) => guard.id === 'platform-table-local-metric-fallback-helper',
);
+ const localMarkerGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'platform-table-local-metric-empty-marker',
+ );
const platformMetricConsumers: Array<[string, string]> = [
['src/features/docker/DockerContainersTable.tsx', dockerContainersTableSource],
['src/features/docker/DockerHostsTable.tsx', dockerHostsTableSource],
['src/features/kubernetes/KubernetesClustersTable.tsx', kubernetesClustersTableSource],
['src/features/kubernetes/KubernetesNodesTable.tsx', kubernetesNodesTableSource],
+ ['src/features/proxmox/ProxmoxNodesTable.tsx', proxmoxNodesTableSource],
['src/features/standalone/AgentsMachinesTable.tsx', agentsMachinesTableSource],
['src/features/truenas/TrueNASAppsTable.tsx', truenasAppsTableSource],
['src/features/truenas/TrueNASSystemsTable.tsx', truenasSystemsTableSource],
+ ['src/features/vmware/VsphereDatastoresTable.tsx', vsphereDatastoresTableSource],
['src/features/vmware/VsphereHostsTable.tsx', vsphereHostsTableSource],
];
const platformMetricConsumerPaths = platformMetricConsumers.map(([path]) => path);
+ const inlineMetricMarkerPatterns = [
+ 'flex justify-center',
+ 'text-xs text-muted',
+ 'aria-hidden="true"',
+ ];
expect(registeredRule?.canonical?.path).toBe(
'src/features/platformPage/sharedPlatformPage.tsx',
@@ -3810,12 +3820,28 @@ describe('shared primitive guardrails', () => {
expect(localHelperGuard?.scopes).toEqual([
'src/features/docker',
'src/features/kubernetes',
+ 'src/features/proxmox',
'src/features/standalone',
'src/features/truenas',
'src/features/vmware',
]);
expect(localHelperGuard?.allowedPaths ?? []).toHaveLength(0);
expect(localHelperGuard?.ignoredPaths ?? []).toHaveLength(0);
+ expect(localMarkerGuard?.canonical?.path).toBe(
+ 'src/features/platformPage/sharedPlatformPage.tsx',
+ );
+ expect(localMarkerGuard?.canonical?.export).toBe('PlatformTableMetricFallback');
+ expect(localMarkerGuard?.allPatterns).toEqual(inlineMetricMarkerPatterns);
+ expect(localMarkerGuard?.scopes).toEqual([
+ 'src/features/docker',
+ 'src/features/kubernetes',
+ 'src/features/proxmox',
+ 'src/features/standalone',
+ 'src/features/truenas',
+ 'src/features/vmware',
+ ]);
+ expect(localMarkerGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(localMarkerGuard?.ignoredPaths ?? []).toHaveLength(0);
expect(sharedPlatformPageSource).toContain('export function PlatformTableMetricFallback');
expect(sharedPlatformPageSource).toContain('export const getPlatformTableFiniteMetric');
@@ -3827,6 +3853,7 @@ describe('shared primitive guardrails', () => {
expect(source).not.toContain('const finiteMetric');
expect(source).not.toContain('const metricFallback');
expect(source).not.toContain('Number.isFinite(value)');
+ expect(inlineMetricMarkerPatterns.every((pattern) => source.includes(pattern))).toBe(false);
}
});
diff --git a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
index 112333528e..f2b6110e2b 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
@@ -31,7 +31,9 @@ import { useWorkloadTableMetricHistory } from '@/components/Workloads/useWorkloa
import { getWorkloadTableLayoutMode } from '@/components/Workloads/guestRowModel';
import {
PlatformTableEmptyState,
+ PlatformTableMetricFallback,
PlatformTableShell,
+ getPlatformTableFiniteMetric,
getPlatformTableCellClassForKind,
getPlatformTableHeadClassForKind,
} from '@/features/platformPage/sharedPlatformPage';
@@ -118,8 +120,9 @@ const projectResourceToLegacyNode = (resource: Resource): LegacyNode => {
};
const formatPercentLabel = (value: number | null | undefined): string => {
- if (typeof value !== 'number' || !Number.isFinite(value)) return '—';
- const normalized = value <= 1 ? value * 100 : value;
+ const finiteValue = typeof value === 'number' ? getPlatformTableFiniteMetric(value) : undefined;
+ if (finiteValue === undefined) return '—';
+ const normalized = finiteValue <= 1 ? finiteValue * 100 : finiteValue;
return `${Math.round(Math.max(0, normalized))}%`;
};
@@ -310,29 +313,26 @@ export const ProxmoxNodesTable: Component<{
const uptime = () => formatNodeUptime(node.uptime);
const metricsKey = () => buildMetricKeyForUnifiedResource(node);
const temperature = () => node.temperature;
- const cpuPercent = () => node.cpu?.current ?? 0;
- const memoryUsed = () => node.memory?.used ?? 0;
- const memoryTotal = () => node.memory?.total ?? 0;
+ const cpuPercent = () => getPlatformTableFiniteMetric(node.cpu?.current) ?? 0;
+ const memoryUsed = () => getPlatformTableFiniteMetric(node.memory?.used) ?? 0;
+ const memoryTotal = () => getPlatformTableFiniteMetric(node.memory?.total) ?? 0;
const memoryPercent = () =>
memoryTotal() > 0
? (memoryUsed() / memoryTotal()) * 100
- : typeof node.memory?.current === 'number'
- ? node.memory.current
- : 0;
+ : (getPlatformTableFiniteMetric(node.memory?.current) ?? 0);
const memoryPercentOnly = () =>
- !memoryTotal() && typeof node.memory?.current === 'number'
- ? node.memory.current
- : undefined;
- const diskPercent = () => node.disk?.current ?? 0;
- const aggregateDisk = (): Disk | undefined =>
- node.disk
- ? ({
- total: node.disk.total ?? 0,
- used: node.disk.used ?? 0,
- free: node.disk.free ?? 0,
- usage: node.disk.current ?? 0,
- } as Disk)
+ !memoryTotal() && getPlatformTableFiniteMetric(node.memory?.current) !== undefined
+ ? getPlatformTableFiniteMetric(node.memory?.current)
: undefined;
+ const diskPercent = () => getPlatformTableFiniteMetric(node.disk?.current) ?? 0;
+ const aggregateDisk = (): Disk | undefined => {
+ if (!node.disk) return undefined;
+ const total = getPlatformTableFiniteMetric(node.disk.total) ?? 0;
+ const used = getPlatformTableFiniteMetric(node.disk.used) ?? 0;
+ const free = getPlatformTableFiniteMetric(node.disk.free) ?? 0;
+ const usage = getPlatformTableFiniteMetric(node.disk.current) ?? 0;
+ return { total, used, free, usage } as Disk;
+ };
const legacyNode = () => projectResourceToLegacyNode(node);
const externalUrl = () => {
const shimmed = drawerNode();
@@ -457,13 +457,7 @@ export const ProxmoxNodesTable: Component<{
when={
isOnline() && (memoryTotal() > 0 || memoryPercentOnly() != null)
}
- fallback={
- <div class="flex justify-center">
- <span class="text-xs text-muted" aria-hidden="true">
- —
- </span>
- </div>
- }
+ fallback={<PlatformTableMetricFallback />}
>
<StackedMemoryBar
used={memoryUsed()}
@@ -492,13 +486,7 @@ export const ProxmoxNodesTable: Component<{
fallback={
<Show
when={isOnline() && (aggregateDisk() || node.agent?.disks?.length)}
- fallback={
- <div class="flex justify-center">
- <span class="text-xs text-muted" aria-hidden="true">
- —
- </span>
- </div>
- }
+ fallback={<PlatformTableMetricFallback />}
>
<StackedDiskBar
mode={
diff --git a/frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx b/frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx
index f6b2326732..faa1182950 100644
--- a/frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx
+++ b/frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx
@@ -7,8 +7,10 @@ import { getSimpleStatusIndicator } from '@/utils/status';
import { asTrimmedString } from '@/utils/stringUtils';
import {
PlatformTableEmptyState,
+ PlatformTableMetricFallback,
PlatformTableToolbar,
createPlatformTableFilterState,
+ getPlatformTableFiniteMetric,
getPlatformTableCellClassForKind,
getPlatformTableHeadClassForKind,
summarizePlatformTableValues,
@@ -77,23 +79,16 @@ const consumerSummary = (resource: Resource): { label: string; title: string } =
const consumerCount = (resource: Resource): number => resource.storage?.consumerCount ?? 0;
const capacityDisk = (resource: Resource) => {
- const total = typeof resource.disk?.total === 'number' ? resource.disk.total : 0;
- const used = typeof resource.disk?.used === 'number' ? resource.disk.used : 0;
- const free =
- typeof resource.disk?.free === 'number' ? resource.disk.free : Math.max(0, total - used);
- const usage =
- typeof resource.disk?.current === 'number' && Number.isFinite(resource.disk.current)
- ? resource.disk.current
- : total > 0
- ? (used / total) * 100
- : 0;
+ const total = getPlatformTableFiniteMetric(resource.disk?.total) ?? 0;
+ const used = getPlatformTableFiniteMetric(resource.disk?.used) ?? 0;
+ const free = getPlatformTableFiniteMetric(resource.disk?.free) ?? Math.max(0, total - used);
+ const current = getPlatformTableFiniteMetric(resource.disk?.current);
+ const usage = current !== undefined ? current : total > 0 ? (used / total) * 100 : 0;
return { total, used, free, usage };
};
const hasCapacityMetric = (resource: Resource): boolean => {
- if (typeof resource.disk?.current === 'number' && Number.isFinite(resource.disk.current)) {
- return true;
- }
+ if (getPlatformTableFiniteMetric(resource.disk?.current) !== undefined) return true;
return (
typeof resource.disk?.used === 'number' &&
typeof resource.disk?.total === 'number' &&
@@ -249,16 +244,7 @@ export const VsphereDatastoresTable: Component<{
</span>
</TableCell>
<TableCell class={getPlatformTableCellClassForKind('metric-bar')}>
- <Show
- when={showCapacity()}
- fallback={
- <div class="flex justify-center">
- <span class="text-xs text-muted" aria-hidden="true">
- —
- </span>
- </div>
- }
- >
+ <Show when={showCapacity()} fallback={<PlatformTableMetricFallback />}>
<StackedDiskBar aggregateDisk={disk()} />
</Show>
</TableCell>