diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2014-05-15 10:03:34 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2014-05-15 10:03:34 +0200 |
commit | 260939349784a1b3bccd447cd5ab7231ec7c50cc (patch) | |
tree | e79d91d5a32f10dfb9141f4eb6c77bcb5ce59b12 /plugins | |
parent | 776371befe2b1a98ba9fb899ec0e84a88e072efb (diff) | |
download | sonarqube-260939349784a1b3bccd447cd5ab7231ec7c50cc.tar.gz sonarqube-260939349784a1b3bccd447cd5ab7231ec7c50cc.zip |
Improve ui of the size widget
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb | 44 |
1 files changed, 21 insertions, 23 deletions
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) -%> </p> <% if ncloc_language_dist_hash %> - <table class="clear width100"> - <% - max = ncloc_language_dist_hash.max_by{|_k,v| v.to_i}[1].to_i + <div class="widget-histogram"> + <table class="clear width100"> + <% + 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| - %> - <tr> - <td> - <% language = languages.find { |l| l.getKey()==language_key.to_s } -%> - <%= language ? language.getName() : language_key -%> - </td> - <td style="padding: 0 5px;" align="right"> - <%= ncloc.format_numeric_value(language_ncloc) %> - </td> - <td> </td> - <td align="left" style="padding-bottom:2px; padding-top:2px;"> - <%= barchart(:width => 70, :percent => (100 * language_ncloc.to_i / max).to_i)%> - </td> - </tr> - <% end %> - </table> + # 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| + %> + <tr> + <td class="widget-histogram-label"> + <% language = languages.find { |l| l.getKey()==language_key.to_s } -%> + <%= language ? language.getName() : language_key -%> + </td> + <td class="widget-histogram-bar"> + <%= barchart(:width => 70, :percent => (100 * language_ncloc.to_i / max).to_i, :value => ncloc.format_numeric_value(language_ncloc), :color => '#1f77b4')%> + </td> + </tr> + <% end %> + </table> + </div> <% end %> <% else %> |