Command Palette: Links opened in a new tab now route correctly when Grafana is served under a subpath (#69845)

don't strip base from url since we're not using locationSrv.push anymore
This commit is contained in:
Ashley Harrison 2023-06-12 15:58:38 +01:00 committed by GitHub
parent 5a831d877a
commit 9eb8ec9fa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -1,7 +1,6 @@
import debounce from 'debounce-promise';
import { useEffect, useRef, useState } from 'react';
import { locationUtil } from '@grafana/data';
import { config } from '@grafana/runtime';
import { t } from 'app/core/internationalization';
import { contextSrv } from 'app/core/services/context_srv';
@ -43,7 +42,7 @@ export async function getRecentDashboardActions(): Promise<CommandPaletteAction[
name: `${name}`,
section: t('command-palette.section.recent-dashboards', 'Recent dashboards'),
priority: RECENT_DASHBOARDS_PRORITY,
url: locationUtil.stripBaseFromUrl(url),
url,
};
});
@ -72,7 +71,7 @@ export async function getSearchResultActions(searchQuery: string): Promise<Comma
? t('command-palette.section.dashboard-search-results', 'Dashboards')
: t('command-palette.section.folder-search-results', 'Folders'),
priority: SEARCH_RESULTS_PRORITY,
url: locationUtil.stripBaseFromUrl(url),
url,
subtitle: data.view.dataFrame.meta?.custom?.locationInfo[location]?.name,
};
});

View File

@ -1,4 +1,4 @@
import { locationUtil, NavModelItem } from '@grafana/data';
import { NavModelItem } from '@grafana/data';
import { t } from 'app/core/internationalization';
import { changeTheme } from 'app/core/services/theme';
@ -32,7 +32,7 @@ function navTreeToActions(navTree: NavModelItem[], parents: NavModelItem[] = [])
id: idForNavItem(navItem),
name: text,
section: section,
url: url && locationUtil.stripBaseFromUrl(url),
url,
target,
parent: parents.length > 0 && !isCreateAction ? idForNavItem(parents[parents.length - 1]) : undefined,
priority: priority,