From e7f28d7e03372df42eb550a319afeac76c19156e Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Tue, 7 Dec 2010 00:27:43 +0000 Subject: [PATCH] SONAR-2036 Violations widget: do not display bar charts when no violations --- .../org/sonar/plugins/core/widgets/rules.html.erb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb index 8875bed9ffd..63d343b3c55 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb @@ -48,12 +48,14 @@ <%= dashboard_configuration.variation? ? format_variation(blocker_violations) : trend_icon(blocker_violations, :empty => true) -%> + <% if max > 0 %> <% if dashboard_configuration.variation? %> <%= barchart(:width => 35, :percent => (values[0]<0 ? (100 * values[0] / max).to_i : 0), :color => '#078C00') %> <%= barchart(:width => 35, :percent => (values[0]>0 ? (100 * values[0] / max).to_i : 0), :color => '#cc0000') %> <% else %> <%= barchart(:width => 70, :percent => (100 * values[0] / max).to_i) %> <% end %> + <% end %> @@ -66,12 +68,14 @@ <%= dashboard_configuration.variation? ? format_variation(critical_violations) : trend_icon(critical_violations, :empty => true) -%> + <% if max > 0 %> <% if dashboard_configuration.variation? %> <%= barchart(:width => 35, :percent => (values[1]<0 ? (100 * values[1] / max).to_i : 0), :color => '#078C00') %> <%= barchart(:width => 35, :percent => (values[1]>0 ? (100 * values[1] / max).to_i : 0), :color => '#cc0000') %> <% else %> <%= barchart(:width => 70, :percent => (100 * values[1] / max).to_i) %> <% end %> + <% end %> @@ -84,12 +88,14 @@ <%= dashboard_configuration.variation? ? format_variation(major_violations) : trend_icon(major_violations, :empty => true) -%> + <% if max > 0 %> <% if dashboard_configuration.variation? %> <%= barchart(:width => 35, :percent => (values[2]<0 ? (100 * values[2] / max).to_i : 0), :color => '#078C00') %> <%= barchart(:width => 35, :percent => (values[2]>0 ? (100 * values[2] / max).to_i : 0), :color => '#cc0000') %> <% else %> <%= barchart(:width => 70, :percent => (100 * values[2] / max).to_i) %> <% end %> + <% end %> @@ -102,12 +108,14 @@ <%= dashboard_configuration.variation? ? format_variation(minor_violations) : trend_icon(minor_violations, :empty => true) -%> + <% if max > 0 %> <% if dashboard_configuration.variation? %> <%= barchart(:width => 35, :percent => (values[3]<0 ? (100 * values[3] / max).to_i : 0), :color => '#078C00') %> <%= barchart(:width => 35, :percent => (values[3]>0 ? (100 * values[3] / max).to_i : 0), :color => '#cc0000') %> <% else %> <%= barchart(:width => 70, :percent => (100 * values[3] / max).to_i) %> <% end %> + <% end %> @@ -120,12 +128,14 @@ <%= dashboard_configuration.variation? ? format_variation(info_violations) : trend_icon(info_violations, :empty => true) -%> + <% if max > 0 %> <% if dashboard_configuration.variation? %> <%= barchart(:width => 35, :percent => (values[4]<0 ? (100 * values[4] / max).to_i : 0), :color => '#078C00') %> <%= barchart(:width => 35, :percent => (values[4]>0 ? (100 * values[4] / max).to_i : 0), :color => '#cc0000') %> <% else %> <%= barchart(:width => 70, :percent => (100 * values[4] / max).to_i) %> <% end %> + <% end %> -- 2.39.5