Fixed monitor state error and added row click back
This commit is contained in:
1 parent
ea99942697
commit
d474113e96
2 files changed
+16
-3
No files matched your search
@@ -16,6 +16,7 @@ import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded";
|
|||||||
import ArrowDownwardRoundedIcon from "@mui/icons-material/ArrowDownwardRounded";
|
import ArrowDownwardRoundedIcon from "@mui/icons-material/ArrowDownwardRounded";
|
||||||
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
import { useNavigate } from "react-router";
|
||||||
import { logger } from "../../../../Utils/Logger";
|
import { logger } from "../../../../Utils/Logger";
|
||||||
import Host from "../host";
|
import Host from "../host";
|
||||||
import { StatusLabel } from "../../../../Components/Label";
|
import { StatusLabel } from "../../../../Components/Label";
|
||||||
@@ -28,6 +29,7 @@ import ActionsMenu from "../actionsMenu";
|
|||||||
|
|
||||||
const MonitorTable = ({ isAdmin }) => {
|
const MonitorTable = ({ isAdmin }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [paginationController, setPaginationController] = useState({
|
const [paginationController, setPaginationController] = useState({
|
||||||
page: 0,
|
page: 0,
|
||||||
@@ -157,7 +159,18 @@ const MonitorTable = ({ isAdmin }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRow key={monitor._id}>
|
<TableRow
|
||||||
|
key={monitor._id}
|
||||||
|
sx={{
|
||||||
|
cursor: "pointer",
|
||||||
|
"&:hover": {
|
||||||
|
backgroundColor: theme.palette.background.accent,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
navigate(`/monitors/${monitor._id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Host key={monitor._id} params={params} />
|
<Host key={monitor._id} params={params} />
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const Monitors = ({ isAdmin }) => {
|
|||||||
dispatch(getUptimeMonitorsByTeamId(authState.authToken));
|
dispatch(getUptimeMonitorsByTeamId(authState.authToken));
|
||||||
}, [authState.authToken, dispatch]);
|
}, [authState.authToken, dispatch]);
|
||||||
|
|
||||||
const monitorStats = monitorState.monitors.monitors.reduce(
|
const monitorStats = monitorState?.monitors?.monitors?.reduce(
|
||||||
(acc, monitor) => {
|
(acc, monitor) => {
|
||||||
if (monitor.isActive === false) {
|
if (monitor.isActive === false) {
|
||||||
acc["paused"] += 1;
|
acc["paused"] += 1;
|
||||||
@@ -111,7 +111,7 @@ const Monitors = ({ isAdmin }) => {
|
|||||||
borderColor={theme.palette.border.light}
|
borderColor={theme.palette.border.light}
|
||||||
backgroundColor={theme.palette.background.accent}
|
backgroundColor={theme.palette.background.accent}
|
||||||
>
|
>
|
||||||
{monitorState.monitors.length}
|
{monitorState.monitors.monitors.length}
|
||||||
</Box>
|
</Box>
|
||||||
{/* TODO - add search bar */}
|
{/* TODO - add search bar */}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
Reference in new issue
Block a user