调整界面

This commit is contained in:
GoEdgeLab
2020-10-10 20:28:36 +08:00
parent 8d24063e80
commit 444ca7535e
35 changed files with 276 additions and 49 deletions

View File

@@ -9,19 +9,19 @@ import (
"github.com/iwind/TeaGo/actions"
)
type CreateAction struct {
type CreatePopupAction struct {
actionutils.ParentAction
}
func (this *CreateAction) Init() {
func (this *CreatePopupAction) Init() {
this.Nav("", "node", "create")
}
func (this *CreateAction) RunGet(params struct{}) {
func (this *CreatePopupAction) RunGet(params struct{}) {
this.Show()
}
func (this *CreateAction) RunPost(params struct {
func (this *CreatePopupAction) RunPost(params struct {
Name string
Description string
ListensJSON []byte

View File

@@ -2,7 +2,6 @@ package node
import (
"github.com/TeaOSLab/EdgeAdmin/internal/rpc"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/logs"
@@ -43,22 +42,10 @@ func (this *Helper) BeforeAction(action *actions.ActionObject) (goNext bool) {
action.WriteString("node not found")
return
}
node := nodeResp.Node
// 顶部Tab栏
selectedTabbar, _ := action.Data["mainTab"]
tabbar := actionutils.NewTabbar()
tabbar.Add("节点列表", "", "/api", "", false)
tabbar.Add("设置", "", "/api/node/settings?nodeId="+nodeIdString, "setting", selectedTabbar == "setting")
{
m := tabbar.Add("当前节点:"+node.Name, "", "", "", false)
m["right"] = true
}
actionutils.SetTabbar(action, tabbar)
// 左侧菜单栏
secondMenuItem := action.Data.GetString("secondMenuItem")
switch selectedTabbar {
switch action.Data.GetString("firstMenuItem") {
case "setting":
action.Data["leftMenuItems"] = this.createSettingMenu(nodeIdString, secondMenuItem)
}

View File

@@ -1,6 +1,7 @@
package node
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
@@ -9,6 +10,7 @@ func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(settingutils.NewHelper("api")).
Prefix("/api/node").
// 这里不受Helper的约束

View File

@@ -15,7 +15,7 @@ type SettingsAction struct {
}
func (this *SettingsAction) Init() {
this.Nav("", "setting", "")
this.Nav("", "setting", "setting")
this.SecondMenu("basic")
}