阶段性提交

This commit is contained in:
刘祥超
2020-07-22 22:19:39 +08:00
parent 795c30b95e
commit e111522366
143 changed files with 22667 additions and 37 deletions

View File

@@ -0,0 +1,51 @@
package nodes
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/actions"
)
type CreateAction struct {
actionutils.ParentAction
}
func (this *CreateAction) Init() {
this.Nav("", "", "create")
}
func (this *CreateAction) RunGet(params struct{}) {
// 所有集群
/**clusters, err := models.SharedNodeClusterDAO.FindAllEnableClusters()
if err != nil {
this.ErrorPage(err)
return
}
clusterMaps := []maps.Map{}
for _, cluster := range clusters {
clusterMaps = append(clusterMaps, maps.Map{
"id": cluster.Id,
"name": cluster.Name,
})
}
this.Data["clusters"] = clusterMaps**/
this.Show()
}
func (this *CreateAction) RunPost(params struct {
Name string
ClusterId int
Must *actions.Must
}) {
params.Must.
Field("name", params.Name).
Require("请输入节点名称")
// TODO 检查cluster
if params.ClusterId <= 0 {
this.Fail("请选择所在集群")
}
// TODO 检查SSH授权
}

View File

@@ -0,0 +1,10 @@
package nodes
import "github.com/iwind/TeaGo/actions"
type Helper struct {
}
func (this *Helper) BeforeAction(action *actions.ActionObject) {
action.Data["teaMenu"] = "nodes"
}

View File

@@ -0,0 +1,15 @@
package nodes
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "", "index")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package nodes
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(new(helpers.UserMustAuth)).
Helper(new(Helper)).
Prefix("/nodes").
Get("", new(IndexAction)).
GetPost("/create", new(CreateAction)).
EndAll()
})
}