From c5776541a0572001afd75ae2e1c2c5761cdfd473 Mon Sep 17 00:00:00 2001 From: Henry Dollman Date: Tue, 23 Jul 2024 14:48:33 -0400 Subject: [PATCH] style / chart axis updates --- .../src/components/charts/bandwidth-chart.tsx | 8 ++++++- .../components/charts/container-cpu-chart.tsx | 2 +- .../src/components/charts/disk-io-chart.tsx | 2 +- hub/site/src/components/table-alerts.tsx | 22 +++++++++---------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/hub/site/src/components/charts/bandwidth-chart.tsx b/hub/site/src/components/charts/bandwidth-chart.tsx index faaf083..5819036 100644 --- a/hub/site/src/components/charts/bandwidth-chart.tsx +++ b/hub/site/src/components/charts/bandwidth-chart.tsx @@ -47,7 +47,13 @@ export default function BandwidthChart({ (max < 0.4 ? 0.4 : Math.ceil(max))]} + domain={[0, (max: number) => (max <= 0.4 ? 0.4 : Math.ceil(max))]} + tickFormatter={(value) => { + if (value >= 100) { + return value.toFixed(0) + } + return value.toFixed((value * 100) % 1 === 0 ? 1 : 2) + }} tickLine={false} axisLine={false} unit={' MB/s'} diff --git a/hub/site/src/components/charts/container-cpu-chart.tsx b/hub/site/src/components/charts/container-cpu-chart.tsx index 7f2004b..adeb00f 100644 --- a/hub/site/src/components/charts/container-cpu-chart.tsx +++ b/hub/site/src/components/charts/container-cpu-chart.tsx @@ -69,7 +69,7 @@ export default function ContainerCpuChart({ > Math.max(Math.ceil(max), 0.4)]} + // domain={[0, (max: number) => Math.max(Math.ceil(max), 0.4)]} width={47} tickLine={false} axisLine={false} diff --git a/hub/site/src/components/charts/disk-io-chart.tsx b/hub/site/src/components/charts/disk-io-chart.tsx index 5636c68..9e6085f 100644 --- a/hub/site/src/components/charts/disk-io-chart.tsx +++ b/hub/site/src/components/charts/disk-io-chart.tsx @@ -47,7 +47,7 @@ export default function DiskIoChart({ (max < 0.4 ? 0.4 : Math.ceil(max))]} + domain={[0, (max: number) => (max <= 0.4 ? 0.4 : Math.ceil(max))]} tickFormatter={(value) => { if (value >= 100) { return value.toFixed(0) diff --git a/hub/site/src/components/table-alerts.tsx b/hub/site/src/components/table-alerts.tsx index 0b5ffbf..95bde78 100644 --- a/hub/site/src/components/table-alerts.tsx +++ b/hub/site/src/components/table-alerts.tsx @@ -71,21 +71,21 @@ export default function AlertsButton({ system }: { system: SystemRecord }) { system={system} alerts={systemAlerts} name="CPU" - title="CPU usage" + title="CPU Usage" description="Triggers when CPU usage exceeds a threshold." /> @@ -104,11 +104,11 @@ function AlertStatus({ system, alerts }: { system: SystemRecord; alerts: AlertRe return (