mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-12 03:10:26 +08:00
32 lines
743 B
Go
32 lines
743 B
Go
|
|
package groups
|
||
|
|
|
||
|
|
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 {
|
||
|
|
ClusterId int64
|
||
|
|
}) {
|
||
|
|
groupsResp, err := this.RPC().NodeGroupRPC().FindAllEnabledNodeGroupsWithClusterId(this.AdminContext(), &pb.FindAllEnabledNodeGroupsWithClusterIdRequest{ClusterId: params.ClusterId})
|
||
|
|
if err != nil {
|
||
|
|
this.ErrorPage(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
groupMaps := []maps.Map{}
|
||
|
|
for _, group := range groupsResp.Groups {
|
||
|
|
groupMaps = append(groupMaps, maps.Map{
|
||
|
|
"id": group.Id,
|
||
|
|
"name": group.Name,
|
||
|
|
})
|
||
|
|
}
|
||
|
|
this.Data["groups"] = groupMaps
|
||
|
|
|
||
|
|
this.Success()
|
||
|
|
}
|