From e87c057ccbf43ba28139f22466be56d425c8fc38 Mon Sep 17 00:00:00 2001 From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca> Date: Mon, 12 May 2025 12:40:53 -0400 Subject: [PATCH 1/3] switch conditional values for state variable --- client/src/Pages/PageSpeed/Configure/index.jsx | 2 +- client/src/Pages/Uptime/Configure/index.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/Pages/PageSpeed/Configure/index.jsx b/client/src/Pages/PageSpeed/Configure/index.jsx index d9753ef2c..b1d4ee11e 100644 --- a/client/src/Pages/PageSpeed/Configure/index.jsx +++ b/client/src/Pages/PageSpeed/Configure/index.jsx @@ -136,7 +136,7 @@ const PageSpeedConfigure = () => { if (pausePageSpeed.fulfilled.match(action)) { const monitor = action.payload.data; setMonitor(monitor); - const state = action?.payload?.data.isActive === false ? "paused" : "resumed"; + const state = action?.payload?.data.isActive === false ? "resumed" : "paused"; createToast({ body: `Monitor ${state} successfully.` }); } else if (pausePageSpeed.rejected.match(action)) { throw new Error(action.error.message); diff --git a/client/src/Pages/Uptime/Configure/index.jsx b/client/src/Pages/Uptime/Configure/index.jsx index 246f9cde1..87143fa8c 100644 --- a/client/src/Pages/Uptime/Configure/index.jsx +++ b/client/src/Pages/Uptime/Configure/index.jsx @@ -164,7 +164,7 @@ const Configure = () => { if (pauseUptimeMonitor.fulfilled.match(action)) { const monitor = action.payload.data; setMonitor(monitor); - const state = action?.payload?.data.isActive === false ? "paused" : "resumed"; + const state = action?.payload?.data.isActive === false ? "resumed" : "paused"; createToast({ body: `Monitor ${state} successfully.` }); } else if (pauseUptimeMonitor.rejected.match(action)) { throw new Error(action.error.message); From 22953ac30a3849025696359b697db1fcab9c76fc Mon Sep 17 00:00:00 2001 From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca> Date: Mon, 12 May 2025 13:47:32 -0400 Subject: [PATCH 2/3] revert back toast messages --- client/src/Pages/PageSpeed/Configure/index.jsx | 2 +- client/src/Pages/Uptime/Configure/index.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/Pages/PageSpeed/Configure/index.jsx b/client/src/Pages/PageSpeed/Configure/index.jsx index b1d4ee11e..d9753ef2c 100644 --- a/client/src/Pages/PageSpeed/Configure/index.jsx +++ b/client/src/Pages/PageSpeed/Configure/index.jsx @@ -136,7 +136,7 @@ const PageSpeedConfigure = () => { if (pausePageSpeed.fulfilled.match(action)) { const monitor = action.payload.data; setMonitor(monitor); - const state = action?.payload?.data.isActive === false ? "resumed" : "paused"; + const state = action?.payload?.data.isActive === false ? "paused" : "resumed"; createToast({ body: `Monitor ${state} successfully.` }); } else if (pausePageSpeed.rejected.match(action)) { throw new Error(action.error.message); diff --git a/client/src/Pages/Uptime/Configure/index.jsx b/client/src/Pages/Uptime/Configure/index.jsx index 87143fa8c..246f9cde1 100644 --- a/client/src/Pages/Uptime/Configure/index.jsx +++ b/client/src/Pages/Uptime/Configure/index.jsx @@ -164,7 +164,7 @@ const Configure = () => { if (pauseUptimeMonitor.fulfilled.match(action)) { const monitor = action.payload.data; setMonitor(monitor); - const state = action?.payload?.data.isActive === false ? "resumed" : "paused"; + const state = action?.payload?.data.isActive === false ? "paused" : "resumed"; createToast({ body: `Monitor ${state} successfully.` }); } else if (pauseUptimeMonitor.rejected.match(action)) { throw new Error(action.error.message); From 39555248355ecf3ccf04185ab38360cf481fc1c1 Mon Sep 17 00:00:00 2001 From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca> Date: Mon, 12 May 2025 13:50:58 -0400 Subject: [PATCH 3/3] Return updated monitor state in pauseMonitor --- server/controllers/monitorController.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/controllers/monitorController.js b/server/controllers/monitorController.js index 9a42ea4e5..53abc7dff 100755 --- a/server/controllers/monitorController.js +++ b/server/controllers/monitorController.js @@ -589,7 +589,9 @@ class MonitorController { status: "$$REMOVE", }, }, - ]); + ], + { new: true } + ); monitor.isActive === true ? await this.jobQueue.deleteJob(monitor) : await this.jobQueue.addJob(monitor._id, monitor);