mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			815 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			815 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
 | 
						|
 | 
						|
package clusters
 | 
						|
 | 
						|
import (
 | 
						|
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
						|
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
						|
	"github.com/iwind/TeaGo/maps"
 | 
						|
)
 | 
						|
 | 
						|
type NodeOptionsAction struct {
 | 
						|
	actionutils.ParentAction
 | 
						|
}
 | 
						|
 | 
						|
func (this *NodeOptionsAction) RunPost(params struct {
 | 
						|
	ClusterId int64
 | 
						|
}) {
 | 
						|
	resp, err := this.RPC().NodeRPC().FindAllEnabledNodesWithNodeClusterId(this.AdminContext(), &pb.FindAllEnabledNodesWithNodeClusterIdRequest{NodeClusterId: params.ClusterId})
 | 
						|
	if err != nil {
 | 
						|
		this.ErrorPage(err)
 | 
						|
		return
 | 
						|
	}
 | 
						|
 | 
						|
	var nodeMaps = []maps.Map{}
 | 
						|
	for _, node := range resp.Nodes {
 | 
						|
		nodeMaps = append(nodeMaps, maps.Map{
 | 
						|
			"id":   node.Id,
 | 
						|
			"name": node.Name,
 | 
						|
		})
 | 
						|
	}
 | 
						|
	this.Data["nodes"] = nodeMaps
 | 
						|
 | 
						|
	this.Success()
 | 
						|
}
 |