mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PluginPage: Fix finding root section for standalone pages (#56554)
This commit is contained in:
@@ -20,7 +20,7 @@ const getNotFoundModel = (): NavModel => {
|
||||
export const getNavModel = (navIndex: NavIndex, id: string, fallback?: NavModel, onlyChild = false): NavModel => {
|
||||
if (navIndex[id]) {
|
||||
const node = navIndex[id];
|
||||
const main = onlyChild ? node : getSectionRoot(node);
|
||||
const main = onlyChild ? node : getRootSectionForNode(node);
|
||||
const mainWithActive = enrichNodeWithActiveState(main, id);
|
||||
|
||||
return {
|
||||
@@ -36,8 +36,8 @@ export const getNavModel = (navIndex: NavIndex, id: string, fallback?: NavModel,
|
||||
return getNotFoundModel();
|
||||
};
|
||||
|
||||
function getSectionRoot(node: NavModelItem): NavModelItem {
|
||||
return node.parentItem && node.parentItem.id !== HOME_NAV_ID ? getSectionRoot(node.parentItem) : node;
|
||||
export function getRootSectionForNode(node: NavModelItem): NavModelItem {
|
||||
return node.parentItem && node.parentItem.id !== HOME_NAV_ID ? getRootSectionForNode(node.parentItem) : node;
|
||||
}
|
||||
|
||||
function enrichNodeWithActiveState(node: NavModelItem, activeId: string): NavModelItem {
|
||||
|
||||
Reference in New Issue
Block a user