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

This commit is contained in:
Gábor Farkas 2021-08-03 14:32:48 +02:00 committed by GitHub
parent 0965132bff
commit bc0ab3cc7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)) {