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

+1 -13
View File
@@ -76,24 +76,12 @@ const Incidents = () => {
else if (filter === "down") return incident.status === false;
})
.map((incident, idx) => {
const params = {
status: "Down",
backgroundColor: "var(--env-var-color-21)",
statusDotColor: "var(--env-var-color-19)",
};
return {
id: idx,
data: [
{
id: idx + 0,
data: (
<StatusLabel
status={params.status}
dot={params.statusDotColor}
customStyles={{ backgroundColor: params.backgroundColor }}
/>
),
data: <StatusLabel status="down" text="Down" />,
},
{ id: idx + 1, data: new Date(incident.createdAt).toLocaleString() },
{ id: idx + 2, data: incident.statusCode },
+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" }}
/>
),
},
+2 -11
View File
@@ -39,17 +39,8 @@ const Card = ({ data }) => {
</Typography>
{/* TODO - fix prop-type error */}
<StatusLabel
status={data.isActive ? "Live (collecting data)" : "Inactive"}
dot={
data.isActive
? "var(--env-var-color-17)"
: "var(--env-var-color-19)"
}
customStyles={{
backgroundColor: data.isActive
? "var(--env-var-color-20)"
: "var(--env-var-color-21)",
}}
status={data.isActive ? "up" : "cannot resolve"}
text={data.isActive ? "Live (collecting data)" : "Inactive"}
/>
</Stack>
<Typography>{data.url}</Typography>