]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5884 Apply feedback
authorStas Vilchik <vilchiks@gmail.com>
Thu, 8 Jan 2015 16:30:03 +0000 (17:30 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Thu, 8 Jan 2015 16:30:03 +0000 (17:30 +0100)
server/sonar-web/src/main/hbs/source-viewer/source-viewer-measures.hbs
server/sonar-web/src/main/hbs/source-viewer/source-viewer.hbs
server/sonar-web/src/main/js/source-viewer/source.js
server/sonar-web/src/main/js/source-viewer/viewer.js
server/sonar-web/src/main/less/components/source.less

index efc58a184d33eb93e39b6e4d73a490562bcb4e5c..deb19d374192094524a87b8341b0ba2c96e2efa0 100644 (file)
@@ -55,6 +55,7 @@
   {{/unless}}
 
 
+  <div class="marginbottom10">&nbsp;</div>
   <a class="js-show-all-measures">{{t 'component_viewer.show_all_measures'}}</a>
 
   <div class="source-viewer-measures source-viewer-measures-secondary js-all-measures hidden">
index f30f2b62168a14fce7e8ed7f3db6cf61ad5075cc..6a73836e5a34965aed09e49b47bd75ebe678fca1 100644 (file)
           <div class="source-line-bar"></div>
         </td>
 
-        <td class="source-meta source-line-duplications {{#if duplicated}}source-line-duplicated{{/if}}"
-            title="{{t 'source_viewer.expand_duplications'}}">
-          <div class="source-line-bar"></div>
-        </td>
-
-        {{#each duplications}}
-          <td class="source-meta source-line-duplications-extra {{#if this}}source-line-duplicated{{/if}}"
-              data-index="{{this}}" data-line-number="{{line}}">
+        {{#if ../hasDuplications}}
+          <td class="source-meta source-line-duplications {{#if duplicated}}source-line-duplicated{{/if}}"
+              title="{{t 'source_viewer.expand_duplications'}}">
             <div class="source-line-bar"></div>
           </td>
-        {{/each}}
+
+          {{#each duplications}}
+            <td class="source-meta source-line-duplications-extra {{#if this}}source-line-duplicated{{/if}}"
+                data-index="{{this}}" data-line-number="{{line}}">
+              <div class="source-line-bar"></div>
+            </td>
+          {{/each}}
+        {{/if}}
 
         <td class="source-meta source-line-issues {{#notEmpty issues}}source-line-with-issues{{/notEmpty}}"
             data-line-number="{{line}}">
index a620f11245ec6da13b2c61b0680df285189f01a3..3b511952d3928b2efa6c25ac8afcbf07916c2bc5 100644 (file)
@@ -58,6 +58,19 @@ define([
         });
       }
       this.set({ source: source });
+    },
+
+    checkIfHasDuplications: function () {
+      var hasDuplications = false,
+          source = this.get('source');
+      if (source != null) {
+        source.forEach(function (line) {
+          if (line.duplicated) {
+            hasDuplications = true;
+          }
+        });
+      }
+      this.set({ hasDuplications: hasDuplications });
     }
   });
 
index aa8e14fb41e952a080bf5b2b51b31c7039256126..d82cbe0a2a300fc40b9a965b13d4d5dc11b0e8fe 100644 (file)
@@ -180,6 +180,7 @@ define([
               hasSourceBefore: firstLine > 1,
               hasSourceAfter: data.sources.length === linesRequested
             });
+            that.model.checkIfHasDuplications();
           }).fail(function (request) {
             if (request.status === 403) {
               that.model.set({
@@ -537,7 +538,6 @@ define([
               };
           return $.get(url, options).done(function (data) {
             source = (data.sources || []).concat(source);
-            console.log(source.length);
             if (source.length > that.TOTAL_LINES_LIMIT + 1) {
               source = source.slice(0, that.TOTAL_LINES_LIMIT);
               that.model.set({ hasSourceAfter: true });
@@ -554,6 +554,7 @@ define([
               that.model.addDuplications(that.model.get('duplications'));
               that.model.addMeta(that.model.get('duplicationsParsed'));
             }
+            that.model.checkIfHasDuplications();
             that.render();
             that.scrollToFirstLine(firstLine);
             if (that.model.get('hasSourceBefore') || that.model.get('hasSourceAfter')) {
@@ -588,6 +589,7 @@ define([
               that.model.addDuplications(that.model.get('duplications'));
               that.model.addMeta(that.model.get('duplicationsParsed'));
             }
+            that.model.checkIfHasDuplications();
             that.render();
             that.scrollToLastLine(lastLine);
             if (that.model.get('hasSourceBefore') || that.model.get('hasSourceAfter')) {
index 7ff32efa2d5c2dbf1dc20edb8717aab3ee98c6d1..aae632723b7ece19660a36591a5a3e7027395fba 100644 (file)
 }
 
 .source-viewer-measures-card-fixed-height {
-  max-height: 50vh;
+  max-height: 36vh;
   overflow-y: scroll;
 }