zizia 4.3.1.alpha.01 → 4.4.0.alpha.01

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7738ad4f5ddf617123e02b0c30426c937b8a6e1a9ac343cdc1f526db6022977
4
- data.tar.gz: 11ef2ee8fd0f01df8a430847383a3f1aff3d2c5c026d30fab2892a00d183bad6
3
+ metadata.gz: 5d6cb2fdcaac771b4c720b937920c89af5cef59a765f49a4a85341b62583ebdc
4
+ data.tar.gz: 98f4e13cdebe4e66978e061f6b44a445bc6bb8d4012e4ffa001ad65924858cf6
5
5
  SHA512:
6
- metadata.gz: 9a83df339c9be7d6aba456040d7c9be5cc260a825f0c46ff0a5daffdef9b1f57046289da88cadaae9c89ce01b6cfc46b099fd138740f32f4d794a0aef228f420
7
- data.tar.gz: 69269d92ffc9743b271e53b5d9886b1408c125b0d6d5fdbb0650032c563644dfffdfe7225295c8c7fc47cd6e06ed4070af4b1f3954f79c9fa9224db5f810afda
6
+ metadata.gz: 4aadd2145031bee0548b90678d89be2138cf3ae0b4b2d14907706da2b361f34da1387fc6c419da79a346f33747077eedb6f39391d541335c1336d1d44611845b
7
+ data.tar.gz: e910f466363fec180fdbdb7fb11cd73f4eb248151d9bb5eb1f194ca21a60c4ed4922a0e6cd10adc771a89950410d5bf525aa73f7e3650ed840748b299c4e423c
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+ module Zizia
3
+ class CsvImportDetailsController < ApplicationController
4
+ def index
5
+ @csv_import_details = Zizia::CsvImportDetail.order(:id).page csv_import_detail_params[:page]
6
+ end
7
+
8
+ def show
9
+ @csv_import_detail = Zizia::CsvImportDetail.find(csv_import_detail_params["id"])
10
+ end
11
+
12
+ private
13
+
14
+ def csv_import_detail_params
15
+ params.permit(:id, :page)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ <h3>CSV Imports</h3>
2
+ <table class="table table-striped">
3
+ <tr>
4
+ <th>ID</th>
5
+ <th>Associated User</th>
6
+ <th>CSV File</th>
7
+ <th>Total Size in Bytes</th>
8
+ </tr>
9
+ <% @csv_import_details.each do |csv_import_detail| %>
10
+ <tr>
11
+ <td>
12
+ <%= link_to csv_import_detail.id, url_for(csv_import_detail) %>
13
+ </td>
14
+ <td>
15
+ <%= User.find(csv_import_detail.csv_import.user_id).email %>
16
+ </td>
17
+ <td>
18
+ <%= csv_import_detail.csv_import.manifest %>
19
+ </td>
20
+ <td>
21
+ <%= csv_import_detail.total_size %>
22
+ </td>
23
+ </tr>
24
+ <% end %>
25
+ </table>
26
+ <%= paginate @csv_import_details %>
@@ -0,0 +1,33 @@
1
+ <div>
2
+ <h3>About the Import:</h3>
3
+ <ul>
4
+ <li>Import created by: <%= User.find(@csv_import_detail.csv_import.user_id) %>
5
+ </li>
6
+ <li>CSV File: <%= @csv_import_detail.csv_import.manifest %></li>
7
+ <li>Total Size in Bytes: <%= @csv_import_detail.total_size %></li>
8
+ </ul>
9
+
10
+ <h3>Files</h3>
11
+ <table id="files-table" class="dataTable display responsive nowrap table table-striped works-list" style="width:100%">
12
+ <tr>
13
+ <th>Filename</th>
14
+ <th>Size in Bytes</th>
15
+ <th>Row Number</th>
16
+ </tr>
17
+
18
+ <% @csv_import_detail.pre_ingest_files.each do |pre_ingest_file| %>
19
+ <tr>
20
+ <td>
21
+ <%= pre_ingest_file.filename %>
22
+ </td>
23
+ <td>
24
+ <%= pre_ingest_file.size %>
25
+ </td>
26
+ <td>
27
+ Row number:
28
+ <%= pre_ingest_file.row_number %>
29
+ </td>
30
+ </tr>
31
+ <% end %>
32
+ </table>
33
+ </div>
@@ -22,7 +22,7 @@
22
22
  <div class="col-md-6">
23
23
  <div class='well'>
24
24
  <p> Your records will be imported in the background. To check the current status, please check the background job status page. </p><br />
25
- <div class="text-center"> <%= link_to 'Background Job Status', '/sidekiq', class: "btn btn-primary btn-lg" %> </div>
25
+ <div class="text-center"> <%= link_to 'Background Job Status', '/csv_import_details/index', class: "btn btn-primary btn-lg" %> </div>
26
26
  </div>
27
27
  </div>
28
28
  </div>
data/config/routes.rb CHANGED
@@ -6,4 +6,7 @@ Zizia::Engine.routes.draw do
6
6
 
7
7
  get 'importer_documentation/guide', to: 'metadata_details#show'
8
8
  get 'importer_documentation/profile', to: 'metadata_details#profile'
9
+
10
+ get 'csv_import_details/index'
11
+ get 'csv_import_details/show/:id', to: 'csv_import_details#show', as: 'csv_import_detail'
9
12
  end
data/lib/zizia/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zizia
4
- VERSION = '4.3.1.alpha.01'
4
+ VERSION = '4.4.0.alpha.01'
5
5
  end
@@ -0,0 +1,18 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe 'viewing the csv import detail page' do
4
+ let(:user) { FactoryBot.create(:user) }
5
+ let(:csv_import) { FactoryBot.create(:csv_import) }
6
+ let(:csv_import_detail) { FactoryBot.create(:csv_import_detail) }
7
+
8
+ it 'displays the metadata when you visit the page' do
9
+ user.save
10
+ csv_import.user_id = user.id
11
+ csv_import.save
12
+ csv_import_detail.save
13
+ visit ('/csv_import_details/index')
14
+ expect(page).to have_content('CSV Imports ID')
15
+ click_on '1'
16
+ expect(page).to have_content('Total Size in Bytes')
17
+ end
18
+ end
@@ -237,6 +237,13 @@ RSpec.describe 'Importing records from a CSV file', :perform_jobs, :clean, type:
237
237
  work = Work.where(title: "*haberdashery*").first
238
238
  expect(work.title.first).to match(/Interior/)
239
239
  expect(work.file_sets.first.label).to eq('cat.jpg')
240
+
241
+
242
+ # Viewing additional details after an import
243
+ visit "/csv_import_details/index"
244
+ expect(page).to have_content('Total Size in Bytes')
245
+ find(:xpath, '//*[@id="content-wrapper"]/table/tbody/tr[2]/td[1]/a').click
246
+ expect(page).to have_content('dog.jpg')
240
247
  end
241
248
  end
242
249
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ # This will guess the User class
3
+ FactoryBot.define do
4
+ factory :csv_import, class: Zizia::CsvImport do
5
+ id { 1 }
6
+ user_id { 1 }
7
+ created_at { Time.current }
8
+ updated_at { Time.current }
9
+ manifest { Rails.root.join('spec', 'fixtures', 'csv_imports', 'good', 'all_fields.csv') }
10
+ fedora_collection_id { '1' }
11
+ update_actor_stack { 'HyraxDefault' }
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ # This will guess the User class
3
+ FactoryBot.define do
4
+ factory :csv_import_detail, class: Zizia::CsvImportDetail do
5
+ csv_import_id { 1 }
6
+ created_at { Time.current }
7
+ updated_at { Time.current }
8
+ depositor_id { FactoryBot.build(:user).id }
9
+ collection_id { '1' }
10
+ batch_id { '1' }
11
+ success_count { 1 }
12
+ failure_count { 0 }
13
+ deduplication_field { 'identifier' }
14
+ update_actor_stack { 'HyraxDefault' }
15
+ end
16
+ end
data/zizia.gemspec CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.required_ruby_version = '>= 2.3.4'
18
18
 
19
19
  gem.add_dependency 'active-fedora'
20
+ gem.add_dependency 'kaminari'
20
21
  gem.add_dependency 'rails', '~> 5.1.4'
21
22
  gem.add_dependency 'carrierwave'
22
23
  gem.add_dependency 'rails-controller-testing'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zizia
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.1.alpha.01
4
+ version: 4.4.0.alpha.01
5
5
  platform: ruby
6
6
  authors:
7
7
  - Data Curation Experts
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: kaminari
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rails
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -644,6 +658,7 @@ files:
644
658
  - app/assets/stylesheets/zizia/application.css
645
659
  - app/assets/stylesheets/zizia/zizia.scss
646
660
  - app/config/usage.yml
661
+ - app/controllers/zizia/csv_import_details_controller.rb
647
662
  - app/controllers/zizia/csv_imports_controller.rb
648
663
  - app/controllers/zizia/metadata_details_controller.rb
649
664
  - app/helpers/zizia/application_helper.rb
@@ -661,6 +676,8 @@ files:
661
676
  - app/uploaders/zizia/csv_manifest_uploader.rb
662
677
  - app/uploaders/zizia/csv_manifest_validator.rb
663
678
  - app/views/layouts/zizia/application.html.erb
679
+ - app/views/zizia/csv_import_details/index.html.erb
680
+ - app/views/zizia/csv_import_details/show.html.erb
664
681
  - app/views/zizia/csv_imports/_actions.html.erb
665
682
  - app/views/zizia/csv_imports/_collection_selection.html.erb
666
683
  - app/views/zizia/csv_imports/_error.html.erb
@@ -1437,6 +1454,7 @@ files:
1437
1454
  - spec/dummy/spec/models/qa/local_authority_spec.rb
1438
1455
  - spec/dummy/spec/rails_helper.rb
1439
1456
  - spec/dummy/spec/spec_helper.rb
1457
+ - spec/dummy/spec/system/csv_import_details_page_spec.rb
1440
1458
  - spec/dummy/spec/system/import_csv_with_warnings_spec.rb
1441
1459
  - spec/dummy/spec/system/import_from_csv_spec.rb
1442
1460
  - spec/dummy/spec/system/import_from_csv_with_errors_spec.rb
@@ -1458,6 +1476,8 @@ files:
1458
1476
  - spec/dummy/test/test_helper.rb
1459
1477
  - spec/dummy/vendor/.keep
1460
1478
  - spec/factories/collection.rb
1479
+ - spec/factories/csv_import.rb
1480
+ - spec/factories/csv_import_detail.rb
1461
1481
  - spec/factories/user.rb
1462
1482
  - spec/fixtures/bad_example.csv
1463
1483
  - spec/fixtures/csv_import/csv_files_with_problems/extra - headers.csv