Merge pull request #2045 from Br0wnHammer/feat/fe/monitor-header-ui
Feat: New Monitor Header UI
This commit is contained in:
4 files changed
+20
-11
No files matched your search
@@ -1,6 +1,4 @@
|
|||||||
import { Stack } from "@mui/material";
|
import { Stack, Typography } from "@mui/material";
|
||||||
import { Heading } from "../Heading";
|
|
||||||
import CircularCount from "../CircularCount";
|
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import SkeletonLayout from "./skeleton";
|
import SkeletonLayout from "./skeleton";
|
||||||
@@ -8,22 +6,36 @@ import SkeletonLayout from "./skeleton";
|
|||||||
const MonitorCountHeader = ({
|
const MonitorCountHeader = ({
|
||||||
shouldRender = true,
|
shouldRender = true,
|
||||||
monitorCount,
|
monitorCount,
|
||||||
heading,
|
heading = "monitors",
|
||||||
sx,
|
sx,
|
||||||
children,
|
children,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
if (!shouldRender) return <SkeletonLayout />;
|
if (!shouldRender) return <SkeletonLayout />;
|
||||||
|
|
||||||
|
if (monitorCount === 1) {
|
||||||
|
heading = "monitor";
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
|
display="flex"
|
||||||
|
width="fit-content"
|
||||||
|
height={theme.spacing(18)}
|
||||||
gap={theme.spacing(2)}
|
gap={theme.spacing(2)}
|
||||||
sx={{ ...sx }}
|
mt={theme.spacing(2)}
|
||||||
|
px={theme.spacing(4)}
|
||||||
|
pt={theme.spacing(2)}
|
||||||
|
pb={theme.spacing(3)}
|
||||||
|
borderRadius={theme.spacing(1)}
|
||||||
|
sx={{
|
||||||
|
...sx,
|
||||||
|
backgroundColor: theme.palette.secondary.main,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Heading component="h2">{heading}</Heading>
|
{monitorCount} <Typography component="h2">{heading}</Typography>
|
||||||
<CircularCount count={monitorCount} />
|
|
||||||
{children}
|
{children}
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ const InfrastructureMonitors = () => {
|
|||||||
/>
|
/>
|
||||||
<MonitorCountHeader
|
<MonitorCountHeader
|
||||||
shouldRender={!isLoading}
|
shouldRender={!isLoading}
|
||||||
heading="Infrastructure monitors"
|
|
||||||
monitorCount={summary?.totalMonitors ?? 0}
|
monitorCount={summary?.totalMonitors ?? 0}
|
||||||
/>
|
/>
|
||||||
<MonitorsTable
|
<MonitorsTable
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ const PageSpeed = () => {
|
|||||||
<MonitorCountHeader
|
<MonitorCountHeader
|
||||||
shouldRender={!isLoading}
|
shouldRender={!isLoading}
|
||||||
monitorCount={summary?.totalMonitors}
|
monitorCount={summary?.totalMonitors}
|
||||||
heading="PageSpeed monitors"
|
|
||||||
sx={{ mb: theme.spacing(8) }}
|
sx={{ mb: theme.spacing(8) }}
|
||||||
/>
|
/>
|
||||||
<MonitorGrid
|
<MonitorGrid
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ const UptimeMonitors = () => {
|
|||||||
|
|
||||||
const filterLookup = new Map([
|
const filterLookup = new Map([
|
||||||
[toFilterStatus, "status"],
|
[toFilterStatus, "status"],
|
||||||
[toFilterActive, "isActive"]
|
[toFilterActive, "isActive"],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const activeFilter = [...filterLookup].find(([key]) => key !== undefined);
|
const activeFilter = [...filterLookup].find(([key]) => key !== undefined);
|
||||||
@@ -202,7 +202,6 @@ const UptimeMonitors = () => {
|
|||||||
<MonitorCountHeader
|
<MonitorCountHeader
|
||||||
shouldRender={monitors?.length > 0 && !monitorsWithSummaryIsLoading}
|
shouldRender={monitors?.length > 0 && !monitorsWithSummaryIsLoading}
|
||||||
monitorCount={monitorsSummary?.totalMonitors}
|
monitorCount={monitorsSummary?.totalMonitors}
|
||||||
heading={"Uptime monitors"}
|
|
||||||
></MonitorCountHeader>
|
></MonitorCountHeader>
|
||||||
<Filter
|
<Filter
|
||||||
selectedTypes={selectedTypes}
|
selectedTypes={selectedTypes}
|
||||||
|
|||||||
Reference in new issue
Block a user