added button to show more preview values for variables, button runs a function that increases options limit, fixes #11508

This commit is contained in:
Patrick O'Carroll
2018-04-23 13:00:24 +02:00
parent 6315142d00
commit c2cc77fa08
2 changed files with 12 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ export class VariableEditorCtrl {
$scope.ctrl = {};
$scope.namePattern = /^(?!__).*$/;
$scope._ = _;
$scope.optionsLimit = 20;
$scope.refreshOptions = [
{ value: 0, text: 'Never' },
@@ -165,6 +166,10 @@ export class VariableEditorCtrl {
$scope.removeVariable = function(variable) {
variableSrv.removeVariable(variable);
};
$scope.showMoreOptions = function() {
$scope.optionsLimit += 20;
};
}
}

View File

@@ -280,11 +280,14 @@
</div>
<div class="gf-form-group" ng-show="current.options.length">
<h5>Preview of values (shows max 20)</h5>
<h5>Preview of values</h5>
<div class="gf-form-inline">
<div class="gf-form" ng-repeat="option in current.options | limitTo: 20">
<span class="gf-form-label">{{option.text}}</span>
</div>
<div class="gf-form" ng-repeat="option in current.options | limitTo: optionsLimit">
<span class="gf-form-label">{{option.text}}</span>
</div>
<div class="gf-form" ng-if= "current.options.length > optionsLimit">
<span class="gf-form-label btn-secondary" ng-click="showMoreOptions()">Show more</span>
</div>
</div>
</div>