influxdb: better query-has-variable check (#37453) (#37482)

(cherry picked from commit bc0ab3cc7a)

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2021-08-03 15:00:14 +02:00
committed by GitHub
co-authored by Gábor Farkas
parent 7442a7c66e
commit 617cf0646d
@@ -321,6 +321,19 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery,
}
targetContainsTemplate(target: any) {
if (this.isFlux) {
return this.templateSrv.variableExists(target.query);
}
// now we know it is an InfluxQL query.
// it can be either a raw-query or a not-raw-query
if (target.rawQuery) {
return this.templateSrv.variableExists(target.query);
}
// now we know it is an InfluxQL not-raw-query
for (const group of target.groupBy) {
for (const param of group.params) {
if (this.templateSrv.variableExists(param)) {