Renamed filter to dateRange, add incidents table
This commit is contained in:
1 parent
60996da401
commit
d95fcb119d
7 files changed
+285
-113
No files matched your search
@@ -9,7 +9,7 @@ import { StatusLabel } from "../../Components/Label";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { useNavigate } from "react-router";
|
||||
import Select from "../../Components/Inputs/Select";
|
||||
|
||||
import IncidentTable from "./IncidentTable";
|
||||
import "./index.css";
|
||||
|
||||
/**
|
||||
@@ -76,99 +76,142 @@ const Incidents = () => {
|
||||
fetchMonitors();
|
||||
}, [authState]);
|
||||
|
||||
useEffect(() => {}, []);
|
||||
|
||||
const handleSelect = (event) => {
|
||||
setSelectedMonitor(event.target.value);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack className="incidents" gap={theme.gap.large}>
|
||||
{loading ? (
|
||||
<SkeletonLayout />
|
||||
) : false ? (
|
||||
<>
|
||||
<Stack direction="row" alignItems="center" gap={theme.gap.medium}>
|
||||
<Typography component="h1">Incident history for: </Typography>
|
||||
<Select
|
||||
id="incidents-select-monitor"
|
||||
placeholder="All servers"
|
||||
value={selectedMonitor}
|
||||
onChange={handleSelect}
|
||||
items={Object.values(monitors)}
|
||||
/>
|
||||
{hasAnyIncidents && hasSpecificIncidents && (
|
||||
<ButtonGroup sx={{ ml: "auto" }}>
|
||||
<Button
|
||||
level="secondary"
|
||||
label="All"
|
||||
onClick={() => setFilter("all")}
|
||||
sx={{
|
||||
backgroundColor:
|
||||
filter === "all" && theme.palette.otherColors.fillGray,
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
level="secondary"
|
||||
label="Down"
|
||||
onClick={() => setFilter("down")}
|
||||
sx={{
|
||||
backgroundColor:
|
||||
filter === "down" && theme.palette.otherColors.fillGray,
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
level="secondary"
|
||||
label="Cannot Resolve"
|
||||
onClick={() => setFilter("resolve")}
|
||||
sx={{
|
||||
backgroundColor:
|
||||
filter === "resolve" &&
|
||||
theme.palette.otherColors.fillGray,
|
||||
}}
|
||||
/>
|
||||
</ButtonGroup>
|
||||
)}
|
||||
</Stack>
|
||||
{hasAnyIncidents && hasSpecificIncidents ? (
|
||||
<div>thing</div>
|
||||
) : (
|
||||
<Typography alignSelf="center" mt={theme.gap.xxl}>
|
||||
The monitor you have selected, has no recorded incidents yet.
|
||||
</Typography>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<Box>
|
||||
<Button
|
||||
level="tertiary"
|
||||
label="Back"
|
||||
animate="slideLeft"
|
||||
img={<WestRoundedIcon />}
|
||||
onClick={() => navigate(-1)}
|
||||
sx={{
|
||||
backgroundColor: theme.palette.otherColors.fillGray,
|
||||
px: theme.gap.ml,
|
||||
mb: theme.gap.ml,
|
||||
"& svg.MuiSvgIcon-root": {
|
||||
mr: theme.gap.small,
|
||||
fill: theme.palette.otherColors.slateGray,
|
||||
},
|
||||
}}
|
||||
/>
|
||||
<Box
|
||||
padding={theme.gap.xxl}
|
||||
gap={theme.gap.small}
|
||||
border={1}
|
||||
borderRadius={`${theme.shape.borderRadius}px`}
|
||||
borderColor={theme.palette.otherColors.graishWhite}
|
||||
backgroundColor={theme.palette.otherColors.white}
|
||||
>
|
||||
<Typography textAlign="center">No incidents, yet.</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
<Stack className="incidents" gap={theme.gap.large}>
|
||||
<Stack direction="row" alignItems="center" gap={theme.gap.medium}>
|
||||
<Select
|
||||
id="incidents-select-monitor"
|
||||
placeholder="All servers"
|
||||
value={selectedMonitor}
|
||||
onChange={handleSelect}
|
||||
items={Object.values(monitors)}
|
||||
/>
|
||||
<ButtonGroup sx={{ ml: "auto" }}>
|
||||
<Button
|
||||
level="secondary"
|
||||
label="All"
|
||||
onClick={() => setFilter("all")}
|
||||
sx={{
|
||||
backgroundColor:
|
||||
filter === "all" && theme.palette.otherColors.fillGray,
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
level="secondary"
|
||||
label="Down"
|
||||
onClick={() => setFilter("down")}
|
||||
sx={{
|
||||
backgroundColor:
|
||||
filter === "down" && theme.palette.otherColors.fillGray,
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
level="secondary"
|
||||
label="Cannot Resolve"
|
||||
onClick={() => setFilter("resolve")}
|
||||
sx={{
|
||||
backgroundColor:
|
||||
filter === "resolve" && theme.palette.otherColors.fillGray,
|
||||
}}
|
||||
/>
|
||||
</ButtonGroup>
|
||||
</Stack>
|
||||
</>
|
||||
<IncidentTable monitorId={selectedMonitor} filter={filter} />
|
||||
</Stack>
|
||||
// <>
|
||||
// <Stack className="incidents" gap={theme.gap.large}>
|
||||
// {loading ? (
|
||||
// <SkeletonLayout />
|
||||
// ) : false ? (
|
||||
// <>
|
||||
// <Stack direction="row" alignItems="center" gap={theme.gap.medium}>
|
||||
// <Typography component="h1">Incident history for: </Typography>
|
||||
// <Select
|
||||
// id="incidents-select-monitor"
|
||||
// placeholder="All servers"
|
||||
// value={selectedMonitor}
|
||||
// onChange={handleSelect}
|
||||
// items={Object.values(monitors)}
|
||||
// />
|
||||
// {hasAnyIncidents && hasSpecificIncidents && (
|
||||
// <ButtonGroup sx={{ ml: "auto" }}>
|
||||
// <Button
|
||||
// level="secondary"
|
||||
// label="All"
|
||||
// onClick={() => setFilter("all")}
|
||||
// sx={{
|
||||
// backgroundColor:
|
||||
// filter === "all" && theme.palette.otherColors.fillGray,
|
||||
// }}
|
||||
// />
|
||||
// <Button
|
||||
// level="secondary"
|
||||
// label="Down"
|
||||
// onClick={() => setFilter("down")}
|
||||
// sx={{
|
||||
// backgroundColor:
|
||||
// filter === "down" && theme.palette.otherColors.fillGray,
|
||||
// }}
|
||||
// />
|
||||
// <Button
|
||||
// level="secondary"
|
||||
// label="Cannot Resolve"
|
||||
// onClick={() => setFilter("resolve")}
|
||||
// sx={{
|
||||
// backgroundColor:
|
||||
// filter === "resolve" &&
|
||||
// theme.palette.otherColors.fillGray,
|
||||
// }}
|
||||
// />
|
||||
// </ButtonGroup>
|
||||
// )}
|
||||
// </Stack>
|
||||
// {hasAnyIncidents && hasSpecificIncidents ? (
|
||||
// <div>thing</div>
|
||||
// ) : (
|
||||
// <Typography alignSelf="center" mt={theme.gap.xxl}>
|
||||
// The monitor you have selected, has no recorded incidents yet.
|
||||
// </Typography>
|
||||
// )}
|
||||
// </>
|
||||
// ) : (
|
||||
// <Box>
|
||||
// <Button
|
||||
// level="tertiary"
|
||||
// label="Back"
|
||||
// animate="slideLeft"
|
||||
// img={<WestRoundedIcon />}
|
||||
// onClick={() => navigate(-1)}
|
||||
// sx={{
|
||||
// backgroundColor: theme.palette.otherColors.fillGray,
|
||||
// px: theme.gap.ml,
|
||||
// mb: theme.gap.ml,
|
||||
// "& svg.MuiSvgIcon-root": {
|
||||
// mr: theme.gap.small,
|
||||
// fill: theme.palette.otherColors.slateGray,
|
||||
// },
|
||||
// }}
|
||||
// />
|
||||
// <Box
|
||||
// padding={theme.gap.xxl}
|
||||
// gap={theme.gap.small}
|
||||
// border={1}
|
||||
// borderRadius={`${theme.shape.borderRadius}px`}
|
||||
// borderColor={theme.palette.otherColors.graishWhite}
|
||||
// backgroundColor={theme.palette.otherColors.white}
|
||||
// >
|
||||
// <Typography textAlign="center">No incidents, yet.</Typography>
|
||||
// </Box>
|
||||
// </Box>
|
||||
// )}
|
||||
// </Stack>
|
||||
// </>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user