mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-24 19:01:01 -06:00
Merge branch 'master' into feat/details-basic-table
This commit is contained in:
@@ -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 (
|
||||
<div className="host-list-item">
|
||||
<a href={link} target="_blank">
|
||||
<img className="host-list-item-open" src={OpenIt} alt="OpenIt" />
|
||||
</a>
|
||||
<div className="host-list-item-name">{title}</div>
|
||||
<div className="host-list-item-precentage" style={{ color: statusColor }}>
|
||||
{precentage}%
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Host;
|
||||
@@ -1,8 +0,0 @@
|
||||
import React from "react";
|
||||
import DashboardSettings from "../DashboardSettingsIcon";
|
||||
|
||||
function HostActions() {
|
||||
return <DashboardSettings />;
|
||||
}
|
||||
|
||||
export default HostActions;
|
||||
@@ -1,18 +0,0 @@
|
||||
import React from "react";
|
||||
|
||||
function HostStatus(backgroundColor, status, dotColor) {
|
||||
return (
|
||||
<div
|
||||
className="host-status-box"
|
||||
style={{ backgroundColor: backgroundColor }}
|
||||
>
|
||||
<div
|
||||
className="host-status-box-circle"
|
||||
style={{ backgroundColor: dotColor }}
|
||||
></div>
|
||||
<div className="host-status-box-text">{status}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default HostStatus;
|
||||
@@ -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<Monitor>} 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 (
|
||||
<div className="current-monitors-table-holder">
|
||||
<table className="current-monitors-table">
|
||||
<thead>
|
||||
<tr className="theader-row">
|
||||
<td className="theader-row-cell">Host</td>
|
||||
<td className="theader-row-cell">Status</td>
|
||||
<td className="theader-row-cell">Response</td>
|
||||
<td className="theader-row-cell">Actions</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{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 (
|
||||
<tr className="tbody-row" key={monitor._id}>
|
||||
<td className="tbody-row-cell">{host}</td>
|
||||
<td className="tbody-row-cell">{status}</td>
|
||||
<td className="tbody-row-cell">
|
||||
<ResponseTimeChart checks={monitor.checks} />
|
||||
</td>
|
||||
<td className="tbody-row-cell actions-cell">
|
||||
{monitor.actions}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
HostsTable.propTypes = {
|
||||
monitors: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
};
|
||||
|
||||
export default HostsTable;
|
||||
@@ -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";
|
||||
|
||||
@@ -309,11 +309,11 @@ const validateRecoveryTokenController = async (req, res, next) => {
|
||||
const resetPasswordController = async (req, res, next) => {
|
||||
try {
|
||||
await newPasswordValidation.validateAsync(req.body);
|
||||
user = await req.db.resetPassword(req, res);
|
||||
const response = await req.db.resetPassword(req, res);
|
||||
res.status(200).json({
|
||||
success: true,
|
||||
msg: successMessages.AUTH_RESET_PASSWORD,
|
||||
data: user,
|
||||
data: response,
|
||||
});
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
|
||||
@@ -220,7 +220,8 @@ const resetPassword = async (req, res) => {
|
||||
})
|
||||
.select("-password")
|
||||
.select("-profileImage");
|
||||
return userWithoutPassword;
|
||||
const token = issueToken(userWithoutPassword);
|
||||
return { user: userWithoutPassword, token: token };
|
||||
} else {
|
||||
throw new Error(errorMessages.DB_USER_NOT_FOUND);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user