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.

Revert Proxmox host disk sub-rows

rcourtmancb31caa1b3dc
diff --git a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
index 7fb5172ead..38085f53e6 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
@@ -17,8 +17,7 @@ import {
} from '@/components/shared/Table';
import { getSimpleStatusIndicator } from '@/utils/status';
import { asTrimmedString } from '@/utils/stringUtils';
-import { formatBytes, formatPercent, normalizeDiskArray } from '@/utils/format';
-import { getMetricColorRgba } from '@/utils/metricThresholds';
+import { normalizeDiskArray } from '@/utils/format';
import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';
import { useWorkloadTableMetricHistory } from '@/components/Workloads/useWorkloadTableMetricHistory';
import { getWorkloadTableLayoutMode } from '@/components/Workloads/guestRowModel';
@@ -119,98 +118,6 @@ const formatPercentLabel = (value: number | null | undefined): string => {
return `${Math.round(Math.max(0, normalized))}%`;
};
-const getDiskUsagePercent = (disk: Disk): number => {
- if (disk.total > 0) return (disk.used / disk.total) * 100;
- if (Number.isFinite(disk.usage)) return disk.usage <= 1 ? disk.usage * 100 : disk.usage;
- return 0;
-};
-
-const getDiskShortLabel = (disk: Disk, index: number): string => {
- const raw = (disk.mountpoint || disk.device || `Disk ${index + 1}`).trim();
- if (raw.startsWith('/dev/')) return raw.slice('/dev/'.length);
- if (raw === '/') return '/';
- if (raw.startsWith('/')) {
- const parts = raw.split('/').filter(Boolean);
- if (parts.length > 0) return parts[parts.length - 1];
- }
- return raw;
-};
-
-const getWorstDiskPercent = (disks: Disk[]): number => {
- let worst = 0;
- for (const disk of disks) {
- const pct = getDiskUsagePercent(disk);
- if (pct > worst) worst = pct;
- }
- return worst;
-};
-
-const DISK_COUNT_BADGE_BASE =
- 'inline-flex items-center gap-1.5 rounded-md bg-surface-alt px-2 py-0.5 text-[11px] font-medium text-base-content';
-
-const ProxmoxHostDiskSubRow: Component<{
- disk: Disk;
- index: number;
- visibleColumns: ProxmoxHostTableColumn[];
-}> = (subProps) => {
- const percent = () => getDiskUsagePercent(subProps.disk);
- const fillPercent = () => Math.min(percent(), 100);
- const color = () => getMetricColorRgba(percent(), 'disk');
- const label = () => getDiskShortLabel(subProps.disk, subProps.index);
- const fullPath = () =>
- subProps.disk.mountpoint || subProps.disk.device || `Disk ${subProps.index + 1}`;
- const usedLabel = () => formatBytes(subProps.disk.used);
- const totalLabel = () =>
- subProps.disk.total > 0 ? formatBytes(subProps.disk.total) : '—';
-
- const diskIdx = () => subProps.visibleColumns.findIndex((c) => c.id === 'disk');
- const leadingColumns = () => subProps.visibleColumns.slice(0, diskIdx());
- const remainingAfterDisk = () => subProps.visibleColumns.length - diskIdx();
- // Span the Disk column plus up to two right neighbours so the row has room
- // for label/bar/percent/size without bleeding all the way to Cluster.
- const detailSpan = () => Math.min(remainingAfterDisk(), 3);
- const trailingColumns = () => subProps.visibleColumns.slice(diskIdx() + detailSpan());
-
- return (
- <TableRow class="text-[11px] bg-surface-alt/30">
- <For each={leadingColumns()}>
- {(column) => (
- <TableCell class={getPlatformTableCellClass(column.align)}>&nbsp;</TableCell>
- )}
- </For>
- <TableCell
- class={`${getPlatformTableCellClass('left')} text-muted`}
- colspan={detailSpan()}
- >
- <div
- class="flex items-center gap-2 min-w-0"
- title={`${fullPath()}: ${formatPercent(percent())} (${usedLabel()} / ${totalLabel()})`}
- >
- <span class="text-muted/70 select-none">└</span>
- <span class="font-mono text-base-content truncate max-w-[80px]">{label()}</span>
- <div class="relative h-2 w-20 shrink-0 rounded bg-surface-hover overflow-hidden">
- <div
- class="absolute inset-y-0 left-0 rounded"
- style={{ width: `${fillPercent()}%`, background: color() }}
- />
- </div>
- <span class="tabular-nums text-base-content w-[36px] text-right">
- {formatPercent(percent())}
- </span>
- <span class="tabular-nums text-muted whitespace-nowrap">
- {usedLabel()} / {totalLabel()}
- </span>
- </div>
- </TableCell>
- <For each={trailingColumns()}>
- {(column) => (
- <TableCell class={getPlatformTableCellClass(column.align)}>&nbsp;</TableCell>
- )}
- </For>
- </TableRow>
- );
-};
-
export const ProxmoxNodesTable: Component<{
nodes: Resource[];
guests: Resource[];
@@ -298,7 +205,6 @@ export const ProxmoxNodesTable: Component<{
? node.memory.current
: undefined;
const diskPercent = () => node.disk?.current ?? 0;
- const diskList = (): Disk[] => normalizeDiskArray(node.agent?.disks) ?? [];
const aggregateDisk = (): Disk | undefined =>
node.disk
? ({
@@ -427,32 +333,10 @@ export const ProxmoxNodesTable: Component<{
</div>
}
>
- <Show
- when={diskList().length > 1}
- fallback={
- <StackedDiskBar
- disks={diskList()}
- aggregateDisk={aggregateDisk()}
- />
- }
- >
- <span
- class={DISK_COUNT_BADGE_BASE}
- title={`${diskList().length} disks — worst ${formatPercent(getWorstDiskPercent(diskList()))}`}
- >
- <span
- class="inline-block h-2 w-2 rounded-full"
- style={{
- background: getMetricColorRgba(
- getWorstDiskPercent(diskList()),
- 'disk',
- ),
- }}
- aria-hidden="true"
- />
- {diskList().length} disks
- </span>
- </Show>
+ <StackedDiskBar
+ disks={normalizeDiskArray(node.agent?.disks)}
+ aggregateDisk={aggregateDisk()}
+ />
</Show>
}
>
@@ -508,22 +392,9 @@ export const ProxmoxNodesTable: Component<{
};
return (
- <>
- <TableRow class="text-[11px] sm:text-xs">
- <For each={visibleColumns()}>{(column) => renderColumnCell(column)}</For>
- </TableRow>
- <Show when={!isSparklineMode() && isOnline() && diskList().length > 1}>
- <For each={diskList()}>
- {(disk, index) => (
- <ProxmoxHostDiskSubRow
- disk={disk}
- index={index()}
- visibleColumns={visibleColumns()}
- />
- )}
- </For>
- </Show>
- </>
+ <TableRow class="text-[11px] sm:text-xs">
+ <For each={visibleColumns()}>{(column) => renderColumnCell(column)}</For>
+ </TableRow>
);
}}
</For>