IP阈值增加节点分组和集群相关统计项目

This commit is contained in:
GoEdgeLab
2021-09-14 11:36:08 +08:00
parent b7a694e99d
commit e454bdd982
11 changed files with 70 additions and 110 deletions

View File

@@ -3,6 +3,7 @@ package node
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/maps"
@@ -25,16 +26,11 @@ func (this *InstallAction) RunGet(params struct {
this.Data["nodeId"] = params.NodeId
// 节点
nodeResp, err := this.RPC().NodeRPC().FindEnabledNode(this.AdminContext(), &pb.FindEnabledNodeRequest{NodeId: params.NodeId})
node, err := nodeutils.InitNodeInfo(this.Parent(), params.NodeId)
if err != nil {
this.ErrorPage(err)
return
}
node := nodeResp.Node
if node == nil {
this.WriteString("找不到要操作的节点")
return
}
// 安装信息
if node.InstallStatus != nil {
@@ -84,15 +80,12 @@ func (this *InstallAction) RunGet(params struct {
}
this.Data["apiEndpoints"] = "\"" + strings.Join(apiEndpoints, "\", \"") + "\""
this.Data["node"] = maps.Map{
"id": node.Id,
"name": node.Name,
"installDir": node.InstallDir,
"isInstalled": node.IsInstalled,
"uniqueId": node.UniqueId,
"secret": node.Secret,
"cluster": clusterMap,
}
var nodeMap = this.Data["node"].(maps.Map)
nodeMap["installDir"] = node.InstallDir
nodeMap["isInstalled"] = node.IsInstalled
nodeMap["uniqueId"] = node.UniqueId
nodeMap["secret"] = node.Secret
nodeMap["cluster"] = clusterMap
this.Show()
}

View File

@@ -22,11 +22,21 @@ func InitNodeInfo(parentAction *actionutils.ParentAction, nodeId int64) (*pb.Nod
return nil, errors.New("node '" + strconv.FormatInt(nodeId, 10) + "' not found")
}
var node = nodeResp.Node
var groupMap maps.Map
if node.NodeGroup != nil {
groupMap = maps.Map{
"id": node.NodeGroup.Id,
"name": node.NodeGroup.Name,
}
}
parentAction.Data["node"] = maps.Map{
"id": node.Id,
"name": node.Name,
"isOn": node.IsOn,
"isUp": node.IsUp,
"id": node.Id,
"name": node.Name,
"isOn": node.IsOn,
"isUp": node.IsUp,
"group": groupMap,
}
var clusterId int64 = 0
if node.NodeCluster != nil {

View File

@@ -45,6 +45,7 @@ func (this *ClusterHelper) BeforeAction(actionPtr actions.ActionWrapper) (goNext
action.WriteString("can not find cluster")
return
}
action.Data["currentClusterName"] = cluster.Name
clusterInfo, err := dao.SharedNodeClusterDAO.FindEnabledNodeClusterConfigInfo(ctx, clusterId)
if err != nil {