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
import type { JSX } from 'solid-js';
import type { WorkloadTableLayoutMode } from '@/components/Workloads/guestRowModel';
import type { PlatformTableColumnKind } from '@/features/platformPage/columnAlignment';
import {
getPlatformTableWeightedColumnWidthStyle,
PLATFORM_TABLE_NARROW_IDENTITY_WIDTH_PERCENT,
PLATFORM_TABLE_PHONE_IDENTITY_WIDTH_PERCENT,
} from '@/features/platformPage/sharedPlatformPage';
export type ProxmoxHostTableColumnId =
'node' | 'version' | 'uptime' | 'cpu' | 'memory' | 'disk' | 'temp' | 'vms' | 'cts' | 'cluster';
export type ProxmoxHostTableColumn = {
id: ProxmoxHostTableColumnId;
label: string;
kind: PlatformTableColumnKind;
};
const HOST_TABLE_LAYOUT_ORDER: Record<WorkloadTableLayoutMode, number> = {
narrow: 0,
phone: 1,
mobile: 2,
tablet: 3,
compact: 4,
wide: 5,
};
const HOST_COLUMN_MIN_LAYOUT: Record<ProxmoxHostTableColumnId, WorkloadTableLayoutMode> = {
node: 'narrow',
cpu: 'narrow',
memory: 'narrow',
disk: 'narrow',
temp: 'mobile',
uptime: 'narrow',
cluster: 'tablet',
vms: 'compact',
cts: 'compact',
version: 'wide',
};
// CPU, memory, and disk render the same kind of usage bar, so they share
// weights (matches the workloads table below, where the three metric
// columns are all 140px). Node gets a little extra headroom for longer
// cluster-style names like "Disaster Recovery A"; the short-content
// columns (version pill, uptime, temp gauge, vms/cts badges, cluster
// pill) take only what they need.
const HOST_COLUMN_DESKTOP_WIDTHS: Record<ProxmoxHostTableColumnId, number> = {
node: 20,
version: 6,
uptime: 7,
cpu: 13,
memory: 13,
disk: 13,
temp: 6,
vms: 5,
cts: 5,
cluster: 12,
};
const HOST_COLUMN_RESPONSIVE_WEIGHTS: Record<
Exclude<WorkloadTableLayoutMode, 'wide'>,
Partial<Record<ProxmoxHostTableColumnId, number>>
> = {
narrow: {
node: 40,
cpu: 15,
memory: 15,
disk: 15,
uptime: 15,
},
// Phones carry the same five columns as the guest table below them. A sixth
// (temperature) left the node name with four characters, which made a
// cluster of "Analytics A".."F" rows unreadable.
phone: {
node: 32,
cpu: 15,
memory: 15,
disk: 15,
uptime: 15,
},
mobile: {
node: 32,
cpu: 13,
memory: 13,
disk: 13,
temp: 15,
uptime: 14,
},
tablet: {
node: 22,
cpu: 15,
memory: 15,
disk: 15,
temp: 8,
uptime: 11,
cluster: 14,
},
compact: {
node: 20,
cpu: 15,
memory: 15,
disk: 15,
temp: 7,
uptime: 8,
vms: 5,
cts: 5,
cluster: 10,
},
};
export const getProxmoxHostTableLayoutModeForContainer = (
width: number,
): WorkloadTableLayoutMode => {
if (Number.isFinite(width) && width < 360) return 'narrow';
if (Number.isFinite(width) && width < 440) return 'phone';
if (!Number.isFinite(width) || width < 800) return 'mobile';
if (width < 1040) return 'tablet';
if (width < 1320) return 'compact';
return 'wide';
};
// Column order follows the canonical recommended ordering documented in
// columnAlignment.ts: identity → context → bars (CPU/Memory/Disk
// contiguous) → diagnostic (Temp) → time (Uptime) → inventory counts
// → source context at end. Web-interface launches live beside the inert node
// name so every runtime table uses the canonical shared adjacent control
// instead of adding a separate action column.
export const PROXMOX_HOST_TABLE_COLUMNS: ProxmoxHostTableColumn[] = [
{ id: 'node', label: 'Node', kind: 'name' },
{ id: 'version', label: 'Version', kind: 'text' },
{ id: 'cpu', label: 'CPU', kind: 'metric-bar' },
{ id: 'memory', label: 'Memory', kind: 'metric-bar' },
{ id: 'disk', label: 'Disk', kind: 'metric-bar' },
{ id: 'temp', label: 'Temp', kind: 'numeric-value' },
{ id: 'uptime', label: 'Uptime', kind: 'numeric-value' },
{ id: 'vms', label: 'VMs', kind: 'numeric-value' },
{ id: 'cts', label: 'CTs', kind: 'numeric-value' },
{ id: 'cluster', label: 'Cluster', kind: 'text' },
];
export const getProxmoxHostVisibleColumnsForLayout = (
layoutMode: WorkloadTableLayoutMode,
options: { singleCluster?: boolean } = {},
): ProxmoxHostTableColumn[] => {
const layoutRank = HOST_TABLE_LAYOUT_ORDER[layoutMode];
return PROXMOX_HOST_TABLE_COLUMNS.filter(
(column) =>
HOST_TABLE_LAYOUT_ORDER[HOST_COLUMN_MIN_LAYOUT[column.id]] <= layoutRank &&
// When every node shares one cluster the column repeats one value on
// every row; the table header names that cluster instead.
!(options.singleCluster && column.id === 'cluster'),
);
};
// The node cell carries the expansion toggle and status dot before the name,
// so it needs more than the shared 30% phone identity anchor to show a
// typical node name whole.
const PROXMOX_HOST_PHONE_IDENTITY_WIDTH_PERCENT = 38;
export const getProxmoxHostColumnWidthStyle = (
columnId: ProxmoxHostTableColumnId,
layoutMode: WorkloadTableLayoutMode,
visibleColumnIds: readonly ProxmoxHostTableColumnId[],
): JSX.CSSProperties => {
const weights =
layoutMode === 'wide' ? HOST_COLUMN_DESKTOP_WIDTHS : HOST_COLUMN_RESPONSIVE_WEIGHTS[layoutMode];
return getPlatformTableWeightedColumnWidthStyle(
columnId,
weights,
visibleColumnIds,
layoutMode === 'narrow'
? { columnId: 'node', widthPercent: PLATFORM_TABLE_NARROW_IDENTITY_WIDTH_PERCENT }
: layoutMode === 'phone'
? { columnId: 'node', widthPercent: PROXMOX_HOST_PHONE_IDENTITY_WIDTH_PERCENT }
: layoutMode === 'mobile'
? { columnId: 'node', widthPercent: PLATFORM_TABLE_PHONE_IDENTITY_WIDTH_PERCENT }
: undefined,
);
};
// The compact identity-plus-metrics layout is deliberately percentage based,
// so it can use the actual phone-width container without a hidden horizontal
// rail. Wider modes retain progressively larger floors so their extra context
// does not collapse into unreadable labels.
export const getProxmoxHostTableMinWidthClass = (
layoutMode: WorkloadTableLayoutMode,
): 'min-w-0' | 'min-w-200' | 'min-w-5xl' | 'min-w-[1240px]' => {
if (layoutMode === 'narrow' || layoutMode === 'phone' || layoutMode === 'mobile') {
return 'min-w-0';
}
if (layoutMode === 'tablet') return 'min-w-200';
if (layoutMode === 'compact') return 'min-w-5xl';
return 'min-w-[1240px]';
};