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

feat(elasticsearch): remove pipeline aggs as possible sources

carl bergquist 10 лет назад
Родитель
Сommit
6e50e2412e

+ 1 - 1
public/app/plugins/datasource/elasticsearch/query_def.js

@@ -96,7 +96,7 @@ function (_) {
       var self = this;
       var result = [];
       _.each(targets.metrics, function(metric) {
-        if (metric.type !== 'moving_avg') {
+        if (!self.isPipelineAgg(metric)) {
           result.push({text: self.describeMetric(metric), value: metric.id });
         }
       });

+ 15 - 1
public/app/plugins/datasource/elasticsearch/specs/query_def_specs.ts

@@ -42,10 +42,24 @@ describe('ElasticQueryDef', function() {
 
       var response = QueryDef.getPipelineAggOptions(targets);
 
-      it('should return zero', function() {
+      it('should return one', function() {
         expect(response.length).to.be(1);
       });
     });
+
+    describe('with derivatives targets', function() {
+      var targets = {
+        metrics: [
+          { type: 'derivative', field: '@value' }
+        ]
+      };
+
+      var response = QueryDef.getPipelineAggOptions(targets);
+
+      it('should return zero', function() {
+        expect(response.length).to.be(0);
+      });
+    });
   });
 
   describe('isPipelineMetric', function() {