hyrax 2.2.4 → 2.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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +75 -0
  3. data/README.md +7 -2
  4. data/app/assets/javascripts/hyrax/batch_select_all.js +5 -0
  5. data/app/assets/stylesheets/hyrax/_forms.scss +7 -0
  6. data/app/assets/stylesheets/hyrax/_header.scss +4 -0
  7. data/app/presenters/hyrax/dashboard/user_presenter.rb +1 -1
  8. data/app/services/hyrax/admin_set_service.rb +12 -7
  9. data/app/views/_controls.html.erb +6 -6
  10. data/app/views/catalog/_search_form.html.erb +35 -30
  11. data/app/views/hyrax/batch_select/_add_button.html.erb +2 -2
  12. data/app/views/hyrax/dashboard/_index_partials/_current_proxy_rights.html.erb +12 -14
  13. data/app/views/hyrax/dashboard/_repository_growth.html.erb +30 -0
  14. data/app/views/hyrax/dashboard/_repository_objects.html.erb +28 -0
  15. data/app/views/hyrax/dashboard/_sidebar.html.erb +17 -15
  16. data/app/views/hyrax/dashboard/_user_activity.html.erb +28 -0
  17. data/app/views/hyrax/dashboard/show_admin.html.erb +15 -37
  18. data/app/views/hyrax/dashboard/show_user.html.erb +1 -1
  19. data/app/views/hyrax/embargoes/_list_expired_active_embargoes.html.erb +2 -2
  20. data/app/views/hyrax/my/_search_form.html.erb +15 -10
  21. data/app/views/hyrax/my/_search_header.html.erb +2 -2
  22. data/config/locales/hyrax.de.yml +15 -10
  23. data/config/locales/hyrax.en.yml +15 -10
  24. data/config/locales/hyrax.es.yml +15 -10
  25. data/config/locales/hyrax.fr.yml +15 -10
  26. data/config/locales/hyrax.it.yml +15 -10
  27. data/config/locales/hyrax.pt-BR.yml +15 -10
  28. data/config/locales/hyrax.zh.yml +15 -10
  29. data/hyrax.gemspec +5 -1
  30. data/lib/hyrax/version.rb +1 -1
  31. data/spec/factories/generic_works.rb +2 -2
  32. data/spec/features/admin_spec.rb +5 -5
  33. data/spec/services/hyrax/admin_set_service_spec.rb +95 -46
  34. data/template.rb +1 -1
  35. metadata +34 -16
@@ -82,7 +82,6 @@ SUMMARY
82
82
  # temporary pin to 2.17 due to failures caused in 2.18.0
83
83
  spec.add_development_dependency "capybara", '~> 2.4', '< 2.18.0'
84
84
  spec.add_development_dependency 'capybara-maleficent', '~> 0.2'
85
- spec.add_development_dependency "chromedriver-helper"
86
85
  spec.add_development_dependency 'database_cleaner', '~> 1.3'
87
86
  spec.add_development_dependency 'engine_cart', '~> 2.0'
88
87
  spec.add_development_dependency "equivalent-xml", '~> 0.5'
@@ -94,6 +93,7 @@ SUMMARY
94
93
  spec.add_development_dependency 'rspec-activemodel-mocks', '~> 1.0'
95
94
  spec.add_development_dependency 'rspec-its', '~> 1.1'
96
95
  spec.add_development_dependency 'rspec-rails', '~> 3.1'
96
+ spec.add_development_dependency 'rspec_junit_formatter'
97
97
  spec.add_development_dependency "selenium-webdriver"
98
98
  spec.add_development_dependency 'solr_wrapper', '>= 1.1', '< 3.0'
99
99
  spec.add_development_dependency 'i18n-debug' if ENV['I18N_DEBUG']
@@ -111,4 +111,8 @@ SUMMARY
111
111
  # simple_form 3.5.1 broke hydra-editor for certain model types;
112
112
  # see: https://github.com/plataformatec/simple_form/issues/1549
113
113
  spec.add_dependency 'simple_form', '~> 3.2', '<= 3.5.0'
