// Components
import DataTable from "../../../../../Components/Table";
import BarChart from "../../../../../Components/Charts/BarChart";
import { Box } from "@mui/material";
import { StatusLabel } from "../../../../../Components/Label";
import Host from "../../../../../Components/Host";
// Utils
import { useTheme } from "@mui/material/styles";
import { useNavigate } from "react-router-dom";
import { useMonitorUtils } from "../../../../../Hooks/useMonitorUtils";
import PropTypes from "prop-types";
// Constants
const TYPE_MAP = {
distributed_http: "Distributed HTTP",
};
const MonitorTable = ({ isLoading, monitors }) => {
const theme = useTheme();
const navigate = useNavigate();
const { determineState } = useMonitorUtils();
const headers = [
{
id: "name",
content: Host,
render: (row) => (
),
},
{
id: "status",
content: Status,
render: (row) => {
const status = determineState(row?.monitor);
return (
);
},
},
{
id: "responseTime",
content: "Response Time",
render: (row) => ,
},
{
id: "type",
content: "Type",
render: (row) => {TYPE_MAP[row.monitor.type]},
},
{
id: "actions",
content: "Actions",
render: (row) => {"TODO"},
},
];
return (
{
navigate(`/distributed-uptime/${row._id}`);
},
}}
/>
);
};
MonitorTable.propTypes = {
isLoading: PropTypes.bool,
monitors: PropTypes.array,
};
export default MonitorTable;