update response time gauge
This commit is contained in:
1 parent
b5ceb5c4c1
commit
3e995c82aa
2 files changed
+14
-15
No files matched your search
@@ -190,8 +190,8 @@ const DownBarChart = memo(({ data, type, onBarHover }) => {
|
|||||||
y={0}
|
y={0}
|
||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
firstDataPoint={data[0]}
|
firstDataPoint={data?.[0] ?? {}}
|
||||||
lastDataPoint={data[data.length - 1]}
|
lastDataPoint={data?.[data.length - 1] ?? {}}
|
||||||
type={type}
|
type={type}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -235,17 +235,16 @@ DownBarChart.propTypes = {
|
|||||||
};
|
};
|
||||||
export { DownBarChart };
|
export { DownBarChart };
|
||||||
|
|
||||||
const ResponseGaugeChart = ({ data }) => {
|
const ResponseGaugeChart = ({ avgResponseTime }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
let max = 1000; // max ms
|
let max = 1000; // max ms
|
||||||
|
|
||||||
const memoizedData = useMemo(
|
const data = [
|
||||||
() => [{ response: max, fill: "transparent", background: false }, ...data],
|
{ response: max, fill: "transparent", background: false },
|
||||||
[data[0].response]
|
{ response: avgResponseTime, background: true },
|
||||||
);
|
];
|
||||||
|
let responseTime = Math.floor(avgResponseTime);
|
||||||
let responseTime = Math.floor(memoizedData[1].response);
|
|
||||||
let responseProps =
|
let responseProps =
|
||||||
responseTime <= 200
|
responseTime <= 200
|
||||||
? {
|
? {
|
||||||
@@ -267,8 +266,8 @@ const ResponseGaugeChart = ({ data }) => {
|
|||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
category: "Poor",
|
category: "Poor",
|
||||||
main: theme.palette.error.light,
|
main: theme.palette.error.main,
|
||||||
bg: theme.palette.error.dark,
|
bg: theme.palette.error.light,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -281,7 +280,7 @@ const ResponseGaugeChart = ({ data }) => {
|
|||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
cy="89%"
|
cy="89%"
|
||||||
data={memoizedData}
|
data={data}
|
||||||
startAngle={180}
|
startAngle={180}
|
||||||
endAngle={0}
|
endAngle={0}
|
||||||
innerRadius={100}
|
innerRadius={100}
|
||||||
|
|||||||
@@ -400,9 +400,9 @@ const DetailsPage = () => {
|
|||||||
</IconBox>
|
</IconBox>
|
||||||
<Typography component="h2">Average Response Time</Typography>
|
<Typography component="h2">Average Response Time</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
{/* <ResponseGaugeChart
|
<ResponseGaugeChart
|
||||||
data={[{ response: monitor?.periodAvgResponseTime }]}
|
avgResponseTime={monitor?.aggregateData?.averageResponseTime ?? 0}
|
||||||
/> */}
|
/>
|
||||||
</ChartBox>
|
</ChartBox>
|
||||||
<ChartBox sx={{ padding: 0 }}>
|
<ChartBox sx={{ padding: 0 }}>
|
||||||
<Stack
|
<Stack
|
||||||
|
|||||||
Reference in new issue
Block a user