From 6ddbbdc1226c8c3b455eef575d6405e18084bcec Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 16 Jul 2024 14:16:45 -0700 Subject: [PATCH] Cleanup --- Client/src/Components/Host/index.jsx | 18 ----- Client/src/Components/HostActions/index.jsx | 8 --- Client/src/Components/HostStatus/index.jsx | 18 ----- Client/src/Components/HostsTable/index.jsx | 80 --------------------- Client/src/Pages/Details/index.jsx | 1 - 5 files changed, 125 deletions(-) delete mode 100644 Client/src/Components/Host/index.jsx delete mode 100644 Client/src/Components/HostActions/index.jsx delete mode 100644 Client/src/Components/HostStatus/index.jsx delete mode 100644 Client/src/Components/HostsTable/index.jsx diff --git a/Client/src/Components/Host/index.jsx b/Client/src/Components/Host/index.jsx deleted file mode 100644 index 370745f4d..000000000 --- a/Client/src/Components/Host/index.jsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from "react"; -import OpenIt from "../../assets/Images/Icon-open-in-tab-gray.png"; - -function Host(title, precentage, statusColor, link) { - return ( -
- - OpenIt - -
{title}
-
- {precentage}% -
-
- ); -} - -export default Host; diff --git a/Client/src/Components/HostActions/index.jsx b/Client/src/Components/HostActions/index.jsx deleted file mode 100644 index c974906e8..000000000 --- a/Client/src/Components/HostActions/index.jsx +++ /dev/null @@ -1,8 +0,0 @@ -import React from "react"; -import DashboardSettings from "../DashboardSettingsIcon"; - -function HostActions() { - return ; -} - -export default HostActions; diff --git a/Client/src/Components/HostStatus/index.jsx b/Client/src/Components/HostStatus/index.jsx deleted file mode 100644 index 3b0660c33..000000000 --- a/Client/src/Components/HostStatus/index.jsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from "react"; - -function HostStatus(backgroundColor, status, dotColor) { - return ( -
-
-
{status}
-
- ); -} - -export default HostStatus; diff --git a/Client/src/Components/HostsTable/index.jsx b/Client/src/Components/HostsTable/index.jsx deleted file mode 100644 index bc1dc1ff9..000000000 --- a/Client/src/Components/HostsTable/index.jsx +++ /dev/null @@ -1,80 +0,0 @@ -import PropTypes from "prop-types"; -import Host from "../Host/"; -import HostStatus from "../HostStatus"; -import ResponseTimeChart from "../Charts/ResponseTimeChart"; -/** - * HostsTable displays the current status of monitor - * - * @component - * @param {Array} monitors - An array of monitor objects to be displayed. - */ - -const getLastCheckStatus = (monitor) => { - if (monitor.checks.length === 0) { - // Default values for when there are no checks - return { - color: "var(--env-var-color-21)", - statusText: "No Data", - dotColor: "var(--env-var-color-19)", - }; - } - - const lastCheck = monitor.checks[monitor.checks.length - 1]; - const isUp = lastCheck.status === true; - return { - color: isUp ? "var(--env-var-color-20)" : "var(--env-var-color-21)", - statusText: isUp ? "Up" : "Down", - dotColor: isUp ? "var(--env-var-color-17)" : "var(--env-var-color-19)", - }; -}; - -const HostsTable = ({ monitors }) => { - return ( -
- - - - - - - - - - - {monitors.map((monitor) => { - const host = Host( - monitor.name, - 100, - "var(--env-var-color-17)", - monitor.url - ); - - const { color, currentStatus, dotColor } = - getLastCheckStatus(monitor); - - const status = HostStatus(color, currentStatus, dotColor); - - return ( - - - - - - - ); - })} - -
HostStatusResponseActions
{host}{status} - - - {monitor.actions} -
-
- ); -}; - -HostsTable.propTypes = { - monitors: PropTypes.arrayOf(PropTypes.object).isRequired, -}; - -export default HostsTable; diff --git a/Client/src/Pages/Details/index.jsx b/Client/src/Pages/Details/index.jsx index 201a32524..c8cd6be7a 100644 --- a/Client/src/Pages/Details/index.jsx +++ b/Client/src/Pages/Details/index.jsx @@ -1,5 +1,4 @@ import React, { useEffect, useState } from "react"; -import CustomizedTables from "../../Components/CustomizedTables"; import { Box, Typography, useTheme } from "@mui/material"; import { useSelector } from "react-redux"; import { useParams } from "react-router-dom";