Dashboards: Remove Explore option from panel menu when panel's datasource uid is "-- Dashboard --" (#69017)

* Remove Explore option from panel menu when panel's datasource uid is "-- Dashboard --"

* Use the constant SHARED_DASHBOARD_QUERY
This commit is contained in:
Haris Rozajac 2023-05-26 08:01:54 -06:00 committed by GitHub
parent 521d5f86dc
commit 3fd04edd81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@ import {
} from 'app/features/dashboard/utils/panel'; } from 'app/features/dashboard/utils/panel';
import { InspectTab } from 'app/features/inspector/types'; import { InspectTab } from 'app/features/inspector/types';
import { isPanelModelLibraryPanel } from 'app/features/library-panels/guard'; import { isPanelModelLibraryPanel } from 'app/features/library-panels/guard';
import { SHARED_DASHBOARD_QUERY } from 'app/plugins/datasource/dashboard';
import { store } from 'app/store/store'; import { store } from 'app/store/store';
import { navigateToExplore } from '../../explore/state/main'; import { navigateToExplore } from '../../explore/state/main';
@ -141,7 +142,11 @@ export function getPanelMenu(
shortcut: 'p s', shortcut: 'p s',
}); });
if (contextSrv.hasAccessToExplore() && !(panel.plugin && panel.plugin.meta.skipDataQuery)) { if (
contextSrv.hasAccessToExplore() &&
!(panel.plugin && panel.plugin.meta.skipDataQuery) &&
panel.datasource?.uid !== SHARED_DASHBOARD_QUERY
) {
menu.push({ menu.push({
text: t('panel.header-menu.explore', `Explore`), text: t('panel.header-menu.explore', `Explore`),
iconClassName: 'compass', iconClassName: 'compass',