mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
数据看板增加独立IP数量
This commit is contained in:
@@ -92,13 +92,16 @@ func (this *IndexAction) RunPost(params struct{}) {
|
|||||||
"diskUsageWarning": diskUsageWarning,
|
"diskUsageWarning": diskUsageWarning,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 今日流量
|
// 今日流量和独立IP数
|
||||||
todayTrafficBytes := int64(0)
|
var todayTrafficBytes int64
|
||||||
|
var todayCountIPs int64
|
||||||
if len(resp.DailyTrafficStats) > 0 {
|
if len(resp.DailyTrafficStats) > 0 {
|
||||||
todayTrafficBytes = resp.DailyTrafficStats[len(resp.DailyTrafficStats)-1].Bytes
|
var lastDailyTrafficStat = resp.DailyTrafficStats[len(resp.DailyTrafficStats)-1]
|
||||||
|
todayTrafficBytes = lastDailyTrafficStat.Bytes
|
||||||
|
todayCountIPs = lastDailyTrafficStat.CountIPs
|
||||||
}
|
}
|
||||||
todayTrafficString := numberutils.FormatBytes(todayTrafficBytes)
|
var todayTrafficString = numberutils.FormatBytes(todayTrafficBytes)
|
||||||
result := regexp.MustCompile(`^(?U)(.+)([a-zA-Z]+)$`).FindStringSubmatch(todayTrafficString)
|
var result = regexp.MustCompile(`^(?U)(.+)([a-zA-Z]+)$`).FindStringSubmatch(todayTrafficString)
|
||||||
if len(result) > 2 {
|
if len(result) > 2 {
|
||||||
this.Data["todayTraffic"] = result[1]
|
this.Data["todayTraffic"] = result[1]
|
||||||
this.Data["todayTrafficUnit"] = result[2]
|
this.Data["todayTrafficUnit"] = result[2]
|
||||||
@@ -107,6 +110,8 @@ func (this *IndexAction) RunPost(params struct{}) {
|
|||||||
this.Data["todayTrafficUnit"] = ""
|
this.Data["todayTrafficUnit"] = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.Data["todayCountIPs"] = todayCountIPs
|
||||||
|
|
||||||
// 24小时流量趋势
|
// 24小时流量趋势
|
||||||
{
|
{
|
||||||
statMaps := []maps.Map{}
|
statMaps := []maps.Map{}
|
||||||
@@ -137,6 +142,7 @@ func (this *IndexAction) RunPost(params struct{}) {
|
|||||||
"countAttackRequests": stat.CountAttackRequests,
|
"countAttackRequests": stat.CountAttackRequests,
|
||||||
"attackBytes": stat.AttackBytes,
|
"attackBytes": stat.AttackBytes,
|
||||||
"day": stat.Day[4:6] + "月" + stat.Day[6:] + "日",
|
"day": stat.Day[4:6] + "月" + stat.Day[6:] + "日",
|
||||||
|
"countIPs": stat.CountIPs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.Data["dailyTrafficStats"] = statMaps
|
this.Data["dailyTrafficStats"] = statMaps
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui column with-border">
|
<div class="ui column">
|
||||||
<h4>API节点<link-icon href="/settings/api" v-if="dashboard.canGoSettings"></link-icon></h4>
|
<h4>API节点<link-icon href="/settings/api" v-if="dashboard.canGoSettings"></link-icon></h4>
|
||||||
<div class="value"><span>{{dashboard.countAPINodes}}</span>个
|
<div class="value"><span>{{dashboard.countAPINodes}}</span>个
|
||||||
<span style="font-size: 1em" v-if="dashboard.countOfflineAPINodes > 0">/ <a href="/settings/api" v-if="dashboard.canGoSettings"><span class="red" style="font-size: 1em">{{dashboard.countOfflineAPINodes}}离线</span></a><span class="red" style="font-size: 1em" v-else>{{dashboard.countOfflineAPINodes}}离线</span></span>
|
<span style="font-size: 1em" v-if="dashboard.countOfflineAPINodes > 0">/ <a href="/settings/api" v-if="dashboard.canGoSettings"><span class="red" style="font-size: 1em">{{dashboard.countOfflineAPINodes}}离线</span></a><span class="red" style="font-size: 1em" v-else>{{dashboard.countOfflineAPINodes}}离线</span></span>
|
||||||
@@ -95,10 +95,19 @@
|
|||||||
<div class="value"><span>{{dashboard.countServers}}</span>个</div>
|
<div class="value"><span>{{dashboard.countServers}}</span>个</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui column with-border">
|
<div class="ui column">
|
||||||
<h4>今日流量</h4>
|
<h4>当天独立IP</h4>
|
||||||
|
<div class="value">
|
||||||
|
<span v-if="todayCountIPs > 0">{{todayCountIPsFormat}}</span>
|
||||||
|
<span v-else class="disabled">尚无数据</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui column">
|
||||||
|
<h4>当天流量</h4>
|
||||||
<div class="value"><span>{{todayTraffic}}</span>{{todayTrafficUnit}}</div>
|
<div class="value"><span>{{todayTraffic}}</span>{{todayTrafficUnit}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</columns-grid>
|
</columns-grid>
|
||||||
|
|
||||||
<chart-columns-grid>
|
<chart-columns-grid>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Tea.context(function () {
|
|||||||
this.dashboard = {}
|
this.dashboard = {}
|
||||||
this.localLowerVersionAPINode = null
|
this.localLowerVersionAPINode = null
|
||||||
this.countWeakAdmins = 0
|
this.countWeakAdmins = 0
|
||||||
|
this.todayCountIPsFormat = "0"
|
||||||
|
|
||||||
this.$delay(function () {
|
this.$delay(function () {
|
||||||
this.$post("$")
|
this.$post("$")
|
||||||
@@ -13,6 +14,8 @@ Tea.context(function () {
|
|||||||
this[k] = resp.data[k]
|
this[k] = resp.data[k]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.todayCountIPsFormat = teaweb.formatNumber(this.todayCountIPs)
|
||||||
|
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
|
|
||||||
this.$delay(function () {
|
this.$delay(function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user