From 39a4ba4396f537b904c3918151d96d4602a3ab13 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Mon, 12 Dec 2022 15:23:49 +0000 Subject: [PATCH] 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 --- 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 d1de2fbc52c..d44950e8c4d 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) @@ -205,6 +206,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{