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.

fix(ui): Show single-point sparkline as horizontal line

rcourtmane1b37c8acc15
diff --git a/frontend-modern/src/components/AI/AICostDashboard.tsx b/frontend-modern/src/components/AI/AICostDashboard.tsx
index 3a1a28b826..dae6d65c50 100644
--- a/frontend-modern/src/components/AI/AICostDashboard.tsx
+++ b/frontend-modern/src/components/AI/AICostDashboard.tsx
@@ -34,7 +34,14 @@ const TinySparkline: Component<{
const max = Math.max(...values, 0);
const safeMax = max <= 0 ? 1 : max;
- const xStep = values.length <= 1 ? 0 : w / (values.length - 1);
+ // For single point, draw a horizontal line across the middle
+ if (values.length === 1) {
+ const y = h - (Math.max(0, values[0]) / safeMax) * h;
+ // Draw a short horizontal line to make the single point visible
+ return `M0,${y.toFixed(2)} L${w.toFixed(2)},${y.toFixed(2)}`;
+ }
+
+ const xStep = w / (values.length - 1);
let d = '';
values.forEach((v, idx) => {
const x = idx * xStep;