Add domains to percentage graphs

This commit is contained in:
Alex Holliday committed 2024-11-25 10:49:16 +08:00
1 parent 947adb197b
commit c8649c8f87
1 file changed
+5 -2
@@ -221,13 +221,12 @@ const InfrastructureDetails = () => {
setMonitor(response.data.data); setMonitor(response.data.data);
} catch (error) { } catch (error) {
navigate("/not-found", { replace: true }); navigate("/not-found", { replace: true });
logger.error(error); logger.error(error);
} }
}; };
fetchData(); fetchData();
}, [authToken, monitorId, dateRange]); }, [authToken, monitorId, dateRange]);
const statBoxConfigs = [ const statBoxConfigs = [
{ {
id: 0, id: 0,
@@ -290,6 +289,7 @@ const InfrastructureDetails = () => {
heading: "Memory usage", heading: "Memory usage",
strokeColor: theme.palette.primary.main, strokeColor: theme.palette.primary.main,
yLabel: "Memory Usage", yLabel: "Memory Usage",
yDomain: [0, 1],
}, },
{ {
type: "cpu", type: "cpu",
@@ -297,6 +297,7 @@ const InfrastructureDetails = () => {
heading: "CPU usage", heading: "CPU usage",
strokeColor: theme.palette.success.main, strokeColor: theme.palette.success.main,
yLabel: "CPU Usage", yLabel: "CPU Usage",
yDomain: [0, 1],
}, },
...(monitor?.checks?.[0]?.disk?.map((disk, idx) => ({ ...(monitor?.checks?.[0]?.disk?.map((disk, idx) => ({
type: "disk", type: "disk",
@@ -305,6 +306,7 @@ const InfrastructureDetails = () => {
heading: `Disk${idx} usage`, heading: `Disk${idx} usage`,
strokeColor: theme.palette.warning.main, strokeColor: theme.palette.warning.main,
yLabel: "Disk Usage", yLabel: "Disk Usage",
yDomain: [0, 1],
})) || []), })) || []),
]; ];
@@ -394,6 +396,7 @@ const InfrastructureDetails = () => {
dataKey={config.dataKey} dataKey={config.dataKey}
xKey="createdAt" xKey="createdAt"
yKey={config.dataKey} yKey={config.dataKey}
yDomain={config.yDomain}
customTooltip={({ active, payload, label }) => ( customTooltip={({ active, payload, label }) => (
<InfrastructureTooltip <InfrastructureTooltip
label={label} label={label}