mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Work arround for slower template variable dropdown when variable has many thousand values, now only top 1000 values are rendered to html, you can still search all values, Closes #2246
This commit is contained in:
@@ -29,7 +29,11 @@ function (angular, app, _) {
|
||||
return tag;
|
||||
});
|
||||
|
||||
vm.search = {query: '', options: vm.options};
|
||||
vm.search = {
|
||||
query: '',
|
||||
options: vm.options.slice(0, Math.min(vm.options.length, 1000))
|
||||
};
|
||||
|
||||
vm.dropdownVisible = true;
|
||||
};
|
||||
|
||||
@@ -204,6 +208,8 @@ function (angular, app, _) {
|
||||
vm.search.options = _.filter(vm.options, function(option) {
|
||||
return option.text.toLowerCase().indexOf(vm.search.query.toLowerCase()) !== -1;
|
||||
});
|
||||
|
||||
vm.search.options = vm.search.options.slice(0, Math.min(vm.search.options.length, 1000));
|
||||
};
|
||||
|
||||
vm.init = function() {
|
||||
|
||||
@@ -10,6 +10,7 @@ function (angular, _, kbn) {
|
||||
|
||||
module.service('templateValuesSrv', function($q, $rootScope, datasourceSrv, $location, templateSrv, timeSrv) {
|
||||
var self = this;
|
||||
|
||||
function getNoneOption() { return { text: 'None', value: '', isNone: true }; }
|
||||
|
||||
$rootScope.onAppEvent('time-range-changed', function() {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<span class="variable-option-icon"></span>
|
||||
Selected ({{vm.selectedValues.length}})
|
||||
</a>
|
||||
<a class="variable-option pointer" bindonce ng-repeat="option in vm.search.options" ng-class="{'selected': option.selected, 'highlighted': $index === vm.highlightIndex}" ng-click="vm.selectValue(option, $event)">
|
||||
<a class="variable-option pointer" ng-repeat="option in vm.search.options" ng-class="{'selected': option.selected, 'highlighted': $index === vm.highlightIndex}" ng-click="vm.selectValue(option, $event)">
|
||||
<span class="variable-option-icon"></span>
|
||||
<span>{{option.text}}</span>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user