Просмотр исходного кода

dont quote numbers for influxdb, closes #4163

Nathan LaFreniere 9 лет назад
Родитель
Сommit
b6de656cf1

+ 3 - 1
public/app/plugins/datasource/influxdb/influx_query.ts

@@ -152,7 +152,9 @@ export default class InfluxQuery {
       if (interpolate) {
       if (interpolate) {
         value = this.templateSrv.replace(value, this.scopedVars);
         value = this.templateSrv.replace(value, this.scopedVars);
       }
       }
-      value = "'" + value.replace('\\', '\\\\') + "'";
+      if (isNaN(+value)) {
+        value = "'" + value.replace('\\', '\\\\') + "'";
+      }
     } else if (interpolate){
     } else if (interpolate){
       value = this.templateSrv.replace(value, this.scopedVars, 'regex');
       value = this.templateSrv.replace(value, this.scopedVars, 'regex');
     }
     }

+ 2 - 2
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 + "'";
       value = "'" + value + "'";
     }
     }