114
+ # chromedriver-helper 2.0 broke the chromedriver used by capybara
115
+ # see: https://github.com/flavorjones/chromedriver-helper/issues/62
116
+ # and https://github.com/flavorjones/chromedriver-helper/issues/57
117
+ spec.add_development_dependency 'chromedriver-helper', '< 2.0'
114
118
  end
@@ -1,3 +1,3 @@
1
1
  module Hyrax
2
- VERSION = '2.2.4'.freeze
2
+ VERSION = '2.3.0'.freeze
3
3
  end
@@ -23,7 +23,6 @@ FactoryBot.define do
23
23
  end
24
24
 
25
25
  title { ["Test title"] }
26
- visibility { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE }
27
26
 
28
27
  after(:build) do |work, evaluator|
29
28
  work.apply_depositor_metadata(evaluator.user.user_key)
@@ -36,7 +35,8 @@ FactoryBot.define do
36
35
  end
37
36
 
38
37
  factory :private_work do
39
- visibility { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE }
38
+ # private is default
39
+ # visibility { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE }
40
40
  end
41
41
 
42
42
  factory :registered_generic_work do
@@ -12,12 +12,12 @@ RSpec.describe "The admin dashboard", :clean_repo do
12
12
  end
13
13
 
14
14
  before do
15
- create(:work_with_two_children, title: ["Work A"], admin_set_id: admin_set_1.id, edit_users: [user])
16
- create(:work_with_one_child, title: ["Work B"], admin_set_id: admin_set_2.id, edit_users: [user])
17
- create(:work_with_two_children, title: ["Work C"], admin_set_id: admin_set_2.id, edit_users: [user])
15
+ create(:work_with_files, title: ["Work A"], admin_set_id: admin_set_1.id, edit_users: [user])
16
+ create(:work_with_one_file, title: ["Work B"], admin_set_id: admin_set_2.id, edit_users: [user])
17
+ create(:work_with_file_and_work, title: ["Work C"], admin_set_id: admin_set_2.id, edit_users: [user])
18
18
  end
19
19
 
20
- it do
20
+ it 'renders the counts of Works and Files in all AdminSets' do
21
21
  login_as(user, scope: :user)
22
22
  visit '/dashboard'
23
23
 
@@ -25,6 +25,6 @@ RSpec.describe "The admin dashboard", :clean_repo do
25
25
  expect(find('tr', text: 'First Admin Set').find('td:eq(3)')).to have_content(2)
26
26
 
27
27
  expect(find('tr', text: 'Second Admin Set').find('td:eq(2)')).to have_content(2)
28
- expect(find('tr', text: 'Second Admin Set').find('td:eq(3)')).to have_content(3)
28
+ expect(find('tr', text: 'Second Admin Set').find('td:eq(3)')).to have_content(2)
29
29
  end
30
30
  end
@@ -51,71 +51,120 @@ RSpec.describe Hyrax::AdminSetService do
51
51
  end
52
52
  end
53
53
 
54
- describe '#search_results_with_work_count' do
54
+ describe '#search_results_with_work_count', :clean_repo do
55
55
  subject { service.search_results_with_work_count(access) }
56
56
 
