From 397541a789565c1bec4aee2e1033f34dbd0ea2e8 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 26 May 2026 15:09:33 -0700 Subject: [PATCH] extract strings --- client/src/Pages/Logs/TabDiagnostics.tsx | 23 +++++----- .../Logs/components/MongoCollectionStats.tsx | 44 ++++++++++++++----- .../src/Pages/Logs/components/MongoStats.tsx | 12 ++--- client/src/locales/en.json | 23 ++++++++++ 4 files changed, 76 insertions(+), 26 deletions(-) diff --git a/client/src/Pages/Logs/TabDiagnostics.tsx b/client/src/Pages/Logs/TabDiagnostics.tsx index 8b641420e..a2ebd45c9 100644 --- a/client/src/Pages/Logs/TabDiagnostics.tsx +++ b/client/src/Pages/Logs/TabDiagnostics.tsx @@ -9,6 +9,7 @@ import { useTheme } from "@mui/material"; import { useTranslation } from "react-i18next"; import { useGet } from "@/Hooks/UseApi"; import type { Diagnostics } from "@/Types/Diagnostics"; +import { LAYOUT, SPACING } from "@/Utils/Theme/constants"; export const TabDiagnostics = () => { const theme = useTheme(); @@ -21,9 +22,9 @@ export const TabDiagnostics = () => { } = useGet("/diagnostic/system", {}, { refreshInterval: 5000 }); return ( - - - + + + { - - + + { - + - {t("MongoDB Stats")} + {t("pages.logs.diagnostics.sections.mongoDBStats.title")} - {t("Information about MongoDB")} + {t("pages.logs.diagnostics.sections.mongoDBStats.description")} - + - {t("MongoDB Collection Stats")} + {t("pages.logs.diagnostics.sections.mongoDBCollectionStats.title")} - {t("Information about Collections")} + {t("pages.logs.diagnostics.sections.mongoDBCollectionStats.description")} diff --git a/client/src/Pages/Logs/components/MongoCollectionStats.tsx b/client/src/Pages/Logs/components/MongoCollectionStats.tsx index e215b0bc4..4f20fa0b6 100644 --- a/client/src/Pages/Logs/components/MongoCollectionStats.tsx +++ b/client/src/Pages/Logs/components/MongoCollectionStats.tsx @@ -3,6 +3,7 @@ import { StatBox, Gauge, Tooltip } from "@/Components/design-elements"; import Stack from "@mui/material/Stack"; import Typography from "@mui/material/Typography"; +import { useTranslation } from "react-i18next"; import prettyBytes from "pretty-bytes"; import { useTheme } from "@mui/material"; import type { Diagnostics } from "@/Types/Diagnostics"; @@ -14,6 +15,7 @@ interface MongoStatsProps { export const MongoCollectionStats = ({ diagnostics }: MongoStatsProps) => { const theme = useTheme(); + const { t } = useTranslation(); const mongoStats = diagnostics?.mongoStats; if (!mongoStats) { @@ -41,17 +43,42 @@ export const MongoCollectionStats = ({ diagnostics }: MongoStatsProps) => { justifyContent={"space-between"} > - {`Documents: ${colStat.documentCount}`} + {/* {`Documents: ${colStat.documentCount}`} */} + + {t("pages.logs.diagnostics.mongoDBCollectionStats.documents", { + count: colStat.documentCount, + })} + {colStat.bucketCount !== undefined && ( - {`Bucket count: ${colStat.bucketCount}`} + + {t("pages.logs.diagnostics.mongoDBCollectionStats.bucketCount", { + count: colStat.bucketCount, + })} + )} - {`Storage size: ${prettyBytes(colStat.storageSize)}`} - {`Index size: ${prettyBytes(colStat.totalIndexSize)}`} - {`Total size: ${prettyBytes(colStat.totalSize)}`} + + {t("pages.logs.diagnostics.mongoDBCollectionStats.storageSize", { + size: prettyBytes(colStat.storageSize), + })} + + + {t("pages.logs.diagnostics.mongoDBCollectionStats.indexSize", { + size: prettyBytes(colStat.totalIndexSize), + })} + + + {t("pages.logs.diagnostics.mongoDBCollectionStats.totalSize", { + size: prettyBytes(colStat.totalSize), + })} + { }, }} > - + diff --git a/client/src/Pages/Logs/components/MongoStats.tsx b/client/src/Pages/Logs/components/MongoStats.tsx index 00263e7a4..ed7b9cc53 100644 --- a/client/src/Pages/Logs/components/MongoStats.tsx +++ b/client/src/Pages/Logs/components/MongoStats.tsx @@ -1,6 +1,7 @@ import Box from "@mui/material/Box"; import { StatBox } from "@/Components/design-elements"; +import { useTranslation } from "react-i18next"; import prettyBytes from "pretty-bytes"; import { useTheme } from "@mui/material"; import type { Diagnostics } from "@/Types/Diagnostics"; @@ -12,6 +13,7 @@ interface MongoStatsProps { export const MongoStats = ({ diagnostics }: MongoStatsProps) => { const theme = useTheme(); + const { t } = useTranslation(); const mongoStats = diagnostics?.mongoStats; if (!mongoStats) { @@ -28,23 +30,23 @@ export const MongoStats = ({ diagnostics }: MongoStatsProps) => { }} > diff --git a/client/src/locales/en.json b/client/src/locales/en.json index fc1e7ea7d..42b4bf34f 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -952,6 +952,14 @@ "memoryCpu": { "title": "Memory & CPU", "description": "How the process is using its allocated memory and host CPU." + }, + "mongoDBStats": { + "title": "MongoDB stats", + "description": "Snapshot of MongoDB metrics" + }, + "mongoDBCollectionStats": { + "title": "MongoDB collection stats", + "description": "Stats for MongoDB collections" } }, "stats": { @@ -961,6 +969,21 @@ "totalHeapSize": "Total heap size", "osMemoryLimit": "OS memory limit" }, + "mongoDBStats": { + "readyState": "Ready state", + "host": "Host", + "port": "Port", + "dbName": "Database name", + "storageSize": "Storage size" + }, + "mongoDBCollectionStats": { + "documents": "Documents: {{count}}", + "bucketCount": "Bucket count: {{count}}", + "storageSize": "Storage size: {{size}}", + "indexSize": "Index size: {{size}}", + "totalSize": "Total size: {{size}}", + "dbUsageTooltip": "{{percentage}}% of DB storage" + }, "gauges": { "heapAllocation": "Heap allocation", "heapUsage": "Heap usage",