Files
Checkmate/Client/src/Pages/Maintenance/index.jsx
T

64 lines
1.9 KiB
React
Raw Normal View History

2024-08-27 20:11:59 -04:00
import { Box } from "@mui/material";
import { useTheme } from "@emotion/react";
import Fallback from "../../Components/Fallback";
2024-10-04 14:10:16 +08:00
import { useState, useEffect } from "react";
import "./index.css";
2024-10-04 14:10:16 +08:00
import MaintenanceTable from "./MaintenanceTable";
import { useSelector } from "react-redux";
2024-08-28 10:28:02 -04:00
const Maintenance = ({ isAdmin }) => {
2024-08-27 20:11:59 -04:00
const theme = useTheme();
2024-10-04 14:10:16 +08:00
const authState = useSelector((state) => state.auth);
const [maintenanceWindows, setMaintenanceWindows] = useState([]);
const [maintenanceWindowCount, setMaintenanceWindowCount] = useState(0);
const [page, setPage] = useState(0);
const [rowsPerPage, setRowsPerPage] = useState(5);
const [sort, setSort] = useState({});
useEffect(() => {});
2024-08-27 20:11:59 -04:00
return (
2024-08-27 20:11:59 -04:00
<Box
className="maintenance"
sx={{
':has(> [class*="fallback__"])': {
position: "relative",
border: 1,
borderColor: theme.palette.border.light,
borderRadius: theme.shape.borderRadius,
borderStyle: "dashed",
backgroundColor: theme.palette.background.main,
overflow: "hidden",
},
}}
>
2024-10-04 14:10:16 +08:00
{maintenanceWindows.length > 0 && (
<MaintenanceTable
page={page}
setPage={setPage}
rowsPerPage={rowsPerPage}
setRowsPerPage={setRowsPerPage}
sort={sort}
setSort={setSort}
maintenanceWindows={maintenanceWindows}
maintenanceWindowCount={maintenanceWindowCount}
/>
)}
{isAdmin && maintenanceWindows.length === 0 && (
<Fallback
title="maintenance window"
checks={[
"Mark your maintenance periods",
"Eliminate any misunderstandings",
"Stop sending alerts in maintenance windows",
]}
link="/maintenance/create"
isAdmin={isAdmin}
/>
)}
2024-08-27 20:11:59 -04:00
</Box>
);
};
export default Maintenance;