fix undefined colors, removed log statements
This commit is contained in:
1 parent
2788dc40be
commit
ec1153decc
2 files changed
+5
-8
No files matched your search
@@ -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,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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]);
|
||||||
|
|||||||
Reference in new issue
Block a user