Merge branch 'master' into public-dashboard

# Conflicts:
#	server/server.js
This commit is contained in:
LouisLam
2021-09-20 18:48:44 +08:00
23 changed files with 430 additions and 30 deletions

View File

@@ -49,7 +49,7 @@
<div class="shadow-box big-padding text-center stats">
<div class="row">
<div class="col">
<h4>{{ pingTitle }}</h4>
<h4>{{ pingTitle() }}</h4>
<p>({{ $t("Current") }})</p>
<span class="num">
<a href="#" @click.prevent="showPingChartBox = !showPingChartBox">
@@ -58,7 +58,7 @@
</span>
</div>
<div class="col">
<h4>{{ $t("Avg.") }} {{ pingTitle }}</h4>
<h4>{{ pingTitle(true) }}</h4>
<p>(24{{ $t("-hour") }})</p>
<span class="num"><CountUp :value="avgPing" /></span>
</div>
@@ -240,14 +240,6 @@ export default {
}
},
computed: {
pingTitle() {
if (this.monitor.type === "http") {
return this.$t("Response");
}
return this.$t("Ping");
},
monitor() {
let id = this.$route.params.id
return this.$root.monitorList[id];
@@ -378,6 +370,19 @@ export default {
}
})
},
pingTitle(average = false) {
let translationPrefix = ""
if (average) {
translationPrefix = "Avg. "
}
if (this.monitor.type === "http") {
return this.$t(translationPrefix + "Response");
}
return this.$t(translationPrefix + "Ping");
},
},
}
</script>

View File

@@ -333,6 +333,11 @@ export default {
this.$root.getSocket().emit("getMonitor", this.$route.params.id, (res) => {
if (res.ok) {
this.monitor = res.monitor;
// Handling for monitors that are created before 1.7.0
if (this.monitor.retryInterval === 0) {
this.monitor.retryInterval = this.monitor.interval;
}
} else {
toast.error(res.msg)
}