zizia 3.1.0.alpha.01 → 4.0.0.alpha.01
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -3
- data/lib/zizia/engine.rb +8 -0
- data/lib/zizia/{hyrax_basic_metadata_mapper.rb → hyrax/hyrax_basic_metadata_mapper.rb} +0 -0
- data/lib/zizia/hyrax/hyrax_default_updater.rb +11 -0
- data/lib/zizia/hyrax/hyrax_delete_files_updater.rb +16 -0
- data/lib/zizia/hyrax/hyrax_metadata_only_updater.rb +58 -0
- data/lib/zizia/{hyrax_record_importer.rb → hyrax/hyrax_record_importer.rb} +45 -56
- data/lib/zizia/{metadata_only_stack.rb → hyrax/metadata_only_stack.rb} +0 -0
- data/lib/zizia/version.rb +1 -1
- data/lib/zizia.rb +6 -3
- metadata +371 -213
- data/.circleci/config.yml +0 -44
- data/.gitignore +0 -16
- data/.rubocop.yml +0 -81
- data/.rubocop_todo.yml +0 -21
- data/.solr_wrapper +0 -8
- data/.travis.yml +0 -12
- data/Gemfile +0 -14
- data/Rakefile +0 -38
- data/app/assets/config/zizia_manifest.js +0 -2
- data/app/assets/images/zizia/.keep +0 -0
- data/app/assets/javascripts/zizia/DisplayUploadedFile.es6 +0 -43
- data/app/assets/javascripts/zizia/application.js +0 -13
- data/app/assets/javascripts/zizia/zizia.js +0 -6
- data/app/assets/stylesheets/zizia/_file_upload.scss +0 -17
- data/app/assets/stylesheets/zizia/application.css +0 -15
- data/app/assets/stylesheets/zizia/zizia.scss +0 -1
- data/app/controllers/zizia/application_controller.rb +0 -6
- data/app/controllers/zizia/csv_imports_controller.rb +0 -53
- data/app/controllers/zizia/importer_documentation_controller.rb +0 -11
- data/app/helpers/importer_documentation_helper.rb +0 -13
- data/app/helpers/zizia/application_helper.rb +0 -14
- data/app/importers/modular_importer.rb +0 -31
- data/app/jobs/zizia/application_job.rb +0 -5
- data/app/jobs/zizia/start_csv_import_job.rb +0 -14
- data/app/models/zizia/application_record.rb +0 -6
- data/app/models/zizia/csv_import.rb +0 -21
- data/app/models/zizia/csv_import_detail.rb +0 -13
- data/app/models/zizia/pre_ingest_file.rb +0 -6
- data/app/models/zizia/pre_ingest_work.rb +0 -6
- data/app/uploaders/zizia/csv_manifest_uploader.rb +0 -62
- data/app/uploaders/zizia/csv_manifest_validator.rb +0 -163
- data/app/views/layouts/zizia/application.html.erb +0 -14
- data/app/views/zizia/csv_imports/_actions.html.erb +0 -3
- data/app/views/zizia/csv_imports/_collection_selection.html.erb +0 -3
- data/app/views/zizia/csv_imports/_error.html.erb +0 -10
- data/app/views/zizia/csv_imports/_file_upload.html.erb +0 -3
- data/app/views/zizia/csv_imports/_form.html.erb +0 -75
- data/app/views/zizia/csv_imports/_no_collection.html.erb +0 -7
- data/app/views/zizia/csv_imports/_record_count.html.erb +0 -7
- data/app/views/zizia/csv_imports/_start_import_form.html.erb +0 -9
- data/app/views/zizia/csv_imports/index.html.erb +0 -21
- data/app/views/zizia/csv_imports/new.html.erb +0 -2
- data/app/views/zizia/csv_imports/preview.html.erb +0 -76
- data/app/views/zizia/csv_imports/show.html.erb +0 -31
- data/app/views/zizia/importer_documentation/guide.html.erb +0 -1
- data/bin/rails +0 -15
- data/config/routes.rb +0 -9
- data/db/migrate/201901162141281_create_zizia_csv_imports.rb +0 -10
- data/db/migrate/201901162203121_add_manifest_to_zizia_csv_imports.rb +0 -6
- data/db/migrate/201901241536541_add_fedora_collection_id_to_zizia_csv_imports.rb +0 -5
- data/db/migrate/20190911133657_create_zizia_pre_ingest_files.rb +0 -12
- data/db/migrate/20190911134002_create_zizia_pre_ingest_works.rb +0 -9
- data/db/migrate/20190911142616_create_zizia_csv_import_details.rb +0 -8
- data/docs/_config.yml +0 -1
- data/docs/customizing_metadata.md +0 -41
- data/docs/index.md +0 -113
- data/log/.keep +0 -0
- data/solr/config/_rest_managed.json +0 -3
- data/solr/config/admin-extra.html +0 -31
- data/solr/config/elevate.xml +0 -36
- data/solr/config/mapping-ISOLatin1Accent.txt +0 -246
- data/solr/config/protwords.txt +0 -21
- data/solr/config/routes.rb +0 -9
- data/solr/config/schema.xml +0 -366
- data/solr/config/scripts.conf +0 -24
- data/solr/config/solrconfig.xml +0 -322
- data/solr/config/spellings.txt +0 -2
- data/solr/config/stopwords.txt +0 -58
- data/solr/config/stopwords_en.txt +0 -58
- data/solr/config/synonyms.txt +0 -31
- data/solr/config/xslt/example.xsl +0 -132
- data/solr/config/xslt/example_atom.xsl +0 -67
- data/solr/config/xslt/example_rss.xsl +0 -66
- data/solr/config/xslt/luke.xsl +0 -337
- data/spec/controllers/importer_documentation_controller_spec.rb +0 -14
- data/spec/dummy/.gitignore +0 -23
- data/spec/dummy/Gemfile +0 -57
- data/spec/dummy/README.md +0 -24
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/config/manifest.js +0 -3
- data/spec/dummy/app/assets/csv/import_manifest.csv +0 -1
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -15
- data/spec/dummy/app/assets/javascripts/cable.js +0 -13
- data/spec/dummy/app/assets/javascripts/channels/.keep +0 -0
- data/spec/dummy/app/assets/markdown/importer_guide.md +0 -256
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/channels/application_cable/channel.rb +0 -4
- data/spec/dummy/app/channels/application_cable/connection.rb +0 -4
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/jobs/application_job.rb +0 -2
- data/spec/dummy/app/mailers/application_mailer.rb +0 -4
- data/spec/dummy/app/models/application_record.rb +0 -3
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/user.rb +0 -2
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/spec/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -9
- data/spec/dummy/bin/rake +0 -9
- data/spec/dummy/bin/setup +0 -38
- data/spec/dummy/bin/spring +0 -17
- data/spec/dummy/bin/update +0 -29
- data/spec/dummy/bin/yarn +0 -11
- data/spec/dummy/config/application.rb +0 -18
- data/spec/dummy/config/boot.rb +0 -3
- data/spec/dummy/config/cable.yml +0 -10
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -54
- data/spec/dummy/config/environments/production.rb +0 -91
- data/spec/dummy/config/environments/test.rb +0 -42
- data/spec/dummy/config/initializers/application_controller_renderer.rb +0 -8
- data/spec/dummy/config/initializers/assets.rb +0 -14
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -5
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -33
- data/spec/dummy/config/puma.rb +0 -56
- data/spec/dummy/config/routes.rb +0 -4
- data/spec/dummy/config/secrets.yml +0 -32
- data/spec/dummy/config/spring.rb +0 -6
- data/spec/dummy/config.ru +0 -5
- data/spec/dummy/db/migrate/20190911165049_create_users.rb +0 -8
- data/spec/dummy/db/schema.rb +0 -55
- data/spec/dummy/db/seeds.rb +0 -7
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/lib/tasks/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/package.json +0 -5
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +0 -1
- data/spec/dummy/test/application_system_test_case.rb +0 -5
- data/spec/dummy/test/controllers/.keep +0 -0
- data/spec/dummy/test/fixtures/.keep +0 -0
- data/spec/dummy/test/fixtures/files/.keep +0 -0
- data/spec/dummy/test/fixtures/users.yml +0 -11
- data/spec/dummy/test/helpers/.keep +0 -0
- data/spec/dummy/test/integration/.keep +0 -0
- data/spec/dummy/test/mailers/.keep +0 -0
- data/spec/dummy/test/models/.keep +0 -0
- data/spec/dummy/test/models/user_test.rb +0 -7
- data/spec/dummy/test/system/.keep +0 -0
- data/spec/dummy/test/test_helper.rb +0 -10
- data/spec/dummy/vendor/.keep +0 -0
- data/spec/fixtures/bad_example.csv +0 -2
- data/spec/fixtures/dog.jpg +0 -0
- data/spec/fixtures/example.csv +0 -4
- data/spec/fixtures/hyrax/example.csv +0 -3
- data/spec/fixtures/images/animals/cat.png +0 -0
- data/spec/fixtures/images/zizia.png +0 -0
- data/spec/fixtures/zizia.png +0 -0
- data/spec/integration/csv_import_detail_spec.rb +0 -48
- data/spec/integration/import_csv_spec.rb +0 -27
- data/spec/integration/import_hyrax_csv.rb +0 -71
- data/spec/models/csv_import_spec.rb +0 -18
- data/spec/spec_helper.rb +0 -31
- data/spec/support/hyrax/basic_metadata.rb +0 -30
- data/spec/support/hyrax/core_metadata.rb +0 -15
- data/spec/support/shared_contexts/with_work_type.rb +0 -101
- data/spec/uploaders/csv_manifest_uploader_spec.rb +0 -30
- data/spec/views/zizia/importer_documentation/guide.html.erb_spec.rb +0 -13
- data/spec/zizia/csv_format_validator_spec.rb +0 -38
- data/spec/zizia/csv_parser_spec.rb +0 -73
- data/spec/zizia/csv_template_spec.rb +0 -15
- data/spec/zizia/hash_mapper_spec.rb +0 -8
- data/spec/zizia/hyrax_basic_metadata_mapper_spec.rb +0 -190
- data/spec/zizia/hyrax_record_importer_spec.rb +0 -176
- data/spec/zizia/importer_spec.rb +0 -46
- data/spec/zizia/input_record_spec.rb +0 -71
- data/spec/zizia/record_importer_spec.rb +0 -53
- data/spec/zizia/title_validator_spec.rb +0 -23
- data/spec/zizia/validator_spec.rb +0 -9
- data/spec/zizia/version_spec.rb +0 -7
- data/spec/zizia_spec.rb +0 -20
- data/zizia.gemspec +0 -42
data/.circleci/config.yml
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
version: 2.1
|
2
|
-
orbs:
|
3
|
-
samvera: samvera/circleci-orb@0.3.1
|
4
|
-
jobs:
|
5
|
-
build:
|
6
|
-
parameters:
|
7
|
-
ruby_version:
|
8
|
-
type: string
|
9
|
-
default: 2.5.3
|
10
|
-
bundler_version:
|
11
|
-
type: string
|
12
|
-
default: 2.0.1
|
13
|
-
executor:
|
14
|
-
name: samvera/ruby_fcrepo_solr_redis
|
15
|
-
ruby_version: << parameters.ruby_version >>
|
16
|
-
working_directory: ~/project
|
17
|
-
parallelism: 4
|
18
|
-
steps:
|
19
|
-
- checkout
|
20
|
-
|
21
|
-
- run:
|
22
|
-
name: install sqlite3
|
23
|
-
command: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
|
24
|
-
|
25
|
-
- samvera/bundle:
|
26
|
-
ruby_version: << parameters.ruby_version >>
|
27
|
-
bundler_version: << parameters.bundler_version >>
|
28
|
-
|
29
|
-
- samvera/rubocop
|
30
|
-
|
31
|
-
- samvera/install_solr_core
|
32
|
-
|
33
|
-
- run:
|
34
|
-
name: install sqlite3
|
35
|
-
command: bundle exec rake db:migrate
|
36
|
-
|
37
|
-
- samvera/parallel_rspec
|
38
|
-
|
39
|
-
workflows:
|
40
|
-
version: 2
|
41
|
-
ci:
|
42
|
-
jobs:
|
43
|
-
- build:
|
44
|
-
name: ruby2-5-3
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
|
-
inherit_gem:
|
4
|
-
bixby: bixby_default.yml
|
5
|
-
|
6
|
-
AllCops:
|
7
|
-
TargetRubyVersion: 2.3
|
8
|
-
Exclude:
|
9
|
-
- 'db/**/*'
|
10
|
-
- 'config/**/*'
|
11
|
-
- 'script/**/*'
|
12
|
-
- 'vendor/**/*'
|
13
|
-
- 'bin/{rails,rake}'
|
14
|
-
- 'spec/dummy/**/*'
|
15
|
-
|
16
|
-
Lint/HandleExceptions:
|
17
|
-
Exclude:
|
18
|
-
- 'spec/**/*'
|
19
|
-
- 'lib/zizia/spec/**/*'
|
20
|
-
|
21
|
-
Metrics/AbcSize:
|
22
|
-
Exclude:
|
23
|
-
- 'spec/support/hyrax/basic_metadata.rb'
|
24
|
-
- 'lib/zizia/hyrax_record_importer.rb'
|
25
|
-
- lib/zizia/importer.rb
|
26
|
-
|
27
|
-
Metrics/BlockLength:
|
28
|
-
Exclude:
|
29
|
-
- 'spec/**/*'
|
30
|
-
- 'lib/zizia/spec/**/*'
|
31
|
-
- 'zizia.gemspec'
|
32
|
-
|
33
|
-
Metrics/ClassLength:
|
34
|
-
Enabled: false
|
35
|
-
|
36
|
-
Metrics/CyclomaticComplexity:
|
37
|
-
Exclude:
|
38
|
-
- lib/zizia/hyrax_basic_metadata_mapper.rb
|
39
|
-
- lib/zizia/hyrax_record_importer.rb
|
40
|
-
|
41
|
-
Metrics/LineLength:
|
42
|
-
Enabled: false
|
43
|
-
|
44
|
-
Metrics/MethodLength:
|
45
|
-
Exclude:
|
46
|
-
- 'spec/support/hyrax/basic_metadata.rb'
|
47
|
-
- 'lib/zizia/hyrax_basic_metadata_mapper.rb'
|
48
|
-
- lib/zizia/hyrax_record_importer.rb
|
49
|
-
|
50
|
-
Metrics/PerceivedComplexity:
|
51
|
-
Exclude:
|
52
|
-
- lib/zizia/hyrax_record_importer.rb
|
53
|
-
|
54
|
-
Naming/AccessorMethodName:
|
55
|
-
Exclude:
|
56
|
-
- lib/zizia/hyrax_record_importer.rb
|
57
|
-
|
58
|
-
RSpec/DescribeClass:
|
59
|
-
Exclude:
|
60
|
-
- 'spec/integration/**/*'
|
61
|
-
- 'spec/*_spec.rb'
|
62
|
-
|
63
|
-
RSpec/ExampleLength:
|
64
|
-
Exclude:
|
65
|
-
- 'spec/zizia/hyrax_basic_metadata_mapper_spec.rb'
|
66
|
-
- 'spec/integration/import_hyrax_csv.rb'
|
67
|
-
- 'spec/integration/csv_import_detail_spec.rb'
|
68
|
-
|
69
|
-
RSpec/MessageSpies:
|
70
|
-
Exclude:
|
71
|
-
- spec/integration/import_csv_spec.rb
|
72
|
-
|
73
|
-
RSpec/MultipleExpectations:
|
74
|
-
Exclude:
|
75
|
-
- 'spec/zizia/hyrax_basic_metadata_mapper_spec.rb'
|
76
|
-
- 'spec/integration/import_hyrax_csv.rb'
|
77
|
-
- 'spec/controllers/importer_documentation_controller_spec.rb'
|
78
|
-
- 'spec/integration/csv_import_detail_spec.rb'
|
79
|
-
|
80
|
-
Style/StructInheritance:
|
81
|
-
Enabled: false
|
data/.rubocop_todo.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2019-02-21 09:32:03 -0500 using RuboCop version 0.52.1.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
Metrics/CyclomaticComplexity:
|
11
|
-
Max: 7
|
12
|
-
|
13
|
-
# Offense count: 1
|
14
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
15
|
-
# URISchemes: http, https
|
16
|
-
Metrics/LineLength:
|
17
|
-
Max: 228
|
18
|
-
|
19
|
-
# Offense count: 1
|
20
|
-
Metrics/PerceivedComplexity:
|
21
|
-
Max: 8
|
data/.solr_wrapper
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'bundler/setup'
|
5
|
-
rescue LoadError
|
6
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
7
|
-
end
|
8
|
-
|
9
|
-
require 'fcrepo_wrapper'
|
10
|
-
require 'solr_wrapper'
|
11
|
-
require 'active_fedora/rake_support'
|
12
|
-
|
13
|
-
require 'rspec/core/rake_task'
|
14
|
-
require 'rubocop/rake_task'
|
15
|
-
|
16
|
-
Bundler::GemHelper.install_tasks
|
17
|
-
|
18
|
-
desc 'Run style checker'
|
19
|
-
RuboCop::RakeTask.new(:rubocop) do |task|
|
20
|
-
task.fail_on_error = true
|
21
|
-
end
|
22
|
-
|
23
|
-
desc 'Run specs'
|
24
|
-
RSpec::Core::RakeTask.new(:spec)
|
25
|
-
|
26
|
-
desc 'Run specs with Fedora & Solr servers'
|
27
|
-
task :spec_with_server do
|
28
|
-
with_test_server { Rake::Task['spec'].invoke }
|
29
|
-
end
|
30
|
-
|
31
|
-
desc 'Check style and run specs'
|
32
|
-
task ci: %w[rubocop spec_with_server]
|
33
|
-
|
34
|
-
task default: :ci
|
35
|
-
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
36
|
-
load 'rails/tasks/engine.rake'
|
37
|
-
|
38
|
-
load 'rails/tasks/statistics.rake'
|
File without changes
|
@@ -1,43 +0,0 @@
|
|
1
|
-
export default class DisplayUploadedFile {
|
2
|
-
constructor() {
|
3
|
-
this.regexp = /[^a-zA-Z0-9\.\-\+_]/g
|
4
|
-
}
|
5
|
-
replaceWhitespace(input) {
|
6
|
-
return input.replace(this.regexp, '_')
|
7
|
-
}
|
8
|
-
|
9
|
-
requiresEscape(input) {
|
10
|
-
return this.regexp.test(input)
|
11
|
-
}
|
12
|
-
|
13
|
-
displayReplaceMessage(input) {
|
14
|
-
if (this.requiresEscape(input)) {
|
15
|
-
return `<b> Note: </b> Your file name contained spaces, which have been replaced by underscores.
|
16
|
-
This will have no effect on your import.`
|
17
|
-
} else {
|
18
|
-
return ''
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
display() {
|
23
|
-
var fileInput = document.querySelector('#file-upload')
|
24
|
-
var files = fileInput.files
|
25
|
-
for (var i = 0; i < files.length; i++) {
|
26
|
-
var file = files[i]
|
27
|
-
document.querySelector('#file-upload-display').innerHTML = `
|
28
|
-
<div class="row">
|
29
|
-
<div class="col-md-12">
|
30
|
-
<div class="well style="
|
31
|
-
background-color: #dff0d8;
|
32
|
-
border-color: #d6e9c6;
|
33
|
-
color: #3c763d;">
|
34
|
-
<p>You sucessfully uploaded this CSV: <b> ${this.replaceWhitespace(file.name)} </b>
|
35
|
-
</p>
|
36
|
-
${this.displayReplaceMessage(file.name)}
|
37
|
-
<p>
|
38
|
-
</div>
|
39
|
-
</div>
|
40
|
-
</div>`
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
-
//
|
10
|
-
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
-
// about supported directives.
|
12
|
-
//
|
13
|
-
//= require_tree .
|
@@ -1,17 +0,0 @@
|
|
1
|
-
.file-upload {
|
2
|
-
width: 0.1px;
|
3
|
-
height: 0.1px;
|
4
|
-
opacity: 0;
|
5
|
-
overflow: hidden;
|
6
|
-
position: absolute;
|
7
|
-
z-index: -1;
|
8
|
-
}
|
9
|
-
|
10
|
-
.file-upload + label {
|
11
|
-
margin-bottom: 1em;
|
12
|
-
}
|
13
|
-
|
14
|
-
.file-upload:focus + label {
|
15
|
-
outline: 1px dotted #000;
|
16
|
-
outline: -webkit-focus-ring-color auto 5px;
|
17
|
-
}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
-
* It is generally better to create a new file per style scope.
|
12
|
-
*
|
13
|
-
*= require zizia/zizia
|
14
|
-
*= require_self
|
15
|
-
*/
|
@@ -1 +0,0 @@
|
|
1
|
-
@import 'file_upload';
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Zizia
|
3
|
-
class CsvImportsController < ::ApplicationController
|
4
|
-
load_and_authorize_resource
|
5
|
-
before_action :load_and_authorize_preview, only: [:preview]
|
6
|
-
|
7
|
-
with_themed_layout 'dashboard'
|
8
|
-
|
9
|
-
def index; end
|
10
|
-
|
11
|
-
def show; end
|
12
|
-
|
13
|
-
def new; end
|
14
|
-
|
15
|
-
# Validate the CSV file and display errors or
|
16
|
-
# warnings to the user.
|
17
|
-
def preview; end
|
18
|
-
|
19
|
-
def create
|
20
|
-
@csv_import.user = current_user
|
21
|
-
preserve_cache
|
22
|
-
|
23
|
-
if @csv_import.save
|
24
|
-
@csv_import.queue_start_job
|
25
|
-
redirect_to @csv_import
|
26
|
-
else
|
27
|
-
render :new
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def load_and_authorize_preview
|
34
|
-
@csv_import = CsvImport.new(create_params)
|
35
|
-
authorize! :create, @csv_import
|
36
|
-
end
|
37
|
-
|
38
|
-
def create_params
|
39
|
-
params.fetch(:csv_import, {}).permit(:manifest, :fedora_collection_id)
|
40
|
-
end
|
41
|
-
|
42
|
-
# Since we are re-rendering the form (once for
|
43
|
-
# :new and again for :preview), we need to
|
44
|
-
# manually set the cache, otherwise the record
|
45
|
-
# will lose the manifest file between the preview
|
46
|
-
# and the record save.
|
47
|
-
def preserve_cache
|
48
|
-
return unless params['csv_import']
|
49
|
-
@csv_import.manifest_cache = params['csv_import']['manifest_cache']
|
50
|
-
@csv_import.fedora_collection_id = params['csv_import']['fedora_collection_id']
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Zizia
|
4
|
-
class ImporterDocumentationController < ApplicationController
|
5
|
-
def guide; end
|
6
|
-
|
7
|
-
def csv
|
8
|
-
send_data Zizia::CsvTemplate.new.to_s, type: 'text/csv; charset=utf-8', disposition: 'attachment', filename: 'import_manifest.csv'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ImporterDocumentationHelper
|
4
|
-
def render_guide
|
5
|
-
renderer = Redcarpet::Render::HTML.new(autolink: true, with_toc_data: true)
|
6
|
-
markdown = Redcarpet::Markdown.new(renderer)
|
7
|
-
if File.exist?(Rails.root.join('app', 'assets', 'markdown', 'importer_guide.md'))
|
8
|
-
markdown.render(File.open(Rails.root.join('app', 'assets', 'markdown', 'importer_guide.md')).read)
|
9
|
-
else
|
10
|
-
'There is currently no documentation.'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Zizia
|
3
|
-
module ApplicationHelper
|
4
|
-
def collections_for_select
|
5
|
-
ActiveFedora::SolrService.query('has_model_ssim:Collection').map do |c|
|
6
|
-
[c['title_tesim'][0], c['id']]
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def collections?
|
11
|
-
!ActiveFedora::SolrService.query('has_model_ssim:Collection').empty?
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'zizia'
|
3
|
-
|
4
|
-
class ModularImporter
|
5
|
-
DEDUPLICATION_FIELD = 'identifier'
|
6
|
-
|
7
|
-
def initialize(csv_import)
|
8
|
-
@csv_import = csv_import
|
9
|
-
@csv_file = csv_import.manifest.file.file.to_s
|
10
|
-
@collection_id = csv_import.fedora_collection_id
|
11
|
-
@user_id = csv_import.user_id
|
12
|
-
@user_email = User.find(csv_import.user_id).email
|
13
|
-
end
|
14
|
-
|
15
|
-
def import
|
16
|
-
raise "Cannot find expected input file #{@csv_file}" unless File.exist?(@csv_file)
|
17
|
-
|
18
|
-
attrs = {
|
19
|
-
collection_id: @collection_id,
|
20
|
-
depositor_id: @user_id,
|
21
|
-
batch_id: @csv_import.id,
|
22
|
-
deduplication_field: DEDUPLICATION_FIELD
|
23
|
-
}
|
24
|
-
|
25
|
-
file = File.open(@csv_file)
|
26
|
-
|
27
|
-
Rails.logger.info "[zizia] event: start_import, batch_id: #{@csv_import.id}, collection_id: #{@collection_id}, user: #{@user_email}"
|
28
|
-
Zizia::Importer.new(parser: Zizia::CsvParser.new(file: file), record_importer: Zizia::HyraxRecordImporter.new(attributes: attrs)).import
|
29
|
-
file.close
|
30
|
-
end
|
31
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Zizia
|
4
|
-
class StartCsvImportJob < ApplicationJob
|
5
|
-
queue_as :default
|
6
|
-
|
7
|
-
def perform(csv_import_id)
|
8
|
-
csv_import = CsvImport.find csv_import_id
|
9
|
-
Rails.logger.info "[zizia] Starting import with batch ID: #{csv_import_id}"
|
10
|
-
importer = ModularImporter.new(csv_import)
|
11
|
-
importer.import
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Zizia
|
4
|
-
class CsvImport < ApplicationRecord
|
5
|
-
belongs_to :user
|
6
|
-
|
7
|
-
# This is where the CSV file is stored:
|
8
|
-
mount_uploader :manifest, CsvManifestUploader
|
9
|
-
|
10
|
-
delegate :warnings, to: :manifest, prefix: true
|
11
|
-
|
12
|
-
delegate :errors, to: :manifest, prefix: true
|
13
|
-
|
14
|
-
delegate :records, to: :manifest, prefix: true
|
15
|
-
|
16
|
-
def queue_start_job
|
17
|
-
StartCsvImportJob.perform_later(id)
|
18
|
-
# TODO: We'll probably need to store job_id on this record.
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Zizia
|
3
|
-
class CsvImportDetail < ApplicationRecord
|
4
|
-
belongs_to :csv_import
|
5
|
-
has_many :pre_ingest_works
|
6
|
-
has_many :pre_ingest_files, through: :pre_ingest_works
|
7
|
-
|
8
|
-
def total_size
|
9
|
-
return 0 if pre_ingest_files.empty?
|
10
|
-
pre_ingest_files.map(&:size).sum
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'carrierwave'
|
4
|
-
|
5
|
-
module Zizia
|
6
|
-
class CsvManifestUploader < CarrierWave::Uploader::Base
|
7
|
-
# Choose what kind of storage to use for this uploader:
|
8
|
-
storage :file
|
9
|
-
|
10
|
-
# Process calls that method whenever a file is uploaded.
|
11
|
-
process :validate_csv
|
12
|
-
|
13
|
-
# The directory where the csv manifest will be stored.
|
14
|
-
def store_dir
|
15
|
-
manifests_path || Rails.root.join('tmp', 'csv_uploads')
|
16
|
-
end
|
17
|
-
|
18
|
-
def cache_dir
|
19
|
-
manifests_cache_path || Rails.root.join('tmp', 'csv_uploads_cache')
|
20
|
-
end
|
21
|
-
|
22
|
-
# Add a white list of extensions which are allowed to be uploaded.
|
23
|
-
# For images you might use something like this:
|
24
|
-
# %w(jpg jpeg gif png)
|
25
|
-
def extension_whitelist
|
26
|
-
%w[csv]
|
27
|
-
end
|
28
|
-
|
29
|
-
# These are stored in memory only, not persisted
|
30
|
-
def errors
|
31
|
-
@validator ? @validator.errors : []
|
32
|
-
end
|
33
|
-
|
34
|
-
# These are stored in memory only, not persisted
|
35
|
-
def warnings
|
36
|
-
@validator ? @validator.warnings : []
|
37
|
-
end
|
38
|
-
|
39
|
-
def records
|
40
|
-
@validator ? @validator.record_count : 0
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def manifests_path
|
46
|
-
return false if ENV['CSV_MANIFESTS_PATH'].nil?
|
47
|
-
return false unless File.directory?(ENV['CSV_MANIFESTS_PATH'])
|
48
|
-
ENV['CSV_MANIFESTS_PATH']
|
49
|
-
end
|
50
|
-
|
51
|
-
def manifests_cache_path
|
52
|
-
return false if ENV['CSV_MANIFESTS_CACHE_PATH'].nil?
|
53
|
-
return false unless File.directory?(ENV['CSV_MANIFESTS_CACHE_PATH'])
|
54
|
-
ENV['CSV_MANIFESTS_CACHE_PATH']
|
55
|
-
end
|
56
|
-
|
57
|
-
def validate_csv
|
58
|
-
@validator = CsvManifestValidator.new(self)
|
59
|
-
@validator.validate
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|