Files
EdgeAdmin/internal/web/actions/default/clusters/regions/createPopup.go

42 lines
862 B
Go
Raw Normal View History

2020-12-10 15:02:55 +08:00
package regions
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 {
Name string
Must *actions.Must
CSRF *actionutils.CSRF
}) {
params.Must.
Field("name", params.Name).
Require("请输入区域名称")
createResp, err := this.RPC().NodeRegionRPC().CreateNodeRegion(this.AdminContext(), &pb.CreateNodeRegionRequest{Name: params.Name})
if err != nil {
this.ErrorPage(err)
return
}
// 日志
defer this.CreateLogInfo("创建节点区域 %d", createResp.NodeRegionId)
this.Success()
}