mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-27 21:06:35 +08:00
优化代码
This commit is contained in:
@@ -139,8 +139,8 @@ func (this *IndexAction) RunGet(params struct {
|
||||
"memUsageText": fmt.Sprintf("%.2f%%", status.MemoryUsage*100),
|
||||
},
|
||||
"cluster": maps.Map{
|
||||
"id": node.Cluster.Id,
|
||||
"name": node.Cluster.Name,
|
||||
"id": node.NodeCluster.Id,
|
||||
"name": node.NodeCluster.Name,
|
||||
},
|
||||
"isSynced": isSynced,
|
||||
"ipAddresses": ipAddresses,
|
||||
|
||||
@@ -26,12 +26,12 @@ func (this *InstallNodesAction) RunGet(params struct {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if clusterResp.Cluster == nil {
|
||||
if clusterResp.NodeCluster == nil {
|
||||
this.NotFound("nodeCluster", params.ClusterId)
|
||||
return
|
||||
}
|
||||
|
||||
cluster := clusterResp.Cluster
|
||||
cluster := clusterResp.NodeCluster
|
||||
|
||||
clusterAPINodesResp, err := this.RPC().NodeClusterRPC().FindAPINodesWithNodeCluster(this.AdminContext(), &pb.FindAPINodesWithNodeClusterRequest{NodeClusterId: params.ClusterId})
|
||||
if err != nil {
|
||||
|
||||
@@ -51,14 +51,14 @@ func (this *InstallAction) RunGet(params struct {
|
||||
|
||||
// 集群
|
||||
var clusterMap maps.Map = nil
|
||||
if node.Cluster != nil {
|
||||
clusterId := node.Cluster.Id
|
||||
if node.NodeCluster != nil {
|
||||
clusterId := node.NodeCluster.Id
|
||||
clusterResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeCluster(this.AdminContext(), &pb.FindEnabledNodeClusterRequest{NodeClusterId: clusterId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
cluster := clusterResp.Cluster
|
||||
cluster := clusterResp.NodeCluster
|
||||
if cluster != nil {
|
||||
clusterMap = maps.Map{
|
||||
"id": cluster.Id,
|
||||
|
||||
@@ -37,14 +37,14 @@ func (this *NodeAction) RunGet(params struct {
|
||||
}
|
||||
|
||||
var clusterMap maps.Map = nil
|
||||
if node.Cluster != nil {
|
||||
clusterId := node.Cluster.Id
|
||||
if node.NodeCluster != nil {
|
||||
clusterId := node.NodeCluster.Id
|
||||
clusterResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeCluster(this.AdminContext(), &pb.FindEnabledNodeClusterRequest{NodeClusterId: clusterId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
cluster := clusterResp.Cluster
|
||||
cluster := clusterResp.NodeCluster
|
||||
if cluster != nil {
|
||||
clusterMap = maps.Map{
|
||||
"id": cluster.Id,
|
||||
|
||||
@@ -37,10 +37,10 @@ func (this *UpdateAction) RunGet(params struct {
|
||||
}
|
||||
|
||||
var clusterMap maps.Map = nil
|
||||
if node.Cluster != nil {
|
||||
if node.NodeCluster != nil {
|
||||
clusterMap = maps.Map{
|
||||
"id": node.Cluster.Id,
|
||||
"name": node.Cluster.Name,
|
||||
"id": node.NodeCluster.Id,
|
||||
"name": node.NodeCluster.Name,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ func (this *UpdateAction) RunGet(params struct {
|
||||
return
|
||||
}
|
||||
clusterMaps := []maps.Map{}
|
||||
for _, cluster := range resp.Clusters {
|
||||
for _, cluster := range resp.NodeClusters {
|
||||
clusterMaps = append(clusterMaps, maps.Map{
|
||||
"id": cluster.Id,
|
||||
"name": cluster.Name,
|
||||
|
||||
@@ -26,7 +26,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
cluster := clusterResp.Cluster
|
||||
cluster := clusterResp.NodeCluster
|
||||
if cluster == nil {
|
||||
this.WriteString("not found cluster")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user