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.

proxmox(drawers): write bar values on the fill, not in a key below

rcourtman8add51358bbe
diff --git a/frontend-modern/src/features/proxmox/ProxmoxCephClusterDrawer.tsx b/frontend-modern/src/features/proxmox/ProxmoxCephClusterDrawer.tsx
index a4f33a463d..ddff71a654 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxCephClusterDrawer.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxCephClusterDrawer.tsx
@@ -1,6 +1,7 @@
import { For, Show, type Component } from 'solid-js';
import XIcon from 'lucide-solid/icons/x';
import { Card } from '@/components/shared/Card';
+import { ProgressBar } from '@/components/shared/ProgressBar';
import { StatusDot } from '@/components/shared/StatusDot';
import type { StatusIndicatorVariant } from '@/utils/status';
import { formatBytes } from '@/utils/format';
@@ -36,64 +37,57 @@ function classifyService(svc: ResourceCephServiceMeta): {
return { variant: 'warning', label: 'Partial' };
}
+// Capacity utilization bar — matches the Workloads row convention:
+// the label sits on top of the fill, not in a legend below. Color
+// thresholds at 75%/90% match the rest of the app's storage bars.
+function capacityToneFor(percent: number): string {
+ if (percent >= 90) return 'bg-red-500 dark:bg-red-400';
+ if (percent >= 75) return 'bg-amber-500 dark:bg-amber-400';
+ return 'bg-emerald-500 dark:bg-emerald-400';
+}
+
function CapacityBar(props: {
used: number;
total: number;
percent: number;
}) {
const clamped = Math.max(0, Math.min(100, props.percent));
- const tone =
- clamped >= 90
- ? 'bg-red-500 dark:bg-red-400'
- : clamped >= 75
- ? 'bg-amber-500 dark:bg-amber-400'
- : 'bg-emerald-500 dark:bg-emerald-400';
const available = Math.max(0, props.total - props.used);
return (
- <div class="space-y-2">
- <div class="flex items-end justify-between gap-2">
- <div class="min-w-0">
- <div class="text-[10px] uppercase tracking-wide text-muted">Raw capacity</div>
- <div class="flex items-baseline gap-2 text-base-content">
- <span class="text-lg font-semibold tabular-nums">{clamped.toFixed(1)}%</span>
- <span class="text-[11px] text-muted tabular-nums">
- {formatBytes(props.used)} of {formatBytes(props.total)} used
+ <ProgressBar
+ value={clamped}
+ class="h-6"
+ fillClass={capacityToneFor(clamped)}
+ label={
+ <span class="absolute inset-0 flex items-center justify-between px-2 text-[11px] font-semibold text-base-content leading-none">
+ <span class="tabular-nums">
+ {clamped.toFixed(1)}%
+ <span class="ml-1 font-normal text-muted">
+ ({formatBytes(props.used)} of {formatBytes(props.total)})
</span>
- </div>
- </div>
- <div class="text-right">
- <div class="text-[10px] uppercase tracking-wide text-muted">Available</div>
- <div class="text-base-content tabular-nums text-[13px]">{formatBytes(available)}</div>
- </div>
- </div>
- <div
- class="relative h-2.5 w-full overflow-hidden rounded-full bg-surface-alt"
- role="progressbar"
- aria-valuenow={clamped}
- aria-valuemin={0}
- aria-valuemax={100}
- >
- <div
- class={`absolute inset-y-0 left-0 ${tone}`}
- style={{ width: `${clamped}%` }}
- />
- </div>
- </div>
+ </span>
+ <span class="tabular-nums font-normal text-muted">
+ {formatBytes(available)} free
+ </span>
+ </span>
+ }
+ />
);
}
function PoolUsageBar(props: { percent: number }) {
const clamped = Math.max(0, Math.min(100, props.percent));
- const tone =
- clamped >= 90
- ? 'bg-red-500 dark:bg-red-400'
- : clamped >= 75
- ? 'bg-amber-500 dark:bg-amber-400'
- : 'bg-emerald-500 dark:bg-emerald-400';
return (
- <div class="relative h-1.5 w-32 overflow-hidden rounded-full bg-surface-alt">
- <div class={`absolute inset-y-0 left-0 ${tone}`} style={{ width: `${clamped}%` }} />
- </div>
+ <ProgressBar
+ value={clamped}
+ class="h-4 w-32"
+ fillClass={capacityToneFor(clamped)}
+ label={
+ <span class="absolute inset-0 flex items-center justify-center text-[10px] font-semibold text-base-content leading-none tabular-nums">
+ {clamped.toFixed(1)}%
+ </span>
+ }
+ />
);
}
@@ -140,13 +134,12 @@ export const ProxmoxCephClusterDrawer: Component<{
</button>
</header>
- <Card padding="md">
- <CapacityBar
- used={usedCapacity()}
- total={totalCapacity()}
- percent={usagePercent()}
- />
- </Card>
+ <CapacityBar
+ used={usedCapacity()}
+ total={totalCapacity()}
+ percent={usagePercent()}
+ />
+
<div class="grid gap-3 lg:grid-cols-2">
<Card padding="md">
@@ -185,11 +178,8 @@ export const ProxmoxCephClusterDrawer: Component<{
{formatBytes(pool.availableBytes)}
</td>
<td class="py-2 text-right">
- <div class="flex items-center justify-end gap-2">
+ <div class="flex items-center justify-end">
<PoolUsageBar percent={pool.percentUsed} />
- <span class="w-12 text-right text-base-content tabular-nums">
- {pool.percentUsed.toFixed(1)}%
- </span>
</div>
</td>
</tr>
diff --git a/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx b/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx
index 74e5ea6866..30e4a5e3a5 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx
@@ -196,9 +196,10 @@ function SpamHistogram(props: { buckets: PMGSpamBucket[] }) {
);
}
-// InOutBar is a side-by-side bar comparing two paired values (e.g.
-// mail in vs mail out, spam in vs spam out). The taller bar fills
-// 100%, the other scales relative.
+// InOutBar shows paired values (e.g. mail in vs mail out) as two
+// adjacent half-bars sharing a max scale. The label sits ABOVE the
+// bar and the values sit ON the bar segments — matches the Workloads
+// MetricBar convention of writing the value on the fill.
function InOutBar(props: {
label: string;
inValue: number;
@@ -207,28 +208,28 @@ function InOutBar(props: {
}) {
const format = props.format ?? formatNumber;
const max = Math.max(props.inValue, props.outValue, 1);
+ const inWidth = (props.inValue / max) * 50;
+ const outWidth = (props.outValue / max) * 50;
return (
<div class="space-y-1">
- <div class="flex items-baseline justify-between text-[11px]">
- <span class="text-muted">{props.label}</span>
- <span class="font-mono text-[10px] text-muted">
- <span class="text-base-content font-semibold">{format(props.inValue)}</span>
- <span class="mx-1">/</span>
- <span class="text-base-content font-semibold">{format(props.outValue)}</span>
- </span>
- </div>
- <div class="flex h-1.5 w-full overflow-hidden rounded-full bg-surface-alt">
+ <div class="text-[11px] text-muted">{props.label}</div>
+ <div
+ class="relative flex h-4 w-full overflow-hidden rounded bg-surface-hover"
+ title={`In ${format(props.inValue)} · Out ${format(props.outValue)}`}
+ >
<div
- class="bg-blue-500 dark:bg-blue-400"
- style={{ width: `${(props.inValue / max) * 50}%` }}
- title={`In: ${format(props.inValue)}`}
+ class="relative bg-blue-500 dark:bg-blue-400"
+ style={{ width: `${inWidth}%` }}
/>
<div class="w-px bg-surface" />
<div
- class="bg-purple-500 dark:bg-purple-400"
- style={{ width: `${(props.outValue / max) * 50}%` }}
- title={`Out: ${format(props.outValue)}`}
+ class="relative bg-purple-500 dark:bg-purple-400"
+ style={{ width: `${outWidth}%` }}
/>
+ <span class="pointer-events-none absolute inset-0 flex items-center justify-between px-1.5 text-[10px] font-semibold text-base-content leading-none tabular-nums">
+ <span>In {format(props.inValue)}</span>
+ <span>Out {format(props.outValue)}</span>
+ </span>
</div>
</div>
);