MixedDatasource: fix datasource selection after edit (#41178)

This commit is contained in:
Ryan McKinley 2021-11-02 01:48:46 -07:00 committed by GitHub
parent 85f2c48448
commit d360e48174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,6 @@ import {
DataQuery,
DataSourceApi,
DataSourceInstanceSettings,
DataSourceRef,
getDefaultTimeRange,
LoadingState,
PanelData,
@ -89,10 +88,10 @@ export class QueryGroup extends PureComponent<Props, State> {
});
try {
const ds = await this.dataSourceSrv.get(options.dataSource.name);
const dsSettings = this.dataSourceSrv.getInstanceSettings(options.dataSource.name);
const ds = await this.dataSourceSrv.get(options.dataSource);
const dsSettings = this.dataSourceSrv.getInstanceSettings(options.dataSource);
const defaultDataSource = await this.dataSourceSrv.get();
const datasource: DataSourceRef = { type: ds.type, uid: ds.uid };
const datasource = ds.getRef();
const queries = options.queries.map((q) => (q.datasource ? q : { ...q, datasource }));
this.setState({ queries, dataSource: ds, dsSettings, defaultDataSource });
} catch (error) {