diff --git a/server/server.js b/server/server.js index 040de225f..4aa8ced11 100644 --- a/server/server.js +++ b/server/server.js @@ -1192,13 +1192,9 @@ let needSetup = false; let count; if (monitorID == null) { - count = await R.count("heartbeat", "important = 1"); - count += await R.count("heartbeat", "ping_important = 1"); + count = await R.count("heartbeat", "important = 1 OR ping_important = 1"); } else { - count = await R.count("heartbeat", "monitor_id = ? AND important = 1", [ - monitorID, - ]); - count += await R.count("heartbeat", "monitor_id = ? AND ping_important = 1", [ + count = await R.count("heartbeat", "monitor_id = ? AND (important = 1 OR ping_important = 1)", [ monitorID, ]); } diff --git a/src/mixins/socket.js b/src/mixins/socket.js index 07ce0f70e..07e0f618a 100644 --- a/src/mixins/socket.js +++ b/src/mixins/socket.js @@ -205,6 +205,26 @@ export default { this.emitter.emit("newImportantHeartbeat", data); } + + if (data.pingImportant) { + + // TODO Do we want slow response toast messages? + // if (this.monitorList[data.monitorID] !== undefined) { + // if (data.pingStatus === SLOW) { + // toast.error(`[${this.monitorList[data.monitorID].name}] [SLOW] ${data.pingMsg}`, { + // timeout: getToastErrorTimeout(), + // }); + // } else if (data.pingStatus === NOMINAL) { + // toast.success(`[${this.monitorList[data.monitorID].name}] [NOMINAL] ${data.pingMsg}`, { + // timeout: getToastSuccessTimeout(), + // }); + // } else { + // toast(`[${this.monitorList[data.monitorID].name}] ${data.pingMsg}`); + // } + // } + + this.emitter.emit("newImportantHeartbeat", data); + } }); socket.on("heartbeatList", (monitorID, data, overwrite = false) => {