57
- let(:access) { :read }
58
- let(:documents) { [doc1, doc2, doc3] }
59
- let(:doc1) { SolrDocument.new(id: 'xyz123') }
60
- let(:doc2) { SolrDocument.new(id: 'yyx123') }
61
- let(:doc3) { SolrDocument.new(id: 'zxy123') }
62
- let(:connection) { instance_double(RSolr::Client) }
63
- let(:facets) { { 'isPartOf_ssim' => [doc1.id, 8, doc2.id, 2] } }
64
- let(:document_list) do
57
+ let(:admin_set_attrs) do
58
+ [
59
+ { id: 'admin_set_1' },
60
+ { id: 'admin_set_2' },
61
+ { id: 'admin_set_3' }
62
+ ]
63
+ end
64
+
65
+ let(:file_set_attrs) do
65
66
  [
66
- {
67
- 'isPartOf_ssim' => ['xyz123'],
68
- 'file_set_ids_ssim' => ['aaa']
69
- },
70
- {
71
- 'isPartOf_ssim' => ['xyz123', 'yyx123'],
72
- 'file_set_ids_ssim' => ['bbb', 'ccc']
73
- }
67
+ { id: 'file_1', has_model_ssim: 'FileSet' },
68
+ { id: 'file_2', has_model_ssim: 'FileSet' },
69
+ { id: 'file_3', has_model_ssim: 'FileSet' },
70
+ { id: 'file_4', has_model_ssim: 'FileSet' },
71
+ { id: 'file_5', has_model_ssim: 'FileSet' },
72
+ { id: 'file_6', has_model_ssim: 'FileSet' },
73
+ { id: 'file_7', has_model_ssim: 'FileSet' },
74
+ { id: 'file_8', has_model_ssim: 'FileSet' },
75
+ { id: 'file_9', has_model_ssim: 'FileSet' },
76
+ { id: 'file_10', has_model_ssim: 'FileSet' },
77
+ { id: 'file_11', has_model_ssim: 'FileSet' }
74
78
  ]
75
79
  end
76
80
 
77
- let(:results) do
78
- {
79
- 'response' =>
80
- {
81
- 'docs' => document_list
82
- },
83
- 'facet_counts' =>
84
- {
85
- 'facet_fields' => facets
86
- }
87
- }
81
+ let(:work1_attrs) { { id: 'work_1' } }
82
+ let(:work2_attrs) { { id: 'work_2' } }
83
+ let(:work3_attrs) { { id: 'work_3' } }
84
+ let(:work4_attrs) { { id: 'work_4' } }
85
+ let(:work5_attrs) { { id: 'work_5' } }
86
+ let(:work6_attrs) { { id: 'work_6' } }
87
+ let(:work7_attrs) { { id: 'work_7' } }
88
+ let(:work8_attrs) { { id: 'work_8' } }
89
+ let(:work9_attrs) { { id: 'work_9' } }
90
+ let(:work10_attrs) { { id: 'work_10' } }
91
+ let(:work11_attrs) { { id: 'work_11' } }
92
+
93
+ let(:work_attrs) { [work1_attrs, work2_attrs, work3_attrs, work4_attrs, work5_attrs, work6_attrs, work7_attrs, work8_attrs, work9_attrs, work10_attrs, work11_attrs] }
94
+
95
+ let(:works) do
96
+ [].tap do |result|
97
+ work_attrs.each do |work|
98
+ result << SolrDocument.new(work)
99
+ end
100
+ end
101
+ end
102
+
103
+ let(:admin_sets) do
104
+ [].tap do |result|
105
+ admin_set_attrs.each do |admin_set|
106
+ result << SolrDocument.new(admin_set)
107
+ end
108
+ end
88
109
  end
89
110
 
111
+ let(:file_sets) do
112
+ [].tap do |result|
113
+ file_set_attrs.each do |file_set|
114
+ result << SolrDocument.new(file_set)
115
+ end
116
+ end
117
+ end
118
+
119
+ let(:access) { :read }
90
120
  let(:struct) { described_class::SearchResultForWorkCount }
91
121
 
92
122
  before do
93
- allow(service).to receive(:search_results).and_return(documents)
94
- allow(ActiveFedora::SolrService.instance).to receive(:conn).and_return(connection)
95
- allow(connection).to receive(:get).with("select", params: { fq: "{!terms f=isPartOf_ssim}xyz123,yyx123,zxy123",
96
- "facet.field" => "isPartOf_ssim" }).and_return(results)
123
+ allow(service).to receive(:search_results).and_return(admin_sets)
124
+ all_objects = []
125
+ all_objects << works << admin_sets << file_sets
126
+ all_objects.each do |obj|
127
+ ActiveFedora::SolrService.add(obj)
128
+ end
129
+ ActiveFedora::SolrService.commit
97
130
  end
98
131
 
