Merge pull request #303 from bluewave-labs/feat/monitor-details-route
Update route to pass monitor ID to details component, #120
This commit is contained in:
2 files changed
+14
-6
No files matched your search
+5
-5
@@ -21,7 +21,6 @@ import ProtectedRoute from "./Components/ProtectedRoute";
|
|||||||
import Details from "./Pages/Details";
|
import Details from "./Pages/Details";
|
||||||
import Maintenance from "./Pages/Maintenance";
|
import Maintenance from "./Pages/Maintenance";
|
||||||
|
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -40,14 +39,15 @@ function App() {
|
|||||||
path="/monitors/create"
|
path="/monitors/create"
|
||||||
element={<ProtectedRoute Component={CreateNewMonitor} />}
|
element={<ProtectedRoute Component={CreateNewMonitor} />}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path="/monitors/:monitorId/"
|
||||||
|
element={<ProtectedRoute Component={Details} />}
|
||||||
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="incidents"
|
path="incidents"
|
||||||
element={<ProtectedRoute Component={Incidents} />}
|
element={<ProtectedRoute Component={Incidents} />}
|
||||||
/>
|
/>
|
||||||
<Route
|
|
||||||
path="details"
|
|
||||||
element={<ProtectedRoute Component={Details} />}
|
|
||||||
/>
|
|
||||||
<Route
|
<Route
|
||||||
path="status"
|
path="status"
|
||||||
element={<ProtectedRoute Component={Status} />}
|
element={<ProtectedRoute Component={Status} />}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import ArrowDownwardRoundedIcon from "@mui/icons-material/ArrowDownwardRounded";
|
|||||||
import OpenInNewPage from "../../assets/icons/open-in-new-page.svg?react";
|
import OpenInNewPage from "../../assets/icons/open-in-new-page.svg?react";
|
||||||
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
||||||
import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded";
|
import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Host component.
|
* Host component.
|
||||||
@@ -94,6 +95,7 @@ const Status = ({ params }) => {
|
|||||||
* @returns {React.Component} Returns a table with the monitor data.
|
* @returns {React.Component} Returns a table with the monitor data.
|
||||||
*/
|
*/
|
||||||
const MonitorTable = ({ monitors = [] }) => {
|
const MonitorTable = ({ monitors = [] }) => {
|
||||||
|
const navigate = useNavigate();
|
||||||
const [page, setPage] = useState(0);
|
const [page, setPage] = useState(0);
|
||||||
const rowsPerPage = 5;
|
const rowsPerPage = 5;
|
||||||
|
|
||||||
@@ -124,7 +126,13 @@ const MonitorTable = ({ monitors = [] }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRow key={monitor._id}>
|
<TableRow
|
||||||
|
sx={{ cursor: "pointer" }}
|
||||||
|
key={monitor._id}
|
||||||
|
onClick={() => {
|
||||||
|
navigate(`/monitors/${monitor._id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Host params={params} />
|
<Host params={params} />
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||
Reference in new issue
Block a user