From 871b98c06b4b14f3a80e58fe36adffc9f5602b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 12 Dec 2017 12:56:40 +0100 Subject: [PATCH] graphite: minor fix for PR #10142 the query was being sent for every segmen t you selected before you completed the metric path --- public/app/plugins/datasource/graphite/graphite_query.ts | 4 ++++ public/app/plugins/datasource/graphite/query_ctrl.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/graphite/graphite_query.ts b/public/app/plugins/datasource/graphite/graphite_query.ts index 54504219dad..824b49f8860 100644 --- a/public/app/plugins/datasource/graphite/graphite_query.ts +++ b/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(); diff --git a/public/app/plugins/datasource/graphite/query_ctrl.ts b/public/app/plugins/datasource/graphite/query_ctrl.ts index d00ac90fe65..a2e54903bcb 100644 --- a/public/app/plugins/datasource/graphite/query_ctrl.ts +++ b/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(); } }