- Move create infrastructure folder to infrastructure and remove Infrastructuremonitor folder

- Add create infrastructure page to globle routes and add "infrastructure" to PATH_MAP
- Add navigation/breadcrumb to  create infrastructure page
- Connect create infrastructure page to create monitor button on home page
This commit is contained in:
Shemy Gan committed 2024-11-19 09:57:39 -05:00
1 parent 657a953ad9
commit 8b8a0962db
5 files changed
+12 -5

No files matched your search

+5 -1
View File
@@ -10,6 +10,7 @@ import Register from "./Pages/Auth/Register/Register";
import Account from "./Pages/Account"; import Account from "./Pages/Account";
import Monitors from "./Pages/Monitors/Home"; import Monitors from "./Pages/Monitors/Home";
import CreateMonitor from "./Pages/Monitors/CreateMonitor"; import CreateMonitor from "./Pages/Monitors/CreateMonitor";
import CreateInfrastructureMonitor from "./Pages/Infrastructure/CreateMonitor";
import Incidents from "./Pages/Incidents"; import Incidents from "./Pages/Incidents";
import Status from "./Pages/Status"; import Status from "./Pages/Status";
import Integrations from "./Pages/Integrations"; import Integrations from "./Pages/Integrations";
@@ -127,7 +128,10 @@ function App() {
path="infrastructure" path="infrastructure"
element={<ProtectedRoute Component={Infrastructure} />} element={<ProtectedRoute Component={Infrastructure} />}
/> />
<Route
path="infrastructure/create"
element={<ProtectedRoute Component={CreateInfrastructureMonitor} />}
/>
<Route <Route
path="incidents/:monitorId?" path="incidents/:monitorId?"
element={<ProtectedRoute Component={Incidents} />} element={<ProtectedRoute Component={Incidents} />}
+1
View File
@@ -90,6 +90,7 @@ const URL_MAP = {
const PATH_MAP = { const PATH_MAP = {
monitors: "Dashboard", monitors: "Dashboard",
pagespeed: "Dashboard", pagespeed: "Dashboard",
infrastructure: "Dashboard",
account: "Account", account: "Account",
settings: "Other", settings: "Other",
}; };
@@ -177,7 +177,7 @@ const CreateInfrastructureMonitor = () => {
); );
if (action.meta.requestStatus === "fulfilled") { if (action.meta.requestStatus === "fulfilled") {
createToast({ body: "Infrastructure monitor created successfully!" }); createToast({ body: "Infrastructure monitor created successfully!" });
navigate("/infrastructure-monitors/create"); navigate("/infrastructure");
} else { } else {
createToast({ body: "Failed to create monitor." }); createToast({ body: "Failed to create monitor." });
} }
@@ -217,8 +217,8 @@ const CreateInfrastructureMonitor = () => {
<Box className="create-infrastructure-monitor"> <Box className="create-infrastructure-monitor">
<Breadcrumbs <Breadcrumbs
list={[ list={[
{ name: "Infrastructure monitors", path: "/infrastructure-monitors/create" }, { name: "Infrastructure monitors", path: "infrastructure" },
{ name: "create", path: `/infrastructure-monitors/create` }, { name: "create", path: `infrastructure/create` },
]} ]}
/> />
<Stack <Stack
+3 -1
View File
@@ -1,5 +1,6 @@
import { Box, Button } from "@mui/material"; import { Box, Button } from "@mui/material";
import { Heading } from "../../Components/Heading"; import { Heading } from "../../Components/Heading";
import { useNavigate } from "react-router-dom";
/** /**
* This is the Infrastructure monitoring page. This is a work in progress * This is the Infrastructure monitoring page. This is a work in progress
@@ -9,13 +10,14 @@ import { Heading } from "../../Components/Heading";
*/ */
function Infrastructure() { function Infrastructure() {
const navigate = useNavigate();
return ( return (
<Box component="main"> <Box component="main">
<Button <Button
variant="contained" variant="contained"
color="primary" color="primary"
onClick={() => { onClick={() => {
// navigate("/monitors/create"); navigate("/infrastructure/create");
}} }}
sx={{ fontWeight: 500 }} sx={{ fontWeight: 500 }}
> >