diff --git a/internal/web/actions/default/dashboard/index.go b/internal/web/actions/default/dashboard/index.go index f9cde459..3b8187bb 100644 --- a/internal/web/actions/default/dashboard/index.go +++ b/internal/web/actions/default/dashboard/index.go @@ -40,6 +40,10 @@ func (this *IndexAction) RunGet(params struct{}) { } } + this.Show() +} + +func (this *IndexAction) RunPost(params struct{}) { // 读取看板数据 resp, err := this.RPC().AdminRPC().ComposeAdminDashboard(this.AdminContext(), &pb.ComposeAdminDashboardRequest{ ApiVersion: teaconst.APINodeVersion, @@ -50,7 +54,7 @@ func (this *IndexAction) RunGet(params struct{}) { } this.Data["dashboard"] = maps.Map{ "defaultClusterId": resp.DefaultNodeClusterId, - + "countServers": resp.CountServers, "countNodeClusters": resp.CountNodeClusters, "countNodes": resp.CountNodes, @@ -85,8 +89,14 @@ func (this *IndexAction) RunGet(params struct{}) { statMaps := []maps.Map{} for _, stat := range resp.HourlyTrafficStats { statMaps = append(statMaps, maps.Map{ - "bytes": stat.Bytes, - "hour": stat.Hour[8:], + "bytes": stat.Bytes, + "cachedBytes": stat.CachedBytes, + "countRequests": stat.CountRequests, + "countCachedRequests": stat.CountCachedRequests, + "countAttackRequests": stat.CountAttackRequests, + "attackBytes": stat.AttackBytes, + "day": stat.Hour[4:6] + "月" + stat.Hour[6:8] + "日", + "hour": stat.Hour[8:], }) } this.Data["hourlyTrafficStats"] = statMaps @@ -97,8 +107,13 @@ func (this *IndexAction) RunGet(params struct{}) { statMaps := []maps.Map{} for _, stat := range resp.DailyTrafficStats { statMaps = append(statMaps, maps.Map{ - "bytes": stat.Bytes, - "day": stat.Day[4:6] + "月" + stat.Day[6:] + "日", + "bytes": stat.Bytes, + "cachedBytes": stat.CachedBytes, + "countRequests": stat.CountRequests, + "countCachedRequests": stat.CountCachedRequests, + "countAttackRequests": stat.CountAttackRequests, + "attackBytes": stat.AttackBytes, + "day": stat.Day[4:6] + "月" + stat.Day[6:] + "日", }) } this.Data["dailyTrafficStats"] = statMaps @@ -172,6 +187,20 @@ func (this *IndexAction) RunGet(params struct{}) { } } + // 域名排行 + { + var statMaps = []maps.Map{} + for _, stat := range resp.TopDomainStats { + statMaps = append(statMaps, maps.Map{ + "serverId": stat.ServerId, + "domain": stat.Domain, + "countRequests": stat.CountRequests, + "bytes": stat.Bytes, + }) + } + this.Data["topDomainStats"] = statMaps + } + // 指标 { var chartMaps = []maps.Map{} @@ -210,5 +239,5 @@ func (this *IndexAction) RunGet(params struct{}) { this.Data["metricCharts"] = chartMaps } - this.Show() + this.Success() } diff --git a/web/views/@default/dashboard/index.html b/web/views/@default/dashboard/index.html index 4a7cea71..5bd26583 100644 --- a/web/views/@default/dashboard/index.html +++ b/web/views/@default/dashboard/index.html @@ -1,24 +1,31 @@ {$layout} {$template "/echarts"} + +