From 7ba0b172ce852d57271a4001397c00cbb1dc8634 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Mon, 12 Dec 2022 15:39:43 +0000 Subject: [PATCH] [v9.3.x] Navigation: Fix some missing pages in admin section (#60174) Navigation: Fix some missing pages in admin section (#60143) * add stats and licensing under admin -> general when topnav is enabled * add ldap to users and access * use ID instead of Id * add enterprise licensing node (cherry picked from commit 39a4ba4396f537b904c3918151d96d4602a3ab13) Co-authored-by: Ashley Harrison --- pkg/services/licensing/oss.go | 10 +++++++++- pkg/services/navtree/models.go | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/services/licensing/oss.go b/pkg/services/licensing/oss.go index 821d05294a6..34c7fbe15e0 100644 --- a/pkg/services/licensing/oss.go +++ b/pkg/services/licensing/oss.go @@ -59,7 +59,15 @@ func ProvideService(cfg *setting.Cfg, hooksService *hooks.HooksService) *OSSLice return } - if adminNode := indexData.NavTree.FindById(navtree.NavIDAdmin); adminNode != nil { + var adminNodeID string + + if cfg.IsFeatureToggleEnabled("topnav") { + adminNodeID = navtree.NavIDCfg + } else { + adminNodeID = navtree.NavIDAdmin + } + + if adminNode := indexData.NavTree.FindById(adminNodeID); adminNode != nil { adminNode.Children = append(adminNode.Children, &navtree.NavLink{ Text: "Stats and license", Id: "upgrading", diff --git a/pkg/services/navtree/models.go b/pkg/services/navtree/models.go index e73929d123a..cf4b3df7fe1 100644 --- a/pkg/services/navtree/models.go +++ b/pkg/services/navtree/models.go @@ -185,6 +185,7 @@ func ApplyAdminIA(root *NavTreeRoot) { accessNodeLinks := []*NavLink{} generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("upgrading")) + generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("licensing")) if orgSettings := root.FindById("org-settings"); orgSettings != nil { orgSettings.Text = "Default preferences" generalNodeLinks = append(generalNodeLinks, orgSettings) @@ -206,6 +207,7 @@ func ApplyAdminIA(root *NavTreeRoot) { accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("teams")) accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("serviceaccounts")) accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("apikeys")) + accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("ldap")) accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("standalone-plugin-page-/a/grafana-auth-app")) // Cloud Access Policies generalNode := &NavLink{