]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5209 Speed up issues rendering
authorStas Vilchik <vilchiks@gmail.com>
Mon, 30 Jun 2014 08:15:22 +0000 (14:15 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 30 Jun 2014 08:15:31 +0000 (14:15 +0600)
sonar-server/src/main/coffee/component-viewer/source.coffee
sonar-server/src/main/coffee/issues/issue-view.coffee
sonar-server/src/main/hbs/component-viewer/source.hbs
sonar-server/src/main/hbs/issues/issue.hbs
sonar-server/src/main/less/style.less
sonar-server/src/main/less/ui.less

index 9b15f4e62766243a819454aed537569cf17ac0f7..50aa37282d58d1ca8a6835bcc3ae0f642510475b 100644 (file)
@@ -103,10 +103,10 @@ define [
       issues.forEach (issue) =>
         line = issue.line || 0
         line = 0 if issue.resolution == 'FIXED' || issue.resolution == 'REMOVED'
-        row = @$("[data-line-number=#{line}]")
+        row = @$("##{@cid}-#{line}")
         unless row.length > 0
           line = 0
-          row = @$("[data-line-number=#{line}]")
+          row = @$("##{@cid}-#{line}")
         if row.length > 0
           row.removeClass 'row-hidden'
           container = row.children('.line')
@@ -277,10 +277,11 @@ define [
 
 
     serializeData: ->
+      uid: @cid
       source: @prepareSource()
       settings: @options.main.settings.toJSON()
       state: @options.main.state.toJSON()
       showSettings: @showSettings
       component: @options.main.component.toJSON()
       columns: @getStatColumnsCount() + 1
-      showZeroLine: @showZeroLine()
\ No newline at end of file
+      showZeroLine: @showZeroLine()
index 5e6ceb5e06e961cf5214f346f4803856268fd47f..e69aad37eec051f775706e4d8bc2415258c3ee2a 100644 (file)
@@ -57,8 +57,8 @@ define [
 
       'click .code-issue-toggle': 'toggleCollapsed',
 
-      'click [href=#tab-issue-rule]': 'fetchRule',
-      'click [href=#tab-issue-changelog]': 'fetchChangeLog',
+      'click [href=#tab-issue-rule]': 'showRuleTab',
+      'click [href=#tab-issue-changelog]': 'showChangeLogTab',
 
       'click #issue-comment': 'comment',
       'click .issue-comment-edit': 'editComment',
@@ -72,8 +72,6 @@ define [
 
 
     onRender: ->
-      @$('.code-issue-details').tabs()
-      @$('.code-issue-form').hide()
       @rule = new Rule key: this.model.get('rule')
       @ruleRegion.show new RuleView model: @rule, issue: @model
       @changeLog = new ChangeLog()
@@ -97,17 +95,34 @@ define [
 
     toggleCollapsed: ->
       @$('.code-issue').toggleClass 'code-issue-collapsed'
-      @fetchRule()
+      unless @$('.code-issue').is '.code-issue-collapsed'
+        @showRuleTab()
+
+
+    hideTabs: ->
+      @$('.js-tab-link').removeClass 'active-link'
+      @$('.js-tab').hide()
+
+
+    showTab: (tab) ->
+      @hideTabs()
+      s = "#tab-issue-#{tab}"
+      @$(s).show()
+      @$("[href=#{s}]").addClass 'active-link'
 
 
-    fetchRule: ->
+    showRuleTab: (e) ->
+      e?.preventDefault()
+      @showTab 'rule'
       unless @rule.has 'name'
         @$('#tab-issue-rule').addClass 'navigator-fetching'
         @rule.fetch
           success: => @$('#tab-issue-rule').removeClass 'navigator-fetching'
 
 
-    fetchChangeLog: ->
+    showChangeLogTab: (e) ->
+      e?.preventDefault()
+      @showTab 'changelog'
       unless @changeLog.length > 0
         @$('#tab-issue-changeLog').addClass 'navigator-fetching'
         @changeLog.fetch
index 1e7a2b407669446503f5ccffc9576869d33f0b48..87542a5e3d6a2304b6f04a5d66425d66addbdb6b 100644 (file)
@@ -10,7 +10,7 @@
 
   <table class="code">
     {{#if showZeroLine}}
-      <tr class="row row-hidden" data-line-number="0">
+      <tr class="row row-hidden" data-line-number="0" id="{{uid}}-0">
         {{#if settings.coverage}}
           <td class="stat coverage-tests"></td>
           <td class="stat coverage-conditions"></td>
@@ -28,8 +28,7 @@
 
     {{#each source}}
       {{#if show}}
-        <tr class="row"
-            data-line-number="{{lineNumber}}">
+        <tr class="row" data-line-number="{{lineNumber}}" id="{{uid}}-{{lineNumber}}">
 
           {{#if ../../settings.scm}}
             <td class="stat {{#if scm}}scm{{/if}}">
index f59b2cae41bf752f3364dd3799959837c02a970b..cbdb2c11765b560e2c36928c9260a257b11cec5d 100644 (file)
     {{#if author}}<li>{{t 'author'}}: {{author}}</li>{{/if}}
   </ul>
 
-  <div class="code-issue-form"></div>
+  <div class="code-issue-form" style="display: none;"></div>
 
 
   <div class="code-issue-details">
-    <ul class="tabs">
+    <ul class="code-issue-tabs">
       <li>
-        <a href="#tab-issue-rule">{{t 'rule'}}</a>
+        <a class="js-tab-link underlined-link" href="#tab-issue-rule">{{t 'rule'}}</a>
       </li>
       <li>
-        <a href="#tab-issue-changelog">{{t 'changelog'}}</a>
+        <a class="js-tab-link underlined-link" href="#tab-issue-changelog">{{t 'changelog'}}</a>
       </li>
     </ul>
 
-    <div id="tab-issue-rule">
+    <div id="tab-issue-rule" class="js-tab">
       <div class="rule-desc"></div>
     </div>
 
-    <div id="tab-issue-changelog"></div>
+    <div id="tab-issue-changelog" class="js-tab"></div>
   </div>
 
 
       </div>
     {{/each}}
   </div>
-</div>
\ No newline at end of file
+</div>
index d23bfadf2c8b485e0ccd8e36da3d9b937d3c25c3..dc70d2aab1ad7153a5c3d707e55d8d96029aa19d 100644 (file)
@@ -917,33 +917,26 @@ th.operations, td.operations {
 }
 
 .code-issue-details {
-  padding: 0 0 5px;
+  padding: 0 10px 5px;
   border-left: 1px solid #DDD;
   border-right: 1px solid #DDD;
   border-bottom: 1px solid #DDD;
   background-color: #EFEFEF;
-}
-
-.code-issue-details .ui-tabs-panel {
-  padding: 5px 10px 0;
   line-height: 1.3;
 }
 
-.code-issue-details .tabs {
-  height: auto;
-  padding: 5px 10px;
-  border-bottom: 1px solid #DDD;
-}
+.code-issue-tabs {
+  margin-bottom: 5px;
+  font-size: 0;
 
-.code-issue-details .tabs li + li {
-  margin-left: 10px;
-}
+  & > li {
+    display: inline-block;
+    padding: 4px 0;
+    color: @secondFontColor;
+    font-size: @smallFontSize;
+  }
 
-.code-issue-details .tabs li a:link,
-.code-issue-details .tabs li a:visited {
-  float: none;
-  margin: 0;
-  padding: 0;
+  & > li + li { margin-left: 15px; }
 }
 
 .code-issue-details-list {
index 232e2395316b48bc15a363b4b0878b01e813affa..5feabf6cdf8e530669d404d5ff2d45c38c4a88eb 100644 (file)
@@ -124,6 +124,11 @@ select::-moz-focus-inner, input::-moz-focus-inner, button::-moz-focus-inner {
   }
 }
 
+.active-link {
+  border-bottom: none;
+  font-weight: 500;
+}
+
 a {
   cursor: pointer;
   .highlighted-link;