import "./index.css"; import { useEffect } from "react"; import { useSelector, useDispatch } from "react-redux"; import { getMonitorsByUserId } from "../../Features/Monitors/monitorsSlice"; import { useNavigate } from "react-router-dom"; import Button from "../../Components/Button"; import ServerStatus from "../../Components/Charts/Servers/ServerStatus"; import { useTheme } from "@emotion/react"; import ArrowDownwardRoundedIcon from "@mui/icons-material/ArrowDownwardRounded"; import OpenInNewPage from "../../assets/icons/open-in-new-page.svg?react"; import BasicTable from "../../Components/BasicTable"; import { StatusLabel } from "../../Components/Label"; import ResponseTimeChart from "../../Components/Charts/ResponseTimeChart"; import { Box, Stack, Typography } from "@mui/material"; /** * Host component. * This subcomponent receives a params object and displays the host details. * * @component * @param {Object} params - An object containing the following properties: * @param {string} params.url - The URL of the host. * @param {string} params.title - The name of the host. * @param {string} params.percentageColor - The color of the percentage text. * @param {number} params.precentage - The percentage to display. * @returns {React.ElementType} Returns a div element with the host details. */ const Host = ({ params }) => { return (
); }; const Monitors = () => { const theme = useTheme(); const navigate = useNavigate(); const monitorState = useSelector((state) => state.monitors); const authState = useSelector((state) => state.auth); const dispatch = useDispatch(); useEffect(() => { dispatch(getMonitorsByUserId(authState.authToken)); }, []); const up = monitorState.monitors.reduce((acc, cur) => { return cur.status === true ? acc + 1 : acc; }, 0); const down = monitorState.monitors.length - up; const data = { cols: [ { id: 1, name: "Host" }, { id: 2, name: ( <> Status