调整目录结构

This commit is contained in:
GoEdgeLab
2020-11-27 15:18:32 +08:00
parent afdb970484
commit b1f4761fbc
42 changed files with 56 additions and 199 deletions

View File

@@ -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)).

View File

@@ -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
}

View File

@@ -17,6 +17,7 @@ func (this *Helper) BeforeAction(action *actions.ActionObject) {
return
}
action.Data["teaMenu"] = "servers"
action.Data["mainTab"] = "component"
action.Data["secondMenuItem"] = "group"
}

View File

@@ -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)).

View File

@@ -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()

View File

@@ -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()

View File

@@ -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)).

View File

@@ -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)).

View File

@@ -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

View File

@@ -109,7 +109,9 @@ func (this *UserMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam
action.Data["teaUserAvatar"] = ""
action.Data["teaMenu"] = ""
if !action.Data.Has("teaMenu") {
action.Data["teaMenu"] = ""
}
action.Data["teaModules"] = this.modules()
action.Data["teaSubMenus"] = []map[string]interface{}{}
action.Data["teaTabbar"] = []map[string]interface{}{}
@@ -151,7 +153,22 @@ func (this *UserMustAuth) modules() []maps.Map {
{
"name": "通用设置",
"url": "/servers/components",
"code": "components",
"code": "global",
},
{
"name": "服务分组",
"url": "/servers/components/groups",
"code": "group",
},
{
"name": "缓存策略",
"url": "/servers/components/cache",
"code": "cache",
},
{
"name": "WAF策略",
"url": "/servers/components/waf",
"code": "waf",
},
{
"name": "证书管理",

View File

@@ -23,7 +23,6 @@ import (
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/groups"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/ip-library"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/log"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/waf"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server"
@@ -74,6 +73,7 @@ import (
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/backup"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/database"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/ip-library"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/login"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/profile"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/security"

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "policy_menu"}
<h3>选择集群</h3>
@@ -30,5 +28,4 @@
</tr>
</table>
<submit-btn v-if="!isRequesting">提交</submit-btn>
</form>
</div>
</form>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
<second-menu>
<menu-item href="/servers/components/cache" code="index">列表</menu-item>
<span class="item">|</span>
@@ -35,5 +33,4 @@
</tr>
</table>
<div class="page" v-html="page"></div>
</div>
<div class="page" v-html="page"></div>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "policy_menu"}
<table class="ui table definition selectable">
@@ -66,5 +64,4 @@
</td>
</tr>
</tbody>
</table>
</div>
</table>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "policy_menu"}
<h3>选择集群</h3>
@@ -34,5 +32,4 @@
</tr>
</table>
<submit-btn v-if="!isRequesting">提交</submit-btn>
</form>
</div>
</form>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "policy_menu"}
<h3>选择集群</h3>
@@ -36,5 +34,4 @@
</tr>
</table>
<submit-btn v-if="!isRequesting">提交</submit-btn>
</form>
</div>
</form>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "policy_menu"}
<h3>选择集群</h3>
@@ -30,5 +28,4 @@
</tr>
</table>
<submit-btn v-if="!isRequesting">提交</submit-btn>
</form>
</div>
</form>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "policy_menu"}
<h3>选择集群</h3>
@@ -69,5 +67,4 @@
</tr>
</table>
<submit-btn v-if="!isRequestingRead">提交</submit-btn>
</form>
</div>
</form>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "policy_menu"}
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
@@ -75,5 +73,4 @@
</tbody>
</table>
<submit-btn></submit-btn>
</form>
</div>
</form>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
<first-menu>
<menu-item href="/servers/components/groups" active="true">列表</menu-item>
<span class="item">|</span>
@@ -36,5 +34,4 @@
</table>
</div>
<p v-if="groups.length > 0" class="comment">可以拖动左侧的<i class="icon bars"></i>排序。</p>
</div>
<p v-if="groups.length > 0" class="comment">可以拖动左侧的<i class="icon bars"></i>排序。</p>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="globalConfigJSON" :value="JSON.stringify(globalConfig)"/>
<h4 style="margin-top:0.5em">域名相关配置</h4>
@@ -53,5 +51,3 @@
</table>
<submit-btn>保存</submit-btn>
</form>
</div>

View File

