PanelEdit: making sure the correct datasource query editor is being rendered. (#29500)

* making sure we try to use the selected db in the query row.

* fixing so we use || instead of ??.
This commit is contained in:
Marcus Andersson 2020-12-02 11:04:42 +01:00 committed by GitHub
parent 63c8945db5
commit 863dbc7ba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,12 +88,13 @@ export class QueryEditorRow extends PureComponent<Props, State> {
}
async loadDatasource() {
const { query, panel } = this.props;
const { query, panel, dataSourceValue } = this.props;
const dataSourceSrv = getDatasourceSrv();
let datasource;
try {
datasource = await dataSourceSrv.get(query.datasource || panel.datasource);
const datasourceName = dataSourceValue || query.datasource || panel.datasource;
datasource = await dataSourceSrv.get(datasourceName);
} catch (error) {
datasource = await dataSourceSrv.get();
}