Navigation: Fix empty admin menu (#94024)

This commit is contained in:
Alexander Zobnin 2024-10-01 11:28:33 +02:00 committed by GitHub
parent 299fe3e5b1
commit 9144e3b44a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,6 +167,10 @@ func (s *ServiceImpl) GetNavTree(c *contextmodel.ReqContext, prefs *pref.Prefere
if sec := treeRoot.FindById(navtree.NavIDCfgAccess); sec != nil && len(sec.Children) == 0 { if sec := treeRoot.FindById(navtree.NavIDCfgAccess); sec != nil && len(sec.Children) == 0 {
treeRoot.RemoveSectionByID(navtree.NavIDCfgAccess) treeRoot.RemoveSectionByID(navtree.NavIDCfgAccess)
} }
// double-check and remove admin menu if empty
if sec := treeRoot.FindById(navtree.NavIDCfg); sec != nil && len(sec.Children) == 0 {
treeRoot.RemoveSectionByID(navtree.NavIDCfg)
}
if s.features.IsEnabled(c.Req.Context(), featuremgmt.FlagPinNavItems) { if s.features.IsEnabled(c.Req.Context(), featuremgmt.FlagPinNavItems) {
treeRoot.AddSection(&navtree.NavLink{ treeRoot.AddSection(&navtree.NavLink{