99
- context "when there are works in the admin set" do
100
- it "returns rows with document in the first column and integer count value in the second and third column" do
101
- expect(subject).to eq [struct.new(doc1, 8, 3), struct.new(doc2, 2, 2), struct.new(doc3, 0, 0)]
132
+ context "when there are works and files in the admin set" do
133
+ let(:work1_attrs) { { id: 'work_1', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_1', 'file_3', 'file_4'] } }
134
+ let(:work2_attrs) { { id: 'work_2', isPartOf_ssim: 'admin_set_2', file_set_ids_ssim: ['file_2'] } }
135
+ let(:work3_attrs) { { id: 'work_3', isPartOf_ssim: 'admin_set_2', file_set_ids_ssim: ['file_6', 'file_7'] } }
136
+ let(:work4_attrs) { { id: 'work_4', isPartOf_ssim: 'admin_set_3', file_set_ids_ssim: ['file_8'] } }
137
+
138
+ it "returns rows with document in the first column, count of works in second column and count of files in the third column" do
139
+ expect(subject).to eq [struct.new(admin_sets[0], 1, 3), struct.new(admin_sets[1], 2, 3), struct.new(admin_sets[2], 1, 1)]
102
140
  end
103
141
  end
104
142
 
105
143
  context "when there are no files in the admin set" do
106
- let(:document_list) do
107
- [
108
- {
109
- 'isPartOf_ssim' => ['xyz123']
110
- },
111
- {
112
- 'isPartOf_ssim' => ['xyz123', 'yyx123']
113
- }
114
- ]
144
+ let(:work1_attrs) { { id: 'work_1', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: [] } }
145
+ let(:work2_attrs) { { id: 'work_2', isPartOf_ssim: 'admin_set_2', file_set_ids_ssim: [] } }
146
+ let(:work3_attrs) { { id: 'work_3', isPartOf_ssim: 'admin_set_2', file_set_ids_ssim: [] } }
147
+
148
+ it "returns rows with document in the first column, count of works in second column and count of no files in the third column" do
149
+ expect(subject).to eq [struct.new(admin_sets[0], 1, 0), struct.new(admin_sets[1], 2, 0), struct.new(admin_sets[2], 0, 0)]
115
150
  end
151
+ end
116
152
 
117
- it "returns rows with document in the first column and integer count value in the second and third column" do
118
- expect(subject).to eq [struct.new(doc1, 8, 0), struct.new(doc2, 2, 0), struct.new(doc3, 0, 0)]
153
+ context "when there are more than 10 works in the admin set" do
154
+ let(:work1_attrs) { { id: 'work_1', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_1'] } }
155
+ let(:work2_attrs) { { id: 'work_2', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_2'] } }
156
+ let(:work3_attrs) { { id: 'work_3', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_3'] } }
157
+ let(:work4_attrs) { { id: 'work_4', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_4'] } }
158
+ let(:work5_attrs) { { id: 'work_5', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_5'] } }
159
+ let(:work6_attrs) { { id: 'work_6', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_6'] } }
160
+ let(:work7_attrs) { { id: 'work_7', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_7'] } }
161
+ let(:work8_attrs) { { id: 'work_8', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_8'] } }
162
+ let(:work9_attrs) { { id: 'work_9', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_9'] } }
163
+ let(:work10_attrs) { { id: 'work_10', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_10'] } }
164
+ let(:work11_attrs) { { id: 'work_11', isPartOf_ssim: 'admin_set_1', file_set_ids_ssim: ['file_11'] } }
165
+
166
+ it "returns rows with document in the first column, count of works in second column and count of files in the third column" do
167
+ expect(subject).to eq [struct.new(admin_sets[0], 11, 11), struct.new(admin_sets[1], 0, 0), struct.new(admin_sets[2], 0, 0)]
119
168
  end
120
169
  end
121
170
  end
@@ -1,4 +1,4 @@
1
- gem 'hyrax', '2.2.4'
1
+ gem 'hyrax', '2.3.0'
2
2
  run 'bundle install'
3
3
  generate 'hyrax:install', '-f'
4
4
  rails_command 'db:migrate'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2018-09-11 00:00:00.000000000 Z
17
+ date: 2018-09-19 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rails
@@ -716,20 +716,6 @@ dependencies:
716
716
  - - "~>"
717
717
  - !ruby/object:Gem::Version
718
718
  version: '0.2'
719
- - !ruby/object:Gem::Dependency
720
- name: chromedriver-helper
721
- requirement: !ruby/object:Gem::Requirement
722
- requirements:
723
- - - ">="
724
- - !ruby/object:Gem::Version
725
- version: '0'
726
- type: :development
727
- prerelease: false
728
- version_requirements: !ruby/object:Gem::Requirement
729
- requirements:
730
- - - ">="
731
- - !ruby/object:Gem::Version
732
- version: '0'
733
719
  - !ruby/object:Gem::Dependency
734
720
  name: database_cleaner
735
721
  requirement: !ruby/object:Gem::Requirement
@@ -902,6 +888,20 @@ dependencies:
902
888
  - - "~>"
903
889
  - !ruby/object:Gem::Version
904
890
  version: '3.1'
891
+ - !ruby/object:Gem::Dependency
892
+ name: rspec_junit_formatter
893
+ requirement: !ruby/object:Gem::Requirement
894
+ requirements:
895
+ - - ">="
896
+ - !ruby/object:Gem::Version
897
+ version: '0'
898
+ type: :development
899
+ prerelease: false
900
+ version_requirements: !ruby/object:Gem::Requirement
901
+ requirements:
902
+ - - ">="
903
+ - !ruby/object:Gem::Version
904
+ version: '0'
905
905
  - !ruby/object:Gem::Dependency
906
906
  name: selenium-webdriver
907
907
  requirement: !ruby/object:Gem::Requirement
@@ -1040,6 +1040,20 @@ dependencies:
1040
1040
  - - "<="
1041
1041
  - !ruby/object:Gem::Version
1042
1042
  version: 3.5.0
1043
+ - !ruby/object:Gem::Dependency
1044
+ name: chromedriver-helper
1045
+ requirement: !ruby/object:Gem::Requirement
1046
+ requirements:
1047
+ - - "<"
1048
+ - !ruby/object:Gem::Version
1049
+ version: '2.0'
1050
+ type: :development
1051
+ prerelease: false
1052
+ version_requirements: !ruby/object:Gem::Requirement
1053
+ requirements:
1054
+ - - "<"
1055
+ - !ruby/object:Gem::Version
1056
+ version: '2.0'
1043
1057
  description: Hyrax is a featureful Samvera front-end based on the latest and greatest
1044
1058
  Samvera software components.
1045
1059
  email:
@@ -1054,6 +1068,7 @@ executables: []
1054
1068
  extensions: []
1055
1069
  extra_rdoc_files: []
1056
1070
  files:
1071
+ - ".circleci/config.yml"
1057
1072
  - ".codeclimate.yml"
1058
1073
  - ".engine_cart.yml"
1059
1074
  - ".eslintignore"
@@ -1874,7 +1889,10 @@ files:
1874
1889
  - app/views/hyrax/dashboard/_index_partials/_current_proxy_rights.html.erb
1875
1890
  - app/views/hyrax/dashboard/_index_partials/_proxy_rights.html.erb
1876
1891
  - app/views/hyrax/dashboard/_index_partials/_transfers.html.erb
1892
+ - app/views/hyrax/dashboard/_repository_growth.html.erb
1893
+ - app/views/hyrax/dashboard/_repository_objects.html.erb
1877
1894
  - app/views/hyrax/dashboard/_sidebar.html.erb
1895
+ - app/views/hyrax/dashboard/_user_activity.html.erb
1878
1896
  - app/views/hyrax/dashboard/collections/_batch_edits_actions.html.erb
1879
1897
  - app/views/hyrax/dashboard/collections/_bookmark_control.html.erb
1880
1898
  - app/views/hyrax/dashboard/collections/_button_create_collection.html.erb