diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2014-07-11 15:18:12 +0600 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2014-07-11 15:19:42 +0600 |
commit | a404f337cdee4b90c13d01269f90b9fc31e196d4 (patch) | |
tree | 4896c474dccc0ffd36a12a9002fd4c65961cd477 /server/sonar-server | |
parent | 2982086f6c5fcb12f8f416436651ecbe3405d83e (diff) | |
download | sonarqube-a404f337cdee4b90c13d01269f90b9fc31e196d4.tar.gz sonarqube-a404f337cdee4b90c13d01269f90b9fc31e196d4.zip |
SONAR-5207 Treemap feedback
Diffstat (limited to 'server/sonar-server')
-rw-r--r-- | server/sonar-server/src/main/coffee/widgets/treemap.coffee | 26 | ||||
-rw-r--r-- | server/sonar-server/src/main/less/icons.less | 3 | ||||
-rw-r--r-- | server/sonar-server/src/main/less/style.less | 18 |
3 files changed, 32 insertions, 15 deletions
diff --git a/server/sonar-server/src/main/coffee/widgets/treemap.coffee b/server/sonar-server/src/main/coffee/widgets/treemap.coffee index 1a55e9f2739..075eabe43e3 100644 --- a/server/sonar-server/src/main/coffee/widgets/treemap.coffee +++ b/server/sonar-server/src/main/coffee/widgets/treemap.coffee @@ -22,6 +22,7 @@ class Treemap extends window.SonarWidgets.BaseWidget cellsEnter = @cells.enter().append 'div' cellsEnter.classed 'treemap-cell', true cellsEnter.append('div').classed 'treemap-inner', true + cellsEnter.append('a').classed 'treemap-link', true @cells.attr 'title', (d) => @tooltip d @cells.style 'background-color', (d) => @@ -37,6 +38,13 @@ class Treemap extends window.SonarWidgets.BaseWidget "#{prefix}<br>#{d.longName.substr prefixLength}" else d.longName + @cellsLink = @box.selectAll('.treemap-link').data nodes + @cellsLink.html '<i class="icon-link"></i>' + @cellsLink.attr 'href', (d) => + url = @options().baseUrl + encodeURIComponent(d.key) + url += '?metric=' + encodeURIComponent(@colorMetric.key) if d.qualifier == 'CLA' || d.qualifier == 'FIL' + url + @attachEvents cellsEnter @maxResultsReachedLabel.style 'display', if @maxResultsReached() then 'block' else 'none' @@ -52,13 +60,6 @@ class Treemap extends window.SonarWidgets.BaseWidget attachEvents: (cells) -> cells.on 'click', (d) => @requestChildren d - cells.on 'dblclick', (d) => @openDashboard d - - - openDashboard: (d) -> - url = @options().baseUrl + encodeURIComponent(d.key) - url += '?metric=' + encodeURIComponent(@colorMetric.key) if d.qualifier == 'CLA' || d.qualifier == 'FIL' - window.location = url positionCells: -> @@ -69,8 +70,9 @@ class Treemap extends window.SonarWidgets.BaseWidget @cells.style 'height', (d) -> "#{d.dy}px" @cells.style 'line-height', (d) -> "#{d.dy}px" @cells.style 'font-size', (d) => "#{@size (d.dx / d.longName.length)}px" - @cells.classed 'treemap-cell-small', (d) -> - (d.dx / d.longName.length) < 1 || d.dy < 40 + @cellsLink.style 'font-size', (d) => "#{@sizeLink Math.min(d.dx, d.dy)}px" + @cells.classed 'treemap-cell-small', (d) -> (d.dx / d.longName.length) < 1 || d.dy < 40 + @cells.classed 'treemap-cell-very-small', (d) -> d.dx < 24 || d.dy < 24 renderLegend: (box) -> @@ -92,6 +94,8 @@ class Treemap extends window.SonarWidgets.BaseWidget breadcrumbs = @breadcrumbsBox.selectAll('.treemap-breadcrumbs-item').data @breadcrumbs breadcrumbs.exit().remove() breadcrumbsEnter = breadcrumbs.enter().append('span').classed 'treemap-breadcrumbs-item', true + breadcrumbsEnter.attr 'title', (d) => + if d.longName? then d.longName else @options().resource breadcrumbsEnter.append('i').classed('icon-chevron-right', true).style 'display', (d, i) -> if i > 0 then 'inline' else 'none' breadcrumbsEnter.append('i').attr 'class', (d) -> @@ -154,8 +158,12 @@ class Treemap extends window.SonarWidgets.BaseWidget @color = @getColorScale() @size = d3.scale.linear().domain([3, 15]).range([@sizeLow, @sizeHigh]).clamp true + @sizeLink = d3.scale.linear().domain([60, 100]).range([12, 14]).clamp true @treemap = d3.layout.treemap() + @treemap.sort (a, b) -> a.value - b.value + @treemap.round true + @treemap.value (d) => @sizeMetric.value d @maxResultsReachedLabel = box.append('div').text @options().maxItemsReachedMessage diff --git a/server/sonar-server/src/main/less/icons.less b/server/sonar-server/src/main/less/icons.less index c7ff41c31c3..014b1d0ade4 100644 --- a/server/sonar-server/src/main/less/icons.less +++ b/server/sonar-server/src/main/less/icons.less @@ -378,9 +378,6 @@ a[class^="icon-"], a[class*=" icon-"] { content: "\f122"; font-size: @iconSmallFontSize; } -.icon-link:before { - content: "\f0c1"; -} .icon-inheritance:before { content: "\f126"; } diff --git a/server/sonar-server/src/main/less/style.less b/server/sonar-server/src/main/less/style.less index 21ad9a7d641..93f7217dd76 100644 --- a/server/sonar-server/src/main/less/style.less +++ b/server/sonar-server/src/main/less/style.less @@ -2843,21 +2843,33 @@ div.rule-title { white-space: nowrap; } -.sonar-d3 .treemap-dashboard { +.sonar-d3 .treemap-link { position: absolute; z-index: 2; top: 5px; right: 5px; - line-height: 16px; - color: inherit; + line-height: @iconSmallFontSize; + color: #fff; opacity: 0.5; &:hover { opacity: 1; } } +.sonar-d3 .treemap-link i, +.sonar-d3 .treemap-link i:before { + vertical-align: top; + font-size: inherit; + line-height: inherit; +} + .sonar-d3 .treemap-cell-small { .treemap-inner { display: none; } } +.sonar-d3 .treemap-cell-very-small { + .treemap-inner { display: none; } + .treemap-link { display: none; } +} + .sonar-d3 .treemap-breadcrumbs { margin-top: 10px; padding-top: 7px; |