Lightweight server monitoring with historical data, docker stats, and alerts.
feat(ui): simplify Services column in systems table (#2399)
Sven van Ginkel0be9882b34bb
diff --git a/internal/site/src/components/systems-table/systems-table-columns.tsx b/internal/site/src/components/systems-table/systems-table-columns.tsxindex 1db27673d..c49b8ca67 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<Systeheader: sortableHeader,hideSort: true,sortingFn: (a, b) => {- // sort priorities: 1) failed services, 2) total services+ // sort priorities: 1) has failed services (dot color), 2) total servicesconst [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<Systeif (sys.status !== SystemStatus.Up || totalCount === 0) {return null}- return (+ const content = (<span className="tabular-nums whitespace-nowrap flex gap-1.5 items-center"><spanclassName={cn("block size-2 rounded-full", {- [STATUS_COLORS[SystemStatus.Down]]: numFailed > 0,- [STATUS_COLORS[SystemStatus.Up]]: numFailed === 0,+ [STATUS_COLORS.pending]: numFailed > 0,+ [STATUS_COLORS.up]: numFailed === 0,})}/>- {totalCount}{" "}- <span className="text-muted-foreground text-sm -ms-0.5">- ({t`Failed`.toLowerCase()}: {numFailed})- </span>+ {plural(totalCount, { one: "# service", other: "# services" })}</span>)+ if (numFailed === 0) {+ return content+ }+ return (+ <Tooltip>+ <TooltipTrigger asChild>+ <Link+ href={getPagePath($router, "system", { id: sys.id })}+ tabIndex={-1}+ className="relative z-10 w-fit block"+ >+ {content}+ </Link>+ </TooltipTrigger>+ <TooltipContent>+ {plural(numFailed, { one: "# failed service", other: "# failed services" })}+ </TooltipContent>+ </Tooltip>+ )},},{