From: Simon Brandhof Date: Sun, 2 Dec 2012 08:08:40 +0000 (+0100) Subject: SONAR-3825 ability to customize treemap X-Git-Tag: 3.4~220 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5f79bf7b8a256678505257d5af376d09cdfaa9f6;p=sonarqube.git SONAR-3825 ability to customize treemap --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb index 4ae790d9307..5ca58e8c3ca 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb @@ -28,13 +28,13 @@ class MeasureFilterDisplayTreemap < MeasureFilterDisplay super(filter, options) @size_metric = Metric.by_key(@filter.criteria('tmSize')||'ncloc') - @color_metric = Metric.by_key(@filter.criteria('tmColor')||'violations_density') + @color_metric = Metric.by_key(@filter.criteria('tmColor')) @html_id = options[:html_id] @filter.metrics=([@size_metric, @color_metric].compact) @height = (@filter.criteria('tmHeight')||'600').to_i @id_count = 0 - filter.set_criteria_value('sort', "metric:#{@size_metric.key}") + filter.set_criteria_value('sort', "metric:#{@size_metric.key}") if @size_metric filter.set_criteria_value('asc', 'true') filter.pagination.per_page = 500 filter.pagination.page = 1 @@ -64,7 +64,7 @@ class MeasureFilterDisplayTreemap < MeasureFilterDisplay private def build_tree(node) - if @filter.results + if @filter.results && @size_metric @filter.results.each do |result| size_measure=result.measure(@size_metric) if size_measure diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb index 589eb1fb02f..a3dc044f302 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb @@ -116,7 +116,7 @@ <%= human_short_date s.created_at -%>
- +
@@ -194,7 +194,7 @@ <% if index < last_index %> <% end %> - + diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb index 54128af8d86..e97a0ad8b6e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb @@ -63,10 +63,10 @@ %> <% if edit_mode %> - +
- <%= metric_select_tag 'metric', Metric.all.reject { |m| m.data? }, + <%= metric_select_tag 'metric', Metric.all.reject { |m| m.hidden || m.data? }, :html_id => 'select-metric', :allow_empty => true, :key_prefix => 'metric:', diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_treemap.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_treemap.html.erb index 9f9fce68896..36455b848fa 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_treemap.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_treemap.html.erb @@ -1,3 +1,50 @@ +<% if edit_mode %> + + + + + + +
+ <%= message('size') -%> +
+ <%= metric_select_tag 'tmSize', Metric.all.select { |m| m.treemap_size? }, + :html_id => 'select-tm-size', + :selected_key => @filter.display.size_metric.key -%> +
+ <%= message('color') -%> + +
+ <%= metric_select_tag 'tmColor', Metric.all.select { |m| m.treemap_color? }, + :html_id => 'select-tm-color', + :allow_empty => true, + :selected_key => (@filter.display.color_metric ? @filter.display.color_metric.key : nil) -%> + + +
+ Done +
+ <% content_for :script do %> + + <% end %> +<% end %> +
<%= @filter.display.html -%>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb index 2d8b5a07a54..8625a0c55de 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb @@ -118,7 +118,7 @@ <%= check_box_tag 'onFavourites', 'true', @filter.criteria['onFavourites']=='true' -%> - <% condition_metrics = Metric.all.select { |m| m.numeric? } %> + <% condition_metrics = Metric.all.select { |m| m.numeric? && !m.hidden } %> <% for i in 1..3 %>
  • "> <%= metric_select_tag "c#{i}_metric", condition_metrics, :allow_empty => true, :selected_key => @filter.criteria("c#{i}_metric"), :width => '100%', :placeholder => 'Metric' -%> diff --git a/sonar-server/src/main/webapp/images/cross-gray.png b/sonar-server/src/main/webapp/images/cross-gray.png new file mode 100644 index 00000000000..16ec36bae4c Binary files /dev/null and b/sonar-server/src/main/webapp/images/cross-gray.png differ diff --git a/sonar-server/src/main/webapp/stylesheets/layout.css b/sonar-server/src/main/webapp/stylesheets/layout.css index 240cbc0f254..30fae43d0db 100644 --- a/sonar-server/src/main/webapp/stylesheets/layout.css +++ b/sonar-server/src/main/webapp/stylesheets/layout.css @@ -265,6 +265,10 @@ ul.sidebar li.spacer { margin: 0; padding: 0; } +ul.sidebar select, ul.sidebar input { + font-size: 93%; +} + #logo { text-align: center; diff --git a/sonar-server/src/main/webapp/stylesheets/select2.css b/sonar-server/src/main/webapp/stylesheets/select2.css index 746c8993703..4b5d4efddca 100755 --- a/sonar-server/src/main/webapp/stylesheets/select2.css +++ b/sonar-server/src/main/webapp/stylesheets/select2.css @@ -48,9 +48,10 @@ Version: 3.2 Timestamp: Mon Sep 10 10:38:04 PDT 2012 white-space: nowrap; position: relative; - /* sonar: reduce height */ + /* sonar: reduce height and font-size */ height: 20px; line-height: 20px; + font-size: 93%; padding: 0 0 0 8px; color: #444; text-decoration: none;