hardcode removed

This commit is contained in:
MuhammadKhalilzadeh committed 2024-06-20 21:47:07 +03:30
1 parent 486547f688
commit 27dd65ccfa
3 files changed
+83 -83

No files matched your search

+78
View File
@@ -15,6 +15,24 @@
"updatedAt": "2024-06-18T18:56:06.212Z",
"__v": 0,
"checks": [
{
"_id": "6671d84a9ba14f9f260eed27",
"monitorId": "6671d8469ba14f9f260eed23",
"status": true,
"responseTime": 143,
"createdAt": "2024-06-18T18:56:10.082Z",
"updatedAt": "2024-06-18T18:56:10.082Z",
"__v": 0
},
{
"_id": "6671d84a9ba14f9f260eed27",
"monitorId": "6671d8469ba14f9f260eed23",
"status": true,
"responseTime": 70,
"createdAt": "2024-06-18T18:56:10.082Z",
"updatedAt": "2024-06-18T18:56:10.082Z",
"__v": 0
},
{
"_id": "6671d84a9ba14f9f260eed27",
"monitorId": "6671d8469ba14f9f260eed23",
@@ -210,6 +228,26 @@
"updatedAt": "2024-06-18T18:56:20.190Z",
"__v": 0
},
{
"_id": "6671d85e9ba14f9f260eed3e",
"monitorId": "6671d8529ba14f9f260eed2b",
"status": false,
"responseTime": 228,
"statusCode": 404,
"createdAt": "2024-06-18T18:56:30.279Z",
"updatedAt": "2024-06-18T18:56:30.279Z",
"__v": 0
},
{
"_id": "6671d8669ba14f9f260eed47",
"monitorId": "6671d8529ba14f9f260eed2b",
"status": true,
"responseTime": 112,
"statusCode": 200,
"createdAt": "2024-06-18T18:56:38.381Z",
"updatedAt": "2024-06-18T18:56:38.381Z",
"__v": 0
},
{
"_id": "6671d8879ba14f9f260eed74",
"monitorId": "6671d8529ba14f9f260eed2b",
@@ -285,6 +323,26 @@
"updatedAt": "2024-06-18T18:57:48.532Z",
"__v": 0
},
{
"_id": "6671d8a59ba14f9f260eed98",
"monitorId": "6671d8529ba14f9f260eed2b",
"status": false,
"responseTime": 271,
"statusCode": 404,
"createdAt": "2024-06-18T18:57:41.421Z",
"updatedAt": "2024-06-18T18:57:41.421Z",
"__v": 0
},
{
"_id": "6671d8ac9ba14f9f260eeda1",
"monitorId": "6671d8529ba14f9f260eed2b",
"status": true,
"responseTime": 127,
"statusCode": 200,
"createdAt": "2024-06-18T18:57:48.532Z",
"updatedAt": "2024-06-18T18:57:48.532Z",
"__v": 0
},
{
"_id": "6671d8b29ba14f9f260eedaa",
"monitorId": "6671d8529ba14f9f260eed2b",
@@ -440,6 +498,26 @@
"updatedAt": "2024-06-18T18:59:16.089Z",
"__v": 0
},
{
"_id": "6671d8d89ba14f9f260eede0",
"monitorId": "6671d8529ba14f9f260eed2b",
"status": false,
"responseTime": 218,
"statusCode": 404,
"createdAt": "2024-06-18T18:58:32.311Z",
"updatedAt": "2024-06-18T18:58:32.311Z",
"__v": 0
},
{
"_id": "6671d8df9ba14f9f260eede9",
"monitorId": "6671d8529ba14f9f260eed2b",
"status": true,
"responseTime": 138,
"statusCode": 200,
"createdAt": "2024-06-18T18:58:39.422Z",
"updatedAt": "2024-06-18T18:58:39.422Z",
"__v": 0
},
{
"_id": "6671d9089ba14f9f260eee28",
"monitorId": "6671d8529ba14f9f260eed2b",
+1 -79
View File
@@ -8,88 +8,10 @@ import ServerStatus from "../../Components/Charts/Servers/ServerStatus";
import CurrentMonitors from "../../Components/CurrentMonitors";
import MockData from "../../Mock/sample_data.json";
const hardCodedMonitors = [
{
host: Host(
"Discord",
100,
"var(--env-var-color-17)",
"https://www.google.com"
),
status: HostStatus(
"var(--env-var-color-20)",
"Up",
"var(--env-var-color-17)"
),
team: <BarChart />,
actions: HostActions(),
},
{
host: Host(
"Google",
99.9,
"var(--env-var-color-17)",
"https://www.google.com"
),
status: HostStatus(
"var(--env-var-color-20)",
"Up",
"var(--env-var-color-17)"
),
team: <BarChart />,
actions: HostActions(),
},
{
host: Host(
"NBC",
98.1,
"var(--env-var-color-18)",
"https://www.google.com"
),
status: HostStatus(
"var(--env-var-color-20)",
"Up",
"var(--env-var-color-17)"
),
team: <BarChart />,
actions: HostActions(),
},
{
host: Host(
"Google",
95.1,
"var(--env-var-color-19)",
"https://www.google.com"
),
status: HostStatus(
"var(--env-var-color-21)",
"Down",
"var(--env-var-color-19)"
),
team: <BarChart />,
actions: HostActions(),
},
{
host: Host(
"NBC",
99.9,
"var(--env-var-color-17)",
"https://www.google.com"
),
status: HostStatus(
"var(--env-var-color-15)",
"Cannot resolve",
"var(--env-var-color-22)"
),
team: <BarChart />,
actions: HostActions(),
},
];
const CurrentStats = (mockdata = true) => {
// The hardcoded part is passed as default value for the purpose of demonstration.
// Pass an empty array, [], before fetching the data
const [monitors, setMonitors] = useState(hardCodedMonitors);
const [monitors, setMonitors] = useState([]);
useEffect(() => {
if (mockdata) {
+4 -4
View File
@@ -1,13 +1,13 @@
import CreateNewMonitor from "./CreateNewMonitor";
// import CurrentStats from "./CurrentStats";
// import CreateNewMonitor from "./CreateNewMonitor";
import CurrentStats from "./CurrentStats";
import "./index.css";
import React from "react";
const Monitors = () => {
return (
<div className="monitors">
{/* <CurrentStats /> */}
<CreateNewMonitor />
<CurrentStats />
{/* <CreateNewMonitor /> */}
</div>
);
};