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
Apply canonical column alignment to shared workloads table
rcourtman6d2faf66bf7f
diff --git a/frontend-modern/src/components/Workloads/WorkloadTableHeader.tsx b/frontend-modern/src/components/Workloads/WorkloadTableHeader.tsxindex b93b77c54d..2419bd0f74 100644--- a/frontend-modern/src/components/Workloads/WorkloadTableHeader.tsx+++ b/frontend-modern/src/components/Workloads/WorkloadTableHeader.tsx@@ -1,6 +1,10 @@import { For } from 'solid-js';import { TableHead, TableHeader, TableRow } from '@/components/shared/Table';+import {+ getPlatformColumnAlign,+ type PlatformTableColumnKind,+} from '@/features/platformPage/columnAlignment';import { getGuestColumnStyle } from './guestRowModel';import type { WorkloadsState, WorkloadSortKey } from './useWorkloadsState';@@ -17,6 +21,26 @@ type WorkloadTableHeaderProps = Pick<| 'workloadTableVisibleColumns'>;+// Canonical alignment per column kind (see+// frontend-modern/src/features/platformPage/columnAlignment.ts).+// 'name' is forced to left because the first column is always the+// primary identifier regardless of how the column model labels it.+// Unknown / unset kinds fall back to text → left.+const resolveAlignClasses = (+ kind: PlatformTableColumnKind | undefined,+ isFirst: boolean,+): { textAlign: string; flexJustify: string } => {+ const effectiveKind: PlatformTableColumnKind = isFirst ? 'name' : (kind ?? 'text');+ const align = getPlatformColumnAlign(effectiveKind);+ if (align === 'right') {+ return { textAlign: 'text-right', flexJustify: 'justify-end' };+ }+ if (align === 'center') {+ return { textAlign: 'text-center', flexJustify: 'justify-center' };+ }+ return { textAlign: 'text-left', flexJustify: 'justify-start' };+};+export function WorkloadTableHeader(props: WorkloadTableHeaderProps) {return (<TableHeader>@@ -24,7 +48,7 @@ export function WorkloadTableHeader(props: WorkloadTableHeaderProps) {<For each={props.workloadTableVisibleColumns()}>{(col) => {const isFirst = () => col.id === props.visibleColumns()[0]?.id;- const isLeftAlignedTextColumn = () => isFirst() || col.id === 'image';+ const alignClasses = () => resolveAlignClasses(col.kind, isFirst());const sortKeyForCol = col.sortKey as WorkloadSortKey | undefined;const isSortable = !!sortKeyForCol;const isSorted = () => sortKeyForCol && props.sortKey() === sortKeyForCol;@@ -32,7 +56,7 @@ export function WorkloadTableHeader(props: WorkloadTableHeaderProps) {return (<TableHeadclass={`py-0.5 text-[11px] sm:text-xs font-medium uppercase tracking-wider whitespace-nowrap- ${isFirst() ? 'pl-2 sm:pl-3 pr-1.5 sm:pr-2' : 'px-1.5 sm:px-2'} ${isLeftAlignedTextColumn() ? 'text-left' : 'text-center'} align-middle+ ${isFirst() ? 'pl-2 sm:pl-3 pr-1.5 sm:pr-2' : 'px-1.5 sm:px-2'} ${alignClasses().textAlign} align-middle${isSortable ? 'cursor-pointer hover:bg-surface-hover' : ''}`}data-workload-col={col.id}style={getGuestColumnStyle(@@ -45,7 +69,7 @@ export function WorkloadTableHeader(props: WorkloadTableHeaderProps) {title={col.icon ? col.label : undefined}><div- class={`flex min-h-[14px] items-center gap-0.5 ${isLeftAlignedTextColumn() ? 'justify-start' : 'justify-center'}`}+ class={`flex min-h-[14px] items-center gap-0.5 ${alignClasses().flexJustify}`}>{col.icon ? (<>diff --git a/frontend-modern/src/components/Workloads/guestRowModel.tsx b/frontend-modern/src/components/Workloads/guestRowModel.tsxindex 28d96bfc90..c882c8a0f4 100644--- a/frontend-modern/src/components/Workloads/guestRowModel.tsx+++ b/frontend-modern/src/components/Workloads/guestRowModel.tsx@@ -161,6 +161,7 @@ export const GUEST_COLUMNS: ColumnDef[] = [minWidth: '180px',maxWidth: '220px',sortKey: 'name',+ kind: 'name',},{id: 'runtime',@@ -169,13 +170,14 @@ export const GUEST_COLUMNS: ColumnDef[] = [minWidth: '74px',maxWidth: '96px',toggleable: true,+ kind: 'text',},createVisibleCanonicalTypeColumn(),- { id: 'info', label: 'Info', width: '100px' },- { id: 'vmid', label: 'ID', width: '45px', sortKey: 'vmid' },- { id: 'cpu', label: 'CPU', width: '140px', sortKey: 'cpu' },- { id: 'memory', label: 'Mem', width: '140px', sortKey: 'memory' },- { id: 'disk', label: 'Disk', width: '140px', toggleable: true, sortKey: 'disk' },+ { id: 'info', label: 'Info', width: '100px', kind: 'numeric-value' },+ { id: 'vmid', label: 'ID', width: '45px', sortKey: 'vmid', kind: 'numeric-value' },+ { id: 'cpu', label: 'CPU', width: '140px', sortKey: 'cpu', kind: 'metric-bar' },+ { id: 'memory', label: 'Mem', width: '140px', sortKey: 'memory', kind: 'metric-bar' },+ { id: 'disk', label: 'Disk', width: '140px', toggleable: true, sortKey: 'disk', kind: 'metric-bar' },{id: 'ip',label: 'IP',@@ -191,6 +193,7 @@ export const GUEST_COLUMNS: ColumnDef[] = [),width: '45px',toggleable: true,+ kind: 'text',},{id: 'uptime',@@ -208,6 +211,7 @@ export const GUEST_COLUMNS: ColumnDef[] = [width: '60px',toggleable: true,sortKey: 'uptime',+ kind: 'numeric-value',},{id: 'node',@@ -225,6 +229,7 @@ export const GUEST_COLUMNS: ColumnDef[] = [width: '70px',toggleable: true,sortKey: 'node',+ kind: 'text',},{id: 'image',@@ -244,6 +249,7 @@ export const GUEST_COLUMNS: ColumnDef[] = [minWidth: '120px',toggleable: true,sortKey: 'image',+ kind: 'text',},{id: 'namespace',@@ -263,6 +269,7 @@ export const GUEST_COLUMNS: ColumnDef[] = [minWidth: '90px',toggleable: true,sortKey: 'namespace',+ kind: 'text',},{id: 'context',@@ -281,6 +288,7 @@ export const GUEST_COLUMNS: ColumnDef[] = [minWidth: '100px',toggleable: true,sortKey: 'contextLabel',+ kind: 'text',},{id: 'backup',@@ -297,6 +305,7 @@ export const GUEST_COLUMNS: ColumnDef[] = [),width: '50px',toggleable: true,+ kind: 'badge',},{id: 'tags',@@ -313,8 +322,9 @@ export const GUEST_COLUMNS: ColumnDef[] = [),width: '60px',toggleable: true,+ kind: 'badge',},- { id: 'os', label: 'OS', width: '45px', toggleable: true },+ { id: 'os', label: 'OS', width: '45px', toggleable: true, kind: 'badge' },{id: 'netIo',label: 'Net I/O',@@ -322,6 +332,7 @@ export const GUEST_COLUMNS: ColumnDef[] = [minWidth: '170px',toggleable: true,sortKey: 'netIo',+ kind: 'numeric-value',},{id: 'diskIo',@@ -330,8 +341,9 @@ export const GUEST_COLUMNS: ColumnDef[] = [minWidth: '170px',toggleable: true,sortKey: 'diskIo',+ kind: 'numeric-value',},- { id: 'update', label: 'Update', width: '86px', toggleable: true },+ { id: 'update', label: 'Update', width: '86px', toggleable: true, kind: 'badge' },];const GUEST_COLUMN_BY_ID = new Map(GUEST_COLUMNS.map((column) => [column.id, column] as const));diff --git a/frontend-modern/src/hooks/useColumnVisibility.ts b/frontend-modern/src/hooks/useColumnVisibility.tsindex d11938a5aa..6c81c1ce71 100644--- a/frontend-modern/src/hooks/useColumnVisibility.ts+++ b/frontend-modern/src/hooks/useColumnVisibility.ts@@ -1,5 +1,6 @@import { createEffect, createMemo, Accessor } from 'solid-js';import type { JSX } from 'solid-js';+import type { PlatformTableColumnKind } from '@/features/platformPage/columnAlignment';import { usePersistentSignal } from './usePersistentSignal';export interface ColumnDef {@@ -13,6 +14,11 @@ export interface ColumnDef {maxWidth?: string;flex?: number;sortKey?: string;+ // Canonical column kind for header / cell alignment. See+ // `frontend-modern/src/features/platformPage/columnAlignment.ts` for the+ // kind → align mapping and rationale. Optional so consumers that don't+ // care about platform-table alignment can omit it.+ kind?: PlatformTableColumnKind;}const normalizePersistedColumnIds = (diff --git a/frontend-modern/src/utils/typeColumnDefinition.ts b/frontend-modern/src/utils/typeColumnDefinition.tsindex ec163cb966..03354c07c5 100644--- a/frontend-modern/src/utils/typeColumnDefinition.ts+++ b/frontend-modern/src/utils/typeColumnDefinition.ts@@ -13,6 +13,7 @@ const createCanonicalTypeColumn = (id: TYPE_COLUMN_ID,label: TYPE_COLUMN_LABEL,toggleable: true,+ kind: 'badge',...options,};};