Conneted Monitor page to backend. Added data normailization to Checks. Added JSdocs and proptypes

This commit is contained in:
Alex Holliday committed 2024-06-21 15:11:54 -07:00
1 parent 2f1053bd05
commit 171b1b8059
7 files changed
+92 -35

No files matched your search

+19 -6
View File
@@ -1,4 +1,12 @@
import React from "react";
import BarChart from "../Charts/BarChart/BarChart";
import PropTypes from "prop-types";
/**
* HostsTable displays the current status of monitor
*
* @component
* @param {Array<Monitor>} monitors - An array of monitor objects to be displayed.
*/
const HostsTable = ({ monitors }) => {
return (
@@ -8,20 +16,21 @@ const HostsTable = ({ monitors }) => {
<tr className="theader-row">
<td className="theader-row-cell">Host</td>
<td className="theader-row-cell">Status</td>
<td className="theader-row-cell">Team</td>
<td className="theader-row-cell">Response</td>
<td className="theader-row-cell">Actions</td>
</tr>
</thead>
<tbody>
{monitors.map((monitor, index) => {
console.log(monitor);
{monitors.map((monitor) => {
return (
<tr className="tbody-row" key={index}>
<tr className="tbody-row" key={monitor._id}>
<td className="tbody-row-cell">{monitor.url}</td>
<td className="tbody-row-cell">
{monitor.isActive ? "Active" : "Down"}
</td>
<td className="tbody-row-cell">{monitor.team}</td>
<td className="tbody-row-cell">
<BarChart checks={monitor.checks} />
</td>
<td className="tbody-row-cell actions-cell">
{monitor.actions}
</td>
@@ -34,4 +43,8 @@ const HostsTable = ({ monitors }) => {
);
};
HostsTable.propTypes = {
monitors: PropTypes.arrayOf(PropTypes.object).isRequired,
};
export default HostsTable;