feat: add uptime to table (#1719)

This commit is contained in:
Sven van Ginkel
2026-02-05 02:18:28 +01:00
committed by GitHub
parent 2a3885a52e
commit 8347afd68e

View File

@@ -8,6 +8,7 @@ import type { ClassValue } from "clsx"
import {
ArrowUpDownIcon,
ChevronRightSquareIcon,
ClockArrowUp,
CopyIcon,
CpuIcon,
HardDriveIcon,
@@ -34,6 +35,7 @@ import {
formatTemperature,
getMeterState,
parseSemVer,
secondsToString,
} from "@/lib/utils"
import { batteryStateTranslations } from "@/lib/i18n"
import type { SystemRecord } from "@/types"
@@ -373,6 +375,29 @@ export function SystemsTableColumns(viewMode: "table" | "grid"): ColumnDef<Syste
)
},
},
{
accessorFn: ({ info }) => info.u || undefined,
id: "uptime",
name: () => t`Uptime`,
size: 50,
Icon: ClockArrowUp,
header: sortableHeader,
cell(info) {
const uptime = info.getValue() as number
if (!uptime) {
return null
}
let formatted: string
if (uptime < 3600) {
formatted = secondsToString(uptime, "minute")
} else if (uptime < 360000) {
formatted = secondsToString(uptime, "hour")
} else {
formatted = secondsToString(uptime, "day")
}
return <span className="tabular-nums whitespace-nowrap">{formatted}</span>
},
},
{
accessorFn: ({ info }) => info.v,
id: "agent",