diff --git a/internal/site/biome.json b/internal/site/biome.json index 7990ae84..c5c0cc25 100644 --- a/internal/site/biome.json +++ b/internal/site/biome.json @@ -48,7 +48,8 @@ }, "suspicious": { "useAwait": "error", - "noEvolvingTypes": "error" + "noEvolvingTypes": "error", + "noArrayIndexKey": "off" } } }, diff --git a/internal/site/src/components/systems-table/systems-table-columns.tsx b/internal/site/src/components/systems-table/systems-table-columns.tsx index 0c83f5ac..e9438418 100644 --- a/internal/site/src/components/systems-table/systems-table-columns.tsx +++ b/internal/site/src/components/systems-table/systems-table-columns.tsx @@ -1,3 +1,4 @@ +/** biome-ignore-all lint/correctness/useHookAtTopLevel: */ import { t } from "@lingui/core/macro" import { Trans, useLingui } from "@lingui/react/macro" import { useStore } from "@nanostores/react" @@ -218,7 +219,7 @@ export function SystemsTableColumns(viewMode: "table" | "grid"): ColumnDef (info.bb || (info.b || 0) * 1024 * 1024) || undefined, + accessorFn: ({ info }) => info.bb || (info.b || 0) * 1024 * 1024 || undefined, id: "net", name: () => t`Net`, size: 0, @@ -291,7 +292,10 @@ export function SystemsTableColumns(viewMode: "table" | "grid"): ColumnDef - {totalCount} ({t`Failed`.toLowerCase()}: {numFailed}) + {totalCount}{" "} + + ({t`Failed`.toLowerCase()}: {numFailed}) + ) }, @@ -377,9 +381,9 @@ function TableCellWithMeter(info: CellContext) { const meterClass = cn( "h-full", (info.row.original.status !== SystemStatus.Up && STATUS_COLORS.paused) || - (threshold === MeterState.Good && STATUS_COLORS.up) || - (threshold === MeterState.Warn && STATUS_COLORS.pending) || - STATUS_COLORS.down + (threshold === MeterState.Good && STATUS_COLORS.up) || + (threshold === MeterState.Warn && STATUS_COLORS.pending) || + STATUS_COLORS.down ) return (
@@ -395,7 +399,6 @@ function DiskCellWithMultiple(info: CellContext) { const { info: sysInfo, status, id } = info.row.original const extraFs = Object.entries(sysInfo.efs ?? {}) - // No extra disks - show basic meter if (extraFs.length === 0) { return TableCellWithMeter(info) } @@ -405,10 +408,9 @@ function DiskCellWithMultiple(info: CellContext) { // sort extra disks by percentage descending extraFs.sort((a, b) => b[1] - a[1]) - function getMeterClass(pct: number) { + function getIndicatorColor(pct: number) { const threshold = getMeterState(pct) - return cn( - "h-full", + return ( (status !== SystemStatus.Up && STATUS_COLORS.paused) || (threshold === MeterState.Good && STATUS_COLORS.up) || (threshold === MeterState.Warn && STATUS_COLORS.pending) || @@ -416,28 +418,43 @@ function DiskCellWithMultiple(info: CellContext) { ) } + function getMeterClass(pct: number) { + return cn("h-full", getIndicatorColor(pct)) + } + return ( - +
{decimalString(rootDiskPct, rootDiskPct >= 10 ? 1 : 2)}% - + {/* Root disk */} - - {/* Extra disks */} - {extraFs.map(([_name, pct], index) => ( - + + {/* Extra disk indicators */} + {extraFs.map(([name, pct]) => ( + ))} -
-
+
-
Root
+
+ Root +
{decimalString(rootDiskPct, rootDiskPct >= 10 ? 1 : 2)}% @@ -448,7 +465,9 @@ function DiskCellWithMultiple(info: CellContext) { {extraFs.map(([name, pct]) => { return (
-
{name}
+
+ {name} +
{decimalString(pct, pct >= 10 ? 1 : 2)}% @@ -469,7 +488,7 @@ export function IndicatorDot({ system, className }: { system: SystemRecord; clas return ( ) }