Added route from pagespeed to monitor
This commit is contained in:
1 parent
d6f59c2b86
commit
2e1861d5e8
3 files changed
+40
-5
No files matched your search
+1
-1
@@ -95,7 +95,7 @@ function App() {
|
|||||||
element={<ProtectedRoute Component={CreatePageSpeed} />}
|
element={<ProtectedRoute Component={CreatePageSpeed} />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="page-speed/:monitorId"
|
path="pagespeed/:monitorId"
|
||||||
element={<ProtectedRoute Component={PageSpeedDetails} />}
|
element={<ProtectedRoute Component={PageSpeedDetails} />}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
import { Box, Stack, Typography } from "@mui/material";
|
import { Box, Stack, Typography } from "@mui/material";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import axiosInstance from "../../../Utils/axiosConfig";
|
||||||
import Button from "../../../Components/Button";
|
import Button from "../../../Components/Button";
|
||||||
import WestRoundedIcon from "@mui/icons-material/WestRounded";
|
import WestRoundedIcon from "@mui/icons-material/WestRounded";
|
||||||
import SettingsIcon from "../../../assets/icons/settings.svg?react";
|
import SettingsIcon from "../../../assets/icons/settings.svg?react";
|
||||||
import LastCheckedIcon from "../../../assets/icons/calendar-check.svg?react";
|
import LastCheckedIcon from "../../../assets/icons/calendar-check.svg?react";
|
||||||
import ClockIcon from "../../../assets/icons/maintenance.svg?react";
|
import ClockIcon from "../../../assets/icons/maintenance.svg?react";
|
||||||
import IntervalCheckIcon from "../../../assets/icons/interval-check.svg?react";
|
import IntervalCheckIcon from "../../../assets/icons/interval-check.svg?react";
|
||||||
import PauseCircleOutlineIcon from "@mui/icons-material/PauseCircleOutline";
|
|
||||||
import GreenCheck from "../../../assets/icons/checkbox-green.svg?react";
|
import GreenCheck from "../../../assets/icons/checkbox-green.svg?react";
|
||||||
import RedCheck from "../../../assets/icons/checkbox-red.svg?react";
|
import RedCheck from "../../../assets/icons/checkbox-red.svg?react";
|
||||||
|
|
||||||
@@ -38,6 +40,27 @@ const StatBox = ({ icon, title, value }) => {
|
|||||||
const PageSpeedDetails = () => {
|
const PageSpeedDetails = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const [monitor, setMonitor] = useState({});
|
||||||
|
const { monitorId } = useParams();
|
||||||
|
const { authToken } = useSelector((state) => state.auth);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchMonitor = async () => {
|
||||||
|
const res = await axiosInstance.get(
|
||||||
|
`/monitors/${monitorId}?sortOrder=asc`,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${authToken}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
setMonitor(res.data.data);
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchMonitor();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
console.log(monitor);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
_id: "66ad34001d483d284550e8cb",
|
_id: "66ad34001d483d284550e8cb",
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { useNavigate } from "react-router";
|
|||||||
|
|
||||||
const Card = ({ data }) => {
|
const Card = ({ data }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get duration since last check or the last date checked
|
* Helper function to get duration since last check or the last date checked
|
||||||
@@ -33,8 +34,19 @@ const Card = ({ data }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid item lg={6} flexGrow={1}>
|
<Grid
|
||||||
<Stack direction="row" gap={theme.gap.medium} p={theme.gap.ml}>
|
item
|
||||||
|
lg={6}
|
||||||
|
flexGrow={1}
|
||||||
|
sx={{ "&:hover > .MuiStack-root": { backgroundColor: "#f9fafb" } }}
|
||||||
|
>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
gap={theme.gap.medium}
|
||||||
|
p={theme.gap.ml}
|
||||||
|
onClick={() => navigate(`/pagespeed/${data._id}`)}
|
||||||
|
sx={{ cursor: "pointer" }}
|
||||||
|
>
|
||||||
<PageSpeedIcon style={{ width: theme.gap.ml, height: theme.gap.ml }} />
|
<PageSpeedIcon style={{ width: theme.gap.ml, height: theme.gap.ml }} />
|
||||||
<Box flex={1}>
|
<Box flex={1}>
|
||||||
<Stack direction="row" justifyContent="space-between">
|
<Stack direction="row" justifyContent="space-between">
|
||||||
|
|||||||
Reference in new issue
Block a user