Merge pull request #833 from bluewave-labs/fix/action-menu-incidents
Enabled incident in actions menu, set selected monitor in Incidents page
This commit is contained in:
3 files changed
+13
-2
No files matched your search
+1
-1
@@ -71,7 +71,7 @@ function App() {
|
|||||||
element={<ProtectedRoute Component={Configure} />}
|
element={<ProtectedRoute Component={Configure} />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="incidents"
|
path="incidents/:monitorId?"
|
||||||
element={<ProtectedRoute Component={Incidents} />}
|
element={<ProtectedRoute Component={Incidents} />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { ButtonGroup, Stack, Typography, Button } from "@mui/material";
|
import { ButtonGroup, Stack, Typography, Button } from "@mui/material";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
|
||||||
import { networkService } from "../../main";
|
import { networkService } from "../../main";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import Select from "../../Components/Inputs/Select";
|
import Select from "../../Components/Inputs/Select";
|
||||||
@@ -11,6 +13,7 @@ import SkeletonLayout from "./skeleton";
|
|||||||
const Incidents = () => {
|
const Incidents = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const authState = useSelector((state) => state.auth);
|
const authState = useSelector((state) => state.auth);
|
||||||
|
const { monitorId } = useParams();
|
||||||
|
|
||||||
const [monitors, setMonitors] = useState({});
|
const [monitors, setMonitors] = useState({});
|
||||||
const [selectedMonitor, setSelectedMonitor] = useState("0");
|
const [selectedMonitor, setSelectedMonitor] = useState("0");
|
||||||
@@ -40,6 +43,7 @@ const Incidents = () => {
|
|||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
setMonitors(monitorLookup);
|
setMonitors(monitorLookup);
|
||||||
|
monitorId !== undefined && setSelectedMonitor(monitorId);
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -125,7 +125,14 @@ const ActionsMenu = ({ monitor, isAdmin, updateCallback }) => {
|
|||||||
Details
|
Details
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
{/* TODO - pass monitor id to Incidents page */}
|
{/* TODO - pass monitor id to Incidents page */}
|
||||||
<MenuItem disabled>Incidents</MenuItem>
|
<MenuItem
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
navigate(`/incidents/${actions.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Incidents
|
||||||
|
</MenuItem>
|
||||||
{isAdmin && (
|
{isAdmin && (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
|
|||||||
Reference in new issue
Block a user