Refactored ChartUtils to allow for variable normalization parameters, Added day, week, and month filters to Details chart

This commit is contained in:
Alex Holliday committed 2024-07-17 23:00:24 -07:00
1 parent 07719aad2b
commit 9cb2abd62a
4 files changed
+91 -26

No files matched your search

+19 -5
View File
@@ -46,6 +46,8 @@ const DetailsPage = () => {
const [data, setData] = useState({});
const { monitorId } = useParams();
const { authToken } = useSelector((state) => state.auth);
const [filter, setFilter] = useState("day");
useEffect(() => {
const fetchMonitor = async () => {
const res = await axiosInstance.get(`/monitors/${monitorId}`, {
@@ -180,13 +182,25 @@ const DetailsPage = () => {
Response Times
</Typography>
<ButtonGroup>
<Button level="secondary" label="Day" />
<Button level="secondary" label="Week" />
<Button level="secondary" label="Month" />
<Button
level="secondary"
label="Day"
onClick={() => setFilter("day")}
/>
<Button
level="secondary"
label="Week"
onClick={() => setFilter("week")}
/>
<Button
level="secondary"
label="Month"
onClick={() => setFilter("month")}
/>
</ButtonGroup>
</div>
<div style={{ height: "10rem" }}>
<MonitorDetailsAreaChart checks={monitor.checks} />
<div style={{ height: "33vh" }}>
<MonitorDetailsAreaChart checks={monitor.checks} filter={filter} />
</div>
<Typography component="h1" mb={theme.gap.small}>
History