Perform sanity check on uptime for status page

Fixes #2628
A sanity check is performed when calculating the uptime of a monitor on
status page. If it is greater than 100%, we just show 100%. This hasn't
been implemented on the dashboard at the request of @louislam due to
concerns it would make debugging more difficult in future if changes
were made to the uptime calculation.

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
pull/2635/head
Matthew Nickson 1 year ago
parent 54d4c4d3f7
commit 86bcb85e9b
No known key found for this signature in database
GPG Key ID: BF229DCFD4748E05

@ -33,7 +33,13 @@ export default {
let key = this.monitor.id + "_" + this.type;
if (this.$root.uptimeList[key] !== undefined) {
return Math.round(this.$root.uptimeList[key] * 10000) / 100 + "%";
let result = Math.round(this.$root.uptimeList[key] * 10000) / 100;
// Only perform sanity check on status page. See louislam/uptime-kuma#2628
if (this.$route.path.startsWith("/status")) {
return result > 100 ? "100%" : result + "%";
} else {
return result + "%";
}
}
return this.$t("notAvailableShort");

Loading…
Cancel
Save