From de34710c90ce797447d5e2b8ac82d36feb8b63b7 Mon Sep 17 00:00:00 2001 From: vineet-channe Date: Tue, 5 Aug 2025 17:35:40 +0530 Subject: [PATCH] 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")}