Commit 6e8d5cd8 by Torkel Ödegaard

fix(opentsdb): blur event triggered twice for metric selector, caused double…

fix(opentsdb): blur event triggered twice for metric selector, caused double query to opentsdb after metric name change
parent 48686cf9
...@@ -42,15 +42,9 @@ ...@@ -42,15 +42,9 @@
Metric Metric
</li> </li>
<li> <li>
<input type="text" <input type="text" class="input-large tight-form-input" ng-model="target.metric"
class="input-large tight-form-input" spellcheck='false' bs-typeahead="suggestMetrics" placeholder="metric name" data-min-length=0 data-items=100
ng-model="target.metric" ng-blur="targetBlur()">
spellcheck='false'
bs-typeahead="suggestMetrics"
placeholder="metric name"
data-min-length=0 data-items=100
ng-model-onblur
ng-change="targetBlur()">
</input> </input>
<a bs-tooltip="target.errors.metric" style="color: rgb(229, 189, 28)" ng-show="target.errors.metric"> <a bs-tooltip="target.errors.metric" style="color: rgb(229, 189, 28)" ng-show="target.errors.metric">
<i class="fa fa-warning"></i> <i class="fa fa-warning"></i>
...@@ -75,11 +69,11 @@ ...@@ -75,11 +69,11 @@
</li> </li>
<li> <li>
<input type="text" class="tight-form-input input-large" <input type="text" class="tight-form-input input-large"
ng-model="target.alias" ng-model="target.alias"
spellcheck='false' spellcheck='false'
placeholder="series alias" placeholder="series alias"
data-min-length=0 data-items=100 data-min-length=0 data-items=100
ng-blur="targetBlur()"></input> ng-blur="targetBlur()"></input>
</li> </li>
</ul> </ul>
...@@ -94,115 +88,101 @@ ...@@ -94,115 +88,101 @@
<li> <li>
<input type="text" class="input-large tight-form-input" <input type="text" class="input-large tight-form-input"
ng-model="target.downsampleInterval" ng-model="target.downsampleInterval"
ng-model-onblur ng-model-onblur
ng-change="targetBlur()" ng-change="targetBlur()"
placeholder="interval (empty = auto)"> placeholder="interval (empty = auto)"></input>
</li> </li>
<li class="tight-form-item">
Aggregator
</li>
<li>
<select ng-model="target.downsampleAggregator" class="tight-form-input input-small"
ng-options="agg for agg in aggregators"
ng-change="targetBlur()">
</select>
</li>
<li class="tight-form-item">
<editor-checkbox text="Disable downsampling" model="target.disableDownsampling" change="targetBlur()"></editor-checkbox>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="tight-form">
<ul class="tight-form-list" role="menu">
<li class="tight-form-item tight-form-align" style="width: 86px">
Tags
</li>
<li ng-repeat="(key, value) in target.tags track by $index" class="tight-form-item">
{{key}}&nbsp;=&nbsp;{{value}}
<a ng-click="removeTag(key)">
<i class="fa fa-remove"></i>
</a>
</li>
<li class="tight-form-item" ng-hide="addTagMode"> <li class="tight-form-item">
<a ng-click="addTag()"> Aggregator
<i class="fa fa-plus"></i> </li>
</a>
</li> <li>
<select ng-model="target.downsampleAggregator" class="tight-form-input input-small"
<li ng-show="addTagMode"> ng-options="agg for agg in aggregators"
<input type="text" class="input-small tight-form-input" ng-change="targetBlur()">
spellcheck='false' </select>
bs-typeahead="suggestTagKeys" </li>
data-min-length=0 data-items=100
ng-model="target.currentTagKey" <li class="tight-form-item">
placeholder="key"> <editor-checkbox text="Disable downsampling" model="target.disableDownsampling" change="targetBlur()"></editor-checkbox>
<input type="text" </li>
class="input-small tight-form-input"
spellcheck='false' </ul>
bs-typeahead="suggestTagValues" <div class="clearfix"></div>
data-min-length=0 data-items=100 </div>
ng-model="target.currentTagValue"
placeholder="value"> <div class="tight-form">
</input> <ul class="tight-form-list" role="menu">
<a ng-click="addTag()"> <li class="tight-form-item tight-form-align" style="width: 86px">
add tag Tags
</a> </li>
<a bs-tooltip="target.errors.tags" <li ng-repeat="(key, value) in target.tags track by $index" class="tight-form-item">
style="color: rgb(229, 189, 28)" {{key}}&nbsp;=&nbsp;{{value}}
ng-show="target.errors.tags"> <a ng-click="removeTag(key)">
<i class="fa fa-warning"></i> <i class="fa fa-remove"></i>
</a> </a>
</li> </li>
</ul>
<div class="clearfix"></div> <li class="tight-form-item" ng-hide="addTagMode">
</div> <a ng-click="addTag()">
<i class="fa fa-plus"></i>
<div class="tight-form"> </a>
<ul class="tight-form-list" role="menu"> </li>
<li class="tight-form-item tight-form-align" style="width: 86px">
<editor-checkbox text="Rate" model="target.shouldComputeRate" change="targetBlur()"></editor-checkbox> <li ng-show="addTagMode">
</li> <input type="text" class="input-small tight-form-input" spellcheck='false'
bs-typeahead="suggestTagKeys" data-min-length=0 data-items=100
<li class="tight-form-item" ng-hide="!target.shouldComputeRate"> ng-model="target.currentTagKey" placeholder="key"></input>
<editor-checkbox text="Counter" model="target.isCounter" change="targetBlur()"></editor-checkbox>
</li> <input type="text" class="input-small tight-form-input"
spellcheck='false' bs-typeahead="suggestTagValues"
<li class="tight-form-item" ng-hide="!target.isCounter"> data-min-length=0 data-items=100 ng-model="target.currentTagValue" placeholder="value">
Counter Max: </input>
</li> <a ng-click="addTag()">
add tag
<li ng-hide="!target.isCounter"> </a>
<input type="text" class="tight-form-input input-small" <a bs-tooltip="target.errors.tags"
ng-disabled="!target.shouldComputeRate" style="color: rgb(229, 189, 28)"
ng-model="target.counterMax" ng-show="target.errors.tags">
spellcheck='false' <i class="fa fa-warning"></i>
placeholder="max value" </a>
ng-model-onblur </li>
ng-blur="targetBlur()"></input> </ul>
</li> <div class="clearfix"></div>
<li class="tight-form-item" ng-hide="!target.isCounter"> </div>
Reset Value:
</li> <div class="tight-form">
<li ng-hide="!target.isCounter"> <ul class="tight-form-list" role="menu">
<input type="text" class="tight-form-input input-small" <li class="tight-form-item tight-form-align" style="width: 86px">
ng-disabled="!target.shouldComputeRate" <editor-checkbox text="Rate" model="target.shouldComputeRate" change="targetBlur()"></editor-checkbox>
ng-model="target.counterResetValue" </li>
spellcheck='false'
placeholder="reset value" <li class="tight-form-item" ng-hide="!target.shouldComputeRate">
ng-model-onblur <editor-checkbox text="Counter" model="target.isCounter" change="targetBlur()"></editor-checkbox>
ng-blur="targetBlur()"></input> </li>
</li>
</ul> <li class="tight-form-item" ng-hide="!target.isCounter">
Counter Max:
<div class="clearfix"></div> </li>
</div>
</div> <li ng-hide="!target.isCounter">
<input type="text" class="tight-form-input input-small" ng-disabled="!target.shouldComputeRate"
ng-model="target.counterMax" spellcheck='false'
placeholder="max value" ng-model-onblur
ng-blur="targetBlur()"></input>
</li>
<li class="tight-form-item" ng-hide="!target.isCounter">
Reset Value:
</li>
<li ng-hide="!target.isCounter">
<input type="text" class="tight-form-input input-small" ng-disabled="!target.shouldComputeRate"
ng-model="target.counterResetValue" spellcheck='false'
placeholder="reset value" ng-model-onblur
ng-blur="targetBlur()"></input>
</li>
</ul>
<div class="clearfix"></div>
</div> </div>
...@@ -21,10 +21,6 @@ function (angular, _, kbn) { ...@@ -21,10 +21,6 @@ function (angular, _, kbn) {
if (!$scope.target.downsampleAggregator) { if (!$scope.target.downsampleAggregator) {
$scope.target.downsampleAggregator = 'avg'; $scope.target.downsampleAggregator = 'avg';
} }
$scope.$on('typeahead-updated', function() {
$timeout($scope.targetBlur);
});
}; };
$scope.targetBlur = function() { $scope.targetBlur = function() {
......
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