Project

General

Profile

Feature #1647

Allow reports to be configured so only last report (per host) is displayed

Added by Adam Kosmin about 10 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Reporting
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Of course, this should be optional. Here's my nasty hack to app/views/reports/_list.html.erb which gets the job done for me despite being hard-coded. Ideally, this would be a configuration option somewhere in the roles scope.

<% firsts = [] %>
  <% @reports.each do |report| %>
    <% unless firsts.include?(report.host) %>
      <% firsts << report.host %>
      <tr>
        <% unless params[:host_id] -%>
          <td><%= link_to h(report.host), host_reports_path(report.host) %></td>
        <% end -%>
        <td><%= reported_at_column(report) %></td>
        <td><%= report_event_column(report.applied, "notice") %></td>
        <td><%= report_event_column(report.restarted, "notice") %></td>
        <td><%= report_event_column(report.failed, "important") %></td>
        <td><%= report_event_column(report.failed_restarts, "warning") %></td>
        <td><%= report_event_column(report.skipped, "notice") %></td>
        <td align="right">
          <%= display_link_if_authorized "Destroy", hash_for_report_path(:id => report.id, :auth_action => :destroy), :confirm => "Delete report for #{report.host.name}?", :method => :delete %>
        </td>
      </tr>
    <% end %>
  <% end %>
</table>
<%= will_paginate @reports %>

Also available in: Atom PDF