mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
Variables: Fixes issue with data source variables not being correctly used in panel queries (#49323)
This commit is contained in:
parent
9b61d9eb1c
commit
8c477a288a
@ -236,9 +236,11 @@ export class PanelQueryRunner {
|
||||
try {
|
||||
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) => {
|
||||
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();
|
||||
}
|
||||
return query;
|
||||
|
Loading…
Reference in New Issue
Block a user