From b1059b6e09e399d222424b0ddc7001d27d82def0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Tue, 10 Nov 2020 15:45:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/clusters/clusterutils/clusters_helper.go | 8 -------- internal/web/actions/default/clusters/grants/init.go | 1 + internal/web/actions/default/nodes/helper.go | 8 -------- internal/web/helpers/user_must_auth.go | 11 ++++++++++- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/internal/web/actions/default/clusters/clusterutils/clusters_helper.go b/internal/web/actions/default/clusters/clusterutils/clusters_helper.go index f1c6b0b7..ea176a06 100644 --- a/internal/web/actions/default/clusters/clusterutils/clusters_helper.go +++ b/internal/web/actions/default/clusters/clusterutils/clusters_helper.go @@ -1,7 +1,6 @@ package clusterutils import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/iwind/TeaGo/actions" "net/http" ) @@ -19,11 +18,4 @@ func (this *ClustersHelper) BeforeAction(action *actions.ActionObject) { } action.Data["teaMenu"] = "clusters" - - selectedTabbar, _ := action.Data["mainTab"] - - tabbar := actionutils.NewTabbar() - tabbar.Add("集群", "", "/clusters", "", selectedTabbar == "cluster") - tabbar.Add("SSH认证", "", "/clusters/grants", "", selectedTabbar == "grant") - actionutils.SetTabbar(action, tabbar) } diff --git a/internal/web/actions/default/clusters/grants/init.go b/internal/web/actions/default/clusters/grants/init.go index f7f38927..695edaeb 100644 --- a/internal/web/actions/default/clusters/grants/init.go +++ b/internal/web/actions/default/clusters/grants/init.go @@ -11,6 +11,7 @@ func init() { server. Helper(helpers.NewUserMustAuth()). Helper(clusterutils.NewClustersHelper()). + Data("teaSubMenu", "grant"). Prefix("/clusters/grants"). // 授权管理 diff --git a/internal/web/actions/default/nodes/helper.go b/internal/web/actions/default/nodes/helper.go index 867b4c07..0beaa9fc 100644 --- a/internal/web/actions/default/nodes/helper.go +++ b/internal/web/actions/default/nodes/helper.go @@ -1,7 +1,6 @@ package nodes import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/iwind/TeaGo/actions" ) @@ -10,11 +9,4 @@ type Helper struct { func (this *Helper) BeforeAction(action *actions.ActionObject) { action.Data["teaMenu"] = "nodes" - - selectedTabbar, _ := action.Data["mainTab"] - - tabbar := actionutils.NewTabbar() - tabbar.Add("节点", "", "/nodes", "", selectedTabbar == "node") - tabbar.Add("认证", "", "/nodes/grants", "", selectedTabbar == "grant") - actionutils.SetTabbar(action, tabbar) } diff --git a/internal/web/helpers/user_must_auth.go b/internal/web/helpers/user_must_auth.go index b24c3a7a..4a09f168 100644 --- a/internal/web/helpers/user_must_auth.go +++ b/internal/web/helpers/user_must_auth.go @@ -96,6 +96,13 @@ func (this *UserMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam "code": "clusters", "name": "节点集群", "icon": "cloud", + "subItems": []maps.Map{ + { + "name": "SSH认证", + "url": "/clusters/grants", + "code": "grant", + }, + }, }, { "code": "dns", @@ -129,7 +136,9 @@ func (this *UserMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam action.Data["teaVersion"] = teaconst.Version action.Data["teaIsSuper"] = false action.Data["teaDemoEnabled"] = teaconst.IsDemo - action.Data["teaSubMenu"] = "" + if !action.Data.Has("teaSubMenu") { + action.Data["teaSubMenu"] = "" + } // 菜单 action.Data["firstMenuItem"] = ""