Skip to content
Permalink
Browse files
some code cleaning
  • Loading branch information
ishanbha committed Nov 13, 2018
1 parent 63eb69f commit ff1141a2aa5d3e20d8db199a1ce6fef1f989b4a6
Showing 2 changed files with 6 additions and 10 deletions.
@@ -39,8 +39,6 @@ var AmbariMetricsQueryCtrl = /** @class */ (function (_super) {
/** @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 @@ var AmbariMetricsQueryCtrl = /** @class */ (function (_super) {
};
_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,15 +107,14 @@ var AmbariMetricsQueryCtrl = /** @class */ (function (_super) {
};
_this.getTextValues = function (metricFindResult) {
return metricFindResult.map(function (value) { return value.text; });
//return lodash.map(metricFindResult, function(value) { return value.text; });
};
return _this;
}
AmbariMetricsQueryCtrl.prototype.targetBlur = function () {
this.target.errors = this.validateTarget(this.target);
this.refresh();
};

;
AmbariMetricsQueryCtrl.prototype.addTag = function () {
if (!this.addTagMode) {
this.addTagMode = true;
@@ -41,8 +41,6 @@ export class AmbariMetricsQueryCtrl extends QueryCtrl {
/** @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 @@ export class AmbariMetricsQueryCtrl extends QueryCtrl {

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 @@ export class AmbariMetricsQueryCtrl extends QueryCtrl {
}
}


0 comments on commit ff1141a

Please sign in to comment.