some code cleaning
diff --git a/ambari-metrics-grafana/ambari-metrics/query_ctrl.js b/ambari-metrics-grafana/ambari-metrics/query_ctrl.js
index 17bcfbf..b466167 100644
--- a/ambari-metrics-grafana/ambari-metrics/query_ctrl.js
+++ b/ambari-metrics-grafana/ambari-metrics/query_ctrl.js
@@ -39,8 +39,6 @@
/** @ngInject **/
function AmbariMetricsQueryCtrl($scope, $injector) {
var _this = _super.call(this, $scope, $injector) || this;
- var self = _this;
- var lodash = lodash_1["default"];
_this.errors = _this.validateTarget(_this.target);
_this.aggregators = ['none', 'avg', 'sum', 'min', 'max'];
_this.precisions = ['default', 'seconds', 'minutes', 'hours', 'days'];
@@ -94,12 +92,12 @@
};
_this.suggestMetrics = function (query, callback) {
_this.datasource.suggestMetrics(query, _this.target.app)
- .then(self.getTextValues)
+ .then(_this.getTextValues)
.then(callback);
};
_this.suggestTagKeys = function (query, callback) {
_this.datasource.metricFindQuery('tag_names(' + _this.target.metric + ')')
- .then(self.getTextValues)
+ .then(_this.getTextValues)
.then(callback);
};
_this.suggestTagValues = function (query, callback) {
@@ -109,7 +107,6 @@
};
_this.getTextValues = function (metricFindResult) {
return metricFindResult.map(function (value) { return value.text; });
- //return lodash.map(metricFindResult, function(value) { return value.text; });
};
return _this;
}
@@ -117,7 +114,7 @@
this.target.errors = this.validateTarget(this.target);
this.refresh();
};
-
+ ;
AmbariMetricsQueryCtrl.prototype.addTag = function () {
if (!this.addTagMode) {
this.addTagMode = true;
diff --git a/ambari-metrics-grafana/ambari-metrics/query_ctrl.ts b/ambari-metrics-grafana/ambari-metrics/query_ctrl.ts
index 13e24f9..cbc8dc0 100644
--- a/ambari-metrics-grafana/ambari-metrics/query_ctrl.ts
+++ b/ambari-metrics-grafana/ambari-metrics/query_ctrl.ts
@@ -41,8 +41,6 @@
/** @ngInject **/
constructor($scope, $injector) {
super($scope, $injector);
- var self = this;
- var lodash = _;
this.errors = this.validateTarget(this.target);
this.aggregators = ['none','avg', 'sum', 'min', 'max'];
this.precisions = ['default','seconds', 'minutes', 'hours', 'days'];
@@ -102,13 +100,13 @@
this.suggestMetrics = (query, callback) => {
this.datasource.suggestMetrics(query, this.target.app)
- .then(self.getTextValues)
+ .then(this.getTextValues)
.then(callback);
};
this.suggestTagKeys = (query, callback) => {
this.datasource.metricFindQuery('tag_names(' + this.target.metric + ')')
- .then(self.getTextValues)
+ .then(this.getTextValues)
.then(callback);
};
@@ -172,3 +170,4 @@
}
}
+