diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-07 00:27:43 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-07 00:27:43 +0000 |
commit | e7f28d7e03372df42eb550a319afeac76c19156e (patch) | |
tree | 88cc75507c434d1529cf1d5d4f89a479974dae80 | |
parent | e3ff6041790b4f9ad4bbbc3d29cb9efa8c70d45d (diff) | |
download | sonarqube-e7f28d7e03372df42eb550a319afeac76c19156e.tar.gz sonarqube-e7f28d7e03372df42eb550a319afeac76c19156e.zip |
SONAR-2036 Violations widget: do not display bar charts when no violations
-rw-r--r-- | plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb | 10 |
1 files changed, 10 insertions, 0 deletions
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) -%> </td> <td align="left" style="padding-bottom:2px; padding-top:2px;"> + <% 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 %> </td> </tr> <tr> @@ -66,12 +68,14 @@ <%= dashboard_configuration.variation? ? format_variation(critical_violations) : trend_icon(critical_violations, :empty => true) -%> </td> <td align="left" style="padding-bottom:2px; padding-top:2px;"> + <% 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 %> </td> </tr> <tr> @@ -84,12 +88,14 @@ <%= dashboard_configuration.variation? ? format_variation(major_violations) : trend_icon(major_violations, :empty => true) -%> </td> <td align="left" style="padding-bottom:2px; padding-top:2px;"> + <% 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 %> </td> </tr> <tr> @@ -102,12 +108,14 @@ <%= dashboard_configuration.variation? ? format_variation(minor_violations) : trend_icon(minor_violations, :empty => true) -%> </td> <td align="left" style="padding-bottom:2px; padding-top:2px;"> + <% 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 %> </td> </tr> <tr> @@ -120,12 +128,14 @@ <%= dashboard_configuration.variation? ? format_variation(info_violations) : trend_icon(info_violations, :empty => true) -%> </td> <td align="left" style="padding-bottom:2px; padding-top:2px;"> + <% 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 %> </td> </tr> </table> |