Explore: Change datasourceName usage to datasourceUID or datasourceRef where appropriate (#52479)

* First pass at using datasource UID when appropriate

* Fix tests

* be more lenient with lookup to accomodate different URLs

* Make test setup get mock work like real datasource get

* Fix the typing issue and remaining tests

* Fix PR feedback
This commit is contained in:
Kristina
2022-07-25 13:05:57 -05:00
committed by GitHub
parent cb35729553
commit 0e13ee345d
17 changed files with 71 additions and 58 deletions

View File

@@ -2,7 +2,7 @@ import { createAction } from '@reduxjs/toolkit';
import { AnyAction } from 'redux';
import { ExploreUrlState, serializeStateToUrlParam, SplitOpen, UrlQueryMap } from '@grafana/data';
import { DataSourceSrv, getDataSourceSrv, locationService } from '@grafana/runtime';
import { DataSourceSrv, locationService } from '@grafana/runtime';
import { GetExploreUrlArguments, stopQueryState } from 'app/core/utils/explore';
import { PanelModel } from 'app/features/dashboard/state';
import { ExploreId, ExploreItemState, ExploreState } from 'app/types/explore';
@@ -108,9 +108,8 @@ export const splitOpen: SplitOpen = (options): ThunkResult<void> => {
let rightUrlState: ExploreUrlState = leftUrlState;
if (options) {
const datasourceName = getDataSourceSrv().getInstanceSettings(options.datasourceUid)?.name || '';
rightUrlState = {
datasource: datasourceName,
datasource: options.datasourceUid,
queries: [options.query],
range: options.range || leftState.range,
panelsState: options.panelsState,