bulkrax 8.3.0 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/bulkrax/import_export.scss +5 -0
- data/app/controllers/concerns/bulkrax/datatables_behavior.rb +1 -1
- data/app/factories/bulkrax/object_factory.rb +4 -1
- data/app/factories/bulkrax/object_factory_interface.rb +2 -2
- data/app/factories/bulkrax/valkyrie_object_factory.rb +4 -2
- data/app/jobs/bulkrax/export_work_job.rb +1 -1
- data/app/models/bulkrax/status.rb +1 -1
- data/app/models/concerns/bulkrax/export_behavior.rb +8 -4
- data/app/parsers/bulkrax/csv_parser.rb +5 -2
- data/app/parsers/bulkrax/parser_export_record_set.rb +1 -1
- data/app/views/bulkrax/entries/show.html.erb +2 -2
- data/app/views/bulkrax/exporters/_form.html.erb +1 -1
- data/app/views/bulkrax/exporters/edit.html.erb +2 -2
- data/app/views/bulkrax/exporters/index.html.erb +2 -2
- data/app/views/bulkrax/exporters/new.html.erb +2 -2
- data/app/views/bulkrax/exporters/show.html.erb +2 -2
- data/app/views/bulkrax/importers/_form.html.erb +1 -1
- data/app/views/bulkrax/importers/edit.html.erb +3 -3
- data/app/views/bulkrax/importers/index.html.erb +2 -2
- data/app/views/bulkrax/importers/new.html.erb +2 -2
- data/app/views/bulkrax/importers/show.html.erb +2 -2
- data/app/views/bulkrax/importers/upload_corrected_entries.html.erb +2 -2
- data/db/migrate/20240806161142_add_file_name_to_uploaded_files.rb +1 -1
- data/db/migrate/20241203010707_entry_error_denormalization.rb +7 -0
- data/db/migrate/20241205212513_faster_first_entry.rb +7 -0
- data/lib/bulkrax/version.rb +1 -1
- data/lib/bulkrax.rb +1 -1
- data/lib/tasks/bulkrax_tasks.rake +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d5a97916d5e7efb9a589f19f850af0c4c2bae1d0197032cdc449fa32ed9470e
|
4
|
+
data.tar.gz: 32e1ed599b25b75b238acff7bd8f24fcc8fe9ea71d09e8d10fa88383c41c79ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23c692b80ac68dc92d67a95635496656e8d2e1e411ac788338d71d55494d34204ea49702f4e14addb623ee9f818e16156e65ecffe1da993d85662a53ad86a44f
|
7
|
+
data.tar.gz: 5583e8ae05b357a28fec59474badf3a26d68bf2b27ed2b37db94ea532b65957a949371a2924694ba8f5e1c9e5dd7bbd8158c8bd9d0e7a023edfd4105b88b2fc3
|
@@ -132,7 +132,7 @@ module Bulkrax
|
|
132
132
|
status_message: status_message_for(e),
|
133
133
|
type: e.type,
|
134
134
|
updated_at: e.updated_at,
|
135
|
-
errors: e.
|
135
|
+
errors: e.status_message == 'Failed' ? view_context.link_to(e.error_class, view_context.item_entry_path(item, e)) : "",
|
136
136
|
actions: entry_util_links(e, item)
|
137
137
|
}
|
138
138
|
end
|
@@ -319,9 +319,9 @@ module Bulkrax
|
|
319
319
|
#
|
320
320
|
# @return [Object] when we've found the object by the entry's :id or by it's
|
321
321
|
# source_identifier
|
322
|
-
# @return [
|
322
|
+
# @return [NilClass] when we cannot find the object.
|
323
323
|
def find
|
324
|
-
find_by_id || search_by_identifier ||
|
324
|
+
find_by_id || search_by_identifier || nil
|
325
325
|
end
|
326
326
|
|
327
327
|
##
|
@@ -81,7 +81,8 @@ module Bulkrax
|
|
81
81
|
return false unless field_supported?(field: field, model: model)
|
82
82
|
|
83
83
|
if model.respond_to?(:schema)
|
84
|
-
|
84
|
+
schema = model.new.singleton_class.schema || model.schema
|
85
|
+
dry_type = schema.key(field.to_sym)
|
85
86
|
return true if dry_type.respond_to?(:primitive) && dry_type.primitive == Array
|
86
87
|
|
87
88
|
false
|
@@ -193,7 +194,8 @@ module Bulkrax
|
|
193
194
|
@schema_properties_map ||= {}
|
194
195
|
|
195
196
|
klass_key = klass.name
|
196
|
-
|
197
|
+
schema = klass.new.singleton_class.schema || klass.schema
|
198
|
+
@schema_properties_map[klass_key] = schema.map { |k| k.name.to_s } unless @schema_properties_map.key?(klass_key)
|
197
199
|
|
198
200
|
@schema_properties_map[klass_key]
|
199
201
|
end
|
@@ -26,7 +26,7 @@ module Bulkrax
|
|
26
26
|
end
|
27
27
|
# rubocop:enable Rails/SkipsModelValidations
|
28
28
|
end
|
29
|
-
return entry if exporter_run.enqueued_records.positive?
|
29
|
+
return entry if exporter_run.reload.enqueued_records.positive?
|
30
30
|
|
31
31
|
if exporter_run.failed_records.positive?
|
32
32
|
exporter_run.exporter.set_status_info('Complete (with failures)')
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Bulkrax
|
4
4
|
class Status < ApplicationRecord
|
5
|
-
belongs_to :statusable, polymorphic: true, denormalize: { fields: %i[status_message], if: :latest? }
|
5
|
+
belongs_to :statusable, polymorphic: true, denormalize: { fields: %i[status_message error_class], if: :latest? }
|
6
6
|
belongs_to :runnable, polymorphic: true
|
7
7
|
serialize :error_backtrace, Array
|
8
8
|
|
@@ -26,11 +26,15 @@ module Bulkrax
|
|
26
26
|
|
27
27
|
# Prepend the file_set id to ensure a unique filename and also one that is not longer than 255 characters
|
28
28
|
def filename(file_set)
|
29
|
-
# NOTE: Will this work with Valkyrie?
|
30
29
|
return if file_set.original_file.blank?
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
if file_set.original_file.respond_to?(:original_filename) # valkyrie
|
31
|
+
fn = file_set.original_file.original_filename
|
32
|
+
mime = ::Marcel::MimeType.for(file_set.original_file.file.io)
|
33
|
+
else # original non valkyrie version
|
34
|
+
fn = file_set.original_file.file_name.first
|
35
|
+
mime = ::Marcel::MimeType.for(declared_type: file_set.original_file.mime_type)
|
36
|
+
end
|
37
|
+
ext_mime = ::Marcel::MimeType.for(name: fn)
|
34
38
|
if fn.include?(file_set.id) || importerexporter.metadata_only?
|
35
39
|
filename = "#{fn}.#{mime.to_sym}"
|
36
40
|
filename = fn if mime.to_s == ext_mime.to_s
|
@@ -244,7 +244,10 @@ module Bulkrax
|
|
244
244
|
record = Bulkrax.object_factory.find(identifier)
|
245
245
|
return unless record
|
246
246
|
|
247
|
-
file_sets =
|
247
|
+
file_sets = Array.wrap(record) if record.file_set?
|
248
|
+
if file_sets.nil? # for valkyrie
|
249
|
+
file_sets = record.respond_to?(:file_sets) ? record.file_sets : record.members&.select(&:file_set?)
|
250
|
+
end
|
248
251
|
file_sets << record.thumbnail if exporter.include_thumbnails && record.thumbnail.present? && record.work?
|
249
252
|
file_sets.each do |fs|
|
250
253
|
path = File.join(exporter_export_path, folder_count, 'files')
|
@@ -252,7 +255,7 @@ module Bulkrax
|
|
252
255
|
file = filename(fs)
|
253
256
|
next if file.blank? || fs.original_file.blank?
|
254
257
|
|
255
|
-
io = open(fs.original_file.uri)
|
258
|
+
io = fs.original_file.respond_to?(:uri) ? open(fs.original_file.uri) : fs.original_file.file.io
|
256
259
|
File.open(File.join(path, file), 'wb') do |f|
|
257
260
|
f.write(io.read)
|
258
261
|
f.close
|
@@ -173,7 +173,7 @@ module Bulkrax
|
|
173
173
|
# @see https://github.com/samvera/hyrax/blob/64c0bbf0dc0d3e1b49f040b50ea70d177cc9d8f6/app/indexers/hyrax/work_indexer.rb#L15-L18
|
174
174
|
def file_sets
|
175
175
|
@file_sets ||= ParserExportRecordSet.in_batches(candidate_file_set_ids) do |batch_of_ids|
|
176
|
-
fsq = "has_model_ssim
|
176
|
+
fsq = "has_model_ssim:\"#{Bulkrax.file_model_internal_resource.demodulize}\" AND id:(\"" + batch_of_ids.join('" OR "') + "\")"
|
177
177
|
fsq += extra_filters if extra_filters.present?
|
178
178
|
Bulkrax.object_factory.query(
|
179
179
|
fsq,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<p id="notice"><%= notice %></p>
|
2
|
-
<div class="panel panel-default">
|
3
|
-
<div class="panel-body">
|
2
|
+
<div class="panel card panel-default">
|
3
|
+
<div class="panel-body card-body">
|
4
4
|
<p class='bulkrax-p-align'>
|
5
5
|
<strong><%= t('bulkrax.importer.labels.identifier') %>:</strong>
|
6
6
|
<%= @entry.identifier %>
|
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
<div class="row">
|
6
6
|
<div class="col-md-12">
|
7
|
-
<div class="panel panel-default
|
7
|
+
<div class="panel card panel-default exporter-form">
|
8
8
|
<%= simple_form_for @exporter do |form| %>
|
9
9
|
<%= render 'form', exporter: @exporter, form: form %>
|
10
|
-
<div class="panel-footer">
|
10
|
+
<div class="panel-footer card-footer bulkrax-card-footer">
|
11
11
|
<div class='pull-right'>
|
12
12
|
<%= form.button :submit, value: 'Update Exporter', class: 'btn btn-primary' %>
|
13
13
|
|
|
@@ -11,8 +11,8 @@
|
|
11
11
|
<meta name="turbolinks-cache-control" content="no-cache">
|
12
12
|
<% end %>
|
13
13
|
|
14
|
-
<div class="panel panel-default">
|
15
|
-
<div class="panel-body">
|
14
|
+
<div class="panel card panel-default">
|
15
|
+
<div class="panel-body card-body">
|
16
16
|
<div class="table-responsive">
|
17
17
|
<table id='exporters-table' class="table table-striped">
|
18
18
|
<thead>
|
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
<div class="row">
|
6
6
|
<div class="col-md-12">
|
7
|
-
<div class="panel panel-default
|
7
|
+
<div class="panel card panel-default exporter-form">
|
8
8
|
<%= simple_form_for @exporter do |form| %>
|
9
9
|
<%= render 'form', exporter: @exporter, form: form %>
|
10
|
-
<div class="panel-footer">
|
10
|
+
<div class="panel-footer card-footer bulkrax-card-footer">
|
11
11
|
<div class='pull-right'>
|
12
12
|
<%= form.button :submit, value: 'Create and Export', class: 'btn btn-primary' %>
|
13
13
|
|
|
@@ -4,8 +4,8 @@
|
|
4
4
|
<h1><span class='fa fa-cloud-download' aria-hidden='true'></span> Exporter: <%= @exporter.name %></h1>
|
5
5
|
</div>
|
6
6
|
|
7
|
-
<div class='panel panel-default'>
|
8
|
-
<div class='panel-body'>
|
7
|
+
<div class='panel card panel-default'>
|
8
|
+
<div class='panel-body card-body'>
|
9
9
|
|
10
10
|
<% if File.exist?(@exporter.exporter_export_zip_path) %>
|
11
11
|
<%= simple_form_for @exporter, method: :get, url: exporter_download_path(@exporter), html: { class: 'form-inline bulkrax-p-align' } do |form| %>
|
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
<div class="row">
|
6
6
|
<div class="col-md-12">
|
7
|
-
<div class="panel panel-default
|
7
|
+
<div class="panel card panel-default importer-form">
|
8
8
|
|
9
9
|
<%= simple_form_for @importer, html: { multipart: true } do |form| %>
|
10
10
|
<%= render 'form', importer: @importer, form: form %>
|
11
|
-
<div class="panel-footer">
|
11
|
+
<div class="panel-footer card-footer bulkrax-card-footer">
|
12
12
|
<div class='pull-right'>
|
13
13
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#bulkraxModal">
|
14
14
|
Update Importer
|
@@ -21,4 +21,4 @@
|
|
21
21
|
<% end %>
|
22
22
|
</div>
|
23
23
|
</div>
|
24
|
-
</div>
|
24
|
+
</div>
|
@@ -11,8 +11,8 @@
|
|
11
11
|
<meta name="turbolinks-cache-control" content="no-cache">
|
12
12
|
<% end %>
|
13
13
|
|
14
|
-
<div class="panel panel-default">
|
15
|
-
<div class="panel-body">
|
14
|
+
<div class="panel card panel-default">
|
15
|
+
<div class="panel-body card-body">
|
16
16
|
<div class="table-responsive">
|
17
17
|
<table id='importers-table' class="table table-striped">
|
18
18
|
<thead>
|
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
<div class="row">
|
6
6
|
<div class="col-md-12">
|
7
|
-
<div class="panel panel-default
|
7
|
+
<div class="panel card panel-default importer-form">
|
8
8
|
<%= simple_form_for @importer, html: { multipart: true } do |form| %>
|
9
9
|
<%= render 'form', importer: @importer, form: form %>
|
10
|
-
<div class="panel-footer">
|
10
|
+
<div class="panel-footer card-footer bulkrax-card-footer">
|
11
11
|
<div class='pull-right'>
|
12
12
|
<% if ENV['SHOW_CREATE_AND_VALIDATE'] == 'true' %>
|
13
13
|
<%= form.button :submit, value: 'Create and Validate', class: 'btn btn-primary' %>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
<% end %>
|
9
9
|
</div>
|
10
10
|
</div>
|
11
|
-
<div class="panel panel-default bulkrax-align-text">
|
12
|
-
<div class="panel-body">
|
11
|
+
<div class="panel card panel-default bulkrax-align-text">
|
12
|
+
<div class="panel-body card-body">
|
13
13
|
<p class="bulkrax-p-align">
|
14
14
|
<strong><%= t('bulkrax.importer.labels.name') %>:</strong>
|
15
15
|
<%= @importer.name %>
|
@@ -2,8 +2,8 @@
|
|
2
2
|
<h1><span class='fa fa-cloud-upload' aria-hidden='true'></span> Upload Corrected Entries: <%= @importer.name %></h1>
|
3
3
|
</div>
|
4
4
|
|
5
|
-
<div class='panel panel-default'>
|
6
|
-
<div class='panel-body'>
|
5
|
+
<div class='panel card panel-default'>
|
6
|
+
<div class='panel-body card-body'>
|
7
7
|
<p>
|
8
8
|
Upload <b>only</b> the corrected entries for the <b><%= @importer.name %></b> importer. To export failed entries for correction,
|
9
9
|
<%= link_to importer_export_errors_path(@importer.id) do %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class AddFileNameToUploadedFiles < ActiveRecord::Migration[5.2]
|
2
2
|
def change
|
3
|
-
add_column :uploaded_files, :filename, :string
|
3
|
+
add_column :uploaded_files, :filename, :string if table_exists?(:uploaded_files) && !column_exists?(:uploaded_files, :filename)
|
4
4
|
end
|
5
5
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class EntryErrorDenormalization < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
add_column :bulkrax_entries, :error_class, :string unless column_exists?(:bulkrax_entries, :error_class)
|
4
|
+
add_column :bulkrax_importers, :error_class, :string unless column_exists?(:bulkrax_importers, :error_class)
|
5
|
+
add_column :bulkrax_exporters, :error_class, :string unless column_exists?(:bulkrax_exporters, :error_class)
|
6
|
+
end
|
7
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
class FasterFirstEntry < ActiveRecord::Migration[5.2]
|
3
|
+
def change
|
4
|
+
add_index :bulkrax_entries, [:importerexporter_id, :importerexporter_type, :id], name: 'index_bulkrax_entries_on_importerexporter_id_type_and_id' unless index_exists?(:bulkrax_entries, [:importerexporter_id, :importerexporter_type, :id],
|
5
|
+
name: 'index_bulkrax_entries_on_importerexporter_id_type_and_id')
|
6
|
+
end
|
7
|
+
end
|
data/lib/bulkrax/version.rb
CHANGED
data/lib/bulkrax.rb
CHANGED
@@ -9,7 +9,7 @@ namespace :bulkrax do
|
|
9
9
|
progress_mark: ' ',
|
10
10
|
remainder_mark: "\u{FF65}")
|
11
11
|
Bulkrax::Status.latest_by_statusable.includes(:statusable).find_each do |status|
|
12
|
-
status.statusable.update(status_message: status.status_message)
|
12
|
+
status.statusable.update(status_message: status.status_message, error_class: status.error_class)
|
13
13
|
@progress.increment
|
14
14
|
end
|
15
15
|
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
|
+
version: 9.0.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: 2024-12-
|
11
|
+
date: 2024-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.6.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: coderay
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -487,6 +487,8 @@ files:
|
|
487
487
|
- db/migrate/20240823173525_add_error_tracking_to_pending_relationships.rb
|
488
488
|
- db/migrate/20240916182737_add_last_imported_at_to_bulkrax_importers.rb
|
489
489
|
- db/migrate/20240916182823_add_next_import_at_to_bulkrax_importers.rb
|
490
|
+
- db/migrate/20241203010707_entry_error_denormalization.rb
|
491
|
+
- db/migrate/20241205212513_faster_first_entry.rb
|
490
492
|
- lib/bulkrax.rb
|
491
493
|
- lib/bulkrax/engine.rb
|
492
494
|
- lib/bulkrax/entry_spec_helper.rb
|
@@ -519,7 +521,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
519
521
|
- !ruby/object:Gem::Version
|
520
522
|
version: '0'
|
521
523
|
requirements: []
|
522
|
-
rubygems_version: 3.4.
|
524
|
+
rubygems_version: 3.4.19
|
523
525
|
signing_key:
|
524
526
|
specification_version: 4
|
525
527
|
summary: Import and export tool for Hyrax and Hyku
|