mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Variables: Fixes issue with data source variables not being correctly used in panel queries (#49323)
This commit is contained in:
@@ -236,9 +236,11 @@ export class PanelQueryRunner {
|
|||||||
try {
|
try {
|
||||||
const ds = await getDataSource(datasource, request.scopedVars);
|
const ds = await getDataSource(datasource, request.scopedVars);
|
||||||
|
|
||||||
// Attach the data source name to each query
|
// Attach the data source to each query
|
||||||
request.targets = request.targets.map((query) => {
|
request.targets = request.targets.map((query) => {
|
||||||
if (!query.datasource) {
|
// When using a data source variable, the panel might have the incorrect datasource
|
||||||
|
// stored, so when running the query make sure it is done with the correct one
|
||||||
|
if (!query.datasource || (query.datasource.uid !== ds.uid && !ds.meta.mixed)) {
|
||||||
query.datasource = ds.getRef();
|
query.datasource = ds.getRef();
|
||||||
}
|
}
|
||||||
return query;
|
return query;
|
||||||
|
|||||||
Reference in New Issue
Block a user