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

small change to influxdb template to support older versions of influxdb

Torkel Ödegaard 11 лет назад
Родитель
Сommit
07610a5f92
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      src/app/services/influxdb/influxdbDatasource.js

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

@@ -62,10 +62,16 @@ function (angular, _, kbn) {
           query = queryElements.join(" ");
         }
         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]] " +
                          "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 = {
             series: target.series,
             column: target.column,