From 86a0b0b60ca8e06e757f2ef1aabc76cc63759f3b Mon Sep 17 00:00:00 2001 From: vineet-channe Date: Mon, 4 Aug 2025 18:43:37 +0530 Subject: [PATCH 1/2] fix: update diagnostic page design to match infrastructure page - Remove 'System diagnostics' title and divider line - Add infrastructure-style status boxes with dynamic status - Update gauge components to use BaseContainer styling - Match infrastructure page layout and spacing Resolves #2725 --- .../Diagnostics/components/gauges/index.jsx | 164 +++++++++++------- client/src/Pages/Logs/Diagnostics/index.jsx | 83 +++++---- 2 files changed, 155 insertions(+), 92 deletions(-) diff --git a/client/src/Pages/Logs/Diagnostics/components/gauges/index.jsx b/client/src/Pages/Logs/Diagnostics/components/gauges/index.jsx index e9f235112..538c157e3 100644 --- a/client/src/Pages/Logs/Diagnostics/components/gauges/index.jsx +++ b/client/src/Pages/Logs/Diagnostics/components/gauges/index.jsx @@ -1,34 +1,83 @@ import Stack from "@mui/material/Stack"; -import Gauge from "../../../../../Components/Charts/CustomGauge"; +import CustomGauge from "../../../../../Components/Charts/CustomGauge"; import Typography from "@mui/material/Typography"; // Utils import { useTheme } from "@emotion/react"; import PropTypes from "prop-types"; -import { getPercentage } from "../../utils/utils"; +import { getPercentage, formatBytes } from "../../utils/utils"; import { useTranslation } from "react-i18next"; +import { Box } from "@mui/material"; -const GaugeBox = ({ title, subtitle, children }) => { - const theme = useTheme(); - return ( - - {children} - - {title} - {subtitle} - +const BaseContainer = ({children}) => { + const theme = useTheme() + return( + + {children} + ); }; -GaugeBox.propTypes = { - title: PropTypes.string.isRequired, - subtitle: PropTypes.string.isRequired, - children: PropTypes.node.isRequired, +const InfrastructureStyleGauge = ({ value, heading, metricOne, valueOne, metricTwo, valueTwo }) => { + const theme = useTheme(); + const valueStyle = { + borderRadius: theme.spacing(2), + backgroundColor: theme.palette.tertiary.main, + width: "40%", + mb: theme.spacing(2), + mt: theme.spacing(2), + pr: theme.spacing(2), + textAlign: "right", + }; + + return( + + + + + + {heading} + + + + + {metricOne} + {valueOne} + + + {metricTwo} + {valueTwo} + + + + + ); }; const Gauges = ({ diagnostics, isLoading }) => { @@ -53,50 +102,41 @@ const Gauges = ({ diagnostics, isLoading }) => { return ( - - - - - - - - - - - - + + + + 80 ? "High" : diagnostics?.cpuUsage?.usagePercentage > 50 ? "Medium" : "Low"} + /> ); }; diff --git a/client/src/Pages/Logs/Diagnostics/index.jsx b/client/src/Pages/Logs/Diagnostics/index.jsx index 7c5d1f5a9..61e64811b 100644 --- a/client/src/Pages/Logs/Diagnostics/index.jsx +++ b/client/src/Pages/Logs/Diagnostics/index.jsx @@ -1,14 +1,14 @@ import Stack from "@mui/material/Stack"; import Box from "@mui/material/Box"; -import Typography from "@mui/material/Typography"; import Gauges from "./components/gauges"; -import Stats from "./components/stats"; -import Divider from "@mui/material/Divider"; import Button from "@mui/material/Button"; - +import StatBox from "../../../Components/StatBox"; +import StatusBoxes from "../../../Components/StatusBoxes"; import { useTheme } from "@emotion/react"; import { useTranslation } from "react-i18next"; import { useFetchDiagnostics } from "../../../Hooks/logHooks"; +import { getHumanReadableDuration } from "../../../Utils/timeUtils"; +import { formatBytes, getPercentage } from "./utils/utils"; const Diagnostics = () => { // Local state @@ -19,34 +19,57 @@ const Diagnostics = () => { const [diagnostics, fetchDiagnostics, isLoading, error] = useFetchDiagnostics(); // Setup return ( - + + + + + + + + + + - {t("diagnosticsPage.diagnosticDescription")} + - - - - - - - - ); }; From de34710c90ce797447d5e2b8ac82d36feb8b63b7 Mon Sep 17 00:00:00 2001 From: vineet-channe Date: Tue, 5 Aug 2025 17:35:40 +0530 Subject: [PATCH 2/2] fix: address review feedback - Replace hardcoded button text with translation - Fix status box translation to avoid showing removed title - Add conditional rendering for optional gauge metrics --- .../Diagnostics/components/gauges/index.jsx | 136 ++++++++++-------- client/src/Pages/Logs/Diagnostics/index.jsx | 22 +-- 2 files changed, 84 insertions(+), 74 deletions(-) diff --git a/client/src/Pages/Logs/Diagnostics/components/gauges/index.jsx b/client/src/Pages/Logs/Diagnostics/components/gauges/index.jsx index 538c157e3..5bb227b7c 100644 --- a/client/src/Pages/Logs/Diagnostics/components/gauges/index.jsx +++ b/client/src/Pages/Logs/Diagnostics/components/gauges/index.jsx @@ -14,10 +14,9 @@ const BaseContainer = ({children}) => { return( @@ -28,15 +27,28 @@ const BaseContainer = ({children}) => { const InfrastructureStyleGauge = ({ value, heading, metricOne, valueOne, metricTwo, valueTwo }) => { const theme = useTheme(); - const valueStyle = { - borderRadius: theme.spacing(2), - backgroundColor: theme.palette.tertiary.main, - width: "40%", - mb: theme.spacing(2), - mt: theme.spacing(2), - pr: theme.spacing(2), - textAlign: "right", - }; + + const MetricRow = ({ label, value }) => ( + + {label} + + {value} + + + ); return( @@ -47,7 +59,6 @@ const InfrastructureStyleGauge = ({ value, heading, metricOne, valueOne, metricT flexDirection: "column", alignItems: "center", width: "100%", - backgroundColor: theme.palette.gradient?.color1 || "transparent" }} > @@ -55,25 +66,11 @@ const InfrastructureStyleGauge = ({ value, heading, metricOne, valueOne, metricT {heading} - - - {metricOne} - {valueOne} - - - {metricTwo} - {valueTwo} - + + + {metricTwo && valueTwo && ( + + )} @@ -105,38 +102,38 @@ const Gauges = ({ diagnostics, isLoading }) => { spacing={theme.spacing(8)} flexWrap="wrap" > - - - - 80 ? "High" : diagnostics?.cpuUsage?.usagePercentage > 50 ? "Medium" : "Low"} - /> + + + + ); }; @@ -146,4 +143,17 @@ Gauges.propTypes = { isLoading: PropTypes.bool, }; +InfrastructureStyleGauge.propTypes = { + value: PropTypes.number, + heading: PropTypes.string, + metricOne: PropTypes.string, + valueOne: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + metricTwo: PropTypes.string, + valueTwo: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), +}; + +BaseContainer.propTypes = { + children: PropTypes.node.isRequired, +}; + export default Gauges; diff --git a/client/src/Pages/Logs/Diagnostics/index.jsx b/client/src/Pages/Logs/Diagnostics/index.jsx index 61e64811b..72ee47f48 100644 --- a/client/src/Pages/Logs/Diagnostics/index.jsx +++ b/client/src/Pages/Logs/Diagnostics/index.jsx @@ -20,39 +20,39 @@ const Diagnostics = () => { // Setup return ( - + @@ -67,7 +67,7 @@ const Diagnostics = () => { onClick={fetchDiagnostics} loading={isLoading} > - Fetch Diagnostics + {t("queuePage.refreshButton")}