mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-02 01:40:25 +08:00
指标中列出使用当前指标的集群
This commit is contained in:
@@ -5,6 +5,8 @@ package metrics
|
|||||||
import (
|
import (
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/metrics/metricutils"
|
"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 {
|
type ItemAction struct {
|
||||||
@@ -24,5 +26,20 @@ func (this *ItemAction) RunGet(params struct {
|
|||||||
return
|
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()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,3 +38,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</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