// Components import { Box, Stack, CircularProgress } from "@mui/material"; import Search from "../../../../Components/Inputs/Search"; import { Heading } from "../../../../Components/Heading"; import DataTable from "../../../../Components/Table"; import ArrowDownwardRoundedIcon from "@mui/icons-material/ArrowDownwardRounded"; import ArrowUpwardRoundedIcon from "@mui/icons-material/ArrowUpwardRounded"; import Host from "../host"; import { StatusLabel } from "../../../../Components/Label"; import BarChart from "../../../../Components/Charts/BarChart"; import ActionsMenu from "../actionsMenu"; // Utils import { useTheme } from "@emotion/react"; import useDebounce from "../../../../Utils/debounce"; import { useState } from "react"; import useUtils from "../../utils"; import { memo } from "react"; import { useNavigate } from "react-router-dom"; import "../index.css"; const UptimeDataTable = ({ isAdmin, isLoading, monitors, monitorCount, sort, setSort, search, setSearch, isSearching, setIsSearching, triggerUpdate, }) => { const { determineState } = useUtils(); const theme = useTheme(); const navigate = useNavigate(); //Utils const debouncedFilter = useDebounce(search, 500); const handleSearch = (value) => { setIsSearching(true); setSearch(value); }; const handleSort = (field) => { let order = ""; if (sort.field !== field) { order = "desc"; } else { order = sort.order === "asc" ? "desc" : "asc"; } setSort({ field, order }); }; const headers = [ { id: "name", content: ( handleSort("name")} > Host {sort.order === "asc" ? ( ) : ( )} ), render: (row) => ( ), }, { id: "status", content: ( handleSort("status")} > {" "} Status {sort.order === "asc" ? ( ) : ( )} ), render: (row) => { const status = determineState(row.monitor); return ( ); }, }, { id: "responseTime", content: "Response Time", render: (row) => , }, { id: "type", content: "Type", render: (row) => ( {row.monitor.type} ), }, { id: "actions", content: "Actions", render: (row) => ( ), }, ]; return ( Uptime monitors {monitorCount} {isSearching && ( <> )} { navigate(`/uptime/${row.id}`); }, emptyView: "No monitors found", }} /> ); }; const MemoizedUptimeDataTable = memo(UptimeDataTable); export default MemoizedUptimeDataTable;