bulkrax 4.1.1 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e466ce0a1d1fe4b2c3baa9a6a5356b0138b5e7c1f2e1b88a7d17b852257f6b46
4
- data.tar.gz: 52b585cd22870e2b4d586b3848cd48f8106f39a54341bc2aeba91a05079b9f0e
3
+ metadata.gz: 1c636e3c53228a9cd6f2d45356f10b2339265f5f3f11b32bd6e523a01388b60b
4
+ data.tar.gz: 6eeb6679cc8e93f77926baa30f91b09c9cea173d7d4135c2be9e865b558d5056
5
5
  SHA512:
6
- metadata.gz: cbb4169d6956f98f3b27ac143f0f16f6ac1adb86fa66a7819fad73f28d45ba5a8578b306de8d4319112a2bf1e4b4edb4aeb3b149abfa0bd840b4eb19a1aa4172
7
- data.tar.gz: b06a77c964f82d2fa17b8cde3cff5413ceb0e9ab21eb9b7e0c299d6b42a3217308fc497474151f6b51022b7d2a48b2b2af4262a7d97941038aa6505b32e053d4
6
+ metadata.gz: 389a8059749407dc1a6d9326e60131934b9729aaf33f1a4802c72255550fdf7e71ad874c88969e244dccf81e80ad95eb09e30179425fb1313fc2383d7f7adc7a
7
+ data.tar.gz: c58567026f654f0577377babd2311f537c3155f6c71833255d13730dc32eed51ec9a0708f0283b925e09945b59d338a14ffdb9945e0375de5ff7be120ed62559
@@ -47,6 +47,7 @@ function prepBulkrax(event) {
47
47
  var config = { childList: true, attributes: true };
48
48
  var callback = function(mutationsList) {
49
49
  for(var mutation of mutationsList) {
50
+
50
51
  if (mutation.type == 'childList') {
51
52
  browseButton = document.getElementById('browse');
52
53
  var exp = /selected_files\[[0-9]*\]\[url\]/
@@ -119,10 +120,35 @@ function handleParserKlass() {
119
120
  $('.parser_fields').append(window[parser_klass.data('partial')])
120
121
  }
121
122
 
123
+ handleBrowseEverything()
122
124
  var file_path_value = $('#importer_parser_fields_import_file_path').val()
123
125
  handleFileToggle(file_path_value)
124
126
  }
125
127
 
128
+ function handleBrowseEverything(){
129
+ var button = $("button[data-toggle='browse-everything']")
130
+ if(button.length == 0) { return; }
131
+ button.browseEverything({
132
+ route: button.data('route'),
133
+ target: button.data('target')
134
+ }).done(function(data) {
135
+ var evt = { isDefaultPrevented: function() { return false; } };
136
+ $('.ev-browser.show').removeClass('show')
137
+ if($('#fileupload').length > 0) {
138
+ var files = $.map(data, function(d) { return { name: d.file_name, size: d.file_size, id: d.url } });
139
+ $.blueimp.fileupload.prototype.options.done.call($('#fileupload').fileupload(), evt, { result: { files: files }});
140
+ }
141
+ return true
142
+ // User has submitted files; data contains an array of URLs and their options
143
+ }).cancel(function() {
144
+ $('.ev-browser.show').removeClass('show')
145
+ // User cancelled the browse operation
146
+ }).fail(function(status, error, text) {
147
+ $('.ev-browser.show').removeClass('show')
148
+ // URL retrieval experienced a technical failure
149
+ });
150
+ }
151
+
126
152
  function handleSourceLoad(refresh_button, base_url, external_set_select) {
127
153
  if (base_url.val() == "") { // ignore empty base_url value
128
154
  return
@@ -163,4 +189,4 @@ function setError(selector, error) {
163
189
  selector.attr('disabled', true)
164
190
  }
165
191
 
166
- $(document).on({'ready': prepBulkrax, 'turbolinks:load': prepBulkrax})
192
+ $(document).on({'ready': prepBulkrax, 'turbolinks:load': prepBulkrax})
@@ -22,7 +22,9 @@ module Bulkrax
22
22
  add_exporter_breadcrumbs
23
23
  add_breadcrumb @exporter.name
24
24
 
25
- @work_entries = @exporter.entries.where(type: @exporter.parser.entry_class.to_s).page(params[:work_entries_page])
25
+ @work_entries = @exporter.entries.where(type: @exporter.parser.entry_class.to_s).page(params[:work_entries_page]).per(30)
26
+ @collection_entries = @exporter.entries.where(type: @exporter.parser.collection_entry_class.to_s).page(params[:collections_entries_page]).per(30)
27
+ @file_set_entries = @exporter.entries.where(type: @exporter.parser.file_set_entry_class.to_s).page(params[:file_set_entries_page]).per(30)
26
28
  end
27
29
 
28
30
  # GET /exporters/new
@@ -12,7 +12,8 @@ module Bulkrax
12
12
  def perform(entry_id, importer_run_id)
13
13
  @importer_run_id = importer_run_id
14
14
  entry = Entry.find(entry_id)
15
- parent_identifier = entry.raw_metadata[entry.related_parents_raw_mapping]&.strip
15
+ # e.g. "parents" or "parents_1"
16
+ parent_identifier = (entry.raw_metadata[entry.related_parents_raw_mapping] || entry.raw_metadata["#{entry.related_parents_raw_mapping}_1"])&.strip
16
17
 
17
18
  validate_parent!(parent_identifier)
18
19
 
@@ -57,7 +58,7 @@ module Bulkrax
57
58
  end
58
59
 
59
60
  def check_parent_exists!(parent_identifier)
60
- raise MissingParentError, %(Unable to find a record with the identifier "#{parent_identifier}") if parent_record.blank?
61
+ raise MissingParentError, %(Unable to find a record with the identifier "#{parent_identifier}") if parent_record.nil?
61
62
  end
62
63
 
63
64
  def check_parent_is_a_work!(parent_identifier)
@@ -66,8 +67,7 @@ module Bulkrax
66
67
  end
67
68
 
68
69
  def find_parent_record(parent_identifier)
69
- @parent_record ||= find_record(parent_identifier, importer_run_id)
70
- @parent_record = parent_record.last if parent_record.is_a? Array
70
+ _, @parent_record = find_record(parent_identifier, importer_run_id)
71
71
  end
72
72
  end
73
73
  end
@@ -112,12 +112,16 @@ module Bulkrax
112
112
  end
113
113
 
114
114
  def build_files_metadata
115
- file_mapping = key_for_export('file')
116
- file_sets = hyrax_record.file_set? ? Array.wrap(hyrax_record) : hyrax_record.file_sets
117
- filenames = map_file_sets(file_sets)
115
+ # attaching files to the FileSet row only so we don't have duplicates when importing to a new tenant
116
+ if hyrax_record.work?
117
+ build_thumbnail_files
118
+ else
119
+ file_mapping = key_for_export('file')
120
+ file_sets = hyrax_record.file_set? ? Array.wrap(hyrax_record) : hyrax_record.file_sets
121
+ filenames = map_file_sets(file_sets)
118
122
 
119
- handle_join_on_export(file_mapping, filenames, mapping['file']&.[]('join')&.present?)
120
- build_thumbnail_files if hyrax_record.work?
123
+ handle_join_on_export(file_mapping, filenames, mapping['file']&.[]('join')&.present?)
124
+ end
121
125
  end
122
126
 
123
127
  def build_relationship_metadata
@@ -134,7 +134,9 @@ module Bulkrax
134
134
 
135
135
  # Base path for imported and exported files
136
136
  def base_path(type = 'import')
137
- ENV['HYKU_MULTITENANT'] ? File.join(Bulkrax.send("#{type}_path"), Site.instance.account.name) : Bulkrax.send("#{type}_path")
137
+ # account for multiple versions of hyku
138
+ is_multitenant = ENV['HYKU_MULTITENANT'] == 'true' || ENV['SETTINGS__MULTITENANCY__ENABLED'] == 'true'
139
+ is_multitenant ? File.join(Bulkrax.send("#{type}_path"), ::Site.instance.account.name) : Bulkrax.send("#{type}_path")
138
140
  end
139
141
 
140
142
  # Path where we'll store the import metadata and files
@@ -264,6 +266,8 @@ module Bulkrax
264
266
 
265
267
  Dir["#{exporter_export_path}/**"].each do |folder|
266
268
  zip_path = "#{exporter_export_zip_path.split('/').last}_#{folder.split('/').last}.zip"
269
+ FileUtils.rm_rf("#{exporter_export_zip_path}/#{zip_path}")
270
+
267
271
  Zip::File.open(File.join("#{exporter_export_zip_path}/#{zip_path}"), create: true) do |zip_file|
268
272
  Dir["#{folder}/**/**"].each do |file|
269
273
  zip_file.add(file.sub("#{folder}/", ''), file)
@@ -134,7 +134,8 @@ module Bulkrax
134
134
 
135
135
  record.file_sets.each do |fs|
136
136
  file_name = filename(fs)
137
- next if file_name.blank?
137
+ next if file_name.blank? || fs.original_file.blank?
138
+
138
139
  io = open(fs.original_file.uri)
139
140
  file = Tempfile.new([file_name, File.extname(file_name)], binmode: true)
140
141
  file.write(io.read)
@@ -200,14 +200,14 @@ module Bulkrax
200
200
  # get the parent collection and child collections
201
201
  @collection_ids = ActiveFedora::SolrService.query("id:#{importerexporter.export_source} #{extra_filters}", method: :post, rows: 2_147_483_647).map(&:id)
202
202
  @collection_ids += ActiveFedora::SolrService.query("has_model_ssim:Collection AND member_of_collection_ids_ssim:#{importerexporter.export_source}", method: :post, rows: 2_147_483_647).map(&:id)
203
+ find_child_file_sets(@work_ids)
203
204
  when 'worktype'
204
205
  @work_ids = ActiveFedora::SolrService.query("has_model_ssim:#{importerexporter.export_source + extra_filters}", method: :post, rows: 2_000_000_000).map(&:id)
206
+ find_child_file_sets(@work_ids)
205
207
  when 'importer'
206
208
  set_ids_for_exporting_from_importer
207
209
  end
208
210
 
209
- find_child_file_sets(@work_ids) if importerexporter.export_from == 'collection'
210
-
211
211
  @work_ids + @collection_ids + @file_set_ids
212
212
  end
213
213
  # rubocop:enable Metrics/AbcSize
@@ -283,6 +283,10 @@ module Bulkrax
283
283
  CsvFileSetEntry
284
284
  end
285
285
 
286
+ def valid_entry_types
287
+ ['Bulkrax::CsvCollectionEntry', 'Bulkrax::CsvFileSetEntry', 'Bulkrax::CsvEntry']
288
+ end
289
+
286
290
  # TODO: figure out why using the version of this method that's in the bagit parser
287
291
  # breaks specs for the "if importer?" line
288
292
  def total
@@ -325,6 +329,7 @@ module Bulkrax
325
329
  require 'open-uri'
326
330
  folder_count = 0
327
331
  sorted_entries = sort_entries(importerexporter.entries.uniq(&:identifier))
332
+ .select { |e| valid_entry_types.include?(e.type) }
328
333
 
329
334
  sorted_entries[0..limit || total].in_groups_of(records_split_count, false) do |group|
330
335
  folder_count += 1
@@ -342,20 +347,24 @@ module Bulkrax
342
347
 
343
348
  def store_files(identifier, folder_count)
344
349
  record = ActiveFedora::Base.find(identifier)
350
+ return unless record
351
+
345
352
  file_sets = record.file_set? ? Array.wrap(record) : record.file_sets
346
353
  file_sets << record.thumbnail if exporter.include_thumbnails && record.thumbnail.present? && record.work?
347
354
  file_sets.each do |fs|
348
355
  path = File.join(exporter_export_path, folder_count, 'files')
349
356
  FileUtils.mkdir_p(path) unless File.exist? path
350
357
  file = filename(fs)
351
- io = open(fs.original_file.uri)
352
- next if file.blank?
358
+ next if file.blank? || fs.original_file.blank?
353
359
 
360
+ io = open(fs.original_file.uri)
354
361
  File.open(File.join(path, file), 'wb') do |f|
355
362
  f.write(io.read)
356
363
  f.close
357
364
  end
358
365
  end
366
+ rescue Ldp::Gone
367
+ return
359
368
  end
360
369
 
361
370
  def export_key_allowed(key)
@@ -391,12 +400,12 @@ module Bulkrax
391
400
  # always export models in the same order: work, collection, file set
392
401
  entries.sort_by do |entry|
393
402
  case entry.type
394
- when 'Bulkrax::CsvEntry'
395
- '0'
396
403
  when 'Bulkrax::CsvCollectionEntry'
397
404
  '1'
398
405
  when 'Bulkrax::CsvFileSetEntry'
399
406
  '2'
407
+ else
408
+ '0'
400
409
  end
401
410
  end
402
411
  end
@@ -446,9 +455,10 @@ module Bulkrax
446
455
  def path_to_files(**args)
447
456
  filename = args.fetch(:filename, '')
448
457
 
449
- @path_to_files ||= File.join(
450
- zip? ? importer_unzip_path : File.dirname(import_file_path), 'files', filename
451
- )
458
+ return @path_to_files if @path_to_files.present? && filename.blank?
459
+ @path_to_files = File.join(
460
+ zip? ? importer_unzip_path : File.dirname(import_file_path), 'files', filename
461
+ )
452
462
  end
453
463
 
454
464
  private
@@ -87,49 +87,25 @@
87
87
 
88
88
  <p class='bulkrax-p-align'><strong><%= t('bulkrax.exporter.labels.field_mapping') %>:</strong></p>
89
89
 
90
- <p class='bulkrax-p-align'>
91
- <strong><%= t('bulkrax.exporter.labels.total_work_entries') %>:</strong>
92
- <%= @exporter.exporter_runs.last&.total_work_entries %>
90
+ <p class="bulkrax-p-align" title="<%= @exporter.last_run&.total_work_entries %> processed, <%= @exporter.last_run&.failed_records %> failed">
91
+ <strong>Total Entries:</strong>
92
+ <%= @exporter.last_run&.total_work_entries %>
93
93
  </p>
94
94
  <br>
95
- <div class='bulkrax-nav-tab-table-left-align'>
96
- <h2>Entries</h2>
97
- <table class='table table-striped'>
98
- <thead>
99
- <tr>
100
- <th>Identifier</th>
101
- <th>Entry ID</th>
102
- <th>Status</th>
103
- <th>Errors</th>
104
- <th>Status Set At</th>
105
- <th>Actions</th>
106
- </tr>
107
- </thead>
108
- <tbody>
109
- <% @work_entries.each do |e| %>
110
- <tr>
111
- <td><%= link_to e.identifier, bulkrax.exporter_entry_path(@exporter.id, e.id) %></td>
112
- <td><%= e.id %></td>
113
- <% if e.status == 'Complete' %>
114
- <td><span class='glyphicon glyphicon-ok' style='color: green;'></span> <%= e.status %></td>
115
- <% elsif e.status == 'Pending' %>
116
- <td><span class='glyphicon glyphicon-option-horizontal' style='color: blue;'></span> <%= e.status %></td>
117
- <% else %>
118
- <td><span class='glyphicon glyphicon-remove' style='color: red;'></span> <%= e.status %></td>
119
- <% end %>
120
- <% if e.last_error.present? %>
121
- <td><%= link_to e.last_error.dig('error_class'), bulkrax.exporter_entry_path(@exporter.id, e.id) %></td>
122
- <% else %>
123
- <td></td>
124
- <% end %>
125
- <td><%= e.status_at %></td>
126
- <td><%= link_to raw("<span class='glyphicon glyphicon-info-sign'></span>"), bulkrax.exporter_entry_path(@exporter.id, e.id) %></td>
127
- </tr>
128
- <% end %>
129
- </tbody>
130
- </table>
131
- <%= page_entries_info(@work_entries) %><br>
132
- <%= paginate(@work_entries, param_name: :work_entries_page) %>
95
+
96
+ <div class="bulkrax-nav-tab-bottom-margin">
97
+ <!-- Nav tabs -->
98
+ <ul class="bulkrax-nav-tab-top-margin tab-nav nav nav-tabs" role="tablist">
99
+ <li role="presentation" class='active'><a href="#work-entries" aria-controls="work-entries" role="tab" data-toggle="tab">Work Entries</a></li>
100
+ <li role="presentation"><a href="#collection-entries" aria-controls="collection-entries" role="tab" data-toggle="tab">Collection Entries</a></li>
101
+ <li role="presentation"><a href="#file-set-entries" aria-controls="file-set-entries" role="tab" data-toggle="tab">File Set Entries</a></li>
102
+ </ul>
103
+ <!-- Tab panes -->
104
+ <div class="tab-content outline">
105
+ <%= render partial: 'bulkrax/shared/work_entries_tab', locals: { item: @exporter, entries: @work_entries } %>
106
+ <%= render partial: 'bulkrax/shared/collection_entries_tab', locals: { item: @exporter, entries: @collection_entries } %>
107
+ <%= render partial: 'bulkrax/shared/file_set_entries_tab', locals: { item: @exporter, entries: @file_set_entries } %>
108
+ </div>
133
109
  <br>
134
110
  <%= link_to 'Edit', edit_exporter_path(@exporter) %>
135
111
  |
@@ -4,7 +4,7 @@
4
4
 
5
5
  <div class="row">
6
6
  <div class="col-md-12">
7
- <div class="panel panel-default tabs">
7
+ <div class="panel panel-default tabs importer-form">
8
8
 
9
9
  <%= simple_form_for @importer, html: { multipart: true } do |form| %>
10
10
  <%= render 'form', importer: @importer, form: form %>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <div class="row">
6
6
  <div class="col-md-12">
7
- <div class="panel panel-default tabs">
7
+ <div class="panel panel-default tabs importer-form">
8
8
  <%= simple_form_for @importer, html: { multipart: true } do |form| %>
9
9
  <%= render 'form', importer: @importer, form: form %>
10
10
  <div class="panel-footer">
@@ -80,120 +80,9 @@
80
80
  </ul>
81
81
  <!-- Tab panes -->
82
82
  <div class="tab-content outline">
83
- <div role="tabpanel" class="tab-pane active bulkrax-nav-tab-table-left-align" id="work-entries">
84
- <table class='table table-striped'>
85
- <thead>
86
- <tr>
87
- <th>Identifier</th>
88
- <th>Entry ID</th>
89
- <th>Status</th>
90
- <th>Errors</th>
91
- <th>Status Set At</th>
92
- <th>Actions</th>
93
- </tr>
94
- </thead>
95
- <tbody>
96
- <% @work_entries.each do |e| %>
97
- <tr>
98
- <td><%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %></td>
99
- <td><%= e.id %></td>
100
- <% if e.status == "Complete" %>
101
- <td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
102
- <% elsif e.status == "Pending" %>
103
- <td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
104
- <% else %>
105
- <td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
106
- <% end %>
107
- <% if e.last_error.present? %>
108
- <td><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
109
- <% else %>
110
- <td></td>
111
- <% end %>
112
- <td><%= e.status_at %></td>
113
- <td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
114
- </tr>
115
- <% end %>
116
- </tbody>
117
- </table>
118
- <%= page_entries_info(@work_entries) %><br />
119
- <%= paginate(@work_entries, theme: 'blacklight', param_name: :work_entries_page, params: { anchor: 'work-entries'}) %>
120
- </div>
121
- <div role="tabpanel" class="tab-pane bulkrax-nav-tab-table-left-align" id="collection-entries">
122
- <table class='table table-striped'>
123
- <thead>
124
- <tr>
125
- <th>Identifier</th>
126
- <th>Entry ID</th>
127
- <th>Status</th>
128
- <th>Errors</th>
129
- <th>Status Set At</th>
130
- <th>Actions</th>
131
- </tr>
132
- </thead>
133
- <tbody>
134
- <% @collection_entries.each do |e| %>
135
- <tr>
136
- <td><%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %></td>
137
- <td><%= e.id %></td>
138
- <% if e.status == "Complete" %>
139
- <td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
140
- <% elsif e.status == "Pending" %>
141
- <td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
142
- <% else %>
143
- <td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
144
- <% end %>
145
- <% if e.last_error.present? %>
146
- <td><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
147
- <% else %>
148
- <td></td>
149
- <% end %>
150
- <td><%= e.status_at %></td>
151
- <td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
152
- </tr>
153
- <% end %>
154
- </tbody>
155
- </table>
156
- <%= page_entries_info(@collection_entries) %><br />
157
- <%= paginate(@collection_entries, theme: 'blacklight', param_name: :collections_entries_page, params: {anchor: 'collection-entries'}) %>
158
- </div>
159
- <div role="tabpanel" class="tab-pane bulkrax-nav-tab-table-left-align" id="file-set-entries">
160
- <table class='table table-striped'>
161
- <thead>
162
- <tr>
163
- <th>Identifier</th>
164
- <th>Entry ID</th>
165
- <th>Status</th>
166
- <th>Errors</th>
167
- <th>Status Set At</th>
168
- <th>Actions</th>
169
- </tr>
170
- </thead>
171
- <tbody>
172
- <% @file_set_entries.each do |e| %>
173
- <tr>
174
- <td><%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %></td>
175
- <td><%= e.id %></td>
176
- <% if e.status == "Complete" %>
177
- <td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
178
- <% elsif e.status == "Pending" %>
179
- <td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
180
- <% else %>
181
- <td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
182
- <% end %>
183
- <% if e.last_error.present? %>
184
- <td><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
185
- <% else %>
186
- <td></td>
187
- <% end %>
188
- <td><%= e.status_at %></td>
189
- <td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), bulkrax.importer_entry_path(@importer.id, e.id) %></td>
190
- </tr>
191
- <% end %>
192
- </tbody>
193
- </table>
194
- <%= page_entries_info(@file_set_entries) %><br />
195
- <%= paginate(@file_set_entries, theme: 'blacklight', param_name: :file_set_entries_page, params: {anchor: 'file-set-entries'}) %>
196
- </div>
83
+ <%= render partial: 'bulkrax/shared/work_entries_tab', locals: { item: @importer, entries: @work_entries } %>
84
+ <%= render partial: 'bulkrax/shared/collection_entries_tab', locals: { item: @importer, entries: @collection_entries } %>
85
+ <%= render partial: 'bulkrax/shared/file_set_entries_tab', locals: { item: @importer, entries: @file_set_entries } %>
197
86
  </div>
198
87
  </div>
199
88
 
@@ -0,0 +1,39 @@
1
+ <div role="tabpanel" class="tab-pane bulkrax-nav-tab-table-left-align" id="collection-entries">
2
+ <table class='table table-striped'>
3
+ <thead>
4
+ <tr>
5
+ <th>Identifier</th>
6
+ <th>Entry ID</th>
7
+ <th>Status</th>
8
+ <th>Errors</th>
9
+ <th>Status Set At</th>
10
+ <th>Actions</th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <% entries.each do |e| %>
15
+ <% entry_path = item.class.to_s.include?('Importer') ? bulkrax.importer_entry_path(item.id, e.id) : bulkrax.exporter_entry_path(item.id, e.id) %>
16
+ <tr>
17
+ <td><%= link_to e.identifier, entry_path %></td>
18
+ <td><%= e.id %></td>
19
+ <% if e.status == "Complete" %>
20
+ <td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
21
+ <% elsif e.status == "Pending" %>
22
+ <td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
23
+ <% else %>
24
+ <td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
25
+ <% end %>
26
+ <% if e.last_error.present? %>
27
+ <td><%= link_to e.last_error.dig("error_class"), entry_path %></td>
28
+ <% else %>
29
+ <td></td>
30
+ <% end %>
31
+ <td><%= e.status_at %></td>
32
+ <td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), entry_path %></td>
33
+ </tr>
34
+ <% end %>
35
+ </tbody>
36
+ </table>
37
+ <%= page_entries_info(entries) %><br />
38
+ <%= paginate(entries, theme: 'blacklight', param_name: :collections_entries_page, params: { anchor: 'collection-entries' }) %>
39
+ </div>
@@ -0,0 +1,39 @@
1
+ <div role="tabpanel" class="tab-pane bulkrax-nav-tab-table-left-align" id="file-set-entries">
2
+ <table class='table table-striped'>
3
+ <thead>
4
+ <tr>
5
+ <th>Identifier</th>
6
+ <th>Entry ID</th>
7
+ <th>Status</th>
8
+ <th>Errors</th>
9
+ <th>Status Set At</th>
10
+ <th>Actions</th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <% entries.each do |e| %>
15
+ <% entry_path = item.class.to_s.include?('Importer') ? bulkrax.importer_entry_path(item.id, e.id) : bulkrax.exporter_entry_path(item.id, e.id) %>
16
+ <tr>
17
+ <td><%= link_to e.identifier, bulkrax.importer_entry_path(item.id, e.id) %></td>
18
+ <td><%= e.id %></td>
19
+ <% if e.status == "Complete" %>
20
+ <td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
21
+ <% elsif e.status == "Pending" %>
22
+ <td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
23
+ <% else %>
24
+ <td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
25
+ <% end %>
26
+ <% if e.last_error.present? %>
27
+ <td><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(item.id, e.id) %></td>
28
+ <% else %>
29
+ <td></td>
30
+ <% end %>
31
+ <td><%= e.status_at %></td>
32
+ <td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), bulkrax.importer_entry_path(item.id, e.id) %></td>
33
+ </tr>
34
+ <% end %>
35
+ </tbody>
36
+ </table>
37
+ <%= page_entries_info(entries) %><br />
38
+ <%= paginate(entries, theme: 'blacklight', param_name: :file_set_entries_page, params: { anchor: 'file-set-entries' }) %>
39
+ </div>
@@ -0,0 +1,39 @@
1
+ <div role="tabpanel" class="tab-pane active bulkrax-nav-tab-table-left-align" id="work-entries">
2
+ <table class='table table-striped'>
3
+ <thead>
4
+ <tr>
5
+ <th>Identifier</th>
6
+ <th>Entry ID</th>
7
+ <th>Status</th>
8
+ <th>Errors</th>
9
+ <th>Status Set At</th>
10
+ <th>Actions</th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <% entries.each do |e| %>
15
+ <% entry_path = item.class.to_s.include?('Importer') ? bulkrax.importer_entry_path(item.id, e.id) : bulkrax.exporter_entry_path(item.id, e.id) %>
16
+ <tr>
17
+ <td><%= link_to e.identifier, entry_path %></td>
18
+ <td><%= e.id %></td>
19
+ <% if e.status == "Complete" %>
20
+ <td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
21
+ <% elsif e.status == "Pending" %>
22
+ <td><span class="glyphicon glyphicon-option-horizontal" style="color: blue;"></span> <%= e.status %></td>
23
+ <% else %>
24
+ <td><span class="glyphicon glyphicon-remove" style="color: <%= e.status == 'Deleted' ? 'green' : 'red' %>;"></span> <%= e.status %></td>
25
+ <% end %>
26
+ <% if e.last_error.present? %>
27
+ <td><%= link_to e.last_error.dig("error_class"), entry_path %></td>
28
+ <% else %>
29
+ <td></td>
30
+ <% end %>
31
+ <td><%= e.status_at %></td>
32
+ <td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), entry_path %></td>
33
+ </tr>
34
+ <% end %>
35
+ </tbody>
36
+ </table>
37
+ <%= page_entries_info(entries) %><br />
38
+ <%= paginate(entries, theme: 'blacklight', param_name: :work_entries_page, params: { anchor: 'work-entries' }) %>
39
+ </div>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bulkrax
4
- VERSION = '4.1.1'
4
+ VERSION = '4.3.0'
5
5
  end
@@ -3,28 +3,27 @@
3
3
  namespace :bulkrax do
4
4
  desc "Remove old exported zips and create new ones with the new file structure"
5
5
  task rerun_all_exporters: :environment do
6
+ # delete the existing folders and zip files
7
+ Dir["tmp/exports/**"].each { |file| FileUtils.rm_rf(file) }
8
+
6
9
  if defined?(::Hyku)
7
10
  Account.find_each do |account|
8
- puts "=============== updating #{account.name} ============"
9
11
  next if account.name == "search"
10
12
  switch!(account)
13
+ puts "=============== updating #{account.name} ============"
11
14
 
12
- rerun_exporters_and_delete_zips
15
+ make_new_exports
13
16
 
14
17
  puts "=============== finished updating #{account.name} ============"
15
18
  end
16
19
  else
17
- rerun_exporters_and_delete_zips
20
+ make_new_exports
18
21
  end
19
22
  end
20
23
 
21
- def rerun_exporters_and_delete_zips
22
- begin
23
- Bulkrax::Exporter.all.each { |e| Bulkrax::ExporterJob.perform_later(e.id) }
24
- rescue => e
25
- puts "(#{e.message})"
26
- end
27
-
28
- Dir["tmp/exports/**.zip"].each { |zip_path| FileUtils.rm_rf(zip_path) }
24
+ def make_new_exports
25
+ Bulkrax::Exporter.all.each { |e| Bulkrax::ExporterJob.perform_later(e.id) }
26
+ rescue => e
27
+ puts "(#{e.message})"
29
28
  end
30
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulkrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kaufman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-19 00:00:00.000000000 Z
11
+ date: 2022-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -351,6 +351,9 @@ files:
351
351
  - app/views/bulkrax/importers/upload_corrected_entries.html.erb
352
352
  - app/views/bulkrax/shared/_bulkrax_errors.html.erb
353
353
  - app/views/bulkrax/shared/_bulkrax_field_mapping.html.erb
354
+ - app/views/bulkrax/shared/_collection_entries_tab.html.erb
355
+ - app/views/bulkrax/shared/_file_set_entries_tab.html.erb
356
+ - app/views/bulkrax/shared/_work_entries_tab.html.erb
354
357
  - app/views/hyrax/dashboard/sidebar/_bulkrax_sidebar_additions.html.erb
355
358
  - app/views/hyrax/dashboard/sidebar/_repository_content.html.erb
356
359
  - app/views/layouts/bulkrax/application.html.erb