Resolve conflicts

This commit is contained in:
Daniel Cojocea committed 2024-09-13 11:37:31 -04:00
commit ee82a20b4d
22 files changed
+1610 -1349

No files matched your search

+5 -11
View File
@@ -23,6 +23,7 @@ import LoadingButton from "@mui/lab/LoadingButton";
import PlayCircleOutlineRoundedIcon from "@mui/icons-material/PlayCircleOutlineRounded";
import SkeletonLayout from "./skeleton";
import "./index.css";
import useUtils from "../../Monitors/utils";
const PageSpeedConfigure = () => {
const theme = useTheme();
@@ -34,6 +35,7 @@ const PageSpeedConfigure = () => {
const { monitorId } = useParams();
const [monitor, setMonitor] = useState({});
const [errors, setErrors] = useState({});
const { determineState, statusColor } = useUtils();
const frequencies = [
{ _id: 3, name: "3 minutes" },
@@ -147,13 +149,7 @@ const PageSpeedConfigure = () => {
gap={theme.spacing(12)}
>
<Stack direction="row" gap={theme.spacing(2)}>
<PulseDot
color={
monitor?.status
? theme.palette.success.main
: theme.palette.error.main
}
/>
<PulseDot color={statusColor[determineState(monitor)]} />
<Box>
<Typography
component="h1"
@@ -166,12 +162,10 @@ const PageSpeedConfigure = () => {
<Typography
component="span"
sx={{
color: monitor?.status
? theme.palette.success.main
: theme.palette.error.text,
color: statusColor[determineState(monitor)],
}}
>
Your pagespeed monitor is {monitor?.status ? "live" : "down"}.
Your pagespeed monitor is {determineState(monitor)}.
</Typography>
</Box>
<Box alignSelf="flex-end" ml="auto">
+1 -1
View File
@@ -7,7 +7,6 @@ import {
Tooltip,
Typography,
} from "@mui/material";
import { useDrawingArea } from "@mui/x-charts";
import { useEffect, useState } from "react";
import { useTheme } from "@emotion/react";
import { useNavigate, useParams } from "react-router-dom";
@@ -39,6 +38,7 @@ const PageSpeedDetails = () => {
const [audits, setAudits] = useState({});
const { monitorId } = useParams();
const { authToken } = useSelector((state) => state.auth);
const { determineState, statusColor, pagespeedStatusMsg } = useUtils();
useEffect(() => {
const fetchMonitor = async () => {
+13 -10
View File
@@ -5,12 +5,14 @@ import { StatusLabel } from "../../Components/Label";
import { Box, Grid, Stack, Typography } from "@mui/material";
import { useNavigate } from "react-router";
import { useTheme } from "@emotion/react";
import useUtils from "../Monitors/utils";
import PropTypes from "prop-types";
const Card = ({ data }) => {
const Card = ({ monitor }) => {
const { determineState, pagespeedStatusMsg } = useUtils();
const theme = useTheme();
const navigate = useNavigate();
const monitorState = determineState(monitor);
return (
<Grid
item
@@ -26,7 +28,7 @@ const Card = ({ data }) => {
direction="row"
gap={theme.spacing(6)}
p={theme.spacing(8)}
onClick={() => navigate(`/pagespeed/${data._id}`)}
onClick={() => navigate(`/pagespeed/${monitor._id}`)}
border={1}
borderColor={theme.palette.border.light}
borderRadius={theme.shape.borderRadius}
@@ -46,23 +48,24 @@ const Card = ({ data }) => {
mb={theme.spacing(2)}
color={theme.palette.primary.main}
>
{data.name}
{monitor.name}
</Typography>
<StatusLabel
status={data.status ? "up" : "cannot resolve"}
text={data.status ? "Live (collecting data)" : "Inactive"}
status={monitorState}
text={pagespeedStatusMsg[monitorState] || "Pending..."}
customStyles={{ textTransform: "capitalize" }}
/>
</Stack>
<Typography fontSize={13}>
{data.url.replace(/^https?:\/\//, "")}
{monitor.url.replace(/^https?:\/\//, "")}
</Typography>
<Typography mt={theme.spacing(12)}>
<Typography component="span" fontWeight={600}>
Last checked:{" "}
</Typography>
{formatDate(getLastChecked(data.checks, false))}{" "}
{formatDate(getLastChecked(monitor.checks, false))}{" "}
<Typography component="span" fontStyle="italic">
({formatDurationRounded(getLastChecked(data.checks))} ago)
({formatDurationRounded(getLastChecked(monitor.checks))} ago)
</Typography>
</Typography>
</Box>
@@ -72,7 +75,7 @@ const Card = ({ data }) => {
};
Card.propTypes = {
data: PropTypes.object.isRequired,
monitor: PropTypes.object.isRequired,
};
export default Card;
+1 -1
View File
@@ -74,7 +74,7 @@ const PageSpeed = ({ isAdmin }) => {
</Box>
<Grid container spacing={theme.spacing(12)}>
{monitorsSummary?.monitors?.map((monitor) => (
<Card data={monitor} key={monitor._id} />
<Card monitor={monitor} key={monitor._id} />
))}
</Grid>
</Box>