mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
BootData: Fix nav tree sort regression (#27533)
#26395 introduced a regression regarding sort order of nav tree items set in Grafana boot data and used for rendering the sidemenu. This fixes so that sort happens after RunIndexDataHooks is called in case the hook make changes to the nav tree.
This commit is contained in:
parent
61463aa123
commit
1983de962c
@ -327,10 +327,6 @@ func (hs *HTTPServer) getNavTree(c *models.ReqContext, hasEditPerm bool) ([]*dto
|
||||
Children: []*dtos.NavLink{},
|
||||
})
|
||||
|
||||
sort.SliceStable(navTree, func(i, j int) bool {
|
||||
return navTree[i].SortWeight < navTree[j].SortWeight
|
||||
})
|
||||
|
||||
return navTree, nil
|
||||
}
|
||||
|
||||
@ -434,6 +430,10 @@ func (hs *HTTPServer) setIndexViewData(c *models.ReqContext) (*dtos.IndexViewDat
|
||||
|
||||
hs.HooksService.RunIndexDataHooks(&data, c)
|
||||
|
||||
sort.SliceStable(data.NavTree, func(i, j int) bool {
|
||||
return data.NavTree[i].SortWeight < data.NavTree[j].SortWeight
|
||||
})
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user