index.go
12.7 KB
-
NavLinks: Make ordering in navigation configurable (#20382) · d4e013fd
The ordering of links in the navigation bar is currently based the order of the slice containing the navigation tree. Since Grafana supports adding more links to the navigation bar with `RunIndexDataHooks` which runs at the very end of the function this means that any link registered through a hook will be placed last in the slice and be displayed last in the menu. With this PR the ordering can be specified with a weight which allows for placing links created by extensions in a more intuitive place where applicable. Stable sorting is used to ensure that the current FIFO ordering is preserved when either no weight is set or two items shares the same weight.
Emil Tullstedt committed