mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-09 00:20:26 +08:00
集群节点列表可以使用“未分组”筛选
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
|||||||
"github.com/iwind/TeaGo/logs"
|
"github.com/iwind/TeaGo/logs"
|
||||||
"github.com/iwind/TeaGo/maps"
|
"github.com/iwind/TeaGo/maps"
|
||||||
"github.com/iwind/TeaGo/types"
|
"github.com/iwind/TeaGo/types"
|
||||||
"strconv"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -238,7 +237,10 @@ func (this *NodesAction) RunGet(params struct {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, group := range groupsResp.NodeGroups {
|
for _, group := range groupsResp.NodeGroups {
|
||||||
countNodesInGroupResp, err := this.RPC().NodeRPC().CountAllEnabledNodesWithNodeGroupId(this.AdminContext(), &pb.CountAllEnabledNodesWithNodeGroupIdRequest{NodeGroupId: group.Id})
|
countNodesInGroupResp, err := this.RPC().NodeRPC().CountAllEnabledNodesMatch(this.AdminContext(), &pb.CountAllEnabledNodesMatchRequest{
|
||||||
|
NodeClusterId: params.ClusterId,
|
||||||
|
NodeGroupId: group.Id,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
@@ -246,7 +248,7 @@ func (this *NodesAction) RunGet(params struct {
|
|||||||
countNodes := countNodesInGroupResp.Count
|
countNodes := countNodesInGroupResp.Count
|
||||||
groupName := group.Name
|
groupName := group.Name
|
||||||
if countNodes > 0 {
|
if countNodes > 0 {
|
||||||
groupName += "(" + strconv.FormatInt(countNodes, 10) + ")"
|
groupName += "(" + types.String(countNodes) + ")"
|
||||||
}
|
}
|
||||||
groupMaps = append(groupMaps, maps.Map{
|
groupMaps = append(groupMaps, maps.Map{
|
||||||
"id": group.Id,
|
"id": group.Id,
|
||||||
@@ -254,6 +256,29 @@ func (this *NodesAction) RunGet(params struct {
|
|||||||
"countNodes": countNodes,
|
"countNodes": countNodes,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 是否有未分组
|
||||||
|
if len(groupMaps) > 0 {
|
||||||
|
countNodesInGroupResp, err := this.RPC().NodeRPC().CountAllEnabledNodesMatch(this.AdminContext(), &pb.CountAllEnabledNodesMatchRequest{
|
||||||
|
NodeClusterId: params.ClusterId,
|
||||||
|
NodeGroupId: -1,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var countUngroupNodes = countNodesInGroupResp.Count
|
||||||
|
if countUngroupNodes > 0 {
|
||||||
|
groupMaps = append([]maps.Map{
|
||||||
|
{
|
||||||
|
"id": -1,
|
||||||
|
"name": "[未分组](" + types.String(countUngroupNodes) + ")",
|
||||||
|
"countNodes": countUngroupNodes,
|
||||||
|
},
|
||||||
|
}, groupMaps...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.Data["groups"] = groupMaps
|
this.Data["groups"] = groupMaps
|
||||||
|
|
||||||
// 所有区域
|
// 所有区域
|
||||||
|
|||||||
Reference in New Issue
Block a user