Commit a2b75197 by Masaori Koshiba

Add space before and after binary operators

parent ddb4b928
...@@ -55,7 +55,7 @@ function (angular, _, kbn) { ...@@ -55,7 +55,7 @@ function (angular, _, kbn) {
var reqBody = { var reqBody = {
metrics: queries metrics: queries
}; };
reqBody.cache_time=0; reqBody.cache_time = 0;
convertToKairosTime(start,reqBody,'start'); convertToKairosTime(start,reqBody,'start');
convertToKairosTime(end,reqBody,'end'); convertToKairosTime(end,reqBody,'end');
var options = { var options = {
...@@ -120,10 +120,10 @@ function (angular, _, kbn) { ...@@ -120,10 +120,10 @@ function (angular, _, kbn) {
if (!results.data) { if (!results.data) {
return []; return [];
} }
if (type==="key") { if (type === "key") {
return _.keys(results.data.queries[0].results[0].tags); return _.keys(results.data.queries[0].results[0].tags);
} }
else if (type==="value" && _.has(results.data.queries[0].results[0].tags,keyValue)) { else if (type === "value" && _.has(results.data.queries[0].results[0].tags,keyValue)) {
return results.data.queries[0].results[0].tags[keyValue]; return results.data.queries[0].results[0].tags[keyValue];
} }
return []; return [];
...@@ -159,19 +159,19 @@ function (angular, _, kbn) { ...@@ -159,19 +159,19 @@ function (angular, _, kbn) {
var target = plotParams[index].alias; var target = plotParams[index].alias;
var details = " ( "; var details = " ( ";
_.each(result.group_by,function(element) { _.each(result.group_by,function(element) {
if (element.name==="tag") { if (element.name === "tag") {
_.each(element.group,function(value, key) { _.each(element.group,function(value, key) {
details+= key+"="+value+" "; details += key + "=" + value + " ";
}); });
} }
else if (element.name==="value") { else if (element.name === "value") {
details+= 'value_group='+element.group.group_number+" "; details += 'value_group=' + element.group.group_number + " ";
} }
else if (element.name==="time") { else if (element.name === "time") {
details+= 'time_group='+element.group.group_number+" "; details += 'time_group=' + element.group.group_number + " ";
} }
}); });
details+= ") "; details += ") ";
if (details !== " ( ) ") { if (details !== " ( ) ") {
target += details; target += details;
} }
...@@ -204,7 +204,7 @@ function (angular, _, kbn) { ...@@ -204,7 +204,7 @@ function (angular, _, kbn) {
}; };
query.aggregators = []; query.aggregators = [];
if (target.downsampling!=='(NONE)') { if (target.downsampling !== '(NONE)') {
query.aggregators.push({ query.aggregators.push({
name: target.downsampling, name: target.downsampling,
align_sampling: true, align_sampling: true,
...@@ -223,13 +223,13 @@ function (angular, _, kbn) { ...@@ -223,13 +223,13 @@ function (angular, _, kbn) {
returnedAggregator.align_start_time =true; returnedAggregator.align_start_time =true;
} }
if (chosenAggregator.unit) { if (chosenAggregator.unit) {
returnedAggregator.unit = chosenAggregator.unit+'s'; returnedAggregator.unit = chosenAggregator.unit + 's';
} }
if (chosenAggregator.factor && chosenAggregator.name==='div') { if (chosenAggregator.factor && chosenAggregator.name === 'div') {
returnedAggregator.divisor = chosenAggregator.factor; returnedAggregator.divisor = chosenAggregator.factor;
} }
else if (chosenAggregator.factor && chosenAggregator.name==='scale') { else if (chosenAggregator.factor && chosenAggregator.name === 'scale') {
returnedAggregator.factor = chosenAggregator.factor; returnedAggregator.factor = chosenAggregator.factor;
} }
if (chosenAggregator.percentile) { if (chosenAggregator.percentile) {
returnedAggregator.percentile = chosenAggregator.percentile; returnedAggregator.percentile = chosenAggregator.percentile;
...@@ -249,10 +249,10 @@ function (angular, _, kbn) { ...@@ -249,10 +249,10 @@ function (angular, _, kbn) {
query.group_by = []; query.group_by = [];
if (target.groupByTags) {query.group_by.push({name: "tag", tags: angular.copy(target.groupByTags)});} if (target.groupByTags) {query.group_by.push({name: "tag", tags: angular.copy(target.groupByTags)});}
if (target.nonTagGroupBys) { if (target.nonTagGroupBys) {
_.each(target.nonTagGroupBys,function(rawGroupBy) { _.each(target.nonTagGroupBys, function(rawGroupBy) {
var formattedGroupBy = angular.copy(rawGroupBy); var formattedGroupBy = angular.copy(rawGroupBy);
if (formattedGroupBy.name==='time') { if (formattedGroupBy.name === 'time') {
formattedGroupBy.range_size=KairosDBDatasource.prototype.convertToKairosInterval(formattedGroupBy.range_size); formattedGroupBy.range_size = KairosDBDatasource.prototype.convertToKairosInterval(formattedGroupBy.range_size);
} }
query.group_by.push(formattedGroupBy); query.group_by.push(formattedGroupBy);
}); });
...@@ -278,9 +278,9 @@ function (angular, _, kbn) { ...@@ -278,9 +278,9 @@ function (angular, _, kbn) {
var value = matches[1]; var value = matches[1];
var unit = matches[2]; var unit = matches[2];
if (value%1!==0) { if (value%1 !== 0) {
if (unit==='ms') {throw new Error('Invalid interval value, cannot be smaller than the millisecond');} if (unit === 'ms') {throw new Error('Invalid interval value, cannot be smaller than the millisecond');}
value = Math.round(kbn.intervals_in_seconds[unit]*value*1000); value = Math.round(kbn.intervals_in_seconds[unit] * value * 1000);
unit = 'ms'; unit = 'ms';
} }
...@@ -413,7 +413,7 @@ function (angular, _, kbn) { ...@@ -413,7 +413,7 @@ function (angular, _, kbn) {
prvDelta = Math.abs((datapoints[i][0] - datapoints[i - 1][0]) / datapoints[i - 1][0]); prvDelta = Math.abs((datapoints[i][0] - datapoints[i - 1][0]) / datapoints[i - 1][0]);
nxtDelta = Math.abs((datapoints[i][0] - datapoints[i + 1][0]) / datapoints[i + 1][0]); nxtDelta = Math.abs((datapoints[i][0] - datapoints[i + 1][0]) / datapoints[i + 1][0]);
if (prvDelta >= limit && nxtDelta >= limit) { if (prvDelta >= limit && nxtDelta >= limit) {
datapoints[i][0] = (datapoints[i-1][0] + datapoints[i+1][0]) / 2; datapoints[i][0] = (datapoints[i - 1][0] + datapoints[i + 1][0]) / 2;
} }
} }
......
...@@ -108,7 +108,7 @@ function (angular, _) { ...@@ -108,7 +108,7 @@ function (angular, _) {
$scope.removeFilterTag = function(key) { $scope.removeFilterTag = function(key) {
delete $scope.target.tags[key]; delete $scope.target.tags[key];
if (_.size($scope.target.tags)===0) { if (_.size($scope.target.tags) === 0) {
$scope.target.tags = null; $scope.target.tags = null;
} }
$scope.targetBlur(); $scope.targetBlur();
...@@ -171,7 +171,7 @@ function (angular, _) { ...@@ -171,7 +171,7 @@ function (angular, _) {
$scope.removeGroupByTag = function(index) { $scope.removeGroupByTag = function(index) {
$scope.target.groupByTags.splice(index, 1); $scope.target.groupByTags.splice(index, 1);
if (_.size($scope.target.groupByTags)===0) { if (_.size($scope.target.groupByTags) === 0) {
$scope.target.groupByTags = null; $scope.target.groupByTags = null;
} }
$scope.targetBlur(); $scope.targetBlur();
...@@ -179,16 +179,16 @@ function (angular, _) { ...@@ -179,16 +179,16 @@ function (angular, _) {
$scope.removeNonTagGroupBy = function(index) { $scope.removeNonTagGroupBy = function(index) {
$scope.target.nonTagGroupBys.splice(index, 1); $scope.target.nonTagGroupBys.splice(index, 1);
if (_.size($scope.target.nonTagGroupBys)===0) { if (_.size($scope.target.nonTagGroupBys) === 0) {
$scope.target.nonTagGroupBys = null; $scope.target.nonTagGroupBys = null;
} }
$scope.targetBlur(); $scope.targetBlur();
}; };
$scope.changeGroupByInput = function() { $scope.changeGroupByInput = function() {
$scope.isTagGroupBy = $scope.target.currentGroupByType==='tag'; $scope.isTagGroupBy = $scope.target.currentGroupByType === 'tag';
$scope.isValueGroupBy = $scope.target.currentGroupByType==='value'; $scope.isValueGroupBy = $scope.target.currentGroupByType === 'value';
$scope.isTimeGroupBy = $scope.target.currentGroupByType==='time'; $scope.isTimeGroupBy = $scope.target.currentGroupByType === 'time';
$scope.validateGroupBy(); $scope.validateGroupBy();
}; };
...@@ -270,7 +270,7 @@ function (angular, _) { ...@@ -270,7 +270,7 @@ function (angular, _) {
$scope.removeHorizontalAggregator = function(index) { $scope.removeHorizontalAggregator = function(index) {
$scope.target.horizontalAggregators.splice(index, 1); $scope.target.horizontalAggregators.splice(index, 1);
if (_.size($scope.target.horizontalAggregators)===0) { if (_.size($scope.target.horizontalAggregators) === 0) {
$scope.target.horizontalAggregators = null; $scope.target.horizontalAggregators = null;
} }
...@@ -282,7 +282,7 @@ function (angular, _) { ...@@ -282,7 +282,7 @@ function (angular, _) {
$scope.target.currentHorizontalAggregatorName); $scope.target.currentHorizontalAggregatorName);
$scope.hasUnit = _.contains(['sampler','rate'], $scope.target.currentHorizontalAggregatorName); $scope.hasUnit = _.contains(['sampler','rate'], $scope.target.currentHorizontalAggregatorName);
$scope.hasFactor = _.contains(['div','scale'], $scope.target.currentHorizontalAggregatorName); $scope.hasFactor = _.contains(['div','scale'], $scope.target.currentHorizontalAggregatorName);
$scope.hasPercentile = 'percentile'===$scope.target.currentHorizontalAggregatorName; $scope.hasPercentile = 'percentile' === $scope.target.currentHorizontalAggregatorName;
$scope.validateHorizontalAggregator(); $scope.validateHorizontalAggregator();
}; };
...@@ -303,7 +303,7 @@ function (angular, _) { ...@@ -303,7 +303,7 @@ function (angular, _) {
errors.factor = 'You must supply a numeric value for this aggregator'; errors.factor = 'You must supply a numeric value for this aggregator';
$scope.isAggregatorValid = false; $scope.isAggregatorValid = false;
} }
else if (parseInt($scope.target.horAggregator.factor)===0 && $scope.target.currentHorizontalAggregatorName==='div') { else if (parseInt($scope.target.horAggregator.factor) === 0 && $scope.target.currentHorizontalAggregatorName === 'div') {
errors.factor = 'Cannot divide by 0'; errors.factor = 'Cannot divide by 0';
$scope.isAggregatorValid = false; $scope.isAggregatorValid = false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment