mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	可以在集群中查看待安装节点、并直接安装节点
This commit is contained in:
		@@ -36,47 +36,37 @@ func (this *ClusterHelper) BeforeAction(action *actions.ActionObject) {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	clusterResp, err := rpcClient.NodeClusterRPC().FindEnabledNodeCluster(rpcClient.Context(action.Context.GetInt64("adminId")), &pb.FindEnabledNodeClusterRequest{ClusterId: clusterId})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		logs.Error(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	cluster := clusterResp.Cluster
 | 
			
		||||
	if cluster == nil {
 | 
			
		||||
		action.WriteString("can not find cluster")
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if clusterId > 0 {
 | 
			
		||||
		clusterResp, err := rpcClient.NodeClusterRPC().FindEnabledNodeCluster(rpcClient.Context(action.Context.GetInt64("adminId")), &pb.FindEnabledNodeClusterRequest{ClusterId: clusterId})
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			logs.Error(err)
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		cluster := clusterResp.Cluster
 | 
			
		||||
		if cluster == nil {
 | 
			
		||||
			action.WriteString("can not find cluster")
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	tabbar := actionutils.NewTabbar()
 | 
			
		||||
	tabbar.Add("集群列表", "", "/clusters", "", false)
 | 
			
		||||
	tabbar.Add("节点", "", "/clusters/cluster?clusterId="+clusterIdString, "server", selectedTabbar == "node")
 | 
			
		||||
	tabbar.Add("设置", "", "/clusters/cluster/settings?clusterId="+clusterIdString, "setting", selectedTabbar == "setting")
 | 
			
		||||
	tabbar.Add("删除", "", "/clusters/cluster/delete?clusterId="+clusterIdString, "trash", selectedTabbar == "delete")
 | 
			
		||||
		tabbar := actionutils.NewTabbar()
 | 
			
		||||
		tabbar.Add("集群列表", "", "/clusters", "", false)
 | 
			
		||||
		tabbar.Add("节点", "", "/clusters/cluster?clusterId="+clusterIdString, "server", selectedTabbar == "node")
 | 
			
		||||
		tabbar.Add("设置", "", "/clusters/cluster/settings?clusterId="+clusterIdString, "setting", selectedTabbar == "setting")
 | 
			
		||||
		tabbar.Add("删除", "", "/clusters/cluster/delete?clusterId="+clusterIdString, "trash", selectedTabbar == "delete")
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
		m := tabbar.Add("当前集群:"+cluster.Name, "", "/clusters/cluster?clusterId="+clusterIdString, "", false)
 | 
			
		||||
		m["right"] = true
 | 
			
		||||
		{
 | 
			
		||||
			m := tabbar.Add("当前集群:"+cluster.Name, "", "/clusters/cluster?clusterId="+clusterIdString, "", false)
 | 
			
		||||
			m["right"] = true
 | 
			
		||||
		}
 | 
			
		||||
		actionutils.SetTabbar(action, tabbar)
 | 
			
		||||
 | 
			
		||||
		// 左侧菜单
 | 
			
		||||
		secondMenuItem := action.Data.GetString("secondMenuItem")
 | 
			
		||||
		switch selectedTabbar {
 | 
			
		||||
		case "setting":
 | 
			
		||||
			action.Data["leftMenuItems"] = this.createSettingMenu(clusterIdString, secondMenuItem)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	actionutils.SetTabbar(action, tabbar)
 | 
			
		||||
 | 
			
		||||
	// 左侧菜单
 | 
			
		||||
	secondMenuItem := action.Data.GetString("secondMenuItem")
 | 
			
		||||
	switch selectedTabbar {
 | 
			
		||||
	case "setting":
 | 
			
		||||
		action.Data["leftMenuItems"] = this.createSettingMenu(clusterIdString, secondMenuItem)
 | 
			
		||||
	case "node":
 | 
			
		||||
		action.Data["leftMenuItems"] = this.createNodeMenu(clusterIdString, secondMenuItem)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 节点菜单
 | 
			
		||||
func (this *ClusterHelper) createNodeMenu(clusterId string, selectedItem string) (items []maps.Map) {
 | 
			
		||||
	items = append(items, maps.Map{
 | 
			
		||||
		"name":     "节点列表",
 | 
			
		||||
		"url":      "/clusters/cluster?clusterId=" + clusterId,
 | 
			
		||||
		"isActive": selectedItem == "nodes",
 | 
			
		||||
	})
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 设置菜单
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user