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,
|
CoreApp,
|
||||||
DataQuery,
|
DataQuery,
|
||||||
DataSourceInstanceSettings,
|
DataSourceInstanceSettings,
|
||||||
|
DataSourceRef,
|
||||||
EventBusExtended,
|
EventBusExtended,
|
||||||
HistoryItem,
|
HistoryItem,
|
||||||
PanelData,
|
PanelData,
|
||||||
@ -60,13 +61,18 @@ export class QueryEditorRows extends PureComponent<Props> {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dataSourceRef: DataSourceRef = {
|
||||||
|
type: dataSource.type,
|
||||||
|
uid: dataSource.uid,
|
||||||
|
};
|
||||||
|
|
||||||
if (item.datasource) {
|
if (item.datasource) {
|
||||||
const previous = getDataSourceSrv().getInstanceSettings(item.datasource);
|
const previous = getDataSourceSrv().getInstanceSettings(item.datasource);
|
||||||
|
|
||||||
if (previous?.type === dataSource.type) {
|
if (previous?.type === dataSource.type) {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
datasource: { uid: dataSource.uid },
|
datasource: dataSourceRef,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,7 +80,7 @@ export class QueryEditorRows extends PureComponent<Props> {
|
|||||||
return {
|
return {
|
||||||
refId: item.refId,
|
refId: item.refId,
|
||||||
hide: item.hide,
|
hide: item.hide,
|
||||||
datasource: { uid: dataSource.uid },
|
datasource: dataSourceRef,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user