diff --git a/Client/src/Pages/Monitors/Home/MonitorTable/index.jsx b/Client/src/Pages/Monitors/Home/MonitorTable/index.jsx
index 421b7d90c..669624025 100644
--- a/Client/src/Pages/Monitors/Home/MonitorTable/index.jsx
+++ b/Client/src/Pages/Monitors/Home/MonitorTable/index.jsx
@@ -22,8 +22,13 @@ import { StatusLabel } from "../../../../Components/Label";
import { jwtDecode } from "jwt-decode";
import { useSelector } from "react-redux";
import { networkService } from "../../../../main";
+import { useTheme } from "@emotion/react";
+import BarChart from "../../../../Components/Charts/BarChart";
+import ActionsMenu from "../actionsMenu";
+
+const MonitorTable = ({ isAdmin }) => {
+ const theme = useTheme();
-const MonitorTable = ({ teamId }) => {
const [paginationController, setPaginationController] = useState({
page: 0,
rowsPerPage: 14,
@@ -56,7 +61,7 @@ const MonitorTable = ({ teamId }) => {
paginationController.rowsPerPage
);
console.log(res.data.data);
- setMonitors([]);
+ setMonitors(res?.data?.data ?? []);
setMonitorCount(0);
} catch (error) {
logger.error(error);
@@ -107,7 +112,68 @@ const MonitorTable = ({ teamId }) => {
Actions
-
+
+ {monitors.map((monitor) => {
+ let uptimePercentage = "";
+ let percentageColor = theme.palette.percentage.uptimeExcellent;
+
+ // Determine uptime percentage and color based on the monitor's uptimePercentage value
+ if (monitor.uptimePercentage !== undefined) {
+ uptimePercentage =
+ monitor.uptimePercentage === 0
+ ? "0"
+ : (monitor.uptimePercentage * 100).toFixed(2);
+
+ percentageColor =
+ monitor.uptimePercentage < 0.25
+ ? theme.palette.percentage.uptimePoor
+ : monitor.uptimePercentage < 0.5
+ ? theme.palette.percentage.uptimeFair
+ : monitor.uptimePercentage < 0.75
+ ? theme.palette.percentage.uptimeGood
+ : theme.palette.percentage.uptimeExcellent;
+ }
+
+ const params = {
+ url: monitor.url,
+ title: monitor.name,
+ percentage: uptimePercentage,
+ percentageColor,
+ status:
+ monitor.status === undefined
+ ? "pending"
+ : monitor.status === true
+ ? "up"
+ : "down",
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ {monitor.type}
+
+
+
+
+
+
+ );
+ })}
+
{paginationComponent}
@@ -115,7 +181,4 @@ const MonitorTable = ({ teamId }) => {
);
};
-MonitorTable.propTypes = {
- teamId: PropTypes.string,
-};
export default MonitorTable;