diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-05-15 10:13:09 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-05-15 10:13:17 +0200 |
commit | aae0816de8a1bf8eb0735ac22d372e3aa86d213e (patch) | |
tree | 901f9fee1156751ce19d5c62188e9e651d87219d | |
parent | 0d2ef60a05e9950379124c7eeb1683d53d32ac3e (diff) | |
download | sonarqube-aae0816de8a1bf8eb0735ac22d372e3aa86d213e.tar.gz sonarqube-aae0816de8a1bf8eb0735ac22d372e3aa86d213e.zip |
SONAR-5130 Do not display bar chart when there's only one language
-rw-r--r-- | plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb | 8 |
1 files changed, 7 insertions, 1 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 bd98536bad0..97efc27572e 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,6 +25,7 @@ <%= dashboard_configuration.selected_period? ? format_variation(ncloc) : trend_icon(ncloc) -%> </p> <% if ncloc_language_dist_hash %> + <% if ncloc_language_dist_hash.size > 1 %> <div class="widget-histogram"> <table class="clear width100"> <% @@ -32,7 +33,6 @@ # 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> @@ -46,6 +46,12 @@ </tr> <% end %> </table> + <% else %> + <% + language_key = ncloc_language_dist_hash.first[0] + language = languages.find { |l| l.getKey()==language_key.to_s } -%> + <%= language ? language.getName() : language_key -%> + <% end %> </div> <% end %> |