remove unused component/imports
This commit is contained in:
1 parent
e173269acd
commit
30a610511c
8 files changed
+7
-148
No files matched your search
@@ -4,14 +4,14 @@ import { useTheme } from "@emotion/react";
|
|||||||
import SkeletonLayout from "./skeleton";
|
import SkeletonLayout from "./skeleton";
|
||||||
|
|
||||||
const MonitorCountHeader = ({
|
const MonitorCountHeader = ({
|
||||||
shouldRender = true,
|
isLoading = false,
|
||||||
monitorCount,
|
monitorCount,
|
||||||
heading = "monitors",
|
heading = "monitors",
|
||||||
sx,
|
sx,
|
||||||
children,
|
children,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
if (!shouldRender) return <SkeletonLayout />;
|
if (isLoading) return <SkeletonLayout />;
|
||||||
|
|
||||||
if (monitorCount === 1) {
|
if (monitorCount === 1) {
|
||||||
heading = "monitor";
|
heading = "monitor";
|
||||||
@@ -42,7 +42,7 @@ const MonitorCountHeader = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
MonitorCountHeader.propTypes = {
|
MonitorCountHeader.propTypes = {
|
||||||
shouldRender: PropTypes.bool,
|
isLoading: PropTypes.bool,
|
||||||
monitorCount: PropTypes.number,
|
monitorCount: PropTypes.number,
|
||||||
heading: PropTypes.string,
|
heading: PropTypes.string,
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
import { Button, Box } from "@mui/material";
|
|
||||||
import { useTheme } from "@emotion/react";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
import SettingsIcon from "../../../assets/icons/settings-bold.svg?react";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
const ConfigButton = ({ shouldRender = true, monitorId, path }) => {
|
|
||||||
const theme = useTheme();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
if (!shouldRender) return null;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box alignSelf="flex-end">
|
|
||||||
<Button
|
|
||||||
variant="contained"
|
|
||||||
color="secondary"
|
|
||||||
onClick={() => navigate(`/${path}/configure/${monitorId}`)}
|
|
||||||
sx={{
|
|
||||||
px: theme.spacing(5),
|
|
||||||
"& svg": {
|
|
||||||
mr: theme.spacing(3),
|
|
||||||
"& path": {
|
|
||||||
/* Should always be contrastText for the button color */
|
|
||||||
stroke: theme.palette.secondary.contrastText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SettingsIcon /> Configure
|
|
||||||
</Button>
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
ConfigButton.propTypes = {
|
|
||||||
shouldRender: PropTypes.bool,
|
|
||||||
monitorId: PropTypes.string,
|
|
||||||
path: PropTypes.string,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ConfigButton;
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
import { Stack, Typography } from "@mui/material";
|
|
||||||
import PulseDot from "../Animated/PulseDot";
|
|
||||||
import Dot from "../Dot";
|
|
||||||
import { useTheme } from "@emotion/react";
|
|
||||||
import { useMonitorUtils } from "../../Hooks/useMonitorUtils";
|
|
||||||
import { formatDurationRounded } from "../../Utils/timeUtils";
|
|
||||||
import ConfigButton from "./ConfigButton";
|
|
||||||
import SkeletonLayout from "./skeleton";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
|
|
||||||
const MonitorStatusHeader = ({ path, isLoading = false, isAdmin, monitor }) => {
|
|
||||||
const theme = useTheme();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const { statusColor, determineState } = useMonitorUtils();
|
|
||||||
if (isLoading) {
|
|
||||||
return <SkeletonLayout />;
|
|
||||||
}
|
|
||||||
|
|
||||||
const intervalText = t("monitorStatus.checkingEvery", {
|
|
||||||
interval: formatDurationRounded(monitor?.interval),
|
|
||||||
});
|
|
||||||
|
|
||||||
const captureVersion = monitor?.stats?.aggregateData?.latestCheck?.capture?.version;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
justifyContent="space-between"
|
|
||||||
>
|
|
||||||
<Stack>
|
|
||||||
<Typography variant="monitorName">{monitor?.name}</Typography>
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
alignItems={"center"}
|
|
||||||
gap={theme.spacing(4)}
|
|
||||||
>
|
|
||||||
<PulseDot color={statusColor[determineState(monitor)]} />
|
|
||||||
<Typography
|
|
||||||
component="h2"
|
|
||||||
variant="monitorUrl"
|
|
||||||
>
|
|
||||||
{monitor?.url?.replace(/^https?:\/\//, "") || "..."}
|
|
||||||
</Typography>
|
|
||||||
<Dot />
|
|
||||||
<Typography>
|
|
||||||
{intervalText}
|
|
||||||
{captureVersion && (
|
|
||||||
<>
|
|
||||||
{" "}
|
|
||||||
{t("monitorStatus.withCaptureAgent", {
|
|
||||||
version: captureVersion,
|
|
||||||
})}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
.
|
|
||||||
</Typography>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
<ConfigButton
|
|
||||||
path={path}
|
|
||||||
shouldRender={isAdmin}
|
|
||||||
monitorId={monitor?._id}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
MonitorStatusHeader.propTypes = {
|
|
||||||
path: PropTypes.string.isRequired,
|
|
||||||
isLoading: PropTypes.bool,
|
|
||||||
isAdmin: PropTypes.bool,
|
|
||||||
monitor: PropTypes.object,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default MonitorStatusHeader;
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import { Stack, Skeleton } from "@mui/material";
|
|
||||||
|
|
||||||
const SkeletonLayout = () => {
|
|
||||||
return (
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
justifyContent="space-between"
|
|
||||||
>
|
|
||||||
<Skeleton
|
|
||||||
height={40}
|
|
||||||
variant="rounded"
|
|
||||||
width="15%"
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height={40}
|
|
||||||
variant="rounded"
|
|
||||||
width="15%"
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default SkeletonLayout;
|
|
||||||
@@ -116,7 +116,7 @@ const InfrastructureMonitors = () => {
|
|||||||
/>
|
/>
|
||||||
<Stack direction={"row"}>
|
<Stack direction={"row"}>
|
||||||
<MonitorCountHeader
|
<MonitorCountHeader
|
||||||
shouldRender={!isLoading}
|
isLoading={isLoading}
|
||||||
monitorCount={summary?.totalMonitors ?? 0}
|
monitorCount={summary?.totalMonitors ?? 0}
|
||||||
/>
|
/>
|
||||||
<Filter
|
<Filter
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import { Stack, Typography } from "@mui/material";
|
import { Stack, Typography } from "@mui/material";
|
||||||
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||||
import MonitorTimeFrameHeader from "../../../Components/MonitorTimeFrameHeader";
|
import MonitorTimeFrameHeader from "../../../Components/MonitorTimeFrameHeader";
|
||||||
import MonitorStatusHeader from "../../../Components/MonitorStatusHeader";
|
|
||||||
import PageSpeedStatusBoxes from "./Components/PageSpeedStatusBoxes";
|
import PageSpeedStatusBoxes from "./Components/PageSpeedStatusBoxes";
|
||||||
import MonitorDetailsControlHeader from "../../../Components/MonitorDetailsControlHeader";
|
import MonitorDetailsControlHeader from "../../../Components/MonitorDetailsControlHeader";
|
||||||
import PageSpeedAreaChart from "./Components/PageSpeedAreaChart";
|
import PageSpeedAreaChart from "./Components/PageSpeedAreaChart";
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ const PageSpeed = () => {
|
|||||||
path="/pagespeed/create"
|
path="/pagespeed/create"
|
||||||
/>
|
/>
|
||||||
<MonitorCountHeader
|
<MonitorCountHeader
|
||||||
shouldRender={!isLoading}
|
isLoading={isLoading}
|
||||||
monitorCount={monitorsSummary?.totalMonitors}
|
monitorCount={monitorsSummary?.totalMonitors}
|
||||||
sx={{ mb: theme.spacing(8) }}
|
sx={{ mb: theme.spacing(8) }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -201,9 +201,9 @@ const UptimeMonitors = () => {
|
|||||||
|
|
||||||
<Stack direction={"row"}>
|
<Stack direction={"row"}>
|
||||||
<MonitorCountHeader
|
<MonitorCountHeader
|
||||||
shouldRender={monitors?.length > 0 && !monitorsWithSummaryIsLoading}
|
isLoading={monitorsWithSummaryIsLoading}
|
||||||
monitorCount={monitorsSummary?.totalMonitors}
|
monitorCount={monitorsSummary?.totalMonitors}
|
||||||
></MonitorCountHeader>
|
/>
|
||||||
<Filter
|
<Filter
|
||||||
selectedTypes={selectedTypes}
|
selectedTypes={selectedTypes}
|
||||||
setSelectedTypes={setSelectedTypes}
|
setSelectedTypes={setSelectedTypes}
|
||||||
|
|||||||
Reference in new issue
Block a user