|
|
@ -7,15 +7,15 @@ import { |
|
|
|
ScopedVars, |
|
|
|
ScopedVars, |
|
|
|
} from '@grafana/data'; |
|
|
|
} from '@grafana/data'; |
|
|
|
import { |
|
|
|
import { |
|
|
|
GetDataSourceListFilters, |
|
|
|
|
|
|
|
DataSourceSrv as DataSourceService, |
|
|
|
DataSourceSrv as DataSourceService, |
|
|
|
|
|
|
|
getBackendSrv, |
|
|
|
|
|
|
|
GetDataSourceListFilters, |
|
|
|
getDataSourceSrv as getDataSourceService, |
|
|
|
getDataSourceSrv as getDataSourceService, |
|
|
|
TemplateSrv, |
|
|
|
|
|
|
|
getTemplateSrv, |
|
|
|
|
|
|
|
getLegacyAngularInjector, |
|
|
|
getLegacyAngularInjector, |
|
|
|
getBackendSrv, |
|
|
|
getTemplateSrv, |
|
|
|
|
|
|
|
TemplateSrv, |
|
|
|
} from '@grafana/runtime'; |
|
|
|
} from '@grafana/runtime'; |
|
|
|
import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend'; |
|
|
|
import { ExpressionDatasourceRef, isExpressionReference } from '@grafana/runtime/src/utils/DataSourceWithBackend'; |
|
|
|
import appEvents from 'app/core/app_events'; |
|
|
|
import appEvents from 'app/core/app_events'; |
|
|
|
import config from 'app/core/config'; |
|
|
|
import config from 'app/core/config'; |
|
|
|
import { |
|
|
|
import { |
|
|
@ -80,6 +80,13 @@ export class DatasourceSrv implements DataSourceService { |
|
|
|
return this.settingsMapByUid[this.defaultName] ?? this.settingsMapByName[this.defaultName]; |
|
|
|
return this.settingsMapByUid[this.defaultName] ?? this.settingsMapByName[this.defaultName]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Expressions has a new UID as __expr__ See: https://github.com/grafana/grafana/pull/62510/
|
|
|
|
|
|
|
|
// But we still have dashboards/panels with old expression UID (-100)
|
|
|
|
|
|
|
|
// To support both UIDs until we migrate them all to new one, this check is necessary
|
|
|
|
|
|
|
|
if (isExpressionReference(nameOrUid)) { |
|
|
|
|
|
|
|
return expressionDatasource.instanceSettings; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Complex logic to support template variable data source names
|
|
|
|
// Complex logic to support template variable data source names
|
|
|
|
// For this we just pick the current or first data source in the variable
|
|
|
|
// For this we just pick the current or first data source in the variable
|
|
|
|
if (nameOrUid[0] === '$') { |
|
|
|
if (nameOrUid[0] === '$') { |
|
|
|