@@ -1,8 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "waf_menu"}
<p class="ui message">此功能暂未开放,敬请期待。</p>
</div>
<p class="ui message">此功能暂未开放,敬请期待。</p>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "waf_menu"}
<h3>分组<a href="" @click.prevent="updateGroup(group.id)">[修改]</a></h3>
@@ -65,5 +63,4 @@
</tbody>
</table>
<p class="comment" v-if="group.sets != null && group.sets.length > 1">所有规则匹配顺序为从上到下,可以拖动左侧的<i class="icon bars"></i>排序。</p>
</div>
<p class="comment" v-if="group.sets != null && group.sets.length > 1">所有规则匹配顺序为从上到下,可以拖动左侧的<i class="icon bars"></i>排序。</p>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "waf_menu"}
<second-menu style="margin-top:-1em">
@@ -43,5 +41,4 @@
</tbody>
</table>
<p class="comment" v-if="groups.length > 0">所有规则匹配顺序为从上到下,可以拖动左侧的<i class="icon bars"></i>排序。</p>
</div>
<p class="comment" v-if="groups.length > 0">所有规则匹配顺序为从上到下,可以拖动左侧的<i class="icon bars"></i>排序。</p>

View File

@@ -1,8 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "waf_menu"}
<p class="ui message">此功能暂未开放,敬请期待。</p>
</div>
<p class="ui message">此功能暂未开放,敬请期待。</p>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
<second-menu>
<menu-item href="/servers/components/waf" code="index">列表</menu-item>
<span class="item">|</span>
@@ -34,5 +32,4 @@
</tr>
</table>
<div class="page" v-html="page"></div>
</div>
<div class="page" v-html="page"></div>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "../waf_menu"}
{$template "menu"}
@@ -49,5 +47,4 @@
</tr>
</table>
<submit-btn></submit-btn>
</form>
</div>
</form>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "../waf_menu"}
{$template "menu"}
@@ -33,5 +31,4 @@
</tr>
</table>
<div class="page" v-html="page"></div>
</div>
<div class="page" v-html="page"></div>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "../waf_menu"}
{$template "menu"}
@@ -35,5 +33,4 @@
</tr>
</table>
<submit-btn></submit-btn>
</form>
</div>
</form>

View File

@@ -9,9 +9,7 @@
<link rel="stylesheet" href="/js/pikaday.triangle.css"/>
{$end}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "waf_menu"}
<form method="get" class="ui form small" :action="path" autocomplete="off">
@@ -51,5 +49,4 @@
<span class="disabled">&nbsp; | &nbsp;</span>
<a :href="path + '?requestId=' + nextRequestId + '&day=' + day + '&firewallPolicyId=' + firewallPolicyId + '&groupId=' + groupId" v-if="hasMore">下一页</a>
<span v-else class="disabled">下一页</span>
</div>
</div>
</div>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "waf_menu"}
<table class="ui table definition selectable">
@@ -54,5 +52,4 @@
<tr v-for="server in servers">
<td>{{server.name}}<link-icon :href="'/servers/server?serverId=' + server.id"></link-icon></td>
</tr>
</table>
</div>
</table>

View File

@@ -1,8 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "waf_menu"}
<p class="ui message">此功能暂未开放,敬请期待。</p>
</div>
<p class="ui message">此功能暂未开放,敬请期待。</p>

View File

@@ -1,7 +1,5 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "waf_menu"}
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
@@ -52,5 +50,4 @@
</tbody>
</table>
<submit-btn></submit-btn>
</form>
</div>
</form>

View File

@@ -1,9 +1,7 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
<first-menu>
<menu-item v-for="type in types" :href="'/servers/components/ip-library?type=' + type.code" :active="type.code == selectedType">{{type.name}}</menu-item>
<menu-item v-for="type in types" :href="'/settings/ip-library?type=' + type.code" :active="type.code == selectedType">{{type.name}}</menu-item>
<span class="item">|</span>
<a href="" class="item" @click.prevent="upload()">[上传]</a>
</first-menu>
@@ -31,9 +29,8 @@
</td>
<td>{{library.createdTime}}</td>
<td>
<a :href="'/servers/components/ip-library/download?libraryId=' + library.id" target="_blank">下载</a> &nbsp; <a href="" @click.prevent="deleteLibrary(library.id)">删除</a>
<a :href="'/settings/ip-library/download?libraryId=' + library.id" target="_blank">下载</a> &nbsp; <a href="" @click.prevent="deleteLibrary(library.id)">删除</a>
</td>
</tr>
</table>
</div>
</div>
</div>

View File

@@ -1,6 +1,6 @@
Tea.context(function () {
this.upload = function () {
teaweb.popup("/servers/components/ip-library/uploadPopup", {
teaweb.popup("/settings/ip-library/uploadPopup", {
callback: function () {
teaweb.success("上传成功", function () {
teaweb.reload()