From 0fe2bc4a54e5dae8d42826c37e454f590afc9c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Thu, 22 Jul 2021 08:25:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=86=85=E5=AD=98=E7=BC=93=E5=AD=98=E6=97=B6=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E7=9C=8B=E6=9D=BF=E9=A1=B5=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clusters/cluster/node/boards/index.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/web/views/@default/clusters/cluster/node/boards/index.js b/web/views/@default/clusters/cluster/node/boards/index.js index ed9fd017..6bbd0d8f 100644 --- a/web/views/@default/clusters/cluster/node/boards/index.js +++ b/web/views/@default/clusters/cluster/node/boards/index.js @@ -82,7 +82,7 @@ Tea.context(function () { attackRatio = Math.round(stats[index].attackBytes * 10000 / stats[index].bytes) / 100 } - return stats[index].day + " " + stats[index].hour + "时
总流量:" + teaweb.formatBytes(stats[index].bytes) + "
缓存流量:" + teaweb.formatBytes(stats[index].cachedBytes) + "
缓存命中率:" + cachedRatio + "%
拦截攻击流量:" + teaweb.formatBytes(stats[index].attackBytes) + "
拦截比例:" + attackRatio + "%" + return stats[index].day + " " + stats[index].hour + "时
总流量:" + teaweb.formatBytes(stats[index].bytes) + "
缓存流量:" + teaweb.formatBytes(stats[index].cachedBytes) + "
缓存命中率:" + cachedRatio + "%
拦截攻击流量:" + teaweb.formatBytes(stats[index].attackBytes) + "
拦截比例:" + attackRatio + "%" }) } @@ -452,10 +452,13 @@ Tea.context(function () { this.cacheDirAvail = "" this.cacheDirAvailWarning = false if (this.cacheDirValues.length > 0) { - this.cacheDirUsed = teaweb.formatBytes(this.cacheDirValues.$last().value.dirs[0].used) - this.cacheDirTotal = teaweb.formatBytes(this.cacheDirValues.$last().value.dirs[0].total) - this.cacheDirAvail = teaweb.formatBytes(this.cacheDirValues.$last().value.dirs[0].avail) - this.cacheDirAvailWarning = (this.cacheDirValues.$last().value.dirs[0].avail < 1024 * 1024 * 1024 * 10) + let lastStat = this.cacheDirValues.$last() + if (lastStat.value != null && lastStat.value.dirs != null && lastStat.value.dirs.length > 0) { + this.cacheDirUsed = teaweb.formatBytes(this.cacheDirValues.$last().value.dirs[0].used) + this.cacheDirTotal = teaweb.formatBytes(this.cacheDirValues.$last().value.dirs[0].total) + this.cacheDirAvail = teaweb.formatBytes(this.cacheDirValues.$last().value.dirs[0].avail) + this.cacheDirAvailWarning = (this.cacheDirValues.$last().value.dirs[0].avail < 1024 * 1024 * 1024 * 10) + } } this.reloadCacheDirsChart = function () { let axis = {unit: "%", divider: 1} @@ -471,7 +474,7 @@ Tea.context(function () { return stats[args.dataIndex].time + "
使用:" + teaweb.formatBytes(v.used) + "
总量:" + teaweb.formatBytes(v.total) + "
比例:" + (Math.ceil(v.used * 100 / v.total * 100) / 100) + "%" }, value: function (v) { - if (v.value.dirs.length ==0) { + if (v.value == null || v.value.dirs == null || v.value.dirs.length == 0) { return 0 } v = v.value.dirs[0]