]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5165 It should be possible to use up and down arrows to navigate through result...
authorStas Vilchik <vilchiks@gmail.com>
Thu, 3 Apr 2014 11:07:22 +0000 (17:07 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Thu, 3 Apr 2014 11:07:32 +0000 (17:07 +0600)
Debounce opening of issues

sonar-server/src/main/js/issues/extra.js

index 630952805b01026aa596c0afbc53c108949fdb18..a291721ed9cd175ac4228d4285a0b99641b1ea86 100644 (file)
@@ -167,8 +167,7 @@ define(
           key.setScope('list');
           this.options.issuesView.selected = this.$el.parent().children().index(this.$el);
 
-          this.$el.parent().children().removeClass('active');
-          this.$el.addClass('active');
+          this.options.issuesView.selectIssue(this.$el, false);
 
           var that = this,
               app = this.options.app,
@@ -245,6 +244,12 @@ define(
         emptyView: NoIssuesView,
 
 
+        initialize: function() {
+          var openIssue = function(el) { el.click(); };
+          this.openIssue = _.debounce(openIssue, 300);
+        },
+
+
         itemViewOptions: function () {
           return {
             issuesView: this,
@@ -253,6 +258,15 @@ define(
         },
 
 
+        selectIssue: function(el, open) {
+          this.$('.active').removeClass('active');
+          el.addClass('active');
+          if (open) {
+            this.openIssue(el);
+          }
+        },
+
+
         selectFirst: function() {
           this.selected = -1;
           this.selectNext();
@@ -269,7 +283,7 @@ define(
             if (bottom > containerHeight) {
               container.scrollTop(container.scrollTop() - containerHeight + bottom);
             }
-            child.click();
+            this.selectIssue(child, true);
           }
         },
 
@@ -283,7 +297,7 @@ define(
             if (top < 0) {
               container.scrollTop(container.scrollTop() + top);
             }
-            child.click();
+            this.selectIssue(child, true);
           }
         },