aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-02-02 17:40:12 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-02-02 17:43:17 +0100
commitc2c47393a42f5d3244e998b7f99288edac0ca499 (patch)
tree47400a45805674881778566a31e10260ef9c4e5f
parentde8d658dc7cc5534e10238a581331eb310d7ca56 (diff)
downloadsonarqube-c2c47393a42f5d3244e998b7f99288edac0ca499.tar.gz
sonarqube-c2c47393a42f5d3244e998b7f99288edac0ca499.zip
SONAR-5789 On DSM, directories with no dependency should be hidden by default
-rw-r--r--server/sonar-web/src/main/coffee/design/app.coffee2
-rw-r--r--server/sonar-web/src/main/coffee/design/view.coffee21
-rw-r--r--server/sonar-web/src/main/hbs/design/design.hbs6
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties1
4 files changed, 24 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/coffee/design/app.coffee b/server/sonar-web/src/main/coffee/design/app.coffee
index 349563bf6a4..1365c63f813 100644
--- a/server/sonar-web/src/main/coffee/design/app.coffee
+++ b/server/sonar-web/src/main/coffee/design/app.coffee
@@ -41,6 +41,8 @@ requirejs [
cell.status = 'cycle'
else
cell.status = 'dependency'
+ data = data.map (row) ->
+ _.extend row, empty: row.v.every (item) -> !item.w?
collection = new Backbone.Collection data
collection.forEach (model) ->
model.set 'pt', packageTangles[model.get 'i']
diff --git a/server/sonar-web/src/main/coffee/design/view.coffee b/server/sonar-web/src/main/coffee/design/view.coffee
index 9df72c06c99..ba2d817d9cc 100644
--- a/server/sonar-web/src/main/coffee/design/view.coffee
+++ b/server/sonar-web/src/main/coffee/design/view.coffee
@@ -1,15 +1,11 @@
define [
'design/info-view',
'templates/design'
-], (
- InfoView
-) ->
-
+], (InfoView) ->
$ = jQuery
API_DEPENDECIES = "#{baseUrl}/api/dependencies"
-
class extends Marionette.Layout
template: Templates['design']
className: 'dsm'
@@ -30,6 +26,11 @@ define [
'dblclick @ui.titles': 'goToComponent'
'click @ui.cells': 'highlightCell'
'dblclick @ui.dependencies': 'showDependencies'
+ 'change .js-hide-dir': 'toggleDirDisplay'
+
+
+ onRender: ->
+ @toggleDirDisplay()
clearCells: ->
@@ -116,3 +117,13 @@ define [
scrollToInfoView: ->
delta = @$(@infoRegion.el).offset().top - 40
$('html, body').animate { scrollTop: delta }, 500
+
+
+ toggleDirDisplay: ->
+ rows = @$('tr')
+ rows.each (index) ->
+ if $(@).data('empty')?
+ $(@).toggleClass 'hidden'
+ rows.each ->
+ $(@).find('td').eq(index + 1).toggleClass 'hidden'
+
diff --git a/server/sonar-web/src/main/hbs/design/design.hbs b/server/sonar-web/src/main/hbs/design/design.hbs
index 39ec6432ee8..21d059293de 100644
--- a/server/sonar-web/src/main/hbs/design/design.hbs
+++ b/server/sonar-web/src/main/hbs/design/design.hbs
@@ -21,13 +21,17 @@
<span class="dsm-legend-label">{{t 'design.legend.uses'}}</span>
<span class="dsm-legend-square yellow"></span>
</li>
+ <li>
+ <input class="js-hide-dir" type="checkbox" id="design-hide-empty-dir" checked>
+ <label for="design-hide-empty-dir">{{t 'design.hide_empty_directories'}}</label>
+ </li>
</ul>
<div class="dsm-body">
<table>
<tbody>
{{#eachIndex items}}
- <tr>
+ <tr {{#if empty}}data-empty{{/if}}>
<td class="dsm-body-title" title="{{t 'design.rowTooltip'}}">
{{qualifierIcon q}} {{n}}
{{#gt pt 0}}
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index e69d965ab71..936ca48f305 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -2866,6 +2866,7 @@ 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
+design.hide_empty_directories=Hide directories with no dependencies