From 260939349784a1b3bccd447cd5ab7231ec7c50cc Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Thu, 15 May 2014 10:03:34 +0200 Subject: Improve ui of the size widget --- .../org/sonar/plugins/core/widgets/size.html.erb | 44 +++++++++++----------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'plugins') diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb index 495005cb8b5..bd98536bad0 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb @@ -25,30 +25,28 @@ <%= dashboard_configuration.selected_period? ? format_variation(ncloc) : trend_icon(ncloc) -%>

<% if ncloc_language_dist_hash %> - - <% - max = ncloc_language_dist_hash.max_by{|_k,v| v.to_i}[1].to_i +
+
+ <% + max = ncloc_language_dist_hash.max_by{|_k,v| v.to_i}[1].to_i - # Sort lines language distribution by language name - languages_by_key = Hash[languages.collect { |l| [l.getKey(), l.getName] }] - puts "#### " + languages_by_key.inspect - ncloc_language_dist_hash.sort {|v1,v2| (languages_by_key[v1[0]] ? languages_by_key[v1[0]].to_s : v1[0]) <=> (languages_by_key[v2[0]] ? languages_by_key[v2[0]].to_s : v2[0]) }.each do |language_key, language_ncloc| - %> - - - - - - - <% end %> -
- <% language = languages.find { |l| l.getKey()==language_key.to_s } -%> - <%= language ? language.getName() : language_key -%> - - <%= ncloc.format_numeric_value(language_ncloc) %> -   - <%= barchart(:width => 70, :percent => (100 * language_ncloc.to_i / max).to_i)%> -
+ # Sort lines language distribution by language name + languages_by_key = Hash[languages.collect { |l| [l.getKey(), l.getName] }] + puts "#### " + languages_by_key.inspect + ncloc_language_dist_hash.sort {|v1,v2| (languages_by_key[v1[0]] ? languages_by_key[v1[0]].to_s : v1[0]) <=> (languages_by_key[v2[0]] ? languages_by_key[v2[0]].to_s : v2[0]) }.each do |language_key, language_ncloc| + %> + + + <% language = languages.find { |l| l.getKey()==language_key.to_s } -%> + <%= language ? language.getName() : language_key -%> + + + <%= barchart(:width => 70, :percent => (100 * language_ncloc.to_i / max).to_i, :value => ncloc.format_numeric_value(language_ncloc), :color => '#1f77b4')%> + + + <% end %> + + <% end %> <% else %> -- cgit v1.2.3