mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-11 08:04:17 -08:00
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>
This commit is contained in:
parent
54d4c4d3f7
commit
86bcb85e9b
|
@ -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…
Reference in a new issue