mirror of https://github.com/statping/statping
Merge branch 'master' into feature/tls-renegotiation
commit
6b74003533
|
@ -96,21 +96,17 @@
|
||||||
start = new Date(start.getUTCFullYear(), start.getUTCMonth()+1, 1);
|
start = new Date(start.getUTCFullYear(), start.getUTCMonth()+1, 1);
|
||||||
monthNum += 1
|
monthNum += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
window.console.log(monthData)
|
|
||||||
this.series = monthData.reverse()
|
this.series = monthData.reverse()
|
||||||
this.ready = true
|
this.ready = true
|
||||||
},
|
},
|
||||||
async heatmapData(start, end) {
|
async heatmapData(start, end) {
|
||||||
|
|
||||||
window.console.log("start: ", start)
|
|
||||||
window.console.log("end: ", end)
|
|
||||||
|
|
||||||
const data = await Api.service_failures_data(this.service.id, this.toUnix(start), this.toUnix(end), "24h", true)
|
const data = await Api.service_failures_data(this.service.id, this.toUnix(start), this.toUnix(end), "24h", true)
|
||||||
|
|
||||||
let dataArr = []
|
let dataArr = []
|
||||||
|
if (!data) {
|
||||||
|
return {name: start.toLocaleString('en-us', { month: 'long'}), data: []}
|
||||||
|
}
|
||||||
data.forEach((d) => {
|
data.forEach((d) => {
|
||||||
dataArr.push({x: this.parseISO(d.timeframe), y: d.amount});
|
dataArr.push({x: this.parseISO(d.timeframe), y: d.amount});
|
||||||
});
|
});
|
||||||
|
|
||||||
let date = new Date(dataArr[0].x);
|
let date = new Date(dataArr[0].x);
|
||||||
|
|
|
@ -44,23 +44,25 @@
|
||||||
async mounted() {
|
async mounted() {
|
||||||
await this.latencyYesterday();
|
await this.latencyYesterday();
|
||||||
},
|
},
|
||||||
async latencyYesterday() {
|
methods: {
|
||||||
const todayTime = await Api.service_hits(this.service.id, this.toUnix(this.nowSubtract(86400)), this.toUnix(new Date()), this.group, false)
|
async latencyYesterday() {
|
||||||
const fetched = await Api.service_hits(this.service.id, this.start, this.end, this.group, false)
|
const todayTime = await Api.service_hits(this.service.id, this.toUnix(this.nowSubtract(86400)), this.toUnix(new Date()), this.group, false)
|
||||||
|
const fetched = await Api.service_hits(this.service.id, this.start, this.end, this.group, false)
|
||||||
|
|
||||||
let todayAmount = this.addAmounts(todayTime)
|
let todayAmount = this.addAmounts(todayTime)
|
||||||
let yesterday = this.addAmounts(fetched)
|
let yesterday = this.addAmounts(fetched)
|
||||||
|
|
||||||
window.console.log(todayAmount)
|
window.console.log(todayAmount)
|
||||||
window.console.log(yesterday)
|
window.console.log(yesterday)
|
||||||
|
|
||||||
},
|
},
|
||||||
addAmounts(data) {
|
addAmounts(data) {
|
||||||
let total = 0
|
let total = 0
|
||||||
data.forEach((f) => {
|
data.forEach((f) => {
|
||||||
total += parseInt(f.amount)
|
total += parseInt(f.amount)
|
||||||
});
|
});
|
||||||
return total
|
return total
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue