节点详情显示API连接状况

This commit is contained in:
GoEdgeLab
2022-11-22 11:27:48 +08:00
parent d9fffdfcdd
commit 27b441e7f2
3 changed files with 23 additions and 0 deletions

View File

@@ -356,6 +356,8 @@ func (this *DetailAction) RunGet(params struct {
"cacheTotalDiskSize": numberutils.FormatBytes(status.CacheTotalDiskSize), "cacheTotalDiskSize": numberutils.FormatBytes(status.CacheTotalDiskSize),
"cacheTotalMemorySize": numberutils.FormatBytes(status.CacheTotalMemorySize), "cacheTotalMemorySize": numberutils.FormatBytes(status.CacheTotalMemorySize),
"exePath": status.ExePath, "exePath": status.ExePath,
"apiSuccessPercent": status.APISuccessPercent,
"apiAvgCostSeconds": status.APIAvgCostSeconds,
}, },
"group": groupMap, "group": groupMap,

View File

@@ -235,6 +235,23 @@
<td>主程序位置</td> <td>主程序位置</td>
<td>{{node.status.exePath}}</td> <td>{{node.status.exePath}}</td>
</tr> </tr>
<tr>
<td>最近API连接状况</td>
<td>
<span v-if="node.status.apiSuccessPercent > 0 && node.status.apiAvgCostSeconds > 0">
<span v-if="node.status.apiSuccessPercent <= 50" class="red">连接错误异常严重({{round(100 - node.status.apiSuccessPercent)}}%失败请改善当前节点和API节点之间通讯</span>
<span v-else-if="node.status.apiSuccessPercent <= 80" class="red">连接错误较多({{round(100 - node.status.apiSuccessPercent)}}%失败请改善当前节点和API节点之间通讯</span>
<span v-else-if="node.status.apiSuccessPercent < 100" class="orange">有连接错误发生({{round(100 - node.status.apiSuccessPercent)}}%失败请改善当前节点和API节点之间通讯</span>
<span v-else>
<span v-if="node.status.apiAvgCostSeconds <= 1" class="green">连接良好</span>
<span v-else-if="node.status.apiAvgCostSeconds <= 5" class="orange">连接基本稳定(平均{{round(node.status.apiAvgCostSeconds)}}秒)</span>
<span v-else-if="node.status.apiAvgCostSeconds <= 10" class="orange">连接速度较慢(平均{{round(node.status.apiAvgCostSeconds)}}秒)</span>
<span v-else class="red">连接非常慢(平均{{round(node.status.apiAvgCostSeconds)}}秒请改善当前节点和API节点之间通讯</span>
</span>
</span>
<span v-else class="disabled">尚未连接</span>
</td>
</tr>
<tr v-if="nodeDatetime.length > 0"> <tr v-if="nodeDatetime.length > 0">
<td>上次更新时间</td> <td>上次更新时间</td>
<td> <td>

View File

@@ -32,4 +32,8 @@ Tea.context(function () {
this.isStopping = false this.isStopping = false
}) })
} }
this.round = function (f) {
return Math.round(f * 100) / 100
}
}) })