Dashboards: Filter out expressions when going to Explore (#64654)

* Filter out expressions when going from dashboard to explore

* Move expression UID constant to types
This commit is contained in:
Kristina
2023-03-13 07:53:19 -05:00
committed by GitHub
parent caf98101e7
commit c363a81806
11 changed files with 28 additions and 24 deletions
+6 -1
View File
@@ -30,6 +30,7 @@ import { RefreshPicker } from '@grafana/ui';
import store from 'app/core/store';
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
import { PanelModel } from 'app/features/dashboard/state';
import { ExpressionDatasourceUID } from 'app/features/expressions/types';
import { ExploreId, QueryOptions, QueryTransaction } from 'app/types/explore';
import { config } from '../config';
@@ -67,8 +68,12 @@ export async function getExploreUrl(args: GetExploreUrlArguments): Promise<strin
/** In Explore, we don't have legend formatter and we don't want to keep
* legend formatting as we can't change it
*
* We also don't have expressions, so filter those out
*/
let exploreTargets: DataQuery[] = panel.targets.map((t) => omit(t, 'legendFormat'));
let exploreTargets: DataQuery[] = panel.targets
.map((t) => omit(t, 'legendFormat'))
.filter((t) => t.datasource?.uid !== ExpressionDatasourceUID);
let url: string | undefined;
// if the mixed datasource is not enabled for explore, choose only one datasource
if (