UNC-Libraries/hy-c

View on GitHub
app/views/ingest_from_ftp/view_status.html.erb

Summary

Maintainability
Test Coverage
<% provide :page_header do %>
  <h1><i class="fa fa-check-circle-o" aria-hidden="true"></i> Ingest status from <%= @source %></h1>
<% end %>

<div class="row">
  <div class="col-md-12 tabs">
    <div class="card">
      <div class="card-body">
        <h2 class="sr-only">Ingest Status from <%= @source %> </h2>
        <%= link_to "Return to list of #{@source} packages", main_app.ingest_from_ftp_path(source: @source), class: 'btn btn-secondary'%>
        <table class="table table-sm table-striped works-list mt-4">
          <thead>
            <tr>
              <th>Package</th>
              <th>Status</th>
              <th>Error</th>
              <th>Status Set At</th>
            </tr>
          </thead>
          <tbody>
            <% @status_results.each_with_index do |(filename, entry), index| %>
              <tr>
                <td>
                  <%= filename %>
                </td>
                <td>
                  <%= entry['status'] %>
                </td>
                <td>
                  <% if entry['error'].present? %>
                    <%= link_to 'View errors', "#status_error_#{index}", 'data-toggle' => 'modal' %>
                    <div class="modal fade" id="status_error_<%= index %>" tabindex="-1" role="dialog" aria-labelledby="select-collectiontype-label">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close error"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title">Errors for <%= filename %></h4>
                          </div>
                          <div class="modal-body">
                            <% entry['error'].each do |error| %>
                              <h4><%= error['message'] %></h4>
                              <% if error['trace'] %>
                                <% error['trace'].each do |line| %>
                                  <%= line %><br>
                                <% end %>
                              <% end %>
                            <% end %>
                          </div>
                        </div>
                      </div>
                    </div>
                  <% end %>
                </td>
                <td>
                  <%= entry['status_timestamp'].to_time.utc %>
                </td>
              </tr>
            <% end %>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>