服务看板改成异步

This commit is contained in:
刘祥超
2021-08-30 11:26:23 +08:00
parent 4dc54f95b6
commit 19178f963e
4 changed files with 37 additions and 6 deletions

View File

@@ -1,4 +1,7 @@
Tea.context(function () {
this.isLoading = true
this.metricCharts = []
this.formatCount = function (count) {
if (count < 1000) {
return count.toString()
@@ -15,11 +18,27 @@ Tea.context(function () {
this.trafficTab = "hourly"
this.$delay(function () {
this.reloadHourlyTrafficChart()
this.reloadHourlyRequestsChart()
this.reloadTopDomainsChart()
this.load()
})
this.load = function () {
this.$post("$")
.params({
serverId: this.server.id
})
.success(function (resp) {
for (let k in resp.data) {
this[k] = resp.data[k]
}
this.reloadHourlyTrafficChart()
this.reloadHourlyRequestsChart()
this.reloadTopDomainsChart()
this.isLoading = false
})
}
this.selectTrafficTab = function (tab) {
this.trafficTab = tab
if (tab == "hourly") {