mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
31 lines
714 B
Go
31 lines
714 B
Go
package clusters
|
|
|
|
import (
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
|
"github.com/iwind/TeaGo/maps"
|
|
)
|
|
|
|
type OptionsAction struct {
|
|
actionutils.ParentAction
|
|
}
|
|
|
|
func (this *OptionsAction) RunPost(params struct{}) {
|
|
clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClusters(this.AdminContext(), &pb.FindAllEnabledNodeClustersRequest{})
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
|
|
clusterMaps := []maps.Map{}
|
|
for _, cluster := range clustersResp.NodeClusters {
|
|
clusterMaps = append(clusterMaps, maps.Map{
|
|
"id": cluster.Id,
|
|
"name": cluster.Name,
|
|
})
|
|
}
|
|
this.Data["clusters"] = clusterMaps
|
|
|
|
this.Success()
|
|
}
|