Fix proptype errors, remove old alert reference
This commit is contained in:
1 parent
7454e8812e
commit
09fb5595ab
3 files changed
+17
-13
No files matched your search
@@ -134,7 +134,7 @@ const Monitors = ({ isAdmin }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
<Box width="25%" minWidth={150} ml="auto">
|
<Box width="25%" minWidth={150} ml="auto">
|
||||||
<Search
|
<Search
|
||||||
options={monitorState?.monitorsSummary.monitors}
|
options={monitorState?.monitorsSummary?.monitors ?? []}
|
||||||
filteredBy="name"
|
filteredBy="name"
|
||||||
value={search}
|
value={search}
|
||||||
handleInputChange={handleSearch}
|
handleInputChange={handleSearch}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const PageSpeedDetails = ({ isAdmin }) => {
|
|||||||
normalize: null,
|
normalize: null,
|
||||||
});
|
});
|
||||||
setMonitor(res?.data?.data ?? {});
|
setMonitor(res?.data?.data ?? {});
|
||||||
setAudits(res?.data?.data?.checks?.[0]?.audits ?? []);
|
setAudits(res?.data?.data?.checks?.[0]?.audits ?? {});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(logger);
|
logger.error(logger);
|
||||||
navigate("/not-found", { replace: true });
|
navigate("/not-found", { replace: true });
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const SERVICE_NAME = "monitorController";
|
|||||||
const { errorMessages, successMessages } = require("../utils/messages");
|
const { errorMessages, successMessages } = require("../utils/messages");
|
||||||
const jwt = require("jsonwebtoken");
|
const jwt = require("jsonwebtoken");
|
||||||
const { getTokenFromHeaders } = require("../utils/utils");
|
const { getTokenFromHeaders } = require("../utils/utils");
|
||||||
|
const logger = require("../utils/logger");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all monitors
|
* Returns all monitors
|
||||||
@@ -315,18 +316,21 @@ const deleteMonitor = async (req, res, next) => {
|
|||||||
try {
|
try {
|
||||||
const monitor = await req.db.deleteMonitor(req, res, next);
|
const monitor = await req.db.deleteMonitor(req, res, next);
|
||||||
// Delete associated checks,alerts,and notifications
|
// Delete associated checks,alerts,and notifications
|
||||||
await req.jobQueue.deleteJob(monitor);
|
try {
|
||||||
await req.db.deleteChecks(monitor._id);
|
await req.jobQueue.deleteJob(monitor);
|
||||||
await req.db.deleteAlertByMonitorId(monitor._id);
|
await req.db.deleteChecks(monitor._id);
|
||||||
await req.db.deletePageSpeedChecksByMonitorId(monitor._id);
|
await req.db.deletePageSpeedChecksByMonitorId(monitor._id);
|
||||||
await req.db.deleteNotificationsByMonitorId(monitor._id);
|
await req.db.deleteNotificationsByMonitorId(monitor._id);
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(
|
||||||
|
`Error deleting associated records for monitor ${monitor._id} with name ${monitor.name}`,
|
||||||
|
{
|
||||||
|
service: SERVICE_NAME,
|
||||||
|
error: error.message,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
* We should remove all checks and alerts associated with this monitor
|
|
||||||
* when it is deleted so there is no orphaned data
|
|
||||||
* We also need to make sure to stop all running services for this monitor
|
|
||||||
*/
|
|
||||||
return res
|
return res
|
||||||
.status(200)
|
.status(200)
|
||||||
.json({ success: true, msg: successMessages.MONITOR_DELETE });
|
.json({ success: true, msg: successMessages.MONITOR_DELETE });
|
||||||
|
|||||||
Reference in new issue
Block a user