diff --git a/Client/src/Components/MonitorTable/index.css b/Client/src/Components/MonitorTable/index.css
new file mode 100644
index 000000000..23b463f87
--- /dev/null
+++ b/Client/src/Components/MonitorTable/index.css
@@ -0,0 +1,49 @@
+.host-row {
+ display: flex;
+ align-items: center;
+}
+
+.host-open-icon {
+ width: var(--env-var-img-width-2);
+ height: var(--env-var-img-width-2);
+ margin-right: 8px;
+}
+
+.host-name {
+ width: 100px;
+ font-size: var(--env-var-font-size-medium);
+ font-weight: bold;
+ margin-right: var(--env-var-spacing-1);
+ text-overflow: ellipsis;
+ overflow: hidden;
+ white-space: nowrap;
+}
+
+.host-percentage {
+ font-size: var(--env-var-font-size-medium);
+}
+
+.host-status {
+ display: flex;
+ align-items: center;
+ height: 100%;
+}
+
+.host-status-details {
+ display: flex;
+ align-items: center;
+ border: 1px solid var(--env-var-color-4);
+ border-radius: var(--env-var-radius-2);
+ padding: calc(var(--env-var-spacing-1) / 2);
+}
+
+.host-status-text {
+ font-size: var(--env-var-font-size-medium);
+ line-height: var(--env-var-font-size-medium);
+}
+.host-status-dot {
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ margin-right: calc(var(--env-var-spacing-1) / 2);
+}
diff --git a/Client/src/Components/MonitorTable/index.jsx b/Client/src/Components/MonitorTable/index.jsx
new file mode 100644
index 000000000..763a66c95
--- /dev/null
+++ b/Client/src/Components/MonitorTable/index.jsx
@@ -0,0 +1,175 @@
+import "./index.css";
+import { useState } from "react";
+import PropTypes from "prop-types";
+import OpenIt from "../../assets/Images/Icon-open-in-tab-gray.png";
+import ResponseTimeChart from "../Charts/ResponseTimeChart";
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableContainer,
+ TableHead,
+ TableRow,
+ TableFooter,
+ TablePagination,
+ Paper,
+} from "@mui/material";
+
+/**
+ * Host component.
+ * This subcomponent receives a params object and displays the host details.
+ *
+ * @component
+ * @param {Object} params - An object containing the following properties:
+ * @param {string} params.url - The URL of the host.
+ * @param {string} params.title - The name of the host.
+ * @param {string} params.percentageColor - The color of the percentage text.
+ * @param {number} params.precentage - The percentage to display.
+ * @returns {React.ElementType} Returns a div element with the host details.
+ */
+const Host = ({ params }) => {
+ return (
+
+
+
+
+
{params.title}
+
+ {params.precentage}%
+
+
+ );
+};
+
+/**
+ * Status component.
+ * This subcomponent receives a params object and displays the status details of a monitor.
+ *
+ * @component
+ * @param {Object} params - An object containing the following properties:
+ * @param {string} params.backgroundColor - The background color of the status box.
+ * @param {string} params.statusDotColor - The color of the status dot.
+ * @param {string} params.status - The status text to display.
+ * @returns {React.ElementType} Returns a div element with the host status.
+ */
+const Status = ({ params }) => {
+ return (
+
+ );
+};
+
+/**
+ * MonitorTable component.
+ * Takes an array of monitor objects and displays them in a table.
+ * Each row in the table represents a monitor and includes the host, status, response time, and action.
+ *
+ * @component
+ * @param {Object[]} monitors - An array of monitor objects. Each object should have the following properties:
+ * @param {string} monitors[].url - The URL of the monitor.
+ * @param {string} monitors[].name - The name of the monitor.
+ * @param {boolean} monitors[].status - The status of the monitor. True if the monitor is up, false otherwise.
+ * @param {Object[]} monitors[].checks - An array of check objects for the response time chart.
+ * @returns {React.Component} Returns a table with the monitor data.
+ */
+const MonitorTable = ({ monitors = [] }) => {
+ const [page, setPage] = useState(0);
+ const [rowsPerPage, setRowsPerPage] = useState(5);
+
+ const handleChangePage = (event, newPage) => {
+ setPage(newPage);
+ };
+
+ const handleChangeRowsPerPage = (event) => {
+ setRowsPerPage(parseInt(event.target.value, 10));
+ setPage(0);
+ };
+
+ const mappedRows = monitors
+ .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
+ .map((monitor) => {
+ const params = {
+ url: monitor.url,
+ title: monitor.name,
+ precentage: 100,
+ percentageColor:
+ 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)",
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+ TODO Add Actions
+
+ );
+ });
+
+ return (
+
+
+
+
+ Host
+ Status
+ Response Time
+ Action
+
+
+ {mappedRows}
+
+
+
+
+
+
+
+ );
+};
+
+MonitorTable.propTypes = {
+ monitors: PropTypes.arrayOf(PropTypes.object).isRequired,
+};
+
+Status.propTypes = { params: PropTypes.object.isRequired };
+Host.propTypes = { params: PropTypes.object.isRequired };
+
+export default MonitorTable;
diff --git a/Client/src/Pages/Monitors/index.jsx b/Client/src/Pages/Monitors/index.jsx
index 4c6d18606..a895ae47a 100644
--- a/Client/src/Pages/Monitors/index.jsx
+++ b/Client/src/Pages/Monitors/index.jsx
@@ -7,8 +7,7 @@ import { useNavigate } from "react-router-dom";
import Button from "../../Components/Button";
import ServerStatus from "../../Components/Charts/Servers/ServerStatus";
import SearchTextField from "../../Components/TextFields/Search/SearchTextField";
-import HostsTable from "../../Components/HostsTable";
-import Pagination from "../../Components/Pagination";
+import MonitorTable from "../../Components/MonitorTable";
const Monitors = () => {
const navigate = useNavigate();
@@ -25,7 +24,6 @@ const Monitors = () => {
}, 0);
const down = monitorState.monitors.length - up;
-
return (
@@ -60,10 +58,9 @@ const Monitors = () => {
-
-
-
-
+
+
+
);
diff --git a/Client/src/Pages/Monitors/monitors.css b/Client/src/Pages/Monitors/monitors.css
index c2ed8532f..3a442aa42 100644
--- a/Client/src/Pages/Monitors/monitors.css
+++ b/Client/src/Pages/Monitors/monitors.css
@@ -66,24 +66,6 @@
font-size: var(--env-var-font-size-medium);
}
-.host-list-item {
- display: flex;
- align-items: center;
- cursor: pointer;
-}
-
-.host-list-item-open {
- width: var(--env-var-img-width-2);
- height: var(--env-var-img-width-2);
- margin-right: 8px;
-}
-
-.host-list-item-name {
- font-size: var(--env-var-font-size-medium);
- font-weight: bold;
- margin-right: var(--env-var-spacing-1);
-}
-
.host-list-item-precentage {
font-size: var(--env-var-font-size-medium);
}
@@ -101,13 +83,6 @@
padding: calc(var(--env-var-spacing-1) / 2);
}
-.host-status-box-circle {
- width: 6px;
- height: 6px;
- border-radius: 50%;
- margin-right: calc(var(--env-var-spacing-1) / 2);
-}
-
.host-actions {
margin: auto;
cursor: pointer;