From 3a1dc469ddb0f0e14952b931a70f4213bec4f8c3 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 7 Apr 2014 17:03:59 +0600 Subject: [PATCH] SONAR-3113 Add links to dashboards --- .../measures/measure_filter_cloud.html.erb | 1 + .../src/main/coffee/widgets/word-cloud.coffee | 17 +++++++++++++++-- sonar-server/src/main/less/style.less | 3 +++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb index 48988ee7a4c..4e8a9440fc0 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb @@ -42,6 +42,7 @@ .source(baseUrl + '/measures/search_filter?' + query) .metricsPriority(metrics) .options({ + reverseColor: <%= reverseColor -%>, baseUrl: baseUrl + '/dashboard/index/', noData: '<%= message('no_data') -%>' }) diff --git a/sonar-server/src/main/coffee/widgets/word-cloud.coffee b/sonar-server/src/main/coffee/widgets/word-cloud.coffee index 8a942a1440a..39560337ca7 100644 --- a/sonar-server/src/main/coffee/widgets/word-cloud.coffee +++ b/sonar-server/src/main/coffee/widgets/word-cloud.coffee @@ -49,7 +49,11 @@ window.SonarWidgets.WordCloud.prototype.render = (container) -> @getSizeMetric = (d) => d.measures[@sizeMetric].val # Configure scales - @color = d3.scale.linear().domain([0, 100]).range(['#d62728', '#1f77b4']) + @color = d3.scale.linear().domain([0, 100]) + if @options().reverseColor + @color.range(['#1f77b4', '#d62728']) + else + @color.range(['#d62728', '#1f77b4']) sizeDomain = d3.extent @components(), (d) => @getSizeMetric d @size = d3.scale.linear().domain(sizeDomain).range([10, 24]) @@ -60,9 +64,18 @@ window.SonarWidgets.WordCloud.prototype.render = (container) -> window.SonarWidgets.WordCloud.prototype.update = -> # Configure words @words = @box.selectAll('a').data @components() - @words.enter().append('a').classed('cloud-word', true).text (d) -> d.name + + wordsEnter = @words.enter().append('a') + wordsEnter.classed 'cloud-word', true + wordsEnter.text (d) -> d.name + wordsEnter.attr 'href', (d) => + url = @options().baseUrl + encodeURIComponent(d.key) + url += '?metric=' + encodeURIComponent(@colorMetric) if d.qualifier == 'CLA' || d.qualifier == 'FIL' + url + @words.style 'color', (d) => @color @getColorMetric d @words.style 'font-size', (d) => "#{@size @getSizeMetric d}px" + @words.exit().remove() diff --git a/sonar-server/src/main/less/style.less b/sonar-server/src/main/less/style.less index 9e50e752215..e1fb7171e3b 100644 --- a/sonar-server/src/main/less/style.less +++ b/sonar-server/src/main/less/style.less @@ -2756,6 +2756,9 @@ div.rule-title { vertical-align: baseline; white-space: nowrap; margin-right: 14px; + text-decoration: none; + + &:hover { text-decoration: underline; } } /* ------------------- Admin pages ------------------- */ -- 2.39.5