mirror of
https://github.com/grafana/grafana.git
synced 2026-07-30 00:08:10 -05:00
DockedMegaMenu: Show correct breadcrumbs on dashboard settings (#75808)
need this logic when using dockedMegaMenu
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { NavModelItem } from '@grafana/data';
|
||||
import { config } from '@grafana/runtime';
|
||||
|
||||
import { Breadcrumb } from './types';
|
||||
|
||||
@@ -16,6 +17,13 @@ export function buildBreadcrumbs(sectionNav: NavModelItem, pageNav?: NavModelIte
|
||||
const urlParts = node.url?.split('?') ?? ['', ''];
|
||||
let urlToMatch = urlParts[0];
|
||||
|
||||
if (config.featureToggles.dockedMegaMenu) {
|
||||
const urlSearchParams = new URLSearchParams(urlParts[1]);
|
||||
if (urlSearchParams.has('editview')) {
|
||||
urlToMatch += `?editview=${urlSearchParams.get('editview')}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we found home/root if if so return early
|
||||
if (homeNav && urlToMatch === homeNav.url) {
|
||||
crumbs.unshift({ text: homeNav.text, href: node.url ?? '' });
|
||||
|
||||
Reference in New Issue
Block a user