Skip to content

Commit

Permalink
Refs #31147 - Correct coloring of zero metrics in report overviews
Browse files Browse the repository at this point in the history
pr #8118 changed to the use of strings for these metrics.
This made the comparison with the integer of 0 fail, resulting in all
metrics being colord even if they were 0

That same pr also failed to apply this change to the reports widget,
which is updated here to have the same behaviour as the
config_reports/_list view
  • Loading branch information
Simon Peeters committed Mar 18, 2021
1 parent 8074699 commit bc330c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/helpers/reports_helper.rb
Expand Up @@ -7,7 +7,7 @@ def reported_at_column(record)
end

def report_event_column(event, style = "")
style = "label-default" if event == 0
style = "label-default" if event.to_i == 0
content_tag(:span, event, :class => 'label ' + style)
end

Expand Down
12 changes: 6 additions & 6 deletions app/views/dashboard/_reports_widget.html.erb
Expand Up @@ -12,12 +12,12 @@
<% @data.latest_events.each do |report| %>
<tr>
<td class='ellipsis'><%= link_to report.host, host_config_reports_path(report.host) %></td>
<td class="ca"><%= report_event_column(report.applied, "label-info") %></td>
<td class="ca"><%= report_event_column(report.restarted, "label-info") %></td>
<td class="ca"><%= report_event_column(report.failed, "label-danger") %></td>
<td class="ca"><%= report_event_column(report.failed_restarts, "label-warning") %></td>
<td class="ca"><%= report_event_column(report.skipped, "label-info") %></td>
<td class="ca"><%= report_event_column(report.pending, "label-info") %></td>
<td class="ca"><%= report_event_column(report.applied_s, "label-info") %></td>
<td class="ca"><%= report_event_column(report.restarted_s, "label-info") %></td>
<td class="ca"><%= report_event_column(report.failed_s, "label-danger") %></td>
<td class="ca"><%= report_event_column(report.failed_restarts_s, "label-warning") %></td>
<td class="ca"><%= report_event_column(report.skipped_s, "label-info") %></td>
<td class="ca"><%= report_event_column(report.pending_s, "label-info") %></td>
</tr>
<% end %>
</tbody>
Expand Down

0 comments on commit bc330c4

Please sign in to comment.