diff --git a/client/package-lock.json b/client/package-lock.json index 145cf5045..84fc4c3a6 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -26,6 +26,7 @@ "joi": "17.13.3", "lucide-react": "^0.562.0", "mui-color-input": "^7.0.0", + "pretty-bytes": "^7.1.0", "pretty-ms": "^9.3.0", "react": "18.3.1", "react-dom": "^18.2.0", @@ -5265,6 +5266,18 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/pretty-bytes": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-7.1.0.tgz", + "integrity": "sha512-nODzvTiYVRGRqAOvE84Vk5JDPyyxsVk0/fbA/bq7RqlnhksGpset09XTxbpvLTIjoaF7K8Z8DG8yHtKGTPSYRw==", + "license": "MIT", + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/pretty-ms": { "version": "9.3.0", "license": "MIT", @@ -6737,7 +6750,6 @@ "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", "devOptional": true, "license": "ISC", - "peer": true, "bin": { "yaml": "bin.mjs" }, diff --git a/client/package.json b/client/package.json index caf4d0856..f0b34dbbc 100644 --- a/client/package.json +++ b/client/package.json @@ -34,6 +34,7 @@ "joi": "17.13.3", "lucide-react": "^0.562.0", "mui-color-input": "^7.0.0", + "pretty-bytes": "^7.1.0", "pretty-ms": "^9.3.0", "react": "18.3.1", "react-dom": "^18.2.0", diff --git a/client/src/Pages/Logs/StatGauges.tsx b/client/src/Pages/Logs/StatGauges.tsx new file mode 100644 index 000000000..e69de29bb diff --git a/client/src/Pages/Logs/Stats.tsx b/client/src/Pages/Logs/Stats.tsx new file mode 100644 index 000000000..e4ffcca7a --- /dev/null +++ b/client/src/Pages/Logs/Stats.tsx @@ -0,0 +1,55 @@ +import Stack from "@mui/material/Stack"; +import { StatBox } from "@/Components/v2/design-elements"; + +import prettyBytes from "pretty-bytes"; +import prettyMilliseconds from "pretty-ms"; +import { useTheme } from "@mui/material"; +import { useTranslation } from "react-i18next"; +import type { Diagnostics } from "@/Types/Diagnostics"; + +interface StatsProps { + diagnostics: Diagnostics | null; +} + +export const Stats = ({ diagnostics }: StatsProps) => { + const { t } = useTranslation(); + const theme = useTheme(); + + if (!diagnostics) { + return null; + } + + return ( + + + + + + + + + ); +}; diff --git a/client/src/Pages/Logs/TabDiagnostics.tsx b/client/src/Pages/Logs/TabDiagnostics.tsx index 92b8801e0..94c17c2f1 100644 --- a/client/src/Pages/Logs/TabDiagnostics.tsx +++ b/client/src/Pages/Logs/TabDiagnostics.tsx @@ -1,3 +1,22 @@ +import Stack from "@mui/material/Stack"; +import { Stats } from "@/Pages/Logs/Stats"; + +import { useTheme } from "@mui/material"; +import { useGet } from "@/Hooks/UseApi"; +import type { Diagnostics } from "@/Types/Diagnostics"; + export const TabDiagnostics = () => { - return "Diagnostics"; + const theme = useTheme(); + const { + data: diagnostics, + isLoading, + error, + refetch, + } = useGet("/diagnostic/system"); + + return ( + + + + ); }; diff --git a/client/src/Pages/Logs/index.tsx b/client/src/Pages/Logs/index.tsx index 2642e177b..ab30b84eb 100644 --- a/client/src/Pages/Logs/index.tsx +++ b/client/src/Pages/Logs/index.tsx @@ -8,7 +8,7 @@ import { useTranslation } from "react-i18next"; const LogsPage = () => { const { t } = useTranslation(); - const [activeTab, setActiveTab] = useState(0); + const [activeTab, setActiveTab] = useState(2); return (