diagnostics locale

This commit is contained in:
Alex Holliday committed 2025-12-17 14:18:06 -08:00
1 parent 9f695ecdcc
commit 5489a107f9
5 files changed
+100 -38

No files matched your search

+59 -2
View File
@@ -113,7 +113,6 @@
"empty": "No checks", "empty": "No checks",
"headers": { "headers": {
"dateTime": "Date & Time", "dateTime": "Date & Time",
"message": "Message",
"statusCode": "Status code" "statusCode": "Status code"
} }
} }
@@ -229,7 +228,8 @@
"monitor": "Monitor", "monitor": "Monitor",
"name": "Name", "name": "Name",
"status": "Status", "status": "Status",
"type": "Type" "type": "Type",
"message": "Message"
} }
}, },
"toasts": { "toasts": {
@@ -244,6 +244,63 @@
"toggleTheme": "Toggle theme" "toggleTheme": "Toggle theme"
} }
}, },
"diagnostics": {
"infoBox": {
"title": "System Diagnostics",
"description": "Review system logs and background job status to troubleshoot issues. Monitor the health of your monitoring infrastructure and investigate any problems."
},
"tabs": {
"logs": "Logs",
"queue": "Queue",
"config": "Config",
"access": "Access"
},
"logs": {
"table": {
"headers": {
"timestamp": "Timestamp",
"level": "Level",
"service": "Service"
}
}
},
"queue": {
"stats": {
"monitoringJobs": {
"title": "Monitoring jobs",
"tooltip": "Total number of monitoring jobs in the queue"
},
"activeJobs": {
"title": "Active jobs",
"tooltip": "Number of jobs being processed"
},
"failingJobs": {
"title": "Failing jobs",
"tooltip": "Jobs that failed on their last execution"
},
"totalRuns": {
"title": "Total runs",
"tooltip": "Total number of job executions"
},
"totalFailures": {
"title": "Total failures",
"tooltip": "Total number of failed job executions"
}
},
"table": {
"headers": {
"jobId": "Job ID",
"url": "URL",
"interval": "Interval",
"runs": "Runs",
"lastRun": "Last run",
"lockedAt": "Locked at",
"finishedAt": "Finished at",
"lastRunTook": "Last run took (ms)"
}
}
}
},
"export": { "export": {
"form": { "form": {
"exportIncidents": { "exportIncidents": {
+11 -8
View File
@@ -4,9 +4,12 @@ import { DiagnosticsQueueTab } from "@/pages/diagnostic/DiagnosticsQueueTab";
import DiagnosticsConfigTab from "@/pages/diagnostic/DiagnosticsConfigTab"; import DiagnosticsConfigTab from "@/pages/diagnostic/DiagnosticsConfigTab";
import DiagnosticsAccessTab from "@/pages/diagnostic/DiagnosticsAccessTab"; import DiagnosticsAccessTab from "@/pages/diagnostic/DiagnosticsAccessTab";
import { FileText, ListTodo, Settings, Shield } from "lucide-react"; import { FileText, ListTodo, Settings, Shield } from "lucide-react";
import { useState } from "react"; import { useState } from "react";
import { useTranslation } from "react-i18next";
const DiagnosticPage = () => { const DiagnosticPage = () => {
const { t } = useTranslation();
const [tabValue, setTabValue] = useState("logs"); const [tabValue, setTabValue] = useState("logs");
const handleTabChange = (_: React.SyntheticEvent, newValue: string) => { const handleTabChange = (_: React.SyntheticEvent, newValue: string) => {
@@ -16,33 +19,33 @@ const DiagnosticPage = () => {
return ( return (
<BasePage> <BasePage>
<InfoBox <InfoBox
title="System Diagnostics" title={t("diagnostics.infoBox.title")}
description="Review system logs and background job status to troubleshoot issues. Monitor the health of your monitoring infrastructure and investigate any problems." description={t("diagnostics.infoBox.description")}
/> />
<Tabs value={tabValue} onChange={handleTabChange}> <Tabs value={tabValue} onChange={handleTabChange}>
<Tab <Tab
label="Logs" label={t("diagnostics.tabs.logs")}
value="logs" value="logs"
icon={<FileText size={18} strokeWidth={1.5} />} icon={<FileText size={18} strokeWidth={1.5} />}
/> />
<Tab <Tab
label="Jobs" label={t("diagnostics.tabs.queue")}
value="jobs" value="queue"
icon={<ListTodo size={18} strokeWidth={1.5} />} icon={<ListTodo size={18} strokeWidth={1.5} />}
/> />
<Tab <Tab
label="Config" label={t("diagnostics.tabs.config")}
value="config" value="config"
icon={<Settings size={18} strokeWidth={1.5} />} icon={<Settings size={18} strokeWidth={1.5} />}
/> />
<Tab <Tab
label="Access" label={t("diagnostics.tabs.access")}
value="access" value="access"
icon={<Shield size={18} strokeWidth={1.5} />} icon={<Shield size={18} strokeWidth={1.5} />}
/> />
</Tabs> </Tabs>
{tabValue === "logs" && <DiagnosticsLogTab />} {tabValue === "logs" && <DiagnosticsLogTab />}
{tabValue === "jobs" && <DiagnosticsQueueTab />} {tabValue === "queue" && <DiagnosticsQueueTab />}
{tabValue === "config" && <DiagnosticsConfigTab />} {tabValue === "config" && <DiagnosticsConfigTab />}
{tabValue === "access" && <DiagnosticsAccessTab />} {tabValue === "access" && <DiagnosticsAccessTab />}
</BasePage> </BasePage>
@@ -11,9 +11,11 @@ import { useGet } from "@/hooks/UseApi";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import type { ILogEntry } from "@/types/log"; import type { ILogEntry } from "@/types/log";
import type { ApiResponse } from "@/types/api"; import type { ApiResponse } from "@/types/api";
import { useTranslation } from "react-i18next";
export const DiagnosticsLogTab = () => { export const DiagnosticsLogTab = () => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const [logLevel, setLogLevel] = useState("all"); const [logLevel, setLogLevel] = useState("all");
const { response } = useGet<ApiResponse<ILogEntry[]>>( const { response } = useGet<ApiResponse<ILogEntry[]>>(
`/diagnostic/logs`, `/diagnostic/logs`,
@@ -33,12 +35,12 @@ export const DiagnosticsLogTab = () => {
const headers: Header<ILogEntry>[] = [ const headers: Header<ILogEntry>[] = [
{ {
id: "timestamp", id: "timestamp",
content: "Timestamp", content: t("diagnostics.logs.table.headers.timestamp"),
render: (log: ILogEntry) => log.timestamp, render: (log: ILogEntry) => log.timestamp,
}, },
{ {
id: "level", id: "level",
content: "Level", content: t("diagnostics.logs.table.headers.level"),
render: (log: ILogEntry) => { render: (log: ILogEntry) => {
const color = const color =
levelColors[log.level] || theme.palette.primary.contrastText; levelColors[log.level] || theme.palette.primary.contrastText;
@@ -53,12 +55,12 @@ export const DiagnosticsLogTab = () => {
}, },
{ {
id: "service", id: "service",
content: "Service", content: t("diagnostics.logs.table.headers.service"),
render: (log: ILogEntry) => log.service, render: (log: ILogEntry) => log.service,
}, },
{ {
id: "message", id: "message",
content: "Message", content: t("common.table.headers.message"),
render: (log: ILogEntry) => log.message, render: (log: ILogEntry) => log.message,
}, },
]; ];
@@ -27,21 +27,21 @@ export const DiagnosticsQueueTab = () => {
const headers: Header<IJob>[] = [ const headers: Header<IJob>[] = [
{ {
id: "name", id: "name",
content: t("diagnosticsPage.tableHeaderId"), content: t("diagnostics.queue.table.headers.jobId"),
render: (row) => { render: (row) => {
return row?.id || "-"; return row?.id || "-";
}, },
}, },
{ {
id: "url", id: "url",
content: t("diagnosticsPage.tableHeaderUrl"), content: t("diagnostics.queue.table.headers.url"),
render: (row) => { render: (row) => {
return row?.data?.url || "-"; return row?.data?.url || "-";
}, },
}, },
{ {
id: "interval", id: "interval",
content: t("diagnosticsPage.tableHeaderInterval"), content: t("diagnostics.queue.table.headers.interval"),
render: (row) => { render: (row) => {
if (!row?.data?.interval) return "-"; if (!row?.data?.interval) return "-";
const seconds = row.data.interval / 1000; const seconds = row.data.interval / 1000;
@@ -50,14 +50,14 @@ export const DiagnosticsQueueTab = () => {
}, },
{ {
id: "type", id: "type",
content: t("diagnosticsPage.tableHeaderType"), content: t("common.table.headers.type"),
render: (row) => { render: (row) => {
return row?.data?.type || "-"; return row?.data?.type || "-";
}, },
}, },
{ {
id: "active", id: "active",
content: t("diagnosticsPage.tableHeaderActive"), content: t("common.table.headers.active"),
render: (row) => { render: (row) => {
return row?.active === true ? "true" : "false"; return row?.active === true ? "true" : "false";
}, },
@@ -65,14 +65,14 @@ export const DiagnosticsQueueTab = () => {
{ {
id: "runCount", id: "runCount",
content: t("diagnosticsPage.tableHeaderRunCount"), content: t("diagnostics.queue.table.headers.runs"),
render: (row) => { render: (row) => {
return row?.runCount || "-"; return row?.runCount || "-";
}, },
}, },
{ {
id: "lastRun", id: "lastRun",
content: t("diagnosticsPage.tableHeaderLastRun"), content: t("diagnostics.queue.table.headers.lastRun"),
render: (row) => { render: (row) => {
if (!row?.lastRunAt) return "-"; if (!row?.lastRunAt) return "-";
const date = new Date(row.lastRunAt); const date = new Date(row.lastRunAt);
@@ -86,7 +86,7 @@ export const DiagnosticsQueueTab = () => {
}, },
{ {
id: "lockedAt", id: "lockedAt",
content: t("diagnosticsPage.tableHeaderLockedAt"), content: t("diagnostics.queue.table.headers.lockedAt"),
render: (row) => { render: (row) => {
if (!row?.lockedAt) return "-"; if (!row?.lockedAt) return "-";
const date = new Date(row.lockedAt); const date = new Date(row.lockedAt);
@@ -100,7 +100,7 @@ export const DiagnosticsQueueTab = () => {
}, },
{ {
id: "lastFinishedAt", id: "lastFinishedAt",
content: t("diagnosticsPage.tableHeaderLastFinishedAt"), content: t("diagnostics.queue.table.headers.finishedAt"),
render: (row) => { render: (row) => {
if (!row?.lastFinishedAt) return "-"; if (!row?.lastFinishedAt) return "-";
const date = new Date(row.lastFinishedAt); const date = new Date(row.lastFinishedAt);
@@ -114,7 +114,7 @@ export const DiagnosticsQueueTab = () => {
}, },
{ {
id: "lastRunTook", id: "lastRunTook",
content: t("diagnosticsPage.tableHeaderLastRunTook"), content: t("diagnostics.queue.table.headers.lastRunTook"),
render: (row) => { render: (row) => {
return row?.lastRunTook || "-"; return row?.lastRunTook || "-";
}, },
@@ -129,34 +129,34 @@ export const DiagnosticsQueueTab = () => {
<Stack spacing={theme.spacing(8)}> <Stack spacing={theme.spacing(8)}>
<Stack direction={{ s: "column", md: "row" }} gap={theme.spacing(8)}> <Stack direction={{ s: "column", md: "row" }} gap={theme.spacing(8)}>
<StatBox <StatBox
title={t("diagnosticsPage.statBoxJobsTitle")} title={t("diagnostics.queue.stats.monitoringJobs.title")}
subtitle={`${metrics?.jobs}`} subtitle={`${metrics?.jobs}`}
sx={{ width: "100%" }} sx={{ width: "100%" }}
tooltip="Total number of monitoring jobs in the queue" tooltip={t("diagnostics.queue.stats.monitoringJobs.tooltip")}
/> />
<StatBox <StatBox
title={t("diagnosticsPage.statBoxActiveJobsTitle")} title={t("diagnostics.queue.stats.activeJobs.title")}
subtitle={`${metrics.activeJobs}`} subtitle={`${metrics.activeJobs}`}
sx={{ width: "100%" }} sx={{ width: "100%" }}
tooltip="Jobs currently running or locked for execution" tooltip={t("diagnostics.queue.stats.activeJobs.tooltip")}
/> />
<StatBox <StatBox
title={t("diagnosticsPage.statBoxFailingJobsTitle")} title={t("diagnostics.queue.stats.failingJobs.title")}
subtitle={`${metrics.failingJobs}`} subtitle={`${metrics.failingJobs}`}
sx={{ width: "100%" }} sx={{ width: "100%" }}
tooltip="Jobs that failed on their last execution" tooltip={t("diagnostics.queue.stats.failingJobs.tooltip")}
/> />
<StatBox <StatBox
title={t("diagnosticsPage.statBoxTotalRunsTitle")} title={t("diagnostics.queue.stats.totalRuns.title")}
subtitle={`${metrics.totalRuns}`} subtitle={`${metrics.totalRuns}`}
sx={{ width: "100%" }} sx={{ width: "100%" }}
tooltip="Total number of job executions across all jobs" tooltip={t("diagnostics.queue.stats.totalRuns.tooltip")}
/> />
<StatBox <StatBox
title={t("diagnosticsPage.statBoxTotalFailuresTitle")} title={t("diagnostics.queue.stats.totalFailures.title")}
subtitle={`${metrics.totalFailures}`} subtitle={`${metrics.totalFailures}`}
sx={{ width: "100%" }} sx={{ width: "100%" }}
tooltip="Total number of failed job executions across all jobs" tooltip={t("diagnostics.queue.stats.totalFailures.tooltip")}
/> />
</Stack> </Stack>
<Table headers={headers} data={jobs} /> <Table headers={headers} data={jobs} />
+4 -4
View File
@@ -16,14 +16,14 @@ const getHeaders = (t: Function, uiTimezone: string) => {
const headers: Header<ICheck>[] = [ const headers: Header<ICheck>[] = [
{ {
id: "status", id: "status",
content: t("monitors.common.table.headers.status"), content: t("common.table.headers.status"),
render: (row) => { render: (row) => {
return <StatusLabel status={row.status as MonitorStatus} />; return <StatusLabel status={row.status as MonitorStatus} />;
}, },
}, },
{ {
id: "date", id: "date",
content: t("monitors.common.table.headers.dateTime"), content: t("checks.table.headers.dateTime"),
render: (row) => { render: (row) => {
return formatDateWithTz( return formatDateWithTz(
row.createdAt, row.createdAt,
@@ -34,14 +34,14 @@ const getHeaders = (t: Function, uiTimezone: string) => {
}, },
{ {
id: "message", id: "message",
content: t("monitors.common.table.headers.message"), content: t("common.table.headers.message"),
render: (row) => { render: (row) => {
return row.message || "N/A"; return row.message || "N/A";
}, },
}, },
{ {
id: "statusCode", id: "statusCode",
content: t("monitors.common.table.headers.statusCode"), content: t("checks.table.headers.statusCode"),
render: (row) => { render: (row) => {
return row.httpStatusCode || "N/A"; return row.httpStatusCode || "N/A";
}, },