mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-02 20:00:26 +08:00
35 lines
814 B
Go
35 lines
814 B
Go
// Copyright 2022 GoEdge CDN goedge.cdn@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()
|
|
}
|