From 5f79bf7b8a256678505257d5af376d09cdfaa9f6 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Sun, 2 Dec 2012 09:08:40 +0100 Subject: [PATCH] SONAR-3825 ability to customize treemap --- .../models/measure_filter_display_treemap.rb | 6 +-- .../app/views/comparison/index.html.erb | 4 +- .../app/views/measures/_display_list.html.erb | 4 +- .../views/measures/_display_treemap.html.erb | 47 ++++++++++++++++++ .../app/views/measures/_sidebar.html.erb | 2 +- .../src/main/webapp/images/cross-gray.png | Bin 0 -> 1189 bytes .../src/main/webapp/stylesheets/layout.css | 4 ++ .../src/main/webapp/stylesheets/select2.css | 3 +- 8 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 sonar-server/src/main/webapp/images/cross-gray.png 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 0000000000000000000000000000000000000000..16ec36bae4c28a799d6e6448eb3fa9ab3a1f95d5 GIT binary patch literal 1189 zcmV;W1X}xvP)4Tx04R}-l+Q~PVHn51vyB)iL11Qkh@nGBs7w}RMCGo(*tBg~f0Po$?CiU{ zle4qa%26U(f|ru*d1uDm5$(qdGxK?$AK&MB z-{F0M8d)(-JtP5n!?BWmQR({Vm{j`_Asj&+!l+YJ+l(X<1E9fUv1@F;hrqupt$X|b zI_lE4ng@jaKh%lTb}(f=ak3uu6-!kMZ8FSKs7BM z|C+c%%_(W1MkH>@24YeH&g(_h@8=*r^~@L^r0;R+=`OQ-d=_TXN_RhT8}a8f>+a#2 z#Pb=gH%8n{&sxUn9rjo_p*gW3k3%Dd9v|?z$wwEp4JbjhwM#!rpOV)g4O?IHuKzA8qHe6NWHQ4?5 zW?+>pP^lFuS83d>RC0Yby(58Yf7(5YU7B8Os@7T+7jCT7FHP^*tHQ2TvC67;&Z}|3 zd?p?hPl_?ILp%pbyd-vt7sYOxofiix8N;NaVZv3ip-`5AN%ERI{+SmG@2t6_p^q8N z(o~6`|AbY@XgUiV(SNxAbMSk`qp>3J!UhhXuG%(|?j0gDE>~^N72v`*x)0t~ZOwEZ z4m|-D&ZtGJ}8;WLk96sqPn3I;4%{fxLET5GkbR{t#`+_*~}`j zbQ|o)<2VxlDdp2_Hha5;zauy$g+d5XsZ;<$A;crVHM}G_6F81D@qJ%-o@X5n2ad<1 z078I=pAW+GJPRoC3Gn;V2zj2Plp=~EeBZam<8c6Re|K+9r&C6w5m}a9*FZ}71cX{^ z(eL-ID2f;i1~q^viWm-u%;)nzi^XDg$_2o(!RaC5B<(x-M}Xt2mBd zq?C_WMZ659RI%UhDao@eLu-9?Va^?t)jOTeuWq+n-E20r+id{KbCM+c^?Ln$*~L2- zY}*c+&1N-CQ|k3PtJNwiih@?F^&?GF8jVI(YaQHlVYl01nkGq-sO@(93ZS(PY}>9W zrO5OA-!3?g6P_xN=lP42^1MhN@S86D*D4#|{u}=S8?x)oO-2OI00000NkvXXu0mjf DdP6p8 literal 0 HcmV?d00001 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; -- 2.39.5