From f65aabe897726d7bb0db7a59e247e55d6c271d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Mon, 19 Jul 2021 15:48:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=87=E6=A0=87=E4=B8=AD=E5=88=97=E5=87=BA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=BD=93=E5=89=8D=E6=8C=87=E6=A0=87=E7=9A=84?= =?UTF-8?q?=E9=9B=86=E7=BE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/actions/default/servers/metrics/item.go | 17 +++++++++++++++++ web/views/@default/servers/metrics/item.html | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/internal/web/actions/default/servers/metrics/item.go b/internal/web/actions/default/servers/metrics/item.go index d53df2d7..4fecada9 100644 --- a/internal/web/actions/default/servers/metrics/item.go +++ b/internal/web/actions/default/servers/metrics/item.go @@ -5,6 +5,8 @@ package metrics import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/metrics/metricutils" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" + "github.com/iwind/TeaGo/maps" ) type ItemAction struct { @@ -24,5 +26,20 @@ func (this *ItemAction) RunGet(params struct { return } + // 使用此指标的集群 + clustersResp, err := this.RPC().NodeClusterMetricItemRPC().FindAllNodeClustersWithMetricItemId(this.AdminContext(), &pb.FindAllNodeClustersWithMetricItemIdRequest{MetricItemId: params.ItemId}) + if err != nil { + this.ErrorPage(err) + return + } + var clusterMaps = []maps.Map{} + for _, cluster := range clustersResp.NodeClusters { + clusterMaps = append(clusterMaps, maps.Map{ + "id": cluster.Id, + "name": cluster.Name, + }) + } + this.Data["clusters"] = clusterMaps + this.Show() } diff --git a/web/views/@default/servers/metrics/item.html b/web/views/@default/servers/metrics/item.html index 0fe2ddcc..5385f133 100644 --- a/web/views/@default/servers/metrics/item.html +++ b/web/views/@default/servers/metrics/item.html @@ -37,4 +37,13 @@ 非公用 + + + +

绑定此指标的集群

+

暂时还没有集群使用此策略。

+ + + +
{{cluster.name}}
\ No newline at end of file