Skip to content

Commit

Permalink
444-exporter-show-page (#542)
Browse files Browse the repository at this point in the history
* wip

* overzealous with the replace all

* showing works, file sets and collections on the exporter page, paginated by 30

* move work, collection and file set tabs on the im/exporter show pages into their own partials

* fix the file set entries tab file
  • Loading branch information
alishaevn authored Aug 4, 2022
1 parent 91f1b50 commit e1851e9
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 156 deletions.
4 changes: 3 additions & 1 deletion app/controllers/bulkrax/exporters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def show
add_exporter_breadcrumbs
add_breadcrumb @exporter.name

@work_entries = @exporter.entries.where(type: @exporter.parser.entry_class.to_s).page(params[:work_entries_page])
@work_entries = @exporter.entries.where(type: @exporter.parser.entry_class.to_s).page(params[:work_entries_page]).per(30)
@collection_entries = @exporter.entries.where(type: @exporter.parser.collection_entry_class.to_s).page(params[:collections_entries_page]).per(30)
@file_set_entries = @exporter.entries.where(type: @exporter.parser.file_set_entry_class.to_s).page(params[:file_set_entries_page]).per(30)
end

# GET /exporters/new
Expand Down
58 changes: 17 additions & 41 deletions app/views/bulkrax/exporters/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -87,49 +87,25 @@

<p class='bulkrax-p-align'><strong><%= t('bulkrax.exporter.labels.field_mapping') %>:</strong></p>

<p class='bulkrax-p-align'>
<strong><%= t('bulkrax.exporter.labels.total_work_entries') %>:</strong>
<%= @exporter.exporter_runs.last&.total_work_entries %>
<p class="bulkrax-p-align" title="<%= @exporter.last_run&.total_work_entries %> processed, <%= @exporter.last_run&.failed_records %> failed">
<strong>Total Entries:</strong>
<%= @exporter.last_run&.total_work_entries %>
</p>
<br>
<div class='bulkrax-nav-tab-table-left-align'>
<h2>Entries</h2>
<table class='table table-striped'>
<thead>
<tr>
<th>Identifier</th>
<th>Entry ID</th>
<th>Status</th>
<th>Errors</th>
<th>Status Set At</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @work_entries.each do |e| %>
<tr>
<td><%= link_to e.identifier, bulkrax.exporter_entry_path(@exporter.id, e.id) %></td>
<td><%= e.id %></td>
<% if e.status == 'Complete' %>
<td><span class='glyphicon glyphicon-ok' style='color: green;'></span> <%= e.status %></td>
<% elsif e.status == 'Pending' %>
<td><span class='glyphicon glyphicon-option-horizontal' style='color: blue;'></span> <%= e.status %></td>
<% else %>
<td><span class='glyphicon glyphicon-remove' style='color: red;'></span> <%= e.status %></td>
<% end %>
<% if e.last_error.present? %>
<td><%= link_to e.last_error.dig('error_class'), bulkrax.exporter_entry_path(@exporter.id, e.id) %></td>
<% else %>
<td></td>
<% end %>
<td><%= e.status_at %></td>
<td><%= link_to raw("<span class='glyphicon glyphicon-info-sign'></span>"), bulkrax.exporter_entry_path(@exporter.id, e.id) %></td>
</tr>
<% end %>
</tbody>
</table>
<%= page_entries_info(@work_entries) %><br>
<%= paginate(@work_entries, param_name: :work_entries_page) %>

<div class="bulkrax-nav-tab-bottom-margin">
<!-- Nav tabs -->
<ul class="bulkrax-nav-tab-top-margin tab-nav nav nav-tabs" role="tablist">
<li role="presentation" class='active'><a href="#work-entries" aria-controls="work-entries" role="tab" data-toggle="tab">Work Entries</a></li>
<li role="presentation"><a href="#collection-entries" aria-controls="collection-entries" role="tab" data-toggle="tab">Collection Entries</a></li>
<li role="presentation"><a href="#file-set-entries" aria-controls="file-set-entries" role="tab" data-toggle="tab">File Set Entries</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content outline">
<%= render partial: 'bulkrax/shared/work_entries_tab', locals: { item: @exporter, entries: @work_entries } %>
<%= render partial: 'bulkrax/shared/collection_entries_tab', locals: { item: @exporter, entries: @collection_entries } %>
<%= render partial: 'bulkrax/shared/file_set_entries_tab', locals: { item: @exporter, entries: @file_set_entries } %>
</div>
<br>
<%= link_to 'Edit', edit_exporter_path(@exporter) %>
|
Expand Down
117 changes: 3 additions & 114 deletions app/views/bulkrax/importers/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -80,120 +80,9 @@
</ul>
<!-- Tab panes -->
<div class="tab-content outline">
<div role="tabpanel" class="tab-pane active bulkrax-nav-tab-table-left-align" id="work-entries">
<table class='table table-striped'>
<thead>
<tr>
<th>Identifier</th>
<th>Entry ID</th>
<th>Status</th>
<th>Errors</th>
<th>Status Set At</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @work_entries.each do |e| %>
<tr>
<td><%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %></td>
<td><%= e.id %></td>
<% if e.status == "Complete" %>
<td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
<% elsif e.status == "Pending" %>
<td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
<% else %>
<td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
<% end %>
<% if e.last_error.present? %>
<td><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
<% else %>
<td></td>
<% end %>
<td><%= e.status_at %></td>
<td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
</tr>
<% end %>
</tbody>
</table>
<%= page_entries_info(@work_entries) %><br />
<%= paginate(@work_entries, theme: 'blacklight', param_name: :work_entries_page, params: { anchor: 'work-entries'}) %>
</div>
<div role="tabpanel" class="tab-pane bulkrax-nav-tab-table-left-align" id="collection-entries">
<table class='table table-striped'>
<thead>
<tr>
<th>Identifier</th>
<th>Entry ID</th>
<th>Status</th>
<th>Errors</th>
<th>Status Set At</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @collection_entries.each do |e| %>
<tr>
<td><%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %></td>
<td><%= e.id %></td>
<% if e.status == "Complete" %>
<td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
<% elsif e.status == "Pending" %>
<td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
<% else %>
<td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
<% end %>
<% if e.last_error.present? %>
<td><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
<% else %>
<td></td>
<% end %>
<td><%= e.status_at %></td>
<td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
</tr>
<% end %>
</tbody>
</table>
<%= page_entries_info(@collection_entries) %><br />
<%= paginate(@collection_entries, theme: 'blacklight', param_name: :collections_entries_page, params: {anchor: 'collection-entries'}) %>
</div>
<div role="tabpanel" class="tab-pane bulkrax-nav-tab-table-left-align" id="file-set-entries">
<table class='table table-striped'>
<thead>
<tr>
<th>Identifier</th>
<th>Entry ID</th>
<th>Status</th>
<th>Errors</th>
<th>Status Set At</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @file_set_entries.each do |e| %>
<tr>
<td><%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %></td>
<td><%= e.id %></td>
<% if e.status == "Complete" %>
<td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
<% elsif e.status == "Pending" %>
<td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
<% else %>
<td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
<% end %>
<% if e.last_error.present? %>
<td><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
<% else %>
<td></td>
<% end %>
<td><%= e.status_at %></td>
<td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
</tr>
<% end %>
</tbody>
</table>
<%= page_entries_info(@file_set_entries) %><br />
<%= paginate(@file_set_entries, theme: 'blacklight', param_name: :file_set_entries_page, params: {anchor: 'file-set-entries'}) %>
</div>
<%= render partial: 'bulkrax/shared/work_entries_tab', locals: { item: @importer, entries: @work_entries } %>
<%= render partial: 'bulkrax/shared/collection_entries_tab', locals: { item: @importer, entries: @collection_entries } %>
<%= render partial: 'bulkrax/shared/file_set_entries_tab', locals: { item: @importer, entries: @file_set_entries } %>
</div>
</div>

Expand Down
39 changes: 39 additions & 0 deletions app/views/bulkrax/shared/_collection_entries_tab.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div role="tabpanel" class="tab-pane bulkrax-nav-tab-table-left-align" id="collection-entries">
<table class='table table-striped'>
<thead>
<tr>
<th>Identifier</th>
<th>Entry ID</th>
<th>Status</th>
<th>Errors</th>
<th>Status Set At</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% entries.each do |e| %>
<% entry_path = item.class.to_s.include?('Importer') ? bulkrax.importer_entry_path(item.id, e.id) : bulkrax.exporter_entry_path(item.id, e.id) %>
<tr>
<td><%= link_to e.identifier, entry_path %></td>
<td><%= e.id %></td>
<% if e.status == "Complete" %>
<td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
<% elsif e.status == "Pending" %>
<td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
<% else %>
<td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
<% end %>
<% if e.last_error.present? %>
<td><%= link_to e.last_error.dig("error_class"), entry_path %></td>
<% else %>
<td></td>
<% end %>
<td><%= e.status_at %></td>
<td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), entry_path %></td>
</tr>
<% end %>
</tbody>
</table>
<%= page_entries_info(entries) %><br />
<%= paginate(entries, theme: 'blacklight', param_name: :collections_entries_page, params: { anchor: 'collection-entries' }) %>
</div>
39 changes: 39 additions & 0 deletions app/views/bulkrax/shared/_file_set_entries_tab.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div role="tabpanel" class="tab-pane bulkrax-nav-tab-table-left-align" id="file-set-entries">
<table class='table table-striped'>
<thead>
<tr>
<th>Identifier</th>
<th>Entry ID</th>
<th>Status</th>
<th>Errors</th>
<th>Status Set At</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% entries.each do |e| %>
<% entry_path = item.class.to_s.include?('Importer') ? bulkrax.importer_entry_path(item.id, e.id) : bulkrax.exporter_entry_path(item.id, e.id) %>
<tr>
<td><%= link_to e.identifier, bulkrax.importer_entry_path(item.id, e.id) %></td>
<td><%= e.id %></td>
<% if e.status == "Complete" %>
<td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
<% elsif e.status == "Pending" %>
<td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
<% else %>
<td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
<% end %>
<% if e.last_error.present? %>
<td><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(item.id, e.id) %></td>
<% else %>
<td></td>
<% end %>
<td><%= e.status_at %></td>
<td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), bulkrax.importer_entry_path(item.id, e.id) %></td>
</tr>
<% end %>
</tbody>
</table>
<%= page_entries_info(entries) %><br />
<%= paginate(entries, theme: 'blacklight', param_name: :file_set_entries_page, params: { anchor: 'file-set-entries' }) %>
</div>
39 changes: 39 additions & 0 deletions app/views/bulkrax/shared/_work_entries_tab.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div role="tabpanel" class="tab-pane active bulkrax-nav-tab-table-left-align" id="work-entries">
<table class='table table-striped'>
<thead>
<tr>
<th>Identifier</th>
<th>Entry ID</th>
<th>Status</th>
<th>Errors</th>
<th>Status Set At</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% entries.each do |e| %>
<% entry_path = item.class.to_s.include?('Importer') ? bulkrax.importer_entry_path(item.id, e.id) : bulkrax.exporter_entry_path(item.id, e.id) %>
<tr>
<td><%= link_to e.identifier, entry_path %></td>
<td><%= e.id %></td>
<% if e.status == "Complete" %>
<td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
<% elsif e.status == "Pending" %>
<td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
<% else %>
<td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
<% end %>
<% if e.last_error.present? %>
<td><%= link_to e.last_error.dig("error_class"), entry_path %></td>
<% else %>
<td></td>
<% end %>
<td><%= e.status_at %></td>
<td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), entry_path %></td>
</tr>
<% end %>
</tbody>
</table>
<%= page_entries_info(entries) %><br />
<%= paginate(entries, theme: 'blacklight', param_name: :work_entries_page, params: { anchor: 'work-entries' }) %>
</div>

0 comments on commit e1851e9

Please sign in to comment.