Changeset - cc18e56220a2
[Not reviewed]
default
0 1 0
Mads Kiilerich - 9 years ago 2016-07-28 16:34:49
madski@unity3d.com
compare: improve select2 performance with many branches

Like elsewhere for pure branch selectors.
1 file changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/templates/compare/compare_diff.html
Show inline comments
 
@@ -108,20 +108,25 @@ ${self.repo_context_bar('changelog')}
 
            return '{0}@{1}'.format(repo_name, obj.text);
 
        },
 
        dropdownAutoWidth: true,
 
        maxResults: 50,
 
        query: function(query){
 
          var key = cache_key;
 
          var cached = cache[key] ;
 
          if(cached) {
 
            var data = {results: []};
 
            var queryLower = query.term.toLowerCase();
 
            //filter results
 
            $.each(cached.results, function(){
 
                var section = this.text;
 
                var children = [];
 
                $.each(this.children, function(){
 
                    if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){
 
                    if(children.length < 50 ?
 
                       ((queryLower.length == 0) || (this.text.toLowerCase().indexOf(queryLower) >= 0)) :
 
                       ((queryLower.length != 0) && (this.text.toLowerCase().indexOf(queryLower) == 0))) {
 
                        children.push(this);
 
                    }
 
                });
 
                children = branchSort(children, undefined, query)
 
                data.results.push({'text': section, 'children': children});
 
            });
 
            //push the typed in changeset
0 comments (0 inline, 0 general)