From 8e7a127792486707adf6504e24ceda8ce5ef75cf Mon Sep 17 00:00:00 2001 From: godfreyhe Date: Fri, 26 Feb 2016 20:47:22 +0800 Subject: [PATCH 1/2] fix bug: can't get the aggregators from opentsdb server --- public/app/plugins/datasource/opentsdb/query_ctrl.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/opentsdb/query_ctrl.ts b/public/app/plugins/datasource/opentsdb/query_ctrl.ts index 43096b2ec36..7e853564cc3 100644 --- a/public/app/plugins/datasource/opentsdb/query_ctrl.ts +++ b/public/app/plugins/datasource/opentsdb/query_ctrl.ts @@ -38,8 +38,9 @@ export class OpenTsQueryCtrl extends QueryCtrl { this.target.downsampleFillPolicy = 'none'; } + var self = this; this.datasource.getAggregators().then(function(aggs) { - this.aggregators = aggs; + self.aggregators = aggs; }); // needs to be defined here as it is called from typeahead From 781041369941cbb5ad55d5cc86432003eed0d02c Mon Sep 17 00:00:00 2001 From: godfreyhe Date: Sun, 28 Feb 2016 11:48:54 +0800 Subject: [PATCH 2/2] use ES6 arrow function instead of self var on getAggregators --- public/app/plugins/datasource/opentsdb/query_ctrl.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/public/app/plugins/datasource/opentsdb/query_ctrl.ts b/public/app/plugins/datasource/opentsdb/query_ctrl.ts index 7e853564cc3..c973bd3a223 100644 --- a/public/app/plugins/datasource/opentsdb/query_ctrl.ts +++ b/public/app/plugins/datasource/opentsdb/query_ctrl.ts @@ -38,9 +38,8 @@ export class OpenTsQueryCtrl extends QueryCtrl { this.target.downsampleFillPolicy = 'none'; } - var self = this; - this.datasource.getAggregators().then(function(aggs) { - self.aggregators = aggs; + this.datasource.getAggregators().then((aggs) => { + this.aggregators = aggs; }); // needs to be defined here as it is called from typeahead