mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-31 03:30:39 +00:00
a8b102ad4a
backend: - new field for monitor: maxretries - new pending status while service is retrying: 2 - pending status event is not marked important - pending pings however register as downtime in the calculation frontend: - added pending status while service is retrying - added color for new pending status - added field to configure amount of retries database: - IMPORTANT: THIS REQUIRES MIGRATION!!!! - added field: maxretries with default value 0
63 lines
1.4 KiB
Vue
63 lines
1.4 KiB
Vue
<template>
|
|
<span :class="className">{{ uptime }}</span>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
monitor : Object,
|
|
type: String,
|
|
pill: {
|
|
Boolean,
|
|
default: false,
|
|
},
|
|
},
|
|
|
|
computed: {
|
|
uptime() {
|
|
|
|
let key = this.monitor.id + "_" + this.type;
|
|
|
|
if (this.$root.uptimeList[key] !== undefined) {
|
|
return Math.round(this.$root.uptimeList[key] * 10000) / 100 + "%";
|
|
} else {
|
|
return "N/A"
|
|
}
|
|
},
|
|
|
|
color() {
|
|
if (this.lastHeartBeat.status === 0) {
|
|
return "danger"
|
|
} else if (this.lastHeartBeat.status === 1) {
|
|
return "primary"
|
|
} else if (this.lastHeartBeat.status === 2) {
|
|
return "warning"
|
|
} else {
|
|
return "secondary"
|
|
}
|
|
},
|
|
|
|
lastHeartBeat() {
|
|
if (this.monitor.id in this.$root.lastHeartbeatList && this.$root.lastHeartbeatList[this.monitor.id]) {
|
|
return this.$root.lastHeartbeatList[this.monitor.id]
|
|
} else {
|
|
return { status: -1 }
|
|
}
|
|
},
|
|
|
|
className() {
|
|
if (this.pill) {
|
|
return `badge rounded-pill bg-${this.color}`;
|
|
} else {
|
|
return "";
|
|
}
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|