mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-14 12:20:27 +08:00
增加用户系统界面管理、用户可以设置关联集群
This commit is contained in:
30
internal/web/actions/default/clusters/options.go
Normal file
30
internal/web/actions/default/clusters/options.go
Normal file
@@ -0,0 +1,30 @@
|
||||
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.Clusters {
|
||||
clusterMaps = append(clusterMaps, maps.Map{
|
||||
"id": cluster.Id,
|
||||
"name": cluster.Name,
|
||||
})
|
||||
}
|
||||
this.Data["clusters"] = clusterMaps
|
||||
|
||||
this.Success()
|
||||
}
|
||||
Reference in New Issue
Block a user