Merge branch 'develop' into 1229-add-a-placeholder-if-there-are-no-infrastructure-monitors

This commit is contained in:
Alex Holliday committed 2024-12-03 11:03:09 +08:00
commit 40282ebcc6
11 files changed
+19 -21

No files matched your search

@@ -44,7 +44,7 @@ const BarChart = ({ checks = [] }) => {
position="relative" position="relative"
width={theme.spacing(4.5)} width={theme.spacing(4.5)}
height="100%" height="100%"
backgroundColor={theme.palette.background.fill} backgroundColor={theme.palette.border.light}
sx={{ sx={{
borderRadius: theme.spacing(1.5), borderRadius: theme.spacing(1.5),
}} }}
@@ -23,7 +23,7 @@ const handleStatusCode = (status) => {
}; };
const getRoundedStatusCode = (status) => { const getRoundedStatusCode = (status) => {
return Math.floor(status / 100) * 100; return Math.floor(status / 100) * 100;
}; };
const HttpStatusLabel = ({ status, customStyles }) => { const HttpStatusLabel = ({ status, customStyles }) => {
@@ -31,12 +31,12 @@ const HttpStatusLabel = ({ status, customStyles }) => {
const colors = { const colors = {
400: { 400: {
dotColor: theme.palette.warning.main, dotColor: theme.palette.warning.main,
bgColor: theme.palette.warning.bg, bgColor: theme.palette.warning.dark,
borderColor: theme.palette.warning.light, borderColor: theme.palette.warning.light,
}, },
500: { 500: {
dotColor: theme.palette.error.main, dotColor: theme.palette.error.main,
bgColor: theme.palette.error.bg, bgColor: theme.palette.error.dark,
borderColor: theme.palette.error.light, borderColor: theme.palette.error.light,
}, },
default: { default: {
@@ -46,11 +46,10 @@ const HttpStatusLabel = ({ status, customStyles }) => {
}, },
}; };
const statusCode = handleStatusCode(status) const statusCode = handleStatusCode(status);
const { borderColor, bgColor, dotColor } = const { borderColor, bgColor, dotColor } =
colors[getRoundedStatusCode(statusCode)] || colors.default; colors[getRoundedStatusCode(statusCode)] || colors.default;
return ( return (
<BaseLabel <BaseLabel
label={String(statusCode)} label={String(statusCode)}
@@ -65,7 +64,7 @@ const HttpStatusLabel = ({ status, customStyles }) => {
}; };
HttpStatusLabel.propTypes = { HttpStatusLabel.propTypes = {
status:PropTypes.number, status: PropTypes.number,
customStyles: PropTypes.object, customStyles: PropTypes.object,
}; };
+1 -1
View File
@@ -1,4 +1,4 @@
import React, { useState } from "react"; import { useState } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useNavigate } from "react-router"; import { useNavigate } from "react-router";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
@@ -103,7 +103,7 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => {
"& ul": { p: theme.spacing(2.5) }, "& ul": { p: theme.spacing(2.5) },
"& li": { m: 0 }, "& li": { m: 0 },
"& li:last-of-type": { "& li:last-of-type": {
color: theme.palette.error.contrastText, color: theme.palette.error.main,
}, },
}, },
}, },
+1 -4
View File
@@ -190,10 +190,7 @@ function Infrastructure() {
{isActuallyLoading ? ( {isActuallyLoading ? (
<SkeletonLayout /> <SkeletonLayout />
) : monitorState.monitors?.length !== 0 ? ( ) : monitorState.monitors?.length !== 0 ? (
<Stack <Stack gap={theme.spacing(8)}>
component="main"
style={{ width: "100%", gap: "1rem" }}
>
<Breadcrumbs list={BREADCRUMBS} /> <Breadcrumbs list={BREADCRUMBS} />
<Stack <Stack
direction="row" direction="row"
@@ -114,7 +114,7 @@ const ActionsMenu = ({ /* isAdmin, */ maintenanceWindow, updateCallback }) => {
"& ul": { p: theme.spacing(2.5) }, "& ul": { p: theme.spacing(2.5) },
"& li": { m: 0 }, "& li": { m: 0 },
"& li:last-of-type": { "& li:last-of-type": {
color: theme.palette.error.contrastText, color: theme.palette.error.main,
}, },
}, },
}, },
@@ -109,7 +109,7 @@ const ActionsMenu = ({ monitor, isAdmin, updateCallback }) => {
"& ul": { p: theme.spacing(2.5) }, "& ul": { p: theme.spacing(2.5) },
"& li": { m: 0 }, "& li": { m: 0 },
"& li:last-of-type": { "& li:last-of-type": {
color: theme.palette.error.contrastText, color: theme.palette.error.main,
}, },
}, },
}, },
-2
View File
@@ -20,8 +20,6 @@ const Monitors = ({ isAdmin }) => {
const authState = useSelector((state) => state.auth); const authState = useSelector((state) => state.auth);
const dispatch = useDispatch({}); const dispatch = useDispatch({});
console.log({ monitorState });
useEffect(() => { useEffect(() => {
dispatch(getUptimeMonitorsByTeamId(authState.authToken)); dispatch(getUptimeMonitorsByTeamId(authState.authToken));
}, [authState.authToken, dispatch]); }, [authState.authToken, dispatch]);
+3 -1
View File
@@ -206,12 +206,14 @@ const semanticColors = {
light: { light: {
light: paletteColors.gray200, light: paletteColors.gray200,
dark: paletteColors.gray800, dark: paletteColors.gray800,
/* TODO this should live in a different key (border.disabled.light and .dark) */
disabled: paletteColors.gray150, disabled: paletteColors.gray150,
}, },
dark: { dark: {
light: paletteColors.gray200, light: paletteColors.gray200,
dark: paletteColors.gray750, dark: paletteColors.gray750,
disabled: paletteColors.gray800, /* TODO this should live in a different key (border.disabled.light and .dark) */
disabled: paletteColors.gray150,
}, },
}, },
unresolved: { unresolved: {
+1
View File
@@ -28,6 +28,7 @@ const {
} = colors; } = colors;
const palette = { const palette = {
/* TODO check if we need the addition of a new color gray150 for this. Also, this color would probably fit for primary contrastText */
action: { action: {
disabled: border.light.disabled, disabled: border.light.disabled,
}, },
+4 -3
View File
@@ -2179,9 +2179,10 @@
} }
}, },
"node_modules/dotenv": { "node_modules/dotenv": {
"version": "16.4.5", "version": "16.4.6",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.6.tgz",
"integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", "integrity": "sha512-JhcR/+KIjkkjiU8yEpaB/USlzVi3i5whwOjpIRNGi9svKEXZSe+Qp6IWAjFjv+2GViAoDRCUv/QLNziQxsLqDg==",
"license": "BSD-2-Clause",
"engines": { "engines": {
"node": ">=12" "node": ">=12"
}, },