mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-01 01:10:25 +08:00
指标中列出使用当前指标的集群
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -37,4 +37,13 @@
|
||||
<span class="disabled" v-else>非公用</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- 使用此指标的集群 -->
|
||||
<h4>绑定此指标的集群</h4>
|
||||
<p class="comment" v-if="clusters.length == 0">暂时还没有集群使用此策略。</p>
|
||||
<table class="ui table selectable" v-if="clusters.length > 0">
|
||||
<tr v-for="cluster in clusters">
|
||||
<td>{{cluster.name}}<link-icon :href="'/clusters/cluster?clusterId=' + cluster.id"></link-icon></td>
|
||||
</tr>
|
||||
</table>
|
||||
Reference in New Issue
Block a user