cdm_migrator 3.5.2 → 4.6.2

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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +0 -0
  3. data/README.md +0 -0
  4. data/Rakefile +0 -0
  5. data/app/assets/config/cdm_migrator_manifest.js +0 -0
  6. data/app/assets/javascripts/cdm_migrator/application.js +0 -0
  7. data/app/assets/stylesheets/cdm_migrator/application.css +0 -0
  8. data/app/assets/stylesheets/cdm_migrator/csv_checker.css +0 -0
  9. data/app/controllers/cdm_migrator/cdm_controller.rb +0 -0
  10. data/app/controllers/cdm_migrator/csv_controller.rb +279 -381
  11. data/app/helpers/cdm_migrator/application_helper.rb +0 -0
  12. data/app/jobs/cdm_migrator/application_job.rb +0 -0
  13. data/app/jobs/cdm_migrator/batch_create_files_job.rb +0 -0
  14. data/app/jobs/cdm_migrator/batch_create_files_with_ordered_members_job.rb +0 -0
  15. data/app/jobs/cdm_migrator/batch_create_works_job.rb +0 -0
  16. data/app/jobs/cdm_migrator/cdm_ingest_files_job.rb +0 -0
  17. data/app/jobs/cdm_migrator/create_work_job.rb +1 -1
  18. data/app/jobs/cdm_migrator/restart_upload_from_middle_job.rb +0 -0
  19. data/app/jobs/cdm_migrator/update_object_job.rb +0 -0
  20. data/app/mailers/cdm_migrator/application_mailer.rb +0 -0
  21. data/app/models/cdm_migrator/application_record.rb +0 -0
  22. data/app/models/cdm_migrator/batch_ingest.rb +33 -33
  23. data/app/models/cdm_migrator/csv_checker.rb +195 -0
  24. data/app/models/cdm_migrator/ingest_work.rb +7 -7
  25. data/app/services/{csv_export_service.rb → cdm_migrator/csv_export_service.rb} +0 -0
  26. data/app/views/cdm_migrator/cdm/collection.html.erb +0 -0
  27. data/app/views/cdm_migrator/cdm/mappings.html.erb +0 -0
  28. data/app/views/cdm_migrator/csv/_batches_list.html.erb +0 -0
  29. data/app/views/cdm_migrator/csv/_default_group.html.erb +0 -0
  30. data/app/views/cdm_migrator/csv/_error_list.html.erb +0 -0
  31. data/app/views/cdm_migrator/csv/_list_batches.html.erb +0 -0
  32. data/app/views/cdm_migrator/csv/_tabs.html.erb +0 -0
  33. data/app/views/cdm_migrator/csv/csv_checker.html.erb +39 -46
  34. data/app/views/cdm_migrator/csv/edit.html.erb +36 -17
  35. data/app/views/cdm_migrator/csv/index.html.erb +0 -0
  36. data/app/views/cdm_migrator/csv/upload.html.erb +52 -18
  37. data/app/views/layouts/cdm_migrator/application.html.erb +0 -0
  38. data/config/routes.rb +0 -0
  39. data/db/migrate/20191211193859_create_batch_ingests.rb +0 -0
  40. data/db/migrate/20191212192315_create_ingest_works.rb +20 -18
  41. data/lib/cdm_migrator/engine.rb +0 -0
  42. data/lib/cdm_migrator/version.rb +1 -1
  43. data/lib/cdm_migrator.rb +0 -0
  44. data/lib/generators/cdm_migrator/install/install_generator.rb +0 -0
  45. data/lib/generators/cdm_migrator/install/templates/config/cdm_migrator.yml +0 -0
  46. data/lib/generators/cdm_migrator/install/templates/presenters/hyku/menu_presenter.rb +0 -0
  47. data/lib/generators/cdm_migrator/install/templates/presenters/hyrax/menu_presenter.rb +0 -0
  48. data/lib/generators/cdm_migrator/install/templates/sidebar/_tasks.html.erb +0 -0
  49. data/lib/tasks/cdm_migrator_tasks.rake +0 -0
  50. metadata +16 -16
  51. data/app/controllers/cdm_migrator/application_controller.rb +0 -10
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -42,7 +42,7 @@ module CdmMigrator
42
42
 
43
43
  permissions = permissions_config.map do |permission_level, group_name|
44
44
  # Check if the permission level is configured in Hyrax
45
- raise "#{permission_level} permission is not configured in this repo. Is it set in Hyrax.config.permission_levels?" unless Hyrax.config.permission_levels.index(permission_level).presence
45
+ raise "#{permission_level} permission is not configured in this repo. Is it set in Hyrax.config.permission_levels?" unless Hyrax.config.permission_levels.has_value?(permission_level)
46
46
  # Construct each permission as a hash
47
47
  group_name.map do |group|
48
48
  { name: group, type: "group", access: permission_level }
File without changes
File without changes
File without changes
@@ -1,33 +1,33 @@
1
- module CdmMigrator
2
- class BatchIngest < ActiveRecord::Base
3
- serialize :data
4
-
5
- def name
6
- csv.split('/').last.gsub(/[0-9]{10}/,"")
7
- end
8
-
9
- def progress
10
- return "Complete" if complete?
11
- completed = IngestWork.where(batch_ingest_id: id, complete: true ).length
12
- if completed==data.length
13
- complete=true
14
- save
15
- "Complete"
16
- else
17
- "#{completed.to_s}/#{size}"
18
- end
19
- end
20
-
21
- def username
22
- @username ||= User.find(user_id).name
23
- end
24
-
25
- def complete?
26
- complete
27
- end
28
-
29
- def message?
30
- not(message.nil?||message.empty?)
31
- end
32
- end
33
- end
1
+ module CdmMigrator
2
+ class BatchIngest < ActiveRecord::Base
3
+ serialize :data, coder: YAML
4
+
5
+ def name
6
+ csv.split('/').last.gsub(/[0-9]{10}/,"")
7
+ end
8
+
9
+ def progress
10
+ return "Complete" if complete?
11
+ completed = IngestWork.where(batch_ingest_id: id, complete: true ).length
12
+ if completed==data.length
13
+ complete=true
14
+ save
15
+ "Complete"
16
+ else
17
+ "#{completed.to_s}/#{size}"
18
+ end
19
+ end
20
+
21
+ def username
22
+ @username ||= User.find(user_id).name
23
+ end
24
+
25
+ def complete?
26
+ complete
27
+ end
28
+
29
+ def message?
30
+ not(message.nil?||message.empty?)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,195 @@
1
+ module CdmMigrator
2
+ class CsvChecker
3
+
4
+ def initialize
5
+ load_config
6
+ end
7
+
8
+ # @param[String] - the path to the CSV
9
+ # @return [Hash] - where hash['errors'] is a list of errors found in the csv,
10
+ # and hash['alerts'] are warnings to display to the user
11
+ def check_csv(csv, multi_value_separator = "|")
12
+ @csv = csv
13
+ row_number = 1
14
+
15
+ results = {}
16
+ @error_list = {}
17
+ @alerts = []
18
+
19
+ check_mounted_drive if @path_to_drive.present?
20
+
21
+ CSV.foreach(csv, headers: true, header_converters: :symbol) do |row|
22
+ row_number +=1 # Tells user what CSV row the error is on
23
+ if row[:object_type].try(:include?, "Work")
24
+ check_dates(row_number, row) if @date_fields.present?
25
+ check_uris(row_number, row) if @uri_fields.present?
26
+ if @separator_fields.present?
27
+ check_multi_val_fields(row_number, row, multi_value_separator)
28
+ else
29
+ alert_message = "No multi-value separator character was selected or no fields were configured. CSV Checker didn't check for valid separators."
30
+ if @alerts.exclude?(alert_message) # Only add this message once, rather than per line
31
+ @alerts << alert_message
32
+ end
33
+ end
34
+ elsif row[:object_type] == "File"
35
+ check_file_path(row_number, row[:url])
36
+ check_transcript_length(row_number, row[:transcript]) if row[:transcript].present?
37
+ check_file_size(row_number, row[:url])
38
+ else
39
+ @error_list[row_number] = { "object_type" => "No or unknown object type. Please give a valid type (e.g. GenericWork, File)." }
40
+ @error_list = @error_list.delete_if { |_, value| value.blank? } # Data are valid, no need to print the row
41
+ end
42
+ end
43
+ results['errors'] = @error_list
44
+ results['alerts'] = @alerts
45
+ results
46
+ end
47
+
48
+ private
49
+
50
+ def work_form(worktype = "GenericWork")
51
+ Module.const_get("Hyrax::#{worktype}Form") rescue nil || Module.const_get("Hyrax::Forms::WorkForm")
52
+ end
53
+
54
+ def file_form
55
+ Module.const_get("Hyrax::FileSetForm") rescue nil || Module.const_get("Hyrax::Forms::FileSetEditForm")
56
+ end
57
+
58
+ def check_file_path(row_number, file_path)
59
+ if file_path.nil?
60
+ @error_list[row_number] = { "url" => "url is blank." }
61
+ elsif File.file?(file_path.gsub("file://", "")) == false
62
+ @error_list[row_number] = { "url" => "No file found at #{file_path}" }
63
+ end
64
+ end
65
+
66
+ def check_mounted_drive
67
+ drive_address = @path_to_drive
68
+ unless Dir.exist?(drive_address) and !Dir[drive_address].empty?
69
+ @alerts << "CSV Checker can't find the mounted drive to check file paths, so some paths may be mislabelled as incorrect. Please contact the administrator or try again later."
70
+ end
71
+ end
72
+
73
+ def check_dates(row_number, row)
74
+ date_fields = @date_fields
75
+ unless @date_indexing_service
76
+ @alerts << "No date indexing service was configured so CSV Checker didn't validate dates."
77
+ return
78
+ end
79
+ edtf_errors = date_fields.each_with_object({}) do |field, hash|
80
+ next unless row[field]
81
+ begin
82
+ @date_indexing_service.new(row[field])
83
+ rescue *@date_indexing_service.error_classes => error
84
+ hash[field.to_s] = "#{error.message}"
85
+ end
86
+ end
87
+ @error_list[row_number] = edtf_errors
88
+ end
89
+
90
+ # <Example: should be http://rightsstatements.org/vocab/etc. NOT https://rightsstatements.org/page/etc.
91
+ def check_uris(row_number, row)
92
+ uri_fields = @uri_fields
93
+ uri_errors = uri_fields.each_with_object({}) do |field, hash|
94
+ if row[field] and row[field].include? "page"
95
+ hash[field.to_s] = "Links to page instead of URI. (e.g. https://rightsstatements.org/page/etc. instead of http://rightsstatements.org/vocab/etc.)"
96
+ elsif row[field] and row[field].match?("https://vocab.getty")
97
+ hash[field.to_s] = "Getty AAT URIs should use http instead of https"
98
+ elsif field == :language
99
+ unless row[field].match?("http://id.loc.gov/vocabulary/iso639-3")
100
+ hash[field.to_s] = "Value doesn't look like a Library of Congress ISO639-3 URI. Is it a URI that starts with http://id.loc.gov/vocabulary/iso639-3?"
101
+ end
102
+ end
103
+ end
104
+ if @error_list[row_number].present?
105
+ @error_list[row_number].merge!(uri_errors)
106
+ else
107
+ @error_list[row_number] = uri_errors
108
+ end
109
+ end
110
+
111
+ # Check multi-value separators
112
+ def check_multi_val_fields(row_number, row, character)
113
+ uri_fields = @separator_fields
114
+ separator_errors = uri_fields.each_with_object({}) do |field, hash|
115
+ if value = row[field]
116
+ # Check for leading or trailing spaces
117
+ if value.match %r{ #{Regexp.escape(character)}|#{Regexp.escape(character)} }
118
+ hash[field.to_s] = "Contains leading or trailing whitespace around multi-value separator."
119
+ end
120
+ values = value.split(character).map(&:strip)
121
+ values.each do |val|
122
+ if val.match(URI::RFC2396_PARSER.make_regexp) # Val should be URI
123
+ remainder = val.gsub(val.match(URI::RFC2396_PARSER.make_regexp)[0],'')
124
+ unless remainder.blank?
125
+ hash[field.to_s] = "May contain the wrong multi-value separator or a typo in the URI."
126
+ end
127
+ if field != :genre && field != :resource_type
128
+ unless val.match(/\bhttps?:\/\/id.worldcat.org\/fast\/\d+\b/)
129
+ hash[field.to_s] = "Field may contain an invalid URI or is missing a separator between URIs."
130
+ end
131
+ end
132
+ else # Or val should be string
133
+ invalid_chars = ["\\"]
134
+ # Make exceptions for backslashes that are part of whitespace characters
135
+ # by deleting them before checking for stray \s
136
+ if val.delete("\t\r\n\s\n").match Regexp.union(invalid_chars)
137
+ hash[field.to_s] = "May contain an invalid character such as #{invalid_chars.to_sentence(last_word_connector: ", or ")}."
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
143
+ @error_list[row_number].merge!(separator_errors)
144
+ end
145
+
146
+ def check_file_size(row_number, file_path)
147
+ if file_path.present? && File.file?(file_path) && @max_file_size
148
+ if File.size(file_path.gsub("file://", "")) > @max_file_size
149
+ @error_list[row_number] = { "file size" => "The file at #{file_path} is too large to be uploaded. Please compress the file or split it into parts.
150
+ Each part should be under #{helpers.number_to_human_size(@max_file_size)}." }
151
+ end
152
+ end
153
+ end
154
+
155
+ def check_transcript_length(row_number, transcript)
156
+ if transcript.is_a? String
157
+ if transcript.length > 9000
158
+ @error_list[row_number] = { "transcript" => "Transcript is too long (over 9000 characters)." }
159
+ end
160
+ elsif transcript.is_a? Array
161
+ if transcript.any? { |tr| tr.length > 9000 }
162
+ @error_list[row_number] = { "transcript" => "Transcript is too long (over 9000 characters)." }
163
+ end
164
+ end
165
+ end
166
+
167
+ def load_config
168
+ if ENV['HYKU_MULTITENANT']
169
+ tenant = Account.find_by(tenant: Apartment::Tenant.current).cname
170
+ else
171
+ tenant = "default"
172
+ end
173
+
174
+ if CdmMigrator::Engine.config['tenant_settings'].has_key?(tenant)
175
+ settings = CdmMigrator::Engine.config['tenant_settings'][tenant]['csv_checker']
176
+ if settings.present?
177
+ @date_indexing_service = settings['date_indexing_service'].first.constantize if settings['date_indexing_service']
178
+ @date_fields = settings['date_fields'].map(&:to_sym) if settings['date_fields']
179
+ @uri_fields = settings['valid_uri_fields'].map(&:to_sym) if settings['valid_uri_fields']
180
+ @separator = settings['multi_value_separator']
181
+ @separator_fields = settings['separator_fields'].map(&:to_sym) if settings['separator_fields']
182
+ @path_to_drive = settings['path_to_drive']
183
+ # If you would like to change this to match the uploader's max file size,
184
+ # change this to Hyrax.config.uploader[:maxFileSize]
185
+ @max_file_size = settings['max_file_size']
186
+ else
187
+ raise "Cdm Migrator couldn't find any configured settings. Are they in cdm_migrator.yml?"
188
+ end
189
+ else
190
+ raise "Cdm Migrator couldn't find this tenant. Is it configured?"
191
+ end
192
+ end
193
+
194
+ end
195
+ end
@@ -1,7 +1,7 @@
1
- module CdmMigrator
2
- class IngestWork < ApplicationRecord
3
-
4
- serialize :data
5
- serialize :files
6
- end
7
- end
1
+ module CdmMigrator
2
+ class IngestWork < ApplicationRecord
3
+
4
+ serialize :data, coder: YAML
5
+ serialize :files, coder: YAML
6
+ end
7
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,46 +1,39 @@
1
- <% provide :page_title, "CSV Checker" %>
2
-
3
- <%#= flash[:alert].join("<br/>") if flash[:alert] %>
4
-
5
- <h1>CSV Checker</h1>
6
-
7
- <!-- <div class="row"> -->
8
- <p>This tool validates CSV data and creates a table listing any errors.</p>
9
-
10
- <a role="button" class="collapse-toggle collapsed csv-collapse-link" data-toggle="collapse" data-target="#errors-explanation" aria-expanded="false">
11
- <span id="csv-collapse-link-text">Expand for more details</span>
12
- </a>
13
- <div class="collapse" id="errors-explanation">
14
- <ul>
15
- <li><strong>File paths: </strong>The url field contains a valid path to a file.</li>
16
- <li><strong>Multi-value separator: </strong>Configured fields with URIs contain the right separator character (e.g. |).</li>
17
- <% if @path_to_drive.present? %>
18
- <li><strong>Mounted drive: </strong>A mounted directory (folder) exists and is not empty.</li>
19
- <% end %>
20
- <% if @edtf_fields.present? %>
21
- <li><strong>EDTF dates: </strong>Configured fields contain valid <a href="https://www.loc.gov/standards/datetime/" target="_blank">EDTF</a> dates or "unknown."</li>
22
- <% end %>
23
- <% if @uri_fields.present? %>
24
- <li><strong>Valid URIs ("page" vs "vocab"): </strong>Configured fields with URIs link to the "vocab" address rather than the "page" address. For example, rights_statement should be "http://rightsstatement.org/vocab/..." and not "https://rightsstatement.org/page/..."</li>
25
- <% end %>
26
- </ul>
27
- </div>
28
-
29
-
30
-
31
- <%= form_tag(check_csv_path, remote: true, method: :post, multipart: true, id: "csv-form") do %>
32
- <div class="input-group">
33
- <%= label_tag :multi_value_separator %>
34
- <%= text_field_tag(:multi_value_separator, @separator, size: 1) %>
35
- <%= file_field_tag(:file, class: "form-control-file") %>
36
- <%= hidden_field_tag :authenticity_token, value: form_authenticity_token %>
37
- <%= button_tag(type: :submit, class: "btn btn-large btn-primary", style: "margin-top: 1em;") do %>
38
- Check CSV
39
- <% end %>
40
- <% end %>
41
- </div>
42
- <!-- </div> -->
43
-
44
- <div id="error_list" class="col-md-10 offset-md-1">
45
- <%= render 'error_list' %>
46
- </div>
1
+ <% content_for(:title, "CSV Checker") %>
2
+ <h1 class="mt-4 mb-3">CSV Checker</h1>
3
+
4
+ <p>This tool validates CSV data and creates a table listing any errors.</p>
5
+
6
+ <a role="button" class="collapse-toggle collapsed csv-collapse-link" data-toggle="collapse" data-target="#errors-explanation" aria-expanded="false">
7
+ <span id="csv-collapse-link-text">Expand for more details</span>
8
+ </a>
9
+ <div class="collapse" id="errors-explanation">
10
+ <ul>
11
+ <li><strong>File paths: </strong>The url field contains a valid path to a file.</li>
12
+ <li><strong>Multi-value separator: </strong>Configured fields with URIs contain the right separator character (e.g. |).</li>
13
+ <% if @path_to_drive.present? %>
14
+ <li><strong>Mounted drive: </strong>A mounted directory (folder) exists and is not empty.</li>
15
+ <% end %>
16
+ <% if @edtf_fields.present? %>
17
+ <li><strong>EDTF dates: </strong>Configured fields contain valid <a href="https://www.loc.gov/standards/datetime/" target="_blank">EDTF</a> dates or "unknown."</li>
18
+ <% end %>
19
+ <% if @uri_fields.present? %>
20
+ <li><strong>Valid URIs ("page" vs "vocab"): </strong>Configured fields with URIs link to the "vocab" address rather than the "page" address. For example, rights_statement should be "http://rightsstatement.org/vocab/..." and not "https://rightsstatement.org/page/..."</li>
21
+ <% end %>
22
+ </ul>
23
+ </div>
24
+
25
+ <%= form_tag(check_csv_path, method: :post, multipart: true, local: true, id: "csv-form") do %>
26
+ <div class="input-group">
27
+ <%= label_tag :multi_value_separator %>
28
+ <%= text_field_tag(:multi_value_separator, @separator, size: 1) %>
29
+ <%= file_field_tag(:file, class: "form-control-file") %>
30
+ <%= hidden_field_tag :authenticity_token, value: form_authenticity_token %>
31
+ <%= button_tag(type: :submit, class: "btn btn-large btn-primary", style: "margin-top: 1em;") do %>
32
+ Check CSV
33
+ <% end %>
34
+ <% end %>
35
+ </div>
36
+
37
+ <div id="error_list" class="col-md-10 offset-md-1">
38
+ <%= render 'error_list' %>
39
+ </div>
@@ -1,17 +1,36 @@
1
-
2
- <h1><span class="fa fa-map"></span> Export </h1>
3
-
4
- <%= form_tag main_app.csv_export_path, method: :post do %>
5
- <%= select_tag 'collection_id', options_for_select(@collections.sort { |x,y| x[0].downcase <=> y[0].downcase }), include_blank: true %>
6
- <%= submit_tag "Download CSV", class: 'btn btn-primary' %>
7
- <% end %>
8
- <h1><span class="fa fa-map"></span> Update </h1>
9
-
10
- <%= form_for :csv_update, url: csv_update_path do |f| %>
11
- <%= f.label 'Multi-value Separator:' %>
12
- <%= f.text_field 'mvs' %>
13
- <br />
14
- <%= f.file_field 'csv_file' %>
15
- <br />
16
- <%= f.submit 'Save' %>
17
- <% end %>
1
+
2
+ <h1 class="mt-3"><span class="fa fa-download"></span> Export Metadata</h1>
3
+
4
+ <%= simple_form_for :csv_export, url: csv_export_path, method: :post do |f| %>
5
+ <div class="form-row form-inline mb-3">
6
+ <%= f.label :collection, label: 'Collection', class: 'col-form-label', for: 'export-collection', required: false %>
7
+ <%= f.input_field :collection,
8
+ id: "export-collection",
9
+ class: 'col-md-4 form-control',
10
+ placeholder: 'Select a collection...',
11
+ inline_label: 'Collection',
12
+ data: {
13
+ autocomplete: 'collection',
14
+ 'autocomplete-url' => Rails.application.routes.url_helpers.qa_path + '/search/collections?access=deposit'
15
+ } %>
16
+ </div>
17
+ <%= f.submit "Download CSV", class: 'btn btn-primary mb-2', data: { disable_with: false } %>
18
+ <% end %>
19
+
20
+ <h1 class="mt-3"><span class="fa fa-cloud-upload"></span> Batch Update Metadata</h1>
21
+
22
+ <%= form_for :csv_update, url: csv_update_path do |f| %>
23
+ <%= f.label 'Multi-value Separator:' %>
24
+ <%= f.text_field 'mvs', class: "mb-2", value: '|' %>
25
+ <br />
26
+ <%= f.file_field 'csv_file', class: "mb-2" %>
27
+ <br />
28
+ <%= f.submit 'Save', class: 'btn btn-primary' %>
29
+ <% end %>
30
+
31
+ <script>
32
+ // Enable autocomplete on the collection id form
33
+ autocomplete = new autocompleteModule()
34
+ element = $('#export-collection')
35
+ autocomplete.setup(element, element.data('autocomplete'), element.data('autocomplete-url'))
36
+ </script>
File without changes
@@ -1,18 +1,52 @@
1
- <h1><span class="fa fa-angle-double-up"></span> <%= default_page_title %></h1>
2
-
3
- <%= form_for :csv_import, url: csv_create_path do |f| %>
4
- <%= f.label 'Multi-value Separator:' %>
5
- <%= f.text_field 'mvs' %>
6
- <br />
7
- <%= f.file_field 'csv_file' %>
8
- <br />
9
- <%= f.label 'Admin Set:' %>
10
- <%= select_tag "admin_set", options_for_select(@admin_sets), :include_blank => true %>
11
- <br />
12
- <%= f.label 'Collection:' %>
13
- <%= select_tag "collection", options_for_select(@collections.sort { |x,y| x[0].downcase <=> y[0].downcase }), :include_blank => true %>
14
- <br />
15
- <%= f.submit 'Save', data: { disable_with: 'Submitting CSV...' } %>
16
- <% end %>
17
- <br />
18
- <%= link_to "template", csv_generate_path %>
1
+ <% content_for(:title, "CSV Batch Upload") %>
2
+ <h1 class="mt-4 mb-3">CSV Batch Upload</h1>
3
+
4
+ <div class="form-group col-md-6">
5
+ <%= simple_form_for :csv_import, url: csv_create_path do |f| %>
6
+
7
+ <div class="form-row form-inline mb-3">
8
+ <%= f.label :mvs, label: 'Multi-value Separator', class: 'col-form-label', required: false %>
9
+ <%= f.input_field :mvs, class: 'form-control col-md-1', value: '|' %>
10
+ </div>
11
+
12
+ <div class="form-row form-inline mb-3">
13
+ <%= f.label :csv_file, class: 'col-form-label sr-only', required: false %>
14
+ <%= f.file_field :csv_file, class: 'form-control-file col-md-4' %>
15
+ </div>
16
+
17
+ <div class="form-row form-inline mb-3">
18
+ <%= f.label :admin_set, class: 'col-form-label', required: false %>
19
+ <%= f.input :admin_set,
20
+ collection: @admin_sets,
21
+ label: false,
22
+ class: 'form-inline' %>
23
+ </div>
24
+
25
+ <div class="form-row form-inline mb-3">
26
+ <%= f.label :collection, label: 'Collection', class: 'col-form-label', for: 'batch-upload-select-collection', required: false %>
27
+ <%= f.input_field :collection,
28
+ id: "batch-upload-select-collection",
29
+ class: 'col-md-8 form-control',
30
+ placeholder: 'Select a collection...',
31
+ inline_label: 'Collection',
32
+ data: {
33
+ autocomplete: 'collection',
34
+ 'autocomplete-url' => Rails.application.routes.url_helpers.qa_path + '/search/collections?access=deposit'
35
+ } %>
36
+ </div>
37
+
38
+
39
+ <%= f.submit 'Save',
40
+ class: 'btn btn-primary',
41
+ data: { disable_with: 'Submitting CSV...' } %>
42
+ <%= link_to "template", csv_generate_path, class: 'ml-4' %>
43
+ <% end %>
44
+ </div>
45
+
46
+
47
+
48
+ <script>
49
+ autocomplete = new autocompleteModule()
50
+ element = $('#batch-upload-select-collection')
51
+ autocomplete.setup(element, element.data('autocomplete'), element.data('autocomplete-url'))
52
+ </script>
File without changes
data/config/routes.rb CHANGED
File without changes
File without changes
@@ -1,18 +1,20 @@
1
- class CreateIngestWorks < ActiveRecord::Migration[5.0]
2
- def up
3
- create_table :ingest_works do |t|
4
- t.string :work_type
5
- t.text :data
6
- t.text :files
7
- t.boolean :complete, :default => false
8
-
9
- t.references :batch_ingest, foreign_key: true
10
-
11
- t.timestamps
12
- end
13
- end
14
-
15
- def down
16
- drop_table :ingest_works
17
- end
18
- end
1
+ class CreateIngestWorks < ActiveRecord::Migration[5.0]
2
+ def up
3
+ unless table_exists?(:ingest_works)
4
+ create_table :ingest_works do |t|
5
+ t.string :work_type
6
+ t.text :data
7
+ t.text :files
8
+ t.boolean :complete, :default => false
9
+
10
+ t.references :batch_ingest, foreign_key: true
11
+
12
+ t.timestamps
13
+ end
14
+ end
15
+ end
16
+
17
+ def down
18
+ drop_table :ingest_works
19
+ end
20
+ end
File without changes
@@ -1,3 +1,3 @@
1
1
  module CdmMigrator
2
- VERSION = '3.5.2'
2
+ VERSION = '4.6.2'
3
3
  end
data/lib/cdm_migrator.rb CHANGED
File without changes
File without changes