From 1c655dd35a15d40d0f2b3718c6bf5302d0ae6dcc Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 10 Dec 2024 14:00:24 +0800 Subject: [PATCH 1/2] Add matching header to infrastructure page --- Client/src/Pages/Infrastructure/index.jsx | 43 ++++++++++------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/Client/src/Pages/Infrastructure/index.jsx b/Client/src/Pages/Infrastructure/index.jsx index 46cf636d2..ff6e5a9a9 100644 --- a/Client/src/Pages/Infrastructure/index.jsx +++ b/Client/src/Pages/Infrastructure/index.jsx @@ -191,31 +191,26 @@ function Infrastructure() { ) : monitorState.monitors?.length !== 0 ? ( - - - {/* - This will be removed from here, but keeping the commented code to remind me to add a max width to the greeting component - - - */} - - + {isAdmin && ( + + )} + + Date: Tue, 10 Dec 2024 14:00:45 +0800 Subject: [PATCH 2/2] Add monitor count to PageSpeed page --- Client/src/Pages/PageSpeed/index.jsx | 33 +++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/Client/src/Pages/PageSpeed/index.jsx b/Client/src/Pages/PageSpeed/index.jsx index 8e0f111bb..b4056ffce 100644 --- a/Client/src/Pages/PageSpeed/index.jsx +++ b/Client/src/Pages/PageSpeed/index.jsx @@ -11,7 +11,7 @@ import Breadcrumbs from "../../Components/Breadcrumbs"; import SkeletonLayout from "./skeleton"; import Card from "./card"; import { networkService } from "../../main"; - +import { Heading } from "../../Components/Heading"; const PageSpeed = ({ isAdmin }) => { const theme = useTheme(); const dispatch = useDispatch(); @@ -20,6 +20,7 @@ const PageSpeed = ({ isAdmin }) => { const { user, authToken } = useSelector((state) => state.auth); const [isLoading, setIsLoading] = useState(true); const [monitors, setMonitors] = useState([]); + const [monitorCount, setMonitorCount] = useState(0); useEffect(() => { dispatch(getPageSpeedByTeamId(authToken)); }, [authToken, dispatch]); @@ -44,6 +45,7 @@ const PageSpeed = ({ isAdmin }) => { }); if (res?.data?.data?.monitors) { setMonitors(res.data.data.monitors); + setMonitorCount(res.data.data.monitorCount); } } catch (error) { console.log(error); @@ -53,7 +55,7 @@ const PageSpeed = ({ isAdmin }) => { }; fetchMonitors(); - }, []); + }, [authToken, user.teamId]); // will show skeletons only on initial load // since monitor state is being added to redux persist, there's no reason to display skeletons on every render @@ -76,8 +78,8 @@ const PageSpeed = ({ isAdmin }) => { {isActuallyLoading ? ( ) : monitors?.length !== 0 ? ( - - + + { )} + + PageSpeed monitors + {/* TODO Correct the class current-monitors-counter, there are some unnecessary things there */} + + {monitorCount} + + { /> ))} - + ) : (