]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2036 Violations widget: do not display bar charts when no violations
authorsimonbrandhof <simon.brandhof@gmail.com>
Tue, 7 Dec 2010 00:27:43 +0000 (00:27 +0000)
committersimonbrandhof <simon.brandhof@gmail.com>
Tue, 7 Dec 2010 00:27:43 +0000 (00:27 +0000)
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb

index 8875bed9ffd085282f6b6165dd656a82e72a8ab6..63d343b3c55b1f539b4989d6c0b86709277097e2 100644 (file)
                                  <%= 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>
                                  <%= 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>
                                  <%= 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>
                                  <%= 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>
                                  <%= 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>