mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-09 08:40:26 +08:00
增加连接数监控图表
This commit is contained in:
@@ -2,6 +2,7 @@ Tea.context(function () {
|
||||
this.$delay(function () {
|
||||
this.loadTrafficInChart()
|
||||
this.loadTrafficOutChart()
|
||||
this.loadConnectionsChart()
|
||||
this.loadCPUChart()
|
||||
this.loadMemoryChart()
|
||||
this.loadLoadChart()
|
||||
@@ -10,6 +11,7 @@ Tea.context(function () {
|
||||
window.addEventListener("resize", function () {
|
||||
that.resizeChart("traffic-in-chart")
|
||||
that.resizeChart("traffic-out-chart")
|
||||
that.resizeChart("connections-chart")
|
||||
that.resizeChart("cpu-chart")
|
||||
that.resizeChart("memory-chart")
|
||||
that.resizeChart("load-chart")
|
||||
@@ -84,6 +86,40 @@ Tea.context(function () {
|
||||
})
|
||||
}
|
||||
|
||||
this.loadConnectionsChart = function () {
|
||||
this.$post(".connections")
|
||||
.params({
|
||||
nodeId: this.nodeId
|
||||
})
|
||||
.success(function (resp) {
|
||||
let values = resp.data.values
|
||||
let maxFunc = function () {
|
||||
let max = values.map(function (v) {
|
||||
return v.value
|
||||
}).$max()
|
||||
if (max < 10) {
|
||||
return 10
|
||||
}
|
||||
if (max < 100) {
|
||||
return 100
|
||||
}
|
||||
if (max < 1000) {
|
||||
return 1000
|
||||
}
|
||||
return null
|
||||
}
|
||||
let valueFunc = function (v) {
|
||||
return v.value
|
||||
}
|
||||
this.reloadChart("connections-chart", "", values, "", maxFunc, valueFunc)
|
||||
})
|
||||
.done(function () {
|
||||
this.$delay(function () {
|
||||
this.loadConnectionsChart()
|
||||
}, 30000)
|
||||
})
|
||||
}
|
||||
|
||||
this.loadCPUChart = function () {
|
||||
this.$post(".cpu")
|
||||
.params({
|
||||
|
||||
Reference in New Issue
Block a user