mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
InfluxDB: add scopedVars to tags to fix repeated panels querying all selected variables (#54934)
* add scoped vars for tags in influx to fix repeated panels * test for adding scopedVars to tags
This commit is contained in:
parent
92857ef331
commit
cd6b7ba688
@ -499,7 +499,7 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery,
|
||||
expandedQuery.tags = query.tags.map((tag) => {
|
||||
return {
|
||||
...tag,
|
||||
value: this.templateSrv.replace(tag.value, undefined, 'regex'),
|
||||
value: this.templateSrv.replace(tag.value, scopedVars, 'regex'),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -319,6 +319,19 @@ describe('InfluxDataSource', () => {
|
||||
});
|
||||
influxChecks(query);
|
||||
});
|
||||
|
||||
it('should apply all scopedVars to tags', () => {
|
||||
ds.isFlux = false;
|
||||
ds.access = 'proxy';
|
||||
config.featureToggles.influxdbBackendMigration = true;
|
||||
const query = ds.applyTemplateVariables(influxQuery, {
|
||||
interpolationVar: { text: text, value: text },
|
||||
interpolationVar2: { text: 'interpolationText2', value: 'interpolationText2' },
|
||||
});
|
||||
const value = query.tags[0].value;
|
||||
const scopedVars = 'interpolationText|interpolationText2';
|
||||
expect(value).toBe(scopedVars);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user