Add maintenance table

This commit is contained in:
Alex Holliday committed 2024-10-04 14:10:16 +08:00
1 parent 68296eccc3
commit b0182cff6d
2 files changed
+325 -10

No files matched your search

+36 -10
View File
@@ -1,10 +1,22 @@
import { Box } from "@mui/material";
import { useTheme } from "@emotion/react";
import Fallback from "../../Components/Fallback";
import { useState, useEffect } from "react";
import "./index.css";
import MaintenanceTable from "./MaintenanceTable";
import { useSelector } from "react-redux";
const Maintenance = ({ isAdmin }) => {
const theme = useTheme();
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(() => {});
return (
<Box
@@ -21,16 +33,30 @@ const Maintenance = ({ isAdmin }) => {
},
}}
>
<Fallback
title="maintenance window"
checks={[
"Mark your maintenance periods",
"Eliminate any misunderstandings",
"Stop sending alerts in maintenance windows",
]}
link="/maintenance/create"
isAdmin={isAdmin}
/>
{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}
/>
)}
</Box>
);
};