]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5718 Fix display of file-level issues
authorStas Vilchik <vilchiks@gmail.com>
Fri, 31 Oct 2014 09:25:16 +0000 (10:25 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Fri, 31 Oct 2014 09:25:16 +0000 (10:25 +0100)
server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee

index a51aaf116c4c074e58601ef69722fc401e438187..6573d999d919d26b992519d9b510a61dd77b9ce8 100644 (file)
@@ -142,17 +142,27 @@ define [
       line = issue.get('line') || 0
       @model.set key: componentKey, issueLine: line
 
-      @requestSources(line - LINES_AROUND, line + LINES_AROUND).done (data) =>
+      @requestSources(line - LINES_AROUND, line + LINES_AROUND)
+      .done (data) =>
         formattedSource = _.map data.sources, (item) => lineNumber: item[0], code: item[1]
         @source.set
           source: data.sources
           formattedSource: formattedSource
-        @model.set hasSourceBefore: line > LINES_AROUND
+        @model.set
+          hasSourceBefore: line > LINES_AROUND
+          hasSourceAfter: formattedSource.length > 2 * LINES_AROUND + 1
         @render()
         @highlightIssue issue.get 'key'
         @scrollToLine issue.get 'line'
         @bindScrollEvents()
         @requestIssues()
+      .fail =>
+        @source.set
+          source: []
+          formattedSource: []
+        @model.set hasSourceBefore: false, hasSourceAfter: false
+        @render()
+        @highlightIssue issue.get 'key'
 
 
     requestSources: (lineFrom, lineTo) ->