mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
QueryEditor: Set data source type in mixed query data source ref (#48734)
This commit is contained in:
parent
a98fae32fc
commit
b04fb8522d
@ -5,6 +5,7 @@ import {
|
||||
CoreApp,
|
||||
DataQuery,
|
||||
DataSourceInstanceSettings,
|
||||
DataSourceRef,
|
||||
EventBusExtended,
|
||||
HistoryItem,
|
||||
PanelData,
|
||||
@ -60,13 +61,18 @@ export class QueryEditorRows extends PureComponent<Props> {
|
||||
return item;
|
||||
}
|
||||
|
||||
const dataSourceRef: DataSourceRef = {
|
||||
type: dataSource.type,
|
||||
uid: dataSource.uid,
|
||||
};
|
||||
|
||||
if (item.datasource) {
|
||||
const previous = getDataSourceSrv().getInstanceSettings(item.datasource);
|
||||
|
||||
if (previous?.type === dataSource.type) {
|
||||
return {
|
||||
...item,
|
||||
datasource: { uid: dataSource.uid },
|
||||
datasource: dataSourceRef,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -74,7 +80,7 @@ export class QueryEditorRows extends PureComponent<Props> {
|
||||
return {
|
||||
refId: item.refId,
|
||||
hide: item.hide,
|
||||
datasource: { uid: dataSource.uid },
|
||||
datasource: dataSourceRef,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user