import { Card, Group, Stack, Table, Text } from "@mantine/core"; import { useSuspenseAPIQuery } from "../api/api"; import { IconRun, IconWall } from "@tabler/icons-react"; const statusConfig: Record< string, { title?: string; formatValue?: (v: any) => string; } > = { startTime: { title: "Start time", formatValue: (v: string) => new Date(v).toUTCString(), }, CWD: { title: "Working directory" }, reloadConfigSuccess: { title: "Configuration reload", formatValue: (v: boolean) => (v ? "Successful" : "Unsuccessful"), }, lastConfigTime: { title: "Last successful configuration reload", formatValue: (v: string) => new Date(v).toUTCString(), }, corruptionCount: { title: "WAL corruptions" }, goroutineCount: { title: "Goroutines" }, storageRetention: { title: "Storage retention" }, }; export default function StatusPage() { const { data: buildinfo } = useSuspenseAPIQuery>(`/status/buildinfo`); const { data: runtimeinfo } = useSuspenseAPIQuery>(`/status/runtimeinfo`); return ( Build information {Object.entries(buildinfo.data).map(([k, v]) => ( {k} {v} ))}
Runtime information {Object.entries(runtimeinfo.data).map(([k, v]) => { const { title = k, formatValue = (val: string) => val } = statusConfig[k] || {}; return ( {title} {formatValue(v)} ); })}
); }