Status label refactor (#478)

* Refactored status label

* Updated colors and replaced old components

* Updated docs
This commit is contained in:
Daniel C authored and GitHub committed 2024-07-29 22:59:58 -07:00
1 parent 0611051c5f
commit 5fe92f2b31
6 files changed
+47 -84

No files matched your search

+6 -21
View File
@@ -13,7 +13,10 @@ import WestRoundedIcon from "@mui/icons-material/WestRounded";
import GreenCheck from "../../../assets/icons/checkbox-green.svg?react";
import RedCheck from "../../../assets/icons/checkbox-red.svg?react";
import SettingsIcon from "../../../assets/icons/settings.svg?react";
import { formatDuration, formatDurationRounded } from "../../../Utils/timeUtils";
import {
formatDuration,
formatDurationRounded,
} from "../../../Utils/timeUtils";
import "./index.css";
const StatBox = ({ title, value }) => {
@@ -54,32 +57,14 @@ const DetailsPage = () => {
{ id: 3, name: "Message" },
],
rows: res.data.data.checks.map((check, idx) => {
const params = {
status: check.status === true ? "Up" : "Down",
backgroundColor:
check.status === true
? "var(--env-var-color-20)"
: "var(--env-var-color-21)",
statusDotColor:
check.status === true
? "var(--env-var-color-17)"
: "var(--env-var-color-19)",
};
const status = check.status === true ? "up" : "down";
return {
id: check._id,
data: [
{
id: idx,
data: (
<StatusLabel
status={params.status}
dot={params.statusDotColor}
customStyles={{
backgroundColor: params.backgroundColor,
}}
/>
),
data: <StatusLabel status={status} text={status} />,
},
{ id: idx + 1, data: new Date(check.createdAt).toLocaleString() },
{ id: idx + 2, data: check.statusCode },
+3 -13
View File
@@ -89,15 +89,7 @@ const Monitors = () => {
monitor.status === true
? "var(--env-var-color-17)"
: "var(--env-var-color-19)",
status: monitor.status === true ? "Up" : "Down",
backgroundColor:
monitor.status === true
? "var(--env-var-color-20)"
: "var(--env-var-color-21)",
statusDotColor:
monitor.status === true
? "var(--env-var-color-17)"
: "var(--env-var-color-19)",
status: monitor.status === true ? "up" : "down",
};
// Reverse checks so latest check is on the right
@@ -113,10 +105,8 @@ const Monitors = () => {
data: (
<StatusLabel
status={params.status}
dot={params.statusDotColor}
customStyles={{
backgroundColor: params.backgroundColor,
}}
text={params.status}
customStyles={{ textTransform: "capitalize" }}
/>
),
},