mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-05 00:44:46 +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
|
* 1 = UP
|
||||||
* 2 = PENDING
|
* 2 = PENDING
|
||||||
* 3 = MAINTENANCE
|
* 3 = MAINTENANCE
|
||||||
|
* pingStatus:
|
||||||
|
* 3 = SLOW
|
||||||
|
* 4 = NOMINAL
|
||||||
*/
|
*/
|
||||||
class Heartbeat extends BeanModel {
|
class Heartbeat extends BeanModel {
|
||||||
|
|
||||||
|
|
|
@ -63,12 +63,9 @@ export default {
|
||||||
[];
|
[];
|
||||||
|
|
||||||
let lastBeat = heartbeatList.at(-1);
|
let lastBeat = heartbeatList.at(-1);
|
||||||
// TODO: Simplify? When page loads, lastBeat contains ping_threshold,
|
|
||||||
// but after the following heartbeat it has pingThreshold.
|
if (lastBeat) {
|
||||||
if (lastBeat?.hasOwnProperty("pingThreshold")) {
|
|
||||||
return lastBeat.pingThreshold;
|
return lastBeat.pingThreshold;
|
||||||
} else if (lastBeat?.hasOwnProperty("ping_threshold")) {
|
|
||||||
return lastBeat.ping_threshold;
|
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
|
@ -763,28 +763,12 @@ export default {
|
||||||
let lastHeartBeat = this.lastHeartbeatList[monitorID];
|
let lastHeartBeat = this.lastHeartbeatList[monitorID];
|
||||||
|
|
||||||
if (lastHeartBeat?.status === UP) {
|
if (lastHeartBeat?.status === UP) {
|
||||||
// TODO ping_status(1st) vs pingStatus(every other time)
|
if (lastHeartBeat.pingStatus === SLOW) {
|
||||||
let pingStatus;
|
|
||||||
if (lastHeartBeat.hasOwnProperty("ping_status")) {
|
|
||||||
pingStatus = lastHeartBeat.ping_status;
|
|
||||||
} else if (lastHeartBeat.hasOwnProperty("pingStatus")) {
|
|
||||||
pingStatus = lastHeartBeat.pingStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pingStatus === SLOW) {
|
|
||||||
result[monitorID] = {
|
result[monitorID] = {
|
||||||
text: this.$t("Slow"),
|
text: this.$t("Slow"),
|
||||||
color: "warning",
|
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;
|
return result;
|
||||||
|
@ -822,15 +806,7 @@ export default {
|
||||||
result.unknown++;
|
result.unknown++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO ping_status(1st) vs pingStatus(every other time)
|
if (beat.pingStatus === SLOW) {
|
||||||
let pingStatus;
|
|
||||||
if (beat.hasOwnProperty("ping_status")) {
|
|
||||||
pingStatus = beat.ping_status;
|
|
||||||
} else if (beat.hasOwnProperty("pingStatus")) {
|
|
||||||
pingStatus = beat.pingStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pingStatus === SLOW) {
|
|
||||||
result.slow++;
|
result.slow++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue