阶段性提交

This commit is contained in:
GoEdgeLab
2020-07-29 19:34:54 +08:00
parent b984b68089
commit 16d2dff57a
56 changed files with 5799 additions and 959 deletions

View File

@@ -1,8 +1,10 @@
package nodes
import (
"github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/maps"
)
type CreateAction struct {
@@ -10,31 +12,34 @@ type CreateAction struct {
}
func (this *CreateAction) Init() {
this.Nav("", "", "create")
this.Nav("", "node", "create")
}
func (this *CreateAction) RunGet(params struct{}) {
// 所有集群
/**clusters, err := models.SharedNodeClusterDAO.FindAllEnableClusters()
resp, err := this.RPC().NodeClusterRPC().FindAllEnabledClusters(this.AdminContext(), &pb.FindAllEnabledNodeClustersRequest{})
if err != nil {
this.ErrorPage(err)
}
if err != nil {
this.ErrorPage(err)
return
}
clusterMaps := []maps.Map{}
for _, cluster := range clusters {
for _, cluster := range resp.Clusters {
clusterMaps = append(clusterMaps, maps.Map{
"id": cluster.Id,
"name": cluster.Name,
})
}
this.Data["clusters"] = clusterMaps**/
this.Data["clusters"] = clusterMaps
this.Show()
}
func (this *CreateAction) RunPost(params struct {
Name string
ClusterId int
ClusterId int64
Must *actions.Must
}) {
@@ -48,4 +53,16 @@ func (this *CreateAction) RunPost(params struct {
}
// TODO 检查SSH授权
// 保存
_, err := this.RPC().NodeRPC().CreateNode(this.AdminContext(), &pb.CreateNodeRequest{
Name: params.Name,
ClusterId: params.ClusterId,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}