实现节点分组管理

This commit is contained in:
刘祥超
2020-10-28 18:21:11 +08:00
parent 94a4db2e1d
commit cd4f4c41f6
18 changed files with 354 additions and 2 deletions

View File

@@ -0,0 +1,44 @@
package groups
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
)
type CreatePopupAction struct {
actionutils.ParentAction
}
func (this *CreatePopupAction) Init() {
this.Nav("", "", "")
}
func (this *CreatePopupAction) RunGet(params struct{}) {
this.Show()
}
func (this *CreatePopupAction) RunPost(params struct {
ClusterId int64
Name string
Must *actions.Must
}) {
if params.ClusterId <= 0 {
this.Fail("请选择集群")
}
params.Must.
Field("name", params.Name).
Require("请输入分组名称")
_, err := this.RPC().NodeGroupRPC().CreateNodeGroup(this.AdminContext(), &pb.CreateNodeGroupRequest{
ClusterId: params.ClusterId,
Name: params.Name,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}