Commit 863dbc7b by Marcus Andersson Committed by GitHub

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 ??.
parent 63c8945d
...@@ -88,12 +88,13 @@ export class QueryEditorRow extends PureComponent<Props, State> { ...@@ -88,12 +88,13 @@ export class QueryEditorRow extends PureComponent<Props, State> {
} }
async loadDatasource() { async loadDatasource() {
const { query, panel } = this.props; const { query, panel, dataSourceValue } = this.props;
const dataSourceSrv = getDatasourceSrv(); const dataSourceSrv = getDatasourceSrv();
let datasource; let datasource;
try { try {
datasource = await dataSourceSrv.get(query.datasource || panel.datasource); const datasourceName = dataSourceValue || query.datasource || panel.datasource;
datasource = await dataSourceSrv.get(datasourceName);
} catch (error) { } catch (error) {
datasource = await dataSourceSrv.get(); datasource = await dataSourceSrv.get();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment