mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Make status page timestamps consistent and use local time
Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
parent
a0463f5501
commit
ff41d45bae
|
@ -2,32 +2,7 @@ import { Card, Group, Stack, Table, Text } from "@mantine/core";
|
|||
import { useSuspenseAPIQuery } from "../api/api";
|
||||
import { IconRun, IconWall } from "@tabler/icons-react";
|
||||
import { formatTimestamp } from "../lib/formatTime";
|
||||
|
||||
const statusConfig: Record<
|
||||
string,
|
||||
{
|
||||
title?: string;
|
||||
formatValue?: (v: string | boolean) => string;
|
||||
}
|
||||
> = {
|
||||
startTime: {
|
||||
title: "Start time",
|
||||
formatValue: (v: string | boolean) =>
|
||||
formatTimestamp(new Date(v as string).valueOf() / 1000, false), // TODO: Set useLocalTime parameter correctly.
|
||||
},
|
||||
CWD: { title: "Working directory" },
|
||||
reloadConfigSuccess: {
|
||||
title: "Configuration reload",
|
||||
formatValue: (v: string | boolean) => (v ? "Successful" : "Unsuccessful"),
|
||||
},
|
||||
lastConfigTime: {
|
||||
title: "Last successful configuration reload",
|
||||
formatValue: (v: string | boolean) => new Date(v as string).toUTCString(),
|
||||
},
|
||||
corruptionCount: { title: "WAL corruptions" },
|
||||
goroutineCount: { title: "Goroutines" },
|
||||
storageRetention: { title: "Storage retention" },
|
||||
};
|
||||
import { useSettings } from "../state/settingsSlice";
|
||||
|
||||
export default function StatusPage() {
|
||||
const { data: buildinfo } = useSuspenseAPIQuery<Record<string, string>>({
|
||||
|
@ -37,6 +12,35 @@ export default function StatusPage() {
|
|||
path: `/status/runtimeinfo`,
|
||||
});
|
||||
|
||||
const { useLocalTime } = useSettings();
|
||||
|
||||
const statusConfig: Record<
|
||||
string,
|
||||
{
|
||||
title?: string;
|
||||
formatValue?: (v: string | boolean) => string;
|
||||
}
|
||||
> = {
|
||||
startTime: {
|
||||
title: "Start time",
|
||||
formatValue: (v: string | boolean) =>
|
||||
formatTimestamp(new Date(v as string).valueOf() / 1000, useLocalTime),
|
||||
},
|
||||
CWD: { title: "Working directory" },
|
||||
reloadConfigSuccess: {
|
||||
title: "Configuration reload",
|
||||
formatValue: (v: string | boolean) => (v ? "Successful" : "Unsuccessful"),
|
||||
},
|
||||
lastConfigTime: {
|
||||
title: "Last successful configuration reload",
|
||||
formatValue: (v: string | boolean) =>
|
||||
formatTimestamp(new Date(v as string).valueOf() / 1000, useLocalTime),
|
||||
},
|
||||
corruptionCount: { title: "WAL corruptions" },
|
||||
goroutineCount: { title: "Goroutines" },
|
||||
storageRetention: { title: "Storage retention" },
|
||||
};
|
||||
|
||||
return (
|
||||
<Stack gap="lg" maw={1000} mx="auto" mt="xs">
|
||||
<Card shadow="xs" withBorder p="md">
|
||||
|
|
Loading…
Reference in a new issue