修复在使用内存缓存时导致节点看板页为空的Bug

This commit is contained in:
刘祥超
2021-07-22 08:25:42 +08:00
parent 9f39cd615f
commit 0fe2bc4a54

View File

@@ -452,11 +452,14 @@ Tea.context(function () {
this.cacheDirAvail = ""
this.cacheDirAvailWarning = false
if (this.cacheDirValues.length > 0) {
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}
teaweb.renderLineChart({
@@ -471,7 +474,7 @@ Tea.context(function () {
return stats[args.dataIndex].time + "<br/>使用:" + teaweb.formatBytes(v.used) + "<br/>总量:" + teaweb.formatBytes(v.total) + "<br/>比例:" + (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]