Merge pull request #2205 from bluewave-labs/hotfix/pagespeed-monitors-config
hotfix: pagespeed monitors config
This commit is contained in:
3 files changed
+7
-9
No files matched your search
@@ -101,7 +101,7 @@ export const updatePageSpeed = createAsyncThunk(
|
|||||||
name: monitor.name,
|
name: monitor.name,
|
||||||
description: monitor.description,
|
description: monitor.description,
|
||||||
interval: monitor.interval,
|
interval: monitor.interval,
|
||||||
// notifications: monitor.notifications,
|
notifications: monitor.notifications,
|
||||||
};
|
};
|
||||||
const res = await networkService.updateMonitor({
|
const res = await networkService.updateMonitor({
|
||||||
monitorId: monitor._id,
|
monitorId: monitor._id,
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ const PageSpeed = () => {
|
|||||||
<Breadcrumbs list={BREADCRUMBS} />
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
<CreateMonitorHeader
|
<CreateMonitorHeader
|
||||||
isAdmin={isAdmin}
|
isAdmin={isAdmin}
|
||||||
shouldRender={!isLoading}
|
isLoading={isLoading}
|
||||||
path="/pagespeed/create"
|
path="/pagespeed/create"
|
||||||
/>
|
/>
|
||||||
<MonitorCountHeader
|
<MonitorCountHeader
|
||||||
|
|||||||
@@ -538,18 +538,16 @@ class MonitorController {
|
|||||||
const monitorBeforeEdit = await this.db.getMonitorById(monitorId);
|
const monitorBeforeEdit = await this.db.getMonitorById(monitorId);
|
||||||
|
|
||||||
// Get notifications from the request body
|
// Get notifications from the request body
|
||||||
const notifications = req.body.notifications;
|
const notifications = req.body.notifications ?? [];
|
||||||
|
|
||||||
const editedMonitor = await this.db.editMonitor(monitorId, req.body);
|
const editedMonitor = await this.db.editMonitor(monitorId, req.body);
|
||||||
|
|
||||||
await this.db.deleteNotificationsByMonitorId(editedMonitor._id);
|
await this.db.deleteNotificationsByMonitorId(editedMonitor._id);
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
notifications &&
|
notifications.map(async (notification) => {
|
||||||
notifications.map(async (notification) => {
|
notification.monitorId = editedMonitor._id;
|
||||||
notification.monitorId = editedMonitor._id;
|
await this.db.createNotification(notification);
|
||||||
await this.db.createNotification(notification);
|
})
|
||||||
})
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Delete the old job(editedMonitor has the same ID as the old monitor)
|
// Delete the old job(editedMonitor has the same ID as the old monitor)
|
||||||
|
|||||||
Reference in new issue
Block a user