Przeglądaj źródła

small change to influxdb template to support older versions of influxdb

Torkel Ödegaard 11 lat temu
rodzic
commit
07610a5f92

+ 7 - 1
src/app/services/influxdb/influxdbDatasource.js

@@ -62,10 +62,16 @@ function (angular, _, kbn) {
           query = queryElements.join(" ");
           query = queryElements.join(" ");
         }
         }
         else {
         else {
-          var template = "select [[func]](\"[[column]]\") as \"[[column]]_[[func]]\" from [[series]] " +
+          var template = "select [[func]]([[column]]) as [[column]]_[[func]] from [[series]] " +
                          "where  [[timeFilter]] [[condition_add]] [[condition_key]] [[condition_op]] [[condition_value]] " +
                          "where  [[timeFilter]] [[condition_add]] [[condition_key]] [[condition_op]] [[condition_value]] " +
                          "group by time([[interval]]) order asc";
                          "group by time([[interval]]) order asc";
 
 
+          if (target.column.indexOf('-') !== -1 || target.column.indexOf('.') !== -1) {
+            template = "select [[func]](\"[[column]]\") as \"[[column]]_[[func]]\" from [[series]] " +
+                         "where  [[timeFilter]] [[condition_add]] [[condition_key]] [[condition_op]] [[condition_value]] " +
+                         "group by time([[interval]]) order asc";
+          }
+
           var templateData = {
           var templateData = {
             series: target.series,
             series: target.series,
             column: target.column,
             column: target.column,