]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5615 When the DSM is not computed on a module, the page fails to load
authorStas Vilchik <vilchiks@gmail.com>
Mon, 6 Oct 2014 10:49:52 +0000 (12:49 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 6 Oct 2014 10:49:59 +0000 (12:49 +0200)
server/sonar-web/src/main/coffee/design/app.coffee
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index b5927ca6d6cd1204a4208bd568b57e1a25757099..46bedf28096e3e2ad4b490ca30a44a7a08b913f2 100644 (file)
@@ -30,6 +30,11 @@ requirejs [
   App = new Marionette.Application
 
 
+  App.noDataAvailable = ->
+    message = t 'design.noData'
+    $('#project-design').html "<p class=\"message-alert\"><i class=\"icon-alert-warn\"></i> #{message}</p>"
+
+
   App.addInitializer ->
     packageTangles = {}
 
@@ -38,9 +43,13 @@ requirejs [
         packageTangles[component.id] = component.msr[0].frmt_val
 
     dsmXHR = $.get RESOURCES_URL, resource: window.resourceKey, metrics: 'dsm'
+    dsmXHR.fail -> App.noDataAvailable()
 
     $.when(packageTanglesXHR, dsmXHR).done ->
       rawData = dsmXHR.responseJSON
+      unless _.isArray(rawData) && rawData.length == 1 && _.isArray(rawData[0].msr)
+        App.noDataAvailable()
+        return
       data = JSON.parse rawData[0].msr[0].data
       data.forEach (row, rowIndex) ->
         row.v.forEach (cell, columnIndex) ->
index 9442b2834590f170aac813fa7c3955787733590a..2f6077c178d9836c3192dd54256110c0029575ff 100644 (file)
@@ -2741,6 +2741,7 @@ design.legend.cycles=Suspect dependency (cycle)
 design.legend.uses=- uses >
 design.cellTooltip=Click to highlight, double-click to display more details
 design.rowTooltip=Click to highlight, double-click to zoom
+design.noData=No DSM data available for the component