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
Improve hosts disk display and column sizing
rcourtman9b07568195b6
diff --git a/frontend-modern/src/components/Dashboard/StackedDiskBar.tsx b/frontend-modern/src/components/Dashboard/StackedDiskBar.tsxindex 158b311912..d2a9259e01 100644--- a/frontend-modern/src/components/Dashboard/StackedDiskBar.tsx+++ b/frontend-modern/src/components/Dashboard/StackedDiskBar.tsx@@ -9,6 +9,8 @@ interface StackedDiskBarProps {disks?: Disk[];/** Aggregate disk data (fallback when disks array unavailable) */aggregateDisk?: Disk;+ /** Display mode for multi-disk hosts */+ mode?: 'stacked' | 'aggregate' | 'mini';/** Baseline anomaly if detected */anomaly?: AnomalyReport | null;}@@ -78,10 +80,9 @@ export function StackedDiskBar(props: StackedDiskBarProps) {return disks && disks.length > 1;});- const hasSingleDisk = createMemo(() => {- const disks = props.disks;- return disks && disks.length === 1;- });+ const aggregateMode = createMemo(() => props.mode === 'aggregate');+ const miniMode = createMemo(() => props.mode === 'mini');+ const useStackedSegments = createMemo(() => hasMultipleDisks() && !aggregateMode() && !miniMode());// Calculate total capacity across all disksconst totalCapacity = createMemo(() => {@@ -104,23 +105,11 @@ export function StackedDiskBar(props: StackedDiskBarProps) {return (totalUsed() / total) * 100;});- // For single disk or aggregate, get the percentage- const singleDiskPercent = createMemo(() => {- if (hasSingleDisk() && props.disks?.[0]) {- const disk = props.disks[0];- if (!disk.total || disk.total <= 0) return 0;- return (disk.used / disk.total) * 100;- }- if (props.aggregateDisk) {- if (!props.aggregateDisk.total || props.aggregateDisk.total <= 0) return 0;- return (props.aggregateDisk.used / props.aggregateDisk.total) * 100;- }- return 0;- });+ const barPercent = createMemo(() => Math.min(overallPercent(), 100));// Calculate segment widths for stacked bar (each disk's used space as % of total capacity)const segments = createMemo(() => {- if (!hasMultipleDisks() || !props.disks) return [];+ if (!useStackedSegments() || !props.disks) return [];const total = totalCapacity();if (total <= 0) return [];@@ -147,8 +136,58 @@ export function StackedDiskBar(props: StackedDiskBarProps) {return props.disks && props.disks.length > 0;});+ const miniDisks = createMemo(() => {+ if (!props.disks) return [];+ return props.disks.map((disk, idx) => {+ const percent = disk.total > 0 ? (disk.used / disk.total) * 100 : 0;+ const label = disk.mountpoint || disk.device || `Disk ${idx + 1}`;+ return {+ label,+ percent,+ color: getUsageColor(percent),+ };+ });+ });++ const maxDiskInfo = createMemo(() => {+ if (!props.disks || props.disks.length === 0) return null;+ let maxPercent = -1;+ let maxLabel = '';+ for (const disk of props.disks) {+ const percent = disk.total > 0 ? (disk.used / disk.total) * 100 : 0;+ if (percent > maxPercent) {+ maxPercent = percent;+ maxLabel = disk.mountpoint || disk.device || 'Disk';+ }+ }+ if (maxPercent < 0) return null;+ return { percent: maxPercent, label: maxLabel };+ });++ const maxLabelShort = createMemo(() => {+ const info = maxDiskInfo();+ if (!info) return '';+ return `max ${formatPercent(info.percent)}`;+ });++ const maxLabelFull = createMemo(() => {+ const info = maxDiskInfo();+ if (!info) return '';+ if (info.label) return `Max ${formatPercent(info.percent)} (${info.label})`;+ return `Max ${formatPercent(info.percent)}`;+ });++ const barColor = createMemo(() => {+ const info = maxDiskInfo();+ if (aggregateMode() && hasMultipleDisks() && info) {+ return getUsageColor(info.percent);+ }+ return getUsageColor(overallPercent());+ });+// Generate tooltip contentconst tooltipContent = createMemo(() => {+ const useUsageColors = aggregateMode() || miniMode();if (hasDisks() && props.disks) {return props.disks.map((disk, idx) => {const percent = disk.total > 0 ? (disk.used / disk.total) * 100 : 0;@@ -158,9 +197,13 @@ export function StackedDiskBar(props: StackedDiskBarProps) {used: formatBytes(disk.used, 0),total: formatBytes(disk.total, 0),percent: formatPercent(percent),- color: percent >= 90 ? getUsageColor(90) :- percent >= 80 ? getUsageColor(80) :- SEGMENT_COLORS[idx % SEGMENT_COLORS.length],+ color: useUsageColors+ ? getUsageColor(percent)+ : percent >= 90+ ? getUsageColor(90)+ : percent >= 80+ ? getUsageColor(80)+ : SEGMENT_COLORS[idx % SEGMENT_COLORS.length],};});}@@ -180,10 +223,7 @@ export function StackedDiskBar(props: StackedDiskBarProps) {// Label for the barconst displayLabel = createMemo(() => {- if (hasMultipleDisks()) {- return formatPercent(overallPercent());- }- return formatPercent(singleDiskPercent());+ return formatPercent(overallPercent());});// Sublabel showing used/total@@ -191,12 +231,27 @@ export function StackedDiskBar(props: StackedDiskBarProps) {return `${formatBytes(totalUsed(), 0)}/${formatBytes(totalCapacity(), 0)}`;});+ const showMaxLabel = createMemo(() => {+ if (!aggregateMode() || !hasMultipleDisks()) return false;+ const shortLabel = maxLabelShort();+ if (!shortLabel) return false;+ const fullText = `${displayLabel()} ${shortLabel}`;+ return containerWidth() >= estimateTextWidth(fullText);+ });+// Check if sublabel fitsconst showSublabel = createMemo(() => {- const fullText = `${displayLabel()} (${displaySublabel()})`;+ const baseText = `${displayLabel()}${showMaxLabel() ? ` ${maxLabelShort()}` : ''}`;+ const fullText = `${baseText} (${displaySublabel()})`;return containerWidth() >= estimateTextWidth(fullText);});+ const containerClass = createMemo(() => {+ return miniMode() && hasDisks()+ ? 'metric-text w-full'+ : 'metric-text w-full h-4 flex items-center justify-center';+ });+const handleMouseEnter = (e: MouseEvent) => {if (tooltipContent().length > 0) {const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();@@ -210,67 +265,108 @@ export function StackedDiskBar(props: StackedDiskBarProps) {};return (- <div ref={containerRef} class="metric-text w-full h-4 flex items-center justify-center">- <div- class="relative w-full h-full overflow-hidden bg-gray-200 dark:bg-gray-600 rounded"- onMouseEnter={handleMouseEnter}- onMouseLeave={handleMouseLeave}- >- {/* Stacked segments for multiple disks */}- <Show when={hasMultipleDisks()}>- <div class="absolute top-0 left-0 h-full w-full flex">- <For each={segments()}>- {(segment, idx) => (- <div- class="h-full"- style={{- width: `${segment.widthPercent}%`,- 'background-color': segment.color,- 'border-right': idx() < segments().length - 1 ? '1px solid rgba(255,255,255,0.3)' : 'none',- }}- />- )}- </For>- </div>- </Show>-- {/* Single bar for single disk or aggregate */}- <Show when={!hasMultipleDisks()}>+ <div ref={containerRef} class={containerClass()}>+ <Show+ when={miniMode() && hasDisks()}+ fallback={<div- class="absolute top-0 left-0 h-full"- style={{- width: `${Math.min(singleDiskPercent(), 100)}%`,- 'background-color': getUsageColor(singleDiskPercent()),- }}- />- </Show>-- {/* Label overlay */}- <span class="absolute inset-0 flex items-center justify-center text-[10px] font-semibold text-gray-700 dark:text-gray-100 leading-none">- <span class="flex items-center gap-1 whitespace-nowrap px-0.5">- <span>{displayLabel()}</span>- <Show when={showSublabel()}>- <span class="metric-sublabel font-normal text-gray-500 dark:text-gray-300">- ({displaySublabel()})- </span>+ class="relative w-full h-full overflow-hidden bg-gray-200 dark:bg-gray-600 rounded"+ onMouseEnter={handleMouseEnter}+ onMouseLeave={handleMouseLeave}+ >+ {/* Stacked segments for multiple disks */}+ <Show when={useStackedSegments()}>+ <div class="absolute top-0 left-0 h-full w-full flex">+ <For each={segments()}>+ {(segment, idx) => (+ <div+ class="h-full"+ style={{+ width: `${segment.widthPercent}%`,+ 'background-color': segment.color,+ 'border-right': idx() < segments().length - 1 ? '1px solid rgba(255,255,255,0.3)' : 'none',+ }}+ />+ )}+ </For>+ </div></Show>- <Show when={hasMultipleDisks()}>- <span class="text-[8px] font-normal text-gray-500 dark:text-gray-400">- [{props.disks?.length}]- </span>++ {/* Single bar for aggregate or single disk */}+ <Show when={!useStackedSegments()}>+ <div+ class="absolute top-0 left-0 h-full"+ style={{+ width: `${barPercent()}%`,+ 'background-color': barColor(),+ }}+ /></Show>- {/* Anomaly indicator */}- <Show when={props.anomaly && anomalyRatio()}>- <span- class={`ml-0.5 font-bold animate-pulse ${anomalySeverityClass[props.anomaly!.severity] || 'text-yellow-400'}`}- title={props.anomaly!.description}- >- {anomalyRatio()}++ {/* Label overlay */}+ <span class="absolute inset-0 flex items-center justify-center text-[10px] font-semibold text-gray-700 dark:text-gray-100 leading-none">+ <span class="flex items-center gap-1 whitespace-nowrap px-0.5">+ <span>{displayLabel()}</span>+ <Show when={showMaxLabel()}>+ <span+ class="text-[8px] font-normal text-gray-500 dark:text-gray-400"+ title={maxLabelFull()}+ >+ {maxLabelShort()}+ </span>+ </Show>+ <Show when={showSublabel()}>+ <span class="metric-sublabel font-normal text-gray-500 dark:text-gray-300">+ ({displaySublabel()})+ </span>+ </Show>+ <Show when={useStackedSegments()}>+ <span class="text-[8px] font-normal text-gray-500 dark:text-gray-400">+ [{props.disks?.length}]+ </span>+ </Show>+ {/* Anomaly indicator */}+ <Show when={props.anomaly && anomalyRatio()}>+ <span+ class={`ml-0.5 font-bold animate-pulse ${anomalySeverityClass[props.anomaly!.severity] || 'text-yellow-400'}`}+ title={props.anomaly!.description}+ >+ {anomalyRatio()}+ </span>+ </Show></span>- </Show>- </span>- </span>- </div>+ </span>+ </div>+ }+ >+ <div class="w-full" onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>+ <div+ class="grid gap-1"+ style={{+ 'grid-template-columns': `repeat(${miniDisks().length}, minmax(0, 1fr))`,+ }}+ >+ <For each={miniDisks()}>+ {(disk) => (+ <div class="flex flex-col items-stretch gap-0.5">+ <span class="text-[8px] text-gray-500 dark:text-gray-400 truncate" title={disk.label}>+ {disk.label}+ </span>+ <div class="relative h-2.5 rounded-sm bg-gray-300/70 dark:bg-gray-500/70 overflow-hidden">+ <div+ class="h-full"+ style={{+ width: `${Math.min(disk.percent, 100)}%`,+ 'background-color': disk.color,+ }}+ />+ </div>+ </div>+ )}+ </For>+ </div>+ </div>+ </Show>{/* Tooltip for disk breakdown */}<Show when={showTooltip() && tooltipContent().length > 0}>@@ -289,16 +385,27 @@ export function StackedDiskBar(props: StackedDiskBarProps) {</div><For each={tooltipContent()}>{(item, idx) => (- <div class="flex justify-between gap-3 py-0.5" classList={{ 'border-t border-gray-700/50': idx() > 0 }}>- <span- class="truncate max-w-[100px]"- style={{ color: item.color }}- >- {item.label}- </span>- <span class="whitespace-nowrap text-gray-300">- {item.percent} ({item.used}/{item.total})- </span>+ <div class="flex flex-col gap-1 py-0.5" classList={{ 'border-t border-gray-700/50': idx() > 0 }}>+ <div class="flex justify-between gap-3">+ <span+ class="truncate max-w-[100px]"+ style={{ color: item.color }}+ >+ {item.label}+ </span>+ <span class="whitespace-nowrap text-gray-300">+ {item.percent} ({item.used}/{item.total})+ </span>+ </div>+ <div class="h-1.5 w-full rounded bg-gray-700/70 overflow-hidden">+ <div+ class="h-full"+ style={{+ width: item.percent,+ 'background-color': item.color,+ }}+ />+ </div></div>)}</For>diff --git a/frontend-modern/src/components/Hosts/HostsOverview.tsx b/frontend-modern/src/components/Hosts/HostsOverview.tsxindex 6e11a0b0ab..446608d60d 100644--- a/frontend-modern/src/components/Hosts/HostsOverview.tsx+++ b/frontend-modern/src/components/Hosts/HostsOverview.tsx@@ -18,6 +18,7 @@ import { EnhancedCPUBar } from '@/components/Dashboard/EnhancedCPUBar';import { useBreakpoint, type ColumnPriority } from '@/hooks/useBreakpoint';import { useColumnVisibility } from '@/hooks/useColumnVisibility';import { aiChatStore } from '@/stores/aiChat';+import { STORAGE_KEYS } from '@/utils/localStorage';import { useResourcesAsLegacy } from '@/hooks/useResources';import { useAlertsActivation } from '@/stores/alertsActivation';@@ -41,11 +42,11 @@ export interface HostColumnDef {// Host table column definitions - all essential for horizontal scroll like Dockerexport const HOST_COLUMNS: HostColumnDef[] = [// Core columns - all essential (visible on all screens with horizontal scroll)- { id: 'name', label: 'Host', priority: 'essential', width: '100px', sortKey: 'name' },- { id: 'platform', label: 'Platform', priority: 'essential', width: '70px', sortKey: 'platform' },+ { id: 'name', label: 'Host', priority: 'essential', width: '210px', sortKey: 'name' },+ { id: 'platform', label: 'Platform', priority: 'essential', width: '110px', sortKey: 'platform' },{ id: 'cpu', label: 'CPU', priority: 'essential', width: '60px', sortKey: 'cpu' },{ id: 'memory', label: 'Memory', priority: 'essential', width: '60px', sortKey: 'memory' },- { id: 'disk', label: 'Disk', priority: 'essential', width: '60px', sortKey: 'disk' },+ { id: 'disk', label: 'Disk', priority: 'essential', width: '220px', sortKey: 'disk' },// Additional columns - essential but toggleable by user{ id: 'temp', label: 'Temp', icon: <svg class="w-3.5 h-3.5 block" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" /></svg>, priority: 'essential', width: '50px', toggleable: true },@@ -961,30 +962,30 @@ export const HostsOverview: Component = () => {<Card padding="none" tone="glass" class="overflow-hidden"><div class="overflow-x-auto" style="scrollbar-width: none; -ms-overflow-style: none;"><style>{`.overflow-x-auto::-webkit-scrollbar { display: none; }`}</style>- <table class="w-full border-collapse whitespace-nowrap" style={{ "min-width": "800px" }}>+ <table class="w-full border-collapse whitespace-nowrap" style={{ "table-layout": "fixed", "min-width": "800px" }}><thead><tr class="bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 border-b border-gray-200 dark:border-gray-700">{/* Essential columns */}- <th class={`${thClass} text-left pl-4`} onClick={() => handleSort('name')}>+ <th class={`${thClass} text-left pl-4`} style={{ "width": isMobile() ? "140px" : "210px" }} onClick={() => handleSort('name')}>Host {renderSortIndicator('name')}</th><Show when={isColVisible('platform')}>- <th class={thClass} onClick={() => handleSort('platform')}>+ <th class={thClass} style={{ "width": isMobile() ? "100px" : "120px" }} onClick={() => handleSort('platform')}>Platform {renderSortIndicator('platform')}</th></Show><Show when={isColVisible('cpu')}>- <th class={thClass} style={{ "min-width": isMobile() ? "60px" : "140px" }} onClick={() => handleSort('cpu')}>+ <th class={thClass} style={{ "width": isMobile() ? "60px" : "140px" }} onClick={() => handleSort('cpu')}>CPU {renderSortIndicator('cpu')}</th></Show><Show when={isColVisible('memory')}>- <th class={thClass} style={{ "min-width": isMobile() ? "60px" : "140px" }} onClick={() => handleSort('memory')}>+ <th class={thClass} style={{ "width": isMobile() ? "60px" : "140px" }} onClick={() => handleSort('memory')}>Memory {renderSortIndicator('memory')}</th></Show><Show when={isColVisible('disk')}>- <th class={thClass} style={{ "min-width": isMobile() ? "60px" : "140px" }} onClick={() => handleSort('disk')}>+ <th class={thClass} style={{ "width": isMobile() ? "90px" : "220px" }} onClick={() => handleSort('disk')}>Disk {renderSortIndicator('disk')}</th></Show>@@ -1182,7 +1183,7 @@ const HostRow: Component<HostRowProps> = (props) => {<><tr class={rowClass()} onClick={handleRowClick}>{/* Host Name - always visible */}- <td class="pl-4 pr-2 py-1 align-middle">+ <td class="pl-4 pr-2 py-1 align-middle overflow-hidden"><div class="flex items-center gap-2 min-w-0"><StatusDotvariant={hostStatus().variant}@@ -1190,18 +1191,21 @@ const HostRow: Component<HostRowProps> = (props) => {ariaLabel={hostStatus().label}size="xs"/>- <div class="min-w-0 flex items-center gap-1.5 group/name">- <div>- <p class="text-sm font-semibold text-gray-900 dark:text-gray-100 whitespace-nowrap">+ <div class="min-w-0 flex items-center gap-1.5 group/name flex-1">+ <div class="min-w-0 flex-1">+ <p+ class="text-sm font-semibold text-gray-900 dark:text-gray-100 truncate"+ title={props.host.displayName || props.host.hostname || props.host.id}+ >{props.host.displayName || props.host.hostname || props.host.id}</p><Show when={props.host.displayName && props.host.displayName !== props.host.hostname}>- <p class="text-xs text-gray-500 dark:text-gray-400 mt-0.5 whitespace-nowrap">+ <p class="text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate" title={props.host.hostname}>{props.host.hostname}</p></Show><Show when={props.host.lastSeen}>- <p class="text-[10px] text-gray-500 dark:text-gray-400 mt-0.5 whitespace-nowrap">+ <p class="text-[10px] text-gray-500 dark:text-gray-400 mt-0.5 truncate">Updated {formatRelativeTime(props.host.lastSeen!)}</p></Show>@@ -1250,17 +1254,18 @@ const HostRow: Component<HostRowProps> = (props) => {</svg></span></Show>+</div></div></td>{/* Platform */}<Show when={props.isColVisible('platform')}>- <td class="px-2 py-1 align-middle">- <div class="text-xs text-gray-700 dark:text-gray-300">- <p class="font-medium capitalize whitespace-nowrap">{props.host.platform || '—'}</p>+ <td class="px-2 py-1 align-middle overflow-hidden">+ <div class="text-xs text-gray-700 dark:text-gray-300 min-w-0">+ <p class="font-medium capitalize truncate" title={props.host.platform || '—'}>{props.host.platform || '—'}</p><Show when={props.host.osName}>- <p class="text-[10px] text-gray-500 dark:text-gray-400 mt-0.5 whitespace-nowrap">+ <p class="text-[10px] text-gray-500 dark:text-gray-400 mt-0.5 truncate" title={`${props.host.osName} ${props.host.osVersion}`.trim()}>{props.host.osName} {props.host.osVersion}</p></Show>@@ -1270,7 +1275,7 @@ const HostRow: Component<HostRowProps> = (props) => {{/* CPU */}<Show when={props.isColVisible('cpu')}>- <td class="px-2 py-1 align-middle" style={{ "min-width": props.isMobile() ? "60px" : "140px", "width": props.isMobile() ? undefined : "140px", "max-width": props.isMobile() ? undefined : "140px" }}>+ <td class="px-2 py-1 align-middle"><Show when={isOnline()} fallback={<div class="flex justify-center"><span class="text-xs text-gray-400">—</span></div>}><EnhancedCPUBarusage={cpuPercent()}@@ -1283,7 +1288,7 @@ const HostRow: Component<HostRowProps> = (props) => {{/* Memory */}<Show when={props.isColVisible('memory')}>- <td class="px-2 py-1 align-middle" style={{ "min-width": props.isMobile() ? "60px" : "140px", "width": props.isMobile() ? undefined : "140px", "max-width": props.isMobile() ? undefined : "140px" }}>+ <td class="px-2 py-1 align-middle"><Show when={isOnline()} fallback={<div class="flex justify-center"><span class="text-xs text-gray-400">—</span></div>}><StackedMemoryBarused={props.host.memory?.used || 0}@@ -1298,10 +1303,11 @@ const HostRow: Component<HostRowProps> = (props) => {{/* Disk */}<Show when={props.isColVisible('disk')}>- <td class="px-2 py-1 align-middle" style={{ "min-width": props.isMobile() ? "60px" : "140px", "width": props.isMobile() ? undefined : "140px", "max-width": props.isMobile() ? undefined : "140px" }}>+ <td class="px-2 py-1 align-middle"><Show when={isOnline()} fallback={<div class="flex justify-center"><span class="text-xs text-gray-400">—</span></div>}><StackedDiskBardisks={props.host.disks}+ mode="mini"aggregateDisk={{total: diskStats().total,used: diskStats().used,