From b6de656cf1d783b1a3de83b3da70247d0e898020 Mon Sep 17 00:00:00 2001 From: Nathan LaFreniere Date: Thu, 14 Apr 2016 17:08:54 -0700 Subject: [PATCH] dont quote numbers for influxdb, closes #4163 --- public/app/plugins/datasource/influxdb/influx_query.ts | 4 +++- public/app/plugins/datasource/influxdb/query_builder.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/influx_query.ts b/public/app/plugins/datasource/influxdb/influx_query.ts index 85457c7a8b3..8143e187b76 100644 --- a/public/app/plugins/datasource/influxdb/influx_query.ts +++ b/public/app/plugins/datasource/influxdb/influx_query.ts @@ -152,7 +152,9 @@ export default class InfluxQuery { if (interpolate) { value = this.templateSrv.replace(value, this.scopedVars); } - value = "'" + value.replace('\\', '\\\\') + "'"; + if (isNaN(+value)) { + value = "'" + value.replace('\\', '\\\\') + "'"; + } } else if (interpolate){ value = this.templateSrv.replace(value, this.scopedVars, 'regex'); } diff --git a/public/app/plugins/datasource/influxdb/query_builder.js b/public/app/plugins/datasource/influxdb/query_builder.js index 1921c672ba6..07d920350d7 100644 --- a/public/app/plugins/datasource/influxdb/query_builder.js +++ b/public/app/plugins/datasource/influxdb/query_builder.js @@ -25,8 +25,8 @@ function (_) { } } - // quote value unless regex - if (operator !== '=~' && operator !== '!~') { + // quote value unless regex or number + if (operator !== '=~' && operator !== '!~' && isNaN(+value)) { value = "'" + value + "'"; }