## Changes - Fix infrastructure monitor configure page loading error by adding required dateRange parameter - Fix URL validation error when editing existing infrastructure monitors - Fix monitor update using correct 'id' property instead of '_id' - Fix gauge box labels: "Device" (capitalized) and "Mounted on" instead of "mountpoint" - Show full device path instead of truncated ".../" prefix - Implement CSS Grid layout for gauge boxes ensuring consistent widths across all rows - Gauge boxes expand to fill space only when 4+ boxes exist ## Files Modified - client/src/Pages/Infrastructure/Create/index.jsx - client/src/Pages/Infrastructure/Create/hooks/useInfrastructureSubmit.jsx - client/src/Pages/Infrastructure/Details/Components/GaugeBoxes/index.jsx - client/src/Pages/Infrastructure/Details/Components/GaugeBoxes/Gauge.jsx - client/src/Pages/Infrastructure/Details/Components/BaseContainer/index.jsx - client/src/Pages/Infrastructure/Details/Hooks/useHardwareUtils.jsx - client/src/locales/en.json
128 lines
3.0 KiB
React
128 lines
3.0 KiB
React
// Components
|
|
import CustomGauge from "@/Components/v1/Charts/CustomGauge/index.jsx";
|
|
import BaseContainer from "../BaseContainer/index.jsx";
|
|
import { Stack, Typography, Box } from "@mui/material";
|
|
// Utils
|
|
import { useTheme } from "@emotion/react";
|
|
import PropTypes from "prop-types";
|
|
|
|
const Gauge = ({
|
|
value,
|
|
heading,
|
|
metricOne,
|
|
valueOne,
|
|
metricTwo,
|
|
valueTwo,
|
|
metricThree,
|
|
valueThree,
|
|
metricFour,
|
|
valueFour,
|
|
shouldExpand = false,
|
|
}) => {
|
|
const theme = useTheme();
|
|
|
|
const valueStyle = {
|
|
borderRadius: theme.spacing(2),
|
|
backgroundColor: theme.palette.tertiary.main,
|
|
minWidth: "40%",
|
|
maxWidth: "60%",
|
|
mb: theme.spacing(2),
|
|
mt: theme.spacing(2),
|
|
pr: theme.spacing(2),
|
|
textAlign: "right",
|
|
overflow: "hidden",
|
|
textOverflow: "ellipsis",
|
|
whiteSpace: "nowrap",
|
|
};
|
|
|
|
return (
|
|
<BaseContainer shouldExpand={shouldExpand}>
|
|
<Stack
|
|
direction="column"
|
|
gap={theme.spacing(2)}
|
|
alignItems="center"
|
|
>
|
|
<Box
|
|
sx={{
|
|
display: "flex",
|
|
flexDirection: "column",
|
|
alignItems: "center",
|
|
width: "100%",
|
|
backgroundColor: theme.palette.gradient.color1,
|
|
}}
|
|
>
|
|
<CustomGauge
|
|
progress={value}
|
|
radius={100}
|
|
/>
|
|
<Typography
|
|
component="h2"
|
|
sx={{ fontWeight: 600 }}
|
|
>
|
|
{heading}
|
|
</Typography>
|
|
</Box>
|
|
<Box
|
|
sx={{
|
|
width: "100%",
|
|
borderTop: `1px solid ${theme.palette.primary.lowContrast}`,
|
|
}}
|
|
>
|
|
<Stack
|
|
justifyContent={"space-between"}
|
|
direction="row"
|
|
alignItems="center"
|
|
gap={theme.spacing(2)}
|
|
>
|
|
<Typography>{metricOne}</Typography>
|
|
<Typography sx={valueStyle}>{valueOne}</Typography>
|
|
</Stack>
|
|
<Stack
|
|
justifyContent={"space-between"}
|
|
direction="row"
|
|
alignItems="center"
|
|
gap={theme.spacing(2)}
|
|
>
|
|
<Typography>{metricTwo}</Typography>
|
|
<Typography sx={valueStyle}>{valueTwo}</Typography>
|
|
</Stack>
|
|
<Stack
|
|
justifyContent={"space-between"}
|
|
direction="row"
|
|
alignItems="center"
|
|
gap={theme.spacing(2)}
|
|
>
|
|
<Typography>{metricThree}</Typography>
|
|
<Typography sx={valueStyle}>{valueThree}</Typography>
|
|
</Stack>
|
|
<Stack
|
|
justifyContent={"space-between"}
|
|
direction="row"
|
|
alignItems="center"
|
|
gap={theme.spacing(2)}
|
|
>
|
|
<Typography>{metricFour}</Typography>
|
|
<Typography sx={valueStyle}>{valueFour}</Typography>
|
|
</Stack>
|
|
</Box>
|
|
</Stack>
|
|
</BaseContainer>
|
|
);
|
|
};
|
|
|
|
Gauge.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]),
|
|
metricThree: PropTypes.string,
|
|
valueThree: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
metricFour: PropTypes.string,
|
|
valueFour: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
shouldExpand: PropTypes.bool,
|
|
};
|
|
|
|
export default Gauge;
|