From 0be9882b34bb3445b5ec7b6af8915b097e0bbf27 Mon Sep 17 00:00:00 2001 From: Sven van Ginkel Date: Thu, 24 Sep 2026 18:05:26 +0200 Subject: [PATCH] feat(ui): simplify Services column in systems table (#2399) Co-authored-by: hank --- .../systems-table/systems-table-columns.tsx | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) 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 1db27673..c49b8ca6 100644 --- a/internal/site/src/components/systems-table/systems-table-columns.tsx +++ b/internal/site/src/components/systems-table/systems-table-columns.tsx @@ -1,5 +1,5 @@ /** biome-ignore-all lint/correctness/useHookAtTopLevel: Hooks live inside memoized column definitions */ -import { t } from "@lingui/core/macro" +import { plural, t } from "@lingui/core/macro" import { Trans, useLingui } from "@lingui/react/macro" import { useStore } from "@nanostores/react" import { getPagePath } from "@nanostores/router" @@ -345,11 +345,13 @@ export function SystemsTableColumns(viewMode: "table" | "grid"): ColumnDef { - // sort priorities: 1) failed services, 2) total services + // sort priorities: 1) has failed services (dot color), 2) total services const [totalCountA, numFailedA] = a.original.info.sv ?? [0, 0] const [totalCountB, numFailedB] = b.original.info.sv ?? [0, 0] - if (numFailedA !== numFailedB) { - return numFailedA - numFailedB + const hasFailedA = numFailedA > 0 ? 1 : 0 + const hasFailedB = numFailedB > 0 ? 1 : 0 + if (hasFailedA !== hasFailedB) { + return hasFailedA - hasFailedB } return totalCountA - totalCountB }, @@ -359,20 +361,36 @@ export function SystemsTableColumns(viewMode: "table" | "grid"): ColumnDef 0, - [STATUS_COLORS[SystemStatus.Up]]: numFailed === 0, + [STATUS_COLORS.pending]: numFailed > 0, + [STATUS_COLORS.up]: numFailed === 0, })} /> - {totalCount}{" "} - - ({t`Failed`.toLowerCase()}: {numFailed}) - + {plural(totalCount, { one: "# service", other: "# services" })} ) + if (numFailed === 0) { + return content + } + return ( + + + + {content} + + + + {plural(numFailed, { one: "# failed service", other: "# failed services" })} + + + ) }, }, {