v1.5.1 增强程序稳定性

This commit is contained in:
robin
2026-03-22 17:37:40 +08:00
parent afbaaa869c
commit 17e182b413
652 changed files with 22949 additions and 34397 deletions

View File

@@ -37,6 +37,7 @@ Tea.context(function () {
this.reloadHourlyTrafficChart = function () {
let stats = this.hourlyStats
if (stats == null || stats.length == 0) {
this.renderEmptyBarChart("hourly-traffic-chart", "暂无请求趋势数据")
return
}
this.reloadTrafficChart("hourly-traffic-chart", stats, function (args) {
@@ -47,6 +48,7 @@ Tea.context(function () {
this.reloadDailyTrafficChart = function () {
let stats = this.dailyStats
if (stats == null || stats.length == 0) {
this.renderEmptyBarChart("daily-traffic-chart", "暂无请求趋势数据")
return
}
this.reloadTrafficChart("daily-traffic-chart", stats, function (args) {
@@ -116,6 +118,7 @@ Tea.context(function () {
this.reloadTopAppsChart = function () {
if (this.topAppStats == null || this.topAppStats.length == 0) {
this.renderEmptyBarChart("top-apps-chart", "暂无应用请求数据")
return
}
let axis = teaweb.countAxis(this.topAppStats, function (v) {
@@ -140,6 +143,7 @@ Tea.context(function () {
this.reloadTopDomainsChart = function () {
if (this.topDomainStats == null || this.topDomainStats.length == 0) {
this.renderEmptyBarChart("top-domains-chart", "暂无域名请求数据")
return
}
let axis = teaweb.countAxis(this.topDomainStats, function (v) {
@@ -164,6 +168,7 @@ Tea.context(function () {
this.reloadTopNodesChart = function () {
if (this.topNodeStats == null || this.topNodeStats.length == 0) {
this.renderEmptyBarChart("top-nodes-chart", "暂无节点访问数据")
return
}
let axis = teaweb.countAxis(this.topNodeStats, function (v) {
@@ -188,4 +193,40 @@ Tea.context(function () {
}
})
}
this.renderEmptyBarChart = function (chartId, message) {
let chartBox = document.getElementById(chartId)
if (chartBox == null) {
return
}
let chart = teaweb.initChart(chartBox)
chart.setOption({
xAxis: {
data: [],
axisLabel: { show: false }
},
yAxis: {
axisLabel: { show: false },
splitLine: { show: true }
},
grid: {
left: 50,
top: 40,
right: 20,
bottom: 20
},
graphic: [{
type: "text",
left: "center",
top: "middle",
style: {
text: message,
fontSize: 13,
fill: "#999"
}
}],
series: []
})
chart.resize()
}
})