add header
This commit is contained in:
1 parent
2246f227d1
commit
a700f446fd
6 files changed
+92
-18
No files matched your search
@@ -1,10 +1,12 @@
|
|||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import type { ButtonProps } from "@mui/material/Button";
|
import type { ButtonProps } from "@mui/material/Button";
|
||||||
export const ButtonInput: React.FC<ButtonProps> = ({ ...props }) => {
|
|
||||||
|
export const ButtonInput: React.FC<ButtonProps> = ({ filled, sx, ...props }) => {
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
|
filled={filled}
|
||||||
{...props}
|
{...props}
|
||||||
sx={{ textTransform: "none", height: 34, fontWeight: 400, borderRadius: 2 }}
|
sx={{ textTransform: "none", height: 34, fontWeight: 400, borderRadius: 2, ...sx }}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -11,17 +11,6 @@ export const ButtonGroupInput: React.FC<ButtonGroupProps> = ({
|
|||||||
<ButtonGroup
|
<ButtonGroup
|
||||||
orientation={orientation}
|
orientation={orientation}
|
||||||
{...props}
|
{...props}
|
||||||
sx={{
|
|
||||||
...(orientation !== "vertical" && { height: 34 }),
|
|
||||||
width: orientation === "vertical" ? "100%" : "auto",
|
|
||||||
border: 1,
|
|
||||||
borderStyle: "solid",
|
|
||||||
borderColor: theme.palette.primary.lowContrast,
|
|
||||||
borderRadius: 2,
|
|
||||||
"& .MuiButtonGroup-grouped": {
|
|
||||||
height: "100%",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import { ButtonGroup, Button } from "@/Components/v2/Inputs";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { theme } from "@/Utils/Theme/v2/theme";
|
||||||
|
|
||||||
|
export const HeaderRange = ({
|
||||||
|
range,
|
||||||
|
setRange,
|
||||||
|
loading,
|
||||||
|
}: {
|
||||||
|
range: string;
|
||||||
|
setRange: Function;
|
||||||
|
loading: boolean;
|
||||||
|
}) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
gap={theme.spacing(9)}
|
||||||
|
direction="row"
|
||||||
|
alignItems={"center"}
|
||||||
|
justifyContent="flex-end"
|
||||||
|
>
|
||||||
|
<Typography variant="body2">{`Showing statistics for past ${range}`}</Typography>
|
||||||
|
<ButtonGroup
|
||||||
|
variant="contained"
|
||||||
|
color={"primary"}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
color={range === "2h" ? "secondary" : "inherit"}
|
||||||
|
onClick={() => setRange("2h")}
|
||||||
|
loading={loading}
|
||||||
|
>
|
||||||
|
Recent
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
color={range === "24h" ? "secondary" : "inherit"}
|
||||||
|
onClick={() => setRange("24h")}
|
||||||
|
loading={loading}
|
||||||
|
>
|
||||||
|
Day
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
color={range === "7d" ? "secondary" : "inherit"}
|
||||||
|
onClick={() => setRange("7d")}
|
||||||
|
loading={loading}
|
||||||
|
>
|
||||||
|
7 days
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
color={range === "30d" ? "secondary" : "inherit"}
|
||||||
|
onClick={() => setRange("30d")}
|
||||||
|
loading={loading}
|
||||||
|
>
|
||||||
|
30 days
|
||||||
|
</Button>
|
||||||
|
</ButtonGroup>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -5,7 +5,7 @@ import { ConfigBox, BasePage } from "@/Components/v2/DesignElements";
|
|||||||
import RadioGroup from "@mui/material/RadioGroup";
|
import RadioGroup from "@mui/material/RadioGroup";
|
||||||
import FormControl from "@mui/material/FormControl";
|
import FormControl from "@mui/material/FormControl";
|
||||||
import { RadioWithDescription } from "@/Components/v2/Inputs/RadioInput";
|
import { RadioWithDescription } from "@/Components/v2/Inputs/RadioInput";
|
||||||
import Button from "@mui/material/Button";
|
import { Button } from "@/Components/v2/Inputs";
|
||||||
import DeleteOutlineRoundedIcon from "@mui/icons-material/DeleteOutlineRounded";
|
import DeleteOutlineRoundedIcon from "@mui/icons-material/DeleteOutlineRounded";
|
||||||
import { Typography } from "@mui/material";
|
import { Typography } from "@mui/material";
|
||||||
import humanInterval from "human-interval";
|
import humanInterval from "human-interval";
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { useState } from "react";
|
|||||||
import { getStatusPalette } from "@/Utils/MonitorUtils";
|
import { getStatusPalette } from "@/Utils/MonitorUtils";
|
||||||
import prettyMilliseconds from "pretty-ms";
|
import prettyMilliseconds from "pretty-ms";
|
||||||
import { ChartResponseTime } from "@/Components/v2/Monitors/ChartResponseTime";
|
import { ChartResponseTime } from "@/Components/v2/Monitors/ChartResponseTime";
|
||||||
|
import { HeaderRange } from "@/Components/v2/Monitors/HeaderRange";
|
||||||
|
|
||||||
const UptimeDetailsPage = () => {
|
const UptimeDetailsPage = () => {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
@@ -73,8 +74,10 @@ const UptimeDetailsPage = () => {
|
|||||||
: -1;
|
: -1;
|
||||||
|
|
||||||
const checks = response?.data?.checks || [];
|
const checks = response?.data?.checks || [];
|
||||||
const upChecks = upResponse?.data?.checks || [];
|
const upChecks = upResponse?.data?.checks ? [...upResponse.data.checks].reverse() : [];
|
||||||
const downChecks = downResponse?.data?.checks || [];
|
const downChecks = downResponse?.data?.checks
|
||||||
|
? [...downResponse.data.checks].reverse()
|
||||||
|
: [];
|
||||||
|
|
||||||
// TODO something with these
|
// TODO something with these
|
||||||
|
|
||||||
@@ -112,6 +115,10 @@ const UptimeDetailsPage = () => {
|
|||||||
subtitle={stats?.lastResponseTime ? `${stats?.lastResponseTime} ms` : "N/A"}
|
subtitle={stats?.lastResponseTime ? `${stats?.lastResponseTime} ms` : "N/A"}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
<HeaderRange
|
||||||
|
range={range}
|
||||||
|
setRange={setRange}
|
||||||
|
/>
|
||||||
<Stack
|
<Stack
|
||||||
direction={isSmall ? "column" : "row"}
|
direction={isSmall ? "column" : "row"}
|
||||||
gap={theme.spacing(8)}
|
gap={theme.spacing(8)}
|
||||||
@@ -119,12 +126,12 @@ const UptimeDetailsPage = () => {
|
|||||||
<HistogramStatus
|
<HistogramStatus
|
||||||
title="Uptime"
|
title="Uptime"
|
||||||
status={"up"}
|
status={"up"}
|
||||||
checks={upChecks.reverse()}
|
checks={upChecks}
|
||||||
range={range}
|
range={range}
|
||||||
/>
|
/>
|
||||||
<HistogramStatus
|
<HistogramStatus
|
||||||
title="Incidents"
|
title="Incidents"
|
||||||
checks={downChecks.reverse()}
|
checks={downChecks}
|
||||||
status={"down"}
|
status={"down"}
|
||||||
range={range}
|
range={range}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Vendored
+16
@@ -22,3 +22,19 @@ declare module "@mui/material/Button" {
|
|||||||
accent: true;
|
accent: true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module "@mui/material/Button" {
|
||||||
|
interface ButtonPropsVariantOverrides {
|
||||||
|
group: true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "@mui/material/ButtonGroup" {
|
||||||
|
interface ButtonGroupPropsColorOverrides {
|
||||||
|
accent: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ButtonGroupPropsVariantOverrides {
|
||||||
|
group: true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user