mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2026-01-07 04:25:49 +08:00
调整目录结构
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/componentutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||
"github.com/iwind/TeaGo"
|
||||
)
|
||||
@@ -11,7 +10,8 @@ func init() {
|
||||
server.
|
||||
Helper(helpers.NewUserMustAuth()).
|
||||
Helper(NewHelper()).
|
||||
Helper(componentutils.NewComponentHelper()).
|
||||
Data("teaMenu", "servers").
|
||||
Data("teaSubMenu", "cache").
|
||||
Prefix("/servers/components/cache").
|
||||
Get("", new(IndexAction)).
|
||||
GetPost("/createPopup", new(CreatePopupAction)).
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
package componentutils
|
||||
|
||||
import (
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ComponentHelper struct {
|
||||
}
|
||||
|
||||
func NewComponentHelper() *ComponentHelper {
|
||||
return &ComponentHelper{}
|
||||
}
|
||||
|
||||
func (this *ComponentHelper) BeforeAction(action *actions.ActionObject) {
|
||||
if action.Request.Method != http.MethodGet {
|
||||
return
|
||||
}
|
||||
action.Data["teaMenu"] = "servers"
|
||||
action.Data["teaSubMenu"] = "components"
|
||||
action.Data["mainTab"] = "component"
|
||||
|
||||
// 创建左侧菜单
|
||||
secondMenuItem := action.Data.GetString("secondMenuItem")
|
||||
action.Data["leftMenuItems"] = this.createLeftMenus(secondMenuItem)
|
||||
}
|
||||
|
||||
func (this *ComponentHelper) createLeftMenus(secondMenuItem string) (items []maps.Map) {
|
||||
items = append(items, maps.Map{
|
||||
"name": "通用设置",
|
||||
"url": "/servers/components",
|
||||
"isActive": secondMenuItem == "global",
|
||||
})
|
||||
items = append(items, maps.Map{
|
||||
"name": "服务分组",
|
||||
"url": "/servers/components/groups",
|
||||
"isActive": secondMenuItem == "group",
|
||||
})
|
||||
items = append(items, maps.Map{
|
||||
"name": "缓存策略",
|
||||
"url": "/servers/components/cache",
|
||||
"isActive": secondMenuItem == "cache",
|
||||
})
|
||||
items = append(items, maps.Map{
|
||||
"name": "WAF策略",
|
||||
"url": "/servers/components/waf",
|
||||
"isActive": secondMenuItem == "waf",
|
||||
})
|
||||
items = append(items, maps.Map{
|
||||
"name": "日志策略",
|
||||
"url": "/servers/components/log",
|
||||
"isActive": secondMenuItem == "log",
|
||||
})
|
||||
items = append(items, maps.Map{
|
||||
"name": "IP库",
|
||||
"url": "/servers/components/ip-library",
|
||||
"isActive": secondMenuItem == "ip-library",
|
||||
})
|
||||
/**items = append(items, maps.Map{
|
||||
"name": "Gzip规则",
|
||||
"url": "/servers/components/gzip",
|
||||
"isActive": secondMenuItem == "gzip",
|
||||
})
|
||||
items = append(items, maps.Map{
|
||||
"name": "路径规则",
|
||||
"url": "/servers/components/location",
|
||||
"isActive": secondMenuItem == "location",
|
||||
})
|
||||
items = append(items, maps.Map{
|
||||
"name": "重写规则",
|
||||
"url": "/servers/components/rewrite",
|
||||
"isActive": secondMenuItem == "write",
|
||||
})
|
||||
items = append(items, maps.Map{
|
||||
"name": "源站",
|
||||
"url": "/servers/components/origin",
|
||||
"isActive": secondMenuItem == "origin",
|
||||
})
|
||||
items = append(items, maps.Map{
|
||||
"name": "变量",
|
||||
"url": "/servers/components/variable",
|
||||
"isActive": secondMenuItem == "variable",
|
||||
})**/
|
||||
|
||||
return
|
||||
}
|
||||
@@ -17,6 +17,7 @@ func (this *Helper) BeforeAction(action *actions.ActionObject) {
|
||||
return
|
||||
}
|
||||
|
||||
action.Data["teaMenu"] = "servers"
|
||||
action.Data["mainTab"] = "component"
|
||||
action.Data["secondMenuItem"] = "group"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package groups
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/componentutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||
"github.com/iwind/TeaGo"
|
||||
)
|
||||
@@ -11,7 +10,7 @@ func init() {
|
||||
server.
|
||||
Helper(helpers.NewUserMustAuth()).
|
||||
Helper(NewHelper()).
|
||||
Helper(componentutils.NewComponentHelper()).
|
||||
Data("teaSubMenu", "group").
|
||||
Prefix("/servers/components/groups").
|
||||
Get("", new(IndexAction)).
|
||||
GetPost("/createPopup", new(CreatePopupAction)).
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package components
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/componentutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||
"github.com/iwind/TeaGo"
|
||||
)
|
||||
@@ -10,8 +9,8 @@ func init() {
|
||||
TeaGo.BeforeStart(func(server *TeaGo.Server) {
|
||||
server.
|
||||
Helper(helpers.NewUserMustAuth()).
|
||||
Data("teaSubMenu", "global").
|
||||
Helper(NewHelper()).
|
||||
Helper(componentutils.NewComponentHelper()).
|
||||
Prefix("/servers/components").
|
||||
GetPost("", new(IndexAction)).
|
||||
EndAll()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/componentutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||
"github.com/iwind/TeaGo"
|
||||
)
|
||||
@@ -11,7 +10,6 @@ func init() {
|
||||
server.
|
||||
Helper(helpers.NewUserMustAuth()).
|
||||
Helper(NewHelper()).
|
||||
Helper(componentutils.NewComponentHelper()).
|
||||
Prefix("/servers/components/log").
|
||||
Get("", new(IndexAction)).
|
||||
EndAll()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package waf
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/componentutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/waf/ipadmin"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||
"github.com/iwind/TeaGo"
|
||||
@@ -12,7 +11,8 @@ func init() {
|
||||
server.
|
||||
Helper(helpers.NewUserMustAuth()).
|
||||
Helper(NewHelper()).
|
||||
Helper(componentutils.NewComponentHelper()).
|
||||
Data("teaMenu", "servers").
|
||||
Data("teaSubMenu", "waf").
|
||||
Prefix("/servers/components/waf").
|
||||
Get("", new(IndexAction)).
|
||||
GetPost("/createPopup", new(CreatePopupAction)).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package iplibrary
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/componentutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||
"github.com/iwind/TeaGo"
|
||||
)
|
||||
@@ -11,8 +11,8 @@ func init() {
|
||||
server.
|
||||
Helper(helpers.NewUserMustAuth()).
|
||||
Helper(NewHelper()).
|
||||
Helper(componentutils.NewComponentHelper()).
|
||||
Prefix("/servers/components/ip-library").
|
||||
Helper(settingutils.NewHelper("ipLibrary")).
|
||||
Prefix("/settings/ip-library").
|
||||
Get("", new(IndexAction)).
|
||||
GetPost("/uploadPopup", new(UploadPopupAction)).
|
||||
Post("/delete", new(DeleteAction)).
|
||||
@@ -31,10 +31,10 @@ func (this *Helper) BeforeAction(actionPtr actions.ActionWrapper) (goNext bool)
|
||||
tabbar.Add("数据库", "", "/settings/database", "", this.tab == "database")
|
||||
tabbar.Add("API节点", "", "/api", "", this.tab == "apiNodes")
|
||||
tabbar.Add("日志数据库", "", "/db", "", this.tab == "dbNodes")
|
||||
tabbar.Add("IP库", "", "/settings/ip-library", "", this.tab == "ipLibrary")
|
||||
tabbar.Add("备份", "", "/settings/backup", "", this.tab == "backup")
|
||||
tabbar.Add("个人资料", "", "/settings/profile", "", this.tab == "profile")
|
||||
tabbar.Add("登录设置", "", "/settings/login", "", this.tab == "login")
|
||||
tabbar.Add("检查新版本", "", "/settings/upgrade", "", this.tab == "upgrade")
|
||||
actionutils.SetTabbar(actionPtr, tabbar)
|
||||
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user