import { styled, useTheme } from '@mui/material/styles';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell, { tableCellClasses } from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import Paper from '@mui/material/Paper';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import { StatusLabel } from "../../Components/Label/";
import PropTypes from 'prop-types';
const StyledTableCell = styled(TableCell)(({ theme }) => ({
[`&.${tableCellClasses.head}`]: {
backgroundColor: theme.palette.action.hover,
color: theme.palette.common.black,
},
[`&.${tableCellClasses.body}`]: {
fontSize: 14,
},
}));
const StyledTableRow = styled(TableRow)(({ theme }) => ({
'&:nth-of-type(odd)': {
backgroundColor: theme.palette.action.hover,
},
'&:nth-of-type(even)': {
backgroundColor: theme.palette.common.white,
},
'&:last-child td, &:last-child th': {
border: 0,
},
}));
function createData(name, date, message) {
return { name, date, message };
}
const CustomizedTables = ({ monitor }) => {
const theme = useTheme();
const rows = (monitor && monitor.checks) ? monitor.checks.map(check => createData(
,
new Date(check.createdAt).toLocaleString(),
`HTTP ${check.statusCode} - ${check.status ? 'OK' : 'NOK'}`
)) : [];
return (
{[...Array(4)].map((_, index) => (
Currently up for
4h 30m 2s
))}
History
Status
Date & Time
Message
{rows.map((row) => (
{row.name}
{row.date}
{row.message}
))}
);
};
CustomizedTables.propTypes = {
monitor: PropTypes.shape({
checks: PropTypes.arrayOf(
PropTypes.shape({
status: PropTypes.bool.isRequired,
createdAt: PropTypes.string.isRequired,
statusCode: PropTypes.number.isRequired,
})
),
}),
};
CustomizedTables.defaultProps = {
monitor: { checks: [] },
};
export default CustomizedTables;