mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-04 16:35:57 +00:00
Simplify logic due to bug fix
This commit is contained in:
parent
20d5ded721
commit
ee53ded19e
3 changed files with 7 additions and 31 deletions
|
@ -6,6 +6,9 @@ const { BeanModel } = require("redbean-node/dist/bean-model");
|
|||
* 1 = UP
|
||||
* 2 = PENDING
|
||||
* 3 = MAINTENANCE
|
||||
* pingStatus:
|
||||
* 3 = SLOW
|
||||
* 4 = NOMINAL
|
||||
*/
|
||||
class Heartbeat extends BeanModel {
|
||||
|
||||
|
|
|
@ -63,12 +63,9 @@ export default {
|
|||
[];
|
||||
|
||||
let lastBeat = heartbeatList.at(-1);
|
||||
// TODO: Simplify? When page loads, lastBeat contains ping_threshold,
|
||||
// but after the following heartbeat it has pingThreshold.
|
||||
if (lastBeat?.hasOwnProperty("pingThreshold")) {
|
||||
|
||||
if (lastBeat) {
|
||||
return lastBeat.pingThreshold;
|
||||
} else if (lastBeat?.hasOwnProperty("ping_threshold")) {
|
||||
return lastBeat.ping_threshold;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
@ -763,28 +763,12 @@ export default {
|
|||
let lastHeartBeat = this.lastHeartbeatList[monitorID];
|
||||
|
||||
if (lastHeartBeat?.status === UP) {
|
||||
// TODO ping_status(1st) vs pingStatus(every other time)
|
||||
let pingStatus;
|
||||
if (lastHeartBeat.hasOwnProperty("ping_status")) {
|
||||
pingStatus = lastHeartBeat.ping_status;
|
||||
} else if (lastHeartBeat.hasOwnProperty("pingStatus")) {
|
||||
pingStatus = lastHeartBeat.pingStatus;
|
||||
}
|
||||
|
||||
if (pingStatus === SLOW) {
|
||||
if (lastHeartBeat.pingStatus === SLOW) {
|
||||
result[monitorID] = {
|
||||
text: this.$t("Slow"),
|
||||
color: "warning",
|
||||
};
|
||||
}
|
||||
// TODO Decide: currently only shows if "slow". Add the
|
||||
// code below else if we want to display "nominal" as well
|
||||
// else if (pingStatus === NOMINAL) {
|
||||
// result[monitorID] = {
|
||||
// text: this.$t("Nominal"),
|
||||
// color: "primary",
|
||||
// };
|
||||
// }
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -822,15 +806,7 @@ export default {
|
|||
result.unknown++;
|
||||
}
|
||||
|
||||
// TODO ping_status(1st) vs pingStatus(every other time)
|
||||
let pingStatus;
|
||||
if (beat.hasOwnProperty("ping_status")) {
|
||||
pingStatus = beat.ping_status;
|
||||
} else if (beat.hasOwnProperty("pingStatus")) {
|
||||
pingStatus = beat.pingStatus;
|
||||
}
|
||||
|
||||
if (pingStatus === SLOW) {
|
||||
if (beat.pingStatus === SLOW) {
|
||||
result.slow++;
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue