Переглянути джерело

graphite: minor fix for PR #10142 the query was being sent for every segmen t you selected before you completed the metric path

Torkel Ödegaard 8 роки тому
батько
коміт
871b98c06b

+ 4 - 0
public/app/plugins/datasource/graphite/graphite_query.ts

@@ -120,6 +120,10 @@ export default class GraphiteQuery {
     this.segments.push({value: "select metric"});
   }
 
+  hasSelectMetric() {
+    return this.segments[this.segments.length - 1].value === 'select metric';
+  }
+
   addFunction(newFunc) {
     this.functions.push(newFunc);
     this.moveAliasFuncLast();

+ 1 - 1
public/app/plugins/datasource/graphite/query_ctrl.ts

@@ -218,7 +218,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
     var oldTarget = this.queryModel.target.target;
     this.updateModelTarget();
 
-    if (this.queryModel.target !== oldTarget) {
+    if (this.queryModel.target !== oldTarget && !this.queryModel.hasSelectMetric()) {
       this.panelCtrl.refresh();
     }
   }