hyrax 4.0.0 → 5.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +124 -232
  3. data/.dassie/.env +8 -2
  4. data/.dassie/Gemfile +27 -42
  5. data/.dassie/Gemfile.dassie +2 -0
  6. data/.dassie/app/assets/config/manifest.js +2 -0
  7. data/.dassie/app/assets/stylesheets/hyrax.scss +1 -0
  8. data/.dassie/config/environments/test.rb +1 -0
  9. data/.dassie/config/initializers/hyrax.rb +3 -1
  10. data/.dassie/config/initializers/riiif.rb +11 -7
  11. data/.dassie/config/metadata/collection_resource.yaml +3 -0
  12. data/.dassie/config/metadata/monograph.yaml +8 -0
  13. data/.dassie/config/metadata/sample_metadata.yaml +1 -0
  14. data/.dassie/config/redis.yml +2 -0
  15. data/.dassie/db/migrate/20230725222727_create_hyrax_counter_metrics.hyrax.rb +14 -0
  16. data/.dassie/db/migrate/20230803165135_change_work_id_to_string.rb +5 -0
  17. data/.dassie/db/migrate/20230808102105_add_indices_to_hyrax_counter_metrics.hyrax.rb +8 -0
  18. data/.dassie/db/migrate/20230821153635_add_fields_to_counter_metric.rb +8 -0
  19. data/.dassie/db/schema.rb +22 -3
  20. data/.dockerignore +7 -0
  21. data/.github/PULL_REQUEST_TEMPLATE.md +10 -7
  22. data/.github/release.yml +5 -2
  23. data/.gitignore +1 -1
  24. data/.koppie/.env +13 -4
  25. data/.koppie/Gemfile +10 -12
  26. data/.koppie/Gemfile.koppie +2 -0
  27. data/.koppie/Rakefile +0 -2
  28. data/.koppie/app/models/ability.rb +1 -5
  29. data/.koppie/app/models/user.rb +0 -2
  30. data/.koppie/config/application.rb +2 -1
  31. data/.koppie/config/arkivo.yml +6 -0
  32. data/.koppie/config/blacklight.yml +2 -2
  33. data/.koppie/config/environments/test.rb +1 -0
  34. data/.koppie/config/features.yml +2 -0
  35. data/.koppie/config/initializers/1_valkyrie.rb +29 -6
  36. data/.koppie/config/initializers/arkivo_constraint.rb +12 -0
  37. data/.koppie/config/initializers/hyrax.rb +10 -4
  38. data/.koppie/config/initializers/riiif.rb +11 -7
  39. data/.koppie/config/metadata/collection_resource.yaml +49 -0
  40. data/.koppie/config/metadata/generic_work.yaml +2 -0
  41. data/.koppie/config/metadata/monograph.yaml +10 -0
  42. data/.koppie/config/role_map.yml +3 -25
  43. data/.koppie/config/routes.rb +1 -2
  44. data/.koppie/config/solr.yml +1 -1
  45. data/.koppie/config/valkyrie_index.yml +4 -10
  46. data/.koppie/config/zotero.yml +6 -0
  47. data/.koppie/db/migrate/20230725222727_create_hyrax_counter_metrics.hyrax.rb +14 -0
  48. data/.koppie/db/migrate/20230803165135_change_work_id_to_string.rb +5 -0
  49. data/.koppie/db/schema.rb +12 -1
  50. data/.koppie/yarn.lock +23 -23
  51. data/.regen +1 -1
  52. data/CONTAINERS.md +1 -3
  53. data/Dockerfile +17 -13
  54. data/Gemfile +4 -21
  55. data/Gemfile.dassie +2 -0
  56. data/Gemfile.koppie +2 -0
  57. data/README.md +0 -1
  58. data/Rakefile +0 -11
  59. data/app/actors/hyrax/actors/base_actor.rb +4 -3
  60. data/app/actors/hyrax/actors/embargo_actor.rb +3 -3
  61. data/app/actors/hyrax/actors/lease_actor.rb +5 -2
  62. data/app/assets/javascripts/hyrax/batch_select_all.js +1 -1
  63. data/app/assets/javascripts/hyrax/file_manager/member.es6 +1 -1
  64. data/app/assets/javascripts/hyrax/file_manager/sorting.es6 +3 -2
  65. data/app/assets/stylesheets/hyrax/_file-listing.scss +0 -2
  66. data/app/assets/stylesheets/hyrax/_work-show.scss +19 -3
  67. data/app/assets/stylesheets/hyrax/sidebar.scss +23 -0
  68. data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +8 -2
  69. data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +7 -1
  70. data/app/controllers/concerns/hyrax/valkyrie_downloads_controller_behavior.rb +79 -0
  71. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +64 -14
  72. data/app/controllers/hyrax/admin/workflows_controller.rb +48 -3
  73. data/app/controllers/hyrax/api/items_controller.rb +2 -3
  74. data/app/controllers/hyrax/batch_edits_controller.rb +39 -10
  75. data/app/controllers/hyrax/batch_uploads_controller.rb +5 -1
  76. data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -1
  77. data/app/controllers/hyrax/downloads_controller.rb +8 -1
  78. data/app/controllers/hyrax/file_sets_controller.rb +50 -6
  79. data/app/controllers/hyrax/my/collections_controller.rb +2 -0
  80. data/app/controllers/hyrax/single_use_links_viewer_controller.rb +16 -2
  81. data/app/forms/concerns/hyrax/basic_metadata_form_fields_behavior.rb +38 -0
  82. data/app/forms/hyrax/forms/collection_form.rb +0 -15
  83. data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +0 -34
  84. data/app/forms/hyrax/forms/file_set_edit_form.rb +1 -1
  85. data/app/forms/hyrax/forms/file_set_form.rb +2 -2
  86. data/app/forms/hyrax/forms/pcdm_object_form.rb +21 -0
  87. data/app/forms/hyrax/forms/permission_template_form.rb +2 -7
  88. data/app/forms/hyrax/forms/resource_batch_edit_form.rb +118 -0
  89. data/app/forms/hyrax/forms/resource_form.rb +21 -34
  90. data/app/forms/hyrax/forms/work_embargo_form.rb +1 -0
  91. data/app/forms/hyrax/forms/work_form.rb +1 -1
  92. data/app/forms/hyrax/forms/work_lease_form.rb +1 -0
  93. data/app/helpers/hyrax/dashboard_helper_behavior.rb +30 -9
  94. data/app/helpers/hyrax/membership_helper.rb +13 -1
  95. data/app/helpers/hyrax/work_form_helper.rb +0 -107
  96. data/app/indexers/hyrax/file_set_indexer.rb +6 -0
  97. data/app/indexers/hyrax/location_indexer.rb +29 -0
  98. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +36 -5
  99. data/app/indexers/hyrax/valkyrie_work_indexer.rb +9 -2
  100. data/app/inputs/controlled_vocabulary_input.rb +1 -1
  101. data/app/jobs/characterize_job.rb +1 -1
  102. data/app/jobs/create_work_job.rb +36 -4
  103. data/app/jobs/valkyrie_characterization_job.rb +9 -0
  104. data/app/jobs/valkyrie_create_derivatives_job.rb +8 -7
  105. data/app/jobs/valkyrie_ingest_job.rb +1 -4
  106. data/app/models/admin_set.rb +1 -31
  107. data/app/models/collection_branding_info.rb +2 -9
  108. data/app/models/concerns/hyrax/ability.rb +2 -1
  109. data/app/models/concerns/hyrax/collection_behavior.rb +4 -12
  110. data/app/models/concerns/hyrax/file_set/derivatives.rb +3 -2
  111. data/app/models/concerns/hyrax/riiif_file.rb +30 -0
  112. data/app/models/concerns/hyrax/solr_document_behavior.rb +20 -3
  113. data/app/models/hyrax/collection_type.rb +5 -14
  114. data/app/models/hyrax/counter_metric.rb +7 -0
  115. data/app/models/hyrax/file_metadata.rb +9 -9
  116. data/app/models/hyrax/file_set.rb +76 -15
  117. data/app/models/hyrax/orcid_validator.rb +0 -6
  118. data/app/models/hyrax/resource.rb +30 -2
  119. data/app/models/hyrax/work.rb +2 -5
  120. data/app/presenters/hyrax/collection_presenter.rb +0 -17
  121. data/app/presenters/hyrax/embargo_presenter.rb +4 -0
  122. data/app/presenters/hyrax/file_set_presenter.rb +6 -0
  123. data/app/presenters/hyrax/iiif_manifest_presenter.rb +3 -7
  124. data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +6 -4
  125. data/app/presenters/hyrax/presenter_renderer.rb +0 -7
  126. data/app/presenters/hyrax/version_list_presenter.rb +19 -10
  127. data/app/presenters/hyrax/version_presenter.rb +19 -4
  128. data/app/presenters/hyrax/work_show_presenter.rb +6 -11
  129. data/app/search_builders/hyrax/file_set_search_builder.rb +1 -1
  130. data/app/search_builders/hyrax/valkyrie_abstract_type_relation.rb +37 -0
  131. data/app/search_builders/hyrax/valkyrie_work_relation.rb +9 -0
  132. data/app/services/hyrax/admin_set_create_service.rb +0 -17
  133. data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +16 -9
  134. data/app/services/hyrax/collections/collection_member_service.rb +1 -1
  135. data/app/services/hyrax/custom_queries/find_by_date_range.rb +55 -0
  136. data/app/services/hyrax/custom_queries/find_count_by.rb +62 -0
  137. data/app/services/hyrax/custom_queries/find_file_metadata.rb +1 -1
  138. data/app/services/hyrax/custom_queries/find_models_by_access.rb +59 -0
  139. data/app/services/hyrax/derivative_bucketed_storage.rb +25 -0
  140. data/app/services/hyrax/derivative_path.rb +14 -4
  141. data/app/services/hyrax/embargo_manager.rb +106 -13
  142. data/app/services/hyrax/embargo_service.rb +12 -10
  143. data/app/services/hyrax/file_set_derivatives_service.rb +14 -13
  144. data/app/services/hyrax/fixity_check_failure_service.rb +1 -1
  145. data/app/services/hyrax/identifier/dispatcher.rb +9 -2
  146. data/app/services/hyrax/lease_manager.rb +88 -8
  147. data/app/services/hyrax/listeners/file_metadata_listener.rb +16 -8
  148. data/app/services/hyrax/listeners/member_cleanup_listener.rb +2 -28
  149. data/app/services/hyrax/listeners/metadata_index_listener.rb +11 -0
  150. data/app/services/hyrax/listeners/workflow_listener.rb +8 -11
  151. data/app/services/hyrax/lock_manager.rb +1 -2
  152. data/app/services/hyrax/persist_directly_contained_output_file_service.rb +24 -2
  153. data/app/services/hyrax/riiif_file_resolver.rb +50 -0
  154. data/app/services/hyrax/simple_schema_loader.rb +31 -0
  155. data/app/services/hyrax/solr_query_service.rb +7 -6
  156. data/app/services/hyrax/statistics/depositors/summary.rb +1 -1
  157. data/app/services/hyrax/statistics/over_time.rb +1 -1
  158. data/app/services/hyrax/statistics/users/over_time.rb +3 -1
  159. data/app/services/hyrax/statistics/valkyrie_query_service.rb +49 -0
  160. data/app/services/hyrax/statistics/works/count.rb +1 -1
  161. data/app/services/hyrax/thumbnail_path_service.rb +5 -0
  162. data/app/services/hyrax/valkyrie_persist_derivatives.rb +16 -11
  163. data/app/services/hyrax/valkyrie_upload.rb +16 -28
  164. data/app/services/hyrax/versioning_service.rb +30 -15
  165. data/app/services/hyrax/visibility_intention.rb +1 -4
  166. data/app/services/hyrax/visibility_propagator.rb +1 -1
  167. data/app/services/hyrax/work_uploads_handler.rb +1 -1
  168. data/app/services/hyrax/workflow/actionable_objects.rb +28 -3
  169. data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +1 -1
  170. data/app/services/hyrax/workflow/grant_read_to_depositor.rb +1 -1
  171. data/app/services/hyrax/workflow/permission_query.rb +23 -2
  172. data/app/validators/hyrax/collection_membership_validator.rb +1 -1
  173. data/app/views/catalog/_search_form.html.erb +1 -1
  174. data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
  175. data/app/views/hyrax/admin/workflows/_tabs.html.erb +9 -0
  176. data/app/views/hyrax/admin/workflows/index.html.erb +53 -76
  177. data/app/views/hyrax/base/_file_manager_members.html.erb +2 -2
  178. data/app/views/hyrax/base/_file_manager_resource_form.html.erb +1 -1
  179. data/app/views/hyrax/base/_form.html.erb +0 -10
  180. data/app/views/hyrax/base/_form_permission_embargo.html.erb +1 -1
  181. data/app/views/hyrax/base/_form_permission_lease.html.erb +1 -1
  182. data/app/views/hyrax/base/_form_visibility_component.html.erb +4 -4
  183. data/app/views/hyrax/base/_items.html.erb +1 -1
  184. data/app/views/hyrax/base/_show_actions.html.erb +1 -1
  185. data/app/views/hyrax/base/_workflow_actions.html.erb +25 -23
  186. data/app/views/hyrax/base/file_manager.html.erb +1 -1
  187. data/app/views/hyrax/base/show.json.jbuilder +4 -3
  188. data/app/views/hyrax/collections/_show_document_list_row.html.erb +1 -1
  189. data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
  190. data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +1 -1
  191. data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +3 -3
  192. data/app/views/hyrax/file_sets/_versioning.html.erb +5 -5
  193. data/app/views/hyrax/file_sets/media_display/_audio.html.erb +4 -4
  194. data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
  195. data/app/views/hyrax/file_sets/media_display/_video.html.erb +2 -2
  196. data/app/views/hyrax/file_sets/show.html.erb +5 -3
  197. data/app/views/hyrax/homepage/_explore_collections.html.erb +1 -1
  198. data/app/views/hyrax/my/_search_form.html.erb +1 -1
  199. data/app/views/hyrax/notifications/_notifications.html.erb +1 -1
  200. data/app/views/hyrax/users/_vitals.html.erb +1 -1
  201. data/bin/dev-entrypoint.sh +13 -0
  202. data/chart/hyrax/Chart.yaml +18 -14
  203. data/chart/hyrax/README.md +34 -21
  204. data/chart/hyrax/templates/_helpers.tpl +34 -1
  205. data/chart/hyrax/templates/configmap-env.yaml +12 -2
  206. data/chart/hyrax/templates/secrets.yaml +1 -1
  207. data/chart/hyrax/values.yaml +39 -14
  208. data/config/initializers/file_length_patch.rb +10 -0
  209. data/config/initializers/listeners.rb +4 -10
  210. data/config/initializers/storage_adapter_initializer.rb +1 -1
  211. data/config/locales/hyrax.en.yml +8 -0
  212. data/config/metadata/basic_metadata.yaml +52 -0
  213. data/config/metadata/core_metadata.yaml +4 -0
  214. data/config/metadata/file_set_metadata.yaml +20 -1
  215. data/config/metadata/hyrax_internal_metadata.yaml +57 -0
  216. data/docker-compose-koppie.yml +36 -22
  217. data/docker-compose-sirenia.yml +202 -0
  218. data/docker-compose.yml +42 -26
  219. data/documentation/developing-your-hyrax-based-app.md +6 -14
  220. data/documentation/legacyREADME.md +3 -1
  221. data/hyrax.gemspec +12 -13
  222. data/karma.conf.js +9 -10
  223. data/lib/generators/hyrax/collection_resource/templates/collection_metadata.yaml +2 -0
  224. data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +1 -1
  225. data/lib/generators/hyrax/templates/config/initializers/riiif.rb +11 -7
  226. data/lib/generators/hyrax/templates/db/migrate/20230725222727_create_hyrax_counter_metrics.rb.erb +14 -0
  227. data/lib/generators/hyrax/templates/db/migrate/20230803165135_change_work_id_to_string.rb.erb +5 -0
  228. data/lib/generators/hyrax/templates/db/migrate/20230808102105_add_indices_to_hyrax_counter_metrics.rb.erb +8 -0
  229. data/lib/generators/hyrax/templates/db/migrate/20230821153635_add_fields_to_counter_metric.rb.erb +8 -0
  230. data/lib/generators/hyrax/templates/db/seeds.rb +1 -1
  231. data/lib/generators/hyrax/work_resource/templates/form.rb.erb +1 -1
  232. data/lib/generators/hyrax/work_resource/templates/metadata.yaml +2 -0
  233. data/lib/hyrax/active_fedora_dummy_model.rb +6 -1
  234. data/lib/hyrax/configuration.rb +147 -43
  235. data/lib/hyrax/controlled_vocabularies/location.rb +7 -1
  236. data/lib/hyrax/engine.rb +2 -1
  237. data/lib/hyrax/form_fields.rb +6 -0
  238. data/lib/hyrax/publisher.rb +23 -3
  239. data/lib/hyrax/redis_event_store.rb +7 -8
  240. data/lib/hyrax/resource_name.rb +4 -0
  241. data/lib/hyrax/specs/capybara.rb +25 -37
  242. data/lib/hyrax/specs/shared_specs/hydra_works.rb +34 -7
  243. data/lib/hyrax/specs/shared_specs/indexers.rb +24 -6
  244. data/lib/hyrax/transactions/collection_destroy.rb +3 -2
  245. data/lib/hyrax/transactions/container.rb +47 -0
  246. data/lib/hyrax/transactions/file_metadata_destroy.rb +20 -0
  247. data/lib/hyrax/transactions/file_set_destroy.rb +3 -1
  248. data/lib/hyrax/transactions/file_set_update.rb +21 -0
  249. data/lib/hyrax/transactions/steps/add_file_sets.rb +6 -0
  250. data/lib/hyrax/transactions/steps/add_to_parent.rb +1 -1
  251. data/lib/hyrax/transactions/steps/apply_permission_template.rb +40 -0
  252. data/lib/hyrax/transactions/steps/delete_all_file_metadata.rb +46 -0
  253. data/lib/hyrax/transactions/steps/delete_all_file_sets.rb +46 -0
  254. data/lib/hyrax/transactions/steps/file_metadata_delete.rb +40 -0
  255. data/lib/hyrax/transactions/steps/remove_from_membership.rb +45 -0
  256. data/lib/hyrax/transactions/steps/save.rb +21 -0
  257. data/lib/hyrax/transactions/work_create.rb +1 -0
  258. data/lib/hyrax/transactions/work_destroy.rb +3 -2
  259. data/lib/hyrax/version.rb +1 -1
  260. data/lib/hyrax.rb +1 -0
  261. data/lib/tasks/collection_type_global_id.rake +9 -4
  262. data/lib/tasks/embargo_lease.rake +1 -0
  263. data/lib/valkyrie/indexing/solr/indexing_adapter.rb +2 -0
  264. data/lib/wings/active_fedora_converter/default_work.rb +7 -2
  265. data/lib/wings/active_fedora_converter/file_metadata_node.rb +1 -1
  266. data/lib/wings/active_fedora_converter.rb +53 -11
  267. data/lib/wings/attribute_transformer.rb +24 -17
  268. data/lib/wings/model_transformer.rb +23 -12
  269. data/lib/wings/orm_converter.rb +23 -18
  270. data/lib/wings/setup.rb +23 -3
  271. data/lib/wings/valkyrie/persister.rb +4 -2
  272. data/lib/wings/valkyrie/storage.rb +8 -90
  273. data/lib/wings.rb +5 -0
  274. data/package.json +3 -1
  275. data/tasks/hyrax_dev.rake +2 -33
  276. data/template.rb +1 -1
  277. metadata +104 -81
  278. data/.engine_cart.yml +0 -3
  279. data/app/forms/hyrax/forms/file_manager_form.rb +0 -35
  280. data/app/services/hyrax/collections/migration_service.rb +0 -113
  281. data/app/views/hyrax/base/_form_collections_error.html.erb +0 -1
  282. data/app/views/hyrax/base/_form_in_works_error.html.erb +0 -3
  283. data/app/views/hyrax/base/_form_ordered_members_error.html.erb +0 -3
  284. data/app/views/hyrax/base/_form_visibility_error.html.erb +0 -19
  285. data/app/views/hyrax/users/_user_util_links_extra.html.erb +0 -0
  286. data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +0 -9
@@ -14,9 +14,9 @@ module Hyrax
14
14
  def destroy
15
15
  case work
16
16
  when Valkyrie::Resource
17
- embargo_manager = Hyrax::EmbargoManager.new(resource: work)
18
- embargo_manager.release && Hyrax::AccessControlList(work).save
19
- embargo_manager.nullify
17
+ Hyrax::EmbargoManager.deactivate_embargo_for(resource: work) &&
18
+ Hyrax.persister.save(resource: work.embargo) &&
19
+ Hyrax::AccessControlList(work).save
20
20
  else
21
21
  work.embargo_visibility! # If the embargo has lapsed, update the current visibility.
22
22
  work.deactivate_embargo!
@@ -15,8 +15,11 @@ module Hyrax
15
15
  case work
16
16
  when Valkyrie::Resource
17
17
  lease_manager = Hyrax::LeaseManager.new(resource: work)
18
- lease_manager.release && Hyrax::AccessControlList(work).save
19
- lease_manager.nullify
18
+ return if lease_manager.lease.lease_expiration_date.blank?
19
+
20
+ lease_manager.deactivate!
21
+ work.lease = Hyrax.persister.save(resource: lease_manager.lease)
22
+ Hyrax::AccessControlList(work).save
20
23
  else
21
24
  work.lease_visibility! # If the lease has lapsed, update the current visibility.
22
25
  work.deactivate_lease!
@@ -41,7 +41,7 @@
41
41
  var checked = $("#check_all")[0]['checked'];
42
42
 
43
43
  // check each individual box
44
- $("input[type='checkbox'].batch_document_selector").each(function(index, value) {
44
+ $("input[type='checkbox'].batch_document_selector:not(.disabled)").each(function(index, value) {
45
45
  value['checked'] = checked;
46
46
  });
47
47
  toggleButtons();
@@ -10,7 +10,7 @@ export class InputTracker {
10
10
  this.notifier = notifier
11
11
  this.element.data("initial-value", this.element.val())
12
12
  this.element.data("tracker", this)
13
- this.element.trigger("change", this.value_changed)
13
+ this.element.on("change", this.value_changed)
14
14
  }
15
15
 
16
16
  reset() {
@@ -4,6 +4,7 @@ export default class SortManager {
4
4
  this.sorting_info = {}
5
5
  this.initialize_sort()
6
6
  this.element.data("current-order", this.order)
7
+ this.sort_property = this.element.data("sort-property")
7
8
  this.save_manager = save_manager
8
9
  this.initialize_alpha_sort_button()
9
10
  }
@@ -38,9 +39,9 @@ export default class SortManager {
38
39
  params() {
39
40
  let params = {}
40
41
  params[this.singular_class_name] = {
41
- "version": this.version,
42
- "ordered_member_ids": this.order
42
+ "version": this.version
43
43
  }
44
+ params[this.singular_class_name][this.sort_property] = this.order
44
45
  params["_method"] = "PATCH"
45
46
  return params
46
47
  }
@@ -70,8 +70,6 @@ h4 .small {
70
70
  .batch-info {
71
71
 
72
72
  .sort-toggle {
73
- height: 5.1em;
74
-
75
73
  button {
76
74
  margin-left: 10px;
77
75
  }
@@ -116,6 +116,21 @@ ul.tabular {
116
116
  background: #fff;
117
117
  border-color: #e0e0e0;
118
118
 
119
+ & > .btn {
120
+ padding: 0;
121
+ border: 0;
122
+ }
123
+
124
+ .btn-primary {
125
+ margin-bottom: 1rem;
126
+ }
127
+
128
+ .workflow-comments {
129
+ label {
130
+ font-weight: bold;
131
+ }
132
+ }
133
+
119
134
  .card-header {
120
135
  background-color: #e6ab5f;
121
136
  color: #ffffff;
@@ -128,8 +143,9 @@ ul.tabular {
128
143
  .card-body {
129
144
  background-color: #f2f1eb;
130
145
  }
131
- }
132
146
 
133
- .workflow-actions {
134
- background-color: #f8f8f8;
147
+ .workflow-actions {
148
+ background-color: #f8f8f8;
149
+ padding: 1rem;
150
+ }
135
151
  }
@@ -56,6 +56,29 @@ $gutter-width: $grid-gutter-width/2;
56
56
  }
57
57
  }
58
58
 
59
+ &:not(.maximized) {
60
+ .sidebar-action-text,
61
+ a span + span,
62
+ h5 {
63
+ display: none;
64
+ }
65
+
66
+ .nav li {
67
+ text-align: center;
68
+ a {
69
+ padding-left: 0;
70
+ padding-right: 0;
71
+ }
72
+ .fa {
73
+ margin-right: 0;
74
+ }
75
+ }
76
+
77
+ .nav-item {
78
+ width: $drawer-small;
79
+ }
80
+ }
81
+
59
82
  .sidebar-toggle {
60
83
  cursor: pointer;
61
84
  background-color: $body-background-color;
@@ -15,7 +15,7 @@ module Hyrax
15
15
  # Removes a single embargo
16
16
  def destroy
17
17
  Hyrax::Actors::EmbargoActor.new(curation_concern).destroy
18
- flash[:notice] = embargo_history(curation_concern)
18
+ flash[:notice] = embargo_history(curation_concern).last
19
19
  if curation_concern.work? && work_has_file_set_members?(curation_concern)
20
20
  redirect_to confirm_permission_path
21
21
  else
@@ -31,7 +31,13 @@ module Hyrax
31
31
  filter_docs_with_edit_access!
32
32
  copy_visibility = []
33
33
  copy_visibility = params[:embargoes].values.map { |h| h[:copy_visibility] } if params[:embargoes]
34
- resources = Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: Hyrax.config.use_valkyrie?)
34
+
35
+ resources = if Hyrax.config.use_valkyrie?
36
+ Hyrax.query_service.find_many_by_ids(ids: batch)
37
+ else
38
+ Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: false)
39
+ end
40
+
35
41
  resources.each do |resource|
36
42
  if Hyrax.config.use_valkyrie?
37
43
  EmbargoManager.new(resource: resource).release!
@@ -29,7 +29,13 @@ module Hyrax
29
29
  filter_docs_with_edit_access!
30
30
  copy_visibility = []
31
31
  copy_visibility = params[:leases].values.map { |h| h[:copy_visibility] } if params[:leases]
32
- resources = Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: Hyrax.config.use_valkyrie?)
32
+
33
+ resources = if Hyrax.config.use_valkyrie?
34
+ Hyrax.query_service.find_many_by_ids(ids: batch)
35
+ else
36
+ Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: false)
37
+ end
38
+
33
39
  resources.each do |resource|
34
40
  if Hyrax.config.use_valkyrie?
35
41
  LeaseManager.new(resource: resource).release!
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+ module Hyrax
3
+ module ValkyrieDownloadsControllerBehavior
4
+ def show_valkyrie
5
+ file_set_id = params.require(:id)
6
+ file_set = Hyrax.query_service.find_by(id: file_set_id)
7
+ send_file_contents_valkyrie(file_set)
8
+ end
9
+
10
+ private
11
+
12
+ def send_file_contents_valkyrie(file_set)
13
+ response.headers["Accept-Ranges"] = "bytes"
14
+ self.status = 200
15
+ use = params.fetch(:file, :original_file).to_sym
16
+ mime_type = params[:mime_type]
17
+ file_metadata = find_file_metadata(file_set: file_set, use: use, mime_type: mime_type)
18
+ return unless stale?(last_modified: file_metadata.updated_at, template: false)
19
+
20
+ file = Valkyrie::StorageAdapter.find_by(id: file_metadata.file_identifier)
21
+ prepare_file_headers_valkyrie(metadata: file_metadata, file: file)
22
+
23
+ # Warning - using the range header will load the range selection in to memory
24
+ # this can cause memory bloat
25
+ if request.headers['Range']
26
+ file.rewind
27
+ send_data send_range_valkyrie(file: file), data_options(file_metadata)
28
+ else
29
+ send_file file.disk_path, data_options(file_metadata).except(:status)
30
+ end
31
+ end
32
+
33
+ def data_options(file_metadata)
34
+ {
35
+ type: file_metadata.mime_type,
36
+ filename: file_metadata.original_filename,
37
+ disposition: "inline",
38
+ status: status
39
+ }
40
+ end
41
+
42
+ def send_range_valkyrie(file:)
43
+ _, range = request.headers['Range'].split('bytes=')
44
+ from, to = range.split('-').map(&:to_i)
45
+ to = file.size - 1 unless to
46
+ length = to - from + 1
47
+ response.headers['Content-Range'] = "bytes #{from}-#{to}/#{file.size}"
48
+ response.headers['Content-Length'] = length.to_s
49
+ self.status = 206
50
+ file.read from # Seek to start of requested range
51
+ file.read length
52
+ end
53
+
54
+ def prepare_file_headers_valkyrie(metadata:, file:, inline: false)
55
+ inline_display = ActiveRecord::Type::Boolean.new.cast(params.fetch(:inline, inline))
56
+ response.headers["Content-Disposition"] = "#{inline_display ? 'inline' : 'attachment'}; filename=#{metadata.original_filename}"
57
+ response.headers["Content-Type"] = metadata.mime_type
58
+ response.headers["Content-Length"] ||= (file.try(:size) || metadata.size.first).to_s
59
+ # Prevent Rack::ETag from calculating a digest over body
60
+ response.headers["Last-Modified"] = metadata.updated_at.utc.strftime("%a, %d %b %Y %T GMT")
61
+ self.content_type = metadata.mime_type
62
+ end
63
+
64
+ def find_file_metadata(file_set:, use: :original_file, mime_type: nil)
65
+ if mime_type.nil?
66
+ use = :thumbnail_file if use == :thumbnail
67
+ use = Hyrax::FileMetadata::Use.uri_for(use: use)
68
+ results = Hyrax.custom_queries.find_many_file_metadata_by_use(resource: file_set, use: use)
69
+ else
70
+ files = Hyrax.custom_queries.find_files(file_set: file_set)
71
+ results = [files.find { |f| f.mime_type == mime_type }]
72
+ end
73
+
74
+ results.first || raise(Hyrax::ObjectNotFoundError)
75
+ rescue ArgumentError
76
+ raise(Hyrax::ObjectNotFoundError)
77
+ end
78
+ end
79
+ end
@@ -79,14 +79,11 @@ module Hyrax
79
79
  wants.html { presenter && parent_presenter }
80
80
  wants.json do
81
81
  # load @curation_concern manually because it's skipped for html
82
- @curation_concern = Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: params[:id])
82
+ @curation_concern = load_curation_concern
83
83
  curation_concern # This is here for authorization checks (we could add authorize! but let's use the same method for CanCanCan)
84
84
  render :show, status: :ok
85
85
  end
86
86
  additional_response_formats(wants)
87
- wants.ttl { render body: presenter.export_as_ttl, mime_type: Mime[:ttl] }
88
- wants.jsonld { render body: presenter.export_as_jsonld, mime_type: Mime[:jsonld] }
89
- wants.nt { render body: presenter.export_as_nt, mime_type: Mime[:nt] }
90
87
  end
91
88
  end
92
89
  # rubocop:enable Metrics/AbcSize
@@ -114,9 +111,9 @@ module Hyrax
114
111
  Hyrax.config.callback.run(:after_destroy, curation_concern.id, current_user, warn: false)
115
112
  else
116
113
  transactions['work_resource.destroy']
117
- .with_step_args('work_resource.delete' => { user: current_user })
118
- .call(curation_concern)
119
- .value!
114
+ .with_step_args('work_resource.delete' => { user: current_user },
115
+ 'work_resource.delete_all_file_sets' => { user: current_user })
116
+ .call(curation_concern).value!
120
117
 
121
118
  title = Array(curation_concern.title).first
122
119
  end
@@ -125,7 +122,7 @@ module Hyrax
125
122
  end
126
123
 
127
124
  def file_manager
128
- @form = Forms::FileManagerForm.new(curation_concern, current_ability)
125
+ @form = presenter
129
126
  end
130
127
 
131
128
  def inspect_work
@@ -139,13 +136,20 @@ module Hyrax
139
136
  json = iiif_manifest_builder.manifest_for(presenter: iiif_manifest_presenter)
140
137
 
141
138
  respond_to do |wants|
142
- wants.json { render json: json }
143
- wants.html { render json: json }
139
+ wants.any { render json: json }
144
140
  end
145
141
  end
146
142
 
147
143
  private
148
144
 
145
+ def load_curation_concern
146
+ if Hyrax.config.disable_wings
147
+ Hyrax.query_service.find_by(id: params[:id])
148
+ else
149
+ Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: params[:id])
150
+ end
151
+ end
152
+
149
153
  def iiif_manifest_builder
150
154
  self.class.iiif_manifest_builder ||
151
155
  (Flipflop.cache_work_iiif_manifest? ? Hyrax::CachingIiifManifestBuilder.new : Hyrax::ManifestBuilderService.new)
@@ -180,15 +184,18 @@ module Hyrax
180
184
 
181
185
  ##
182
186
  # @return [#errors]
187
+ # rubocop:disable Metrics/MethodLength
183
188
  def create_valkyrie_work
184
189
  form = build_form
185
- return after_create_error(form_err_msg(form)) unless form.validate(params[hash_key_for_curation_concern])
190
+ # fallback to an empty hash to avoid: # NoMethodError: undefined method `has_key?` for nil:NilClass
191
+ original_input_params_for_form = params[hash_key_for_curation_concern] ? params[hash_key_for_curation_concern] : {}
192
+ return after_create_error(form_err_msg(form), original_input_params_for_form) unless form.validate(original_input_params_for_form)
186
193
 
187
194
  result =
188
195
  transactions['change_set.create_work']
189
196
  .with_step_args(
190
197
  'work_resource.add_to_parent' => { parent_id: params[:parent_id], user: current_user },
191
- 'work_resource.add_file_sets' => { uploaded_files: uploaded_files, file_set_params: params[hash_key_for_curation_concern][:file_set] },
198
+ 'work_resource.add_file_sets' => { uploaded_files: uploaded_files, file_set_params: original_input_params_for_form[:file_set] },
192
199
  'change_set.set_user_as_depositor' => { user: current_user },
193
200
  'work_resource.change_depositor' => { user: ::User.find_by_user_key(form.on_behalf_of) },
194
201
  'work_resource.save_acl' => { permissions_params: form.input_params["permissions"] }
@@ -197,6 +204,7 @@ module Hyrax
197
204
  @curation_concern = result.value_or { return after_create_error(transaction_err_msg(result)) }
198
205
  after_create_response
199
206
  end
207
+ # rubocop:enable Metrics/MethodLength
200
208
 
201
209
  def update_valkyrie_work
202
210
  form = build_form
@@ -370,10 +378,15 @@ module Hyrax
370
378
  end
371
379
  end
372
380
 
381
+ def format_error_messages(errors)
382
+ # the error may already be a string
383
+ errors.respond_to?(:messages) ? errors.messages.values.flatten.join("\n") : errors
384
+ end
385
+
373
386
  def after_create_error(errors, original_input_params_for_form = nil)
374
387
  respond_to do |wants|
375
388
  wants.html do
376
- flash[:error] = errors.to_s
389
+ flash[:error] = format_error_messages(errors)
377
390
  rebuild_form(original_input_params_for_form) if original_input_params_for_form.present?
378
391
  render 'new', status: :unprocessable_entity
379
392
  end
@@ -402,7 +415,7 @@ module Hyrax
402
415
  def after_update_error(errors)
403
416
  respond_to do |wants|
404
417
  wants.html do
405
- flash[:error] = errors.to_s
418
+ flash[:error] = format_error_messages(errors)
406
419
  build_form unless @form.is_a? Hyrax::ChangeSet
407
420
  render 'edit', status: :unprocessable_entity
408
421
  end
@@ -418,6 +431,13 @@ module Hyrax
418
431
  end
419
432
 
420
433
  def additional_response_formats(format)
434
+ respond_to_endnote(format)
435
+ respond_to_ttl(format)
436
+ respond_to_jsonld(format)
437
+ respond_to_nt(format)
438
+ end
439
+
440
+ def respond_to_endnote(format)
421
441
  format.endnote do
422
442
  send_data(presenter.solr_document.export_as_endnote,
423
443
  type: "application/x-endnote-refer",
@@ -425,6 +445,36 @@ module Hyrax
425
445
  end
426
446
  end
427
447
 
448
+ def respond_to_ttl(format)
449
+ format.ttl do
450
+ if presenter.valkyrie_presenter?
451
+ render plain: "Error: Not Implemented", status: :not_implemented
452
+ else
453
+ render body: presenter.export_as_ttl, mime_type: Mime[:ttl]
454
+ end
455
+ end
456
+ end
457
+
458
+ def respond_to_jsonld(format)
459
+ format.jsonld do
460
+ if presenter.valkyrie_presenter?
461
+ render plain: "Error: Not Implemented", status: :not_implemented
462
+ else
463
+ render body: presenter.export_as_jsonld, mime_type: Mime[:jsonld]
464
+ end
465
+ end
466
+ end
467
+
468
+ def respond_to_nt(format)
469
+ format.nt do
470
+ if presenter.valkyrie_presenter?
471
+ render plain: "Error: Not Implemented", status: :not_implemented
472
+ else
473
+ render body: presenter.export_as_nt, mime_type: Mime[:nt]
474
+ end
475
+ end
476
+ end
477
+
428
478
  def save_permissions
429
479
  @saved_permissions =
430
480
  case curation_concern
@@ -15,9 +15,8 @@ module Hyrax
15
15
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
16
16
  add_breadcrumb t(:'hyrax.admin.sidebar.tasks'), '#'
17
17
  add_breadcrumb t(:'hyrax.admin.sidebar.workflow_review'), request.path
18
-
19
- @status_list = actionable_objects.reject(&:published?)
20
- @published_list = actionable_objects.select(&:published?)
18
+ assign_action_objects_params
19
+ @response = WorkflowResponse.new(actionable_objects.to_a, actionable_objects.total_count, current_page, per_page, under_review?)
21
20
  end
22
21
 
23
22
  private
@@ -30,5 +29,51 @@ module Hyrax
30
29
  @actionable_objects ||=
31
30
  Hyrax::Workflow::ActionableObjects.new(user: current_user)
32
31
  end
32
+
33
+ def current_page
34
+ @page ||= params.fetch('page', 1).to_i
35
+ end
36
+
37
+ def per_page
38
+ @per_page ||= params.fetch('per_page', 10).to_i
39
+ end
40
+
41
+ def assign_action_objects_params
42
+ actionable_objects.page = current_page
43
+ actionable_objects.per_page = per_page
44
+ actionable_objects.workflow_state_filter = (under_review? ? '!' : '') + deposited_workflow_state_name
45
+ end
46
+
47
+ def under_review?
48
+ @under_review = params['state'] != 'published'
49
+ end
50
+
51
+ class WorkflowResponse
52
+ attr_reader :total_count
53
+ attr_reader :current_page
54
+ attr_reader :per_page
55
+ attr_reader :docs
56
+ attr_reader :under_review
57
+
58
+ def initialize(docs, total_count, page, per_page, under_review)
59
+ @docs = docs
60
+ @total_count = total_count
61
+ @per_page = per_page.to_i
62
+ @current_page = page.to_i
63
+ @under_review = under_review
64
+ end
65
+
66
+ def total_pages
67
+ (total_count.to_f / per_page).ceil
68
+ end
69
+
70
+ def limit_value
71
+ docs.length
72
+ end
73
+
74
+ def viewing_under_review?
75
+ under_review
76
+ end
77
+ end
33
78
  end
34
79
  end
@@ -33,12 +33,11 @@ module Hyrax
33
33
  private
34
34
 
35
35
  def my_load_and_authorize_resource
36
- @work = Hyrax::WorkRelation.new.find(params[:id])
37
-
36
+ @work = Hyrax.query_service.find_by(id: params[:id])
38
37
  return render plain: "#{user} lacks access to #{@work}", status: :unauthorized unless user.can? :edit, @work
39
38
 
40
39
  return render plain: "Forbidden: #{@work} not deposited via Arkivo", status: :forbidden if @work.arkivo_checksum.nil?
41
- rescue ActiveFedora::ObjectNotFoundError
40
+ rescue ActiveFedora::ObjectNotFoundError, Valkyrie::Persistence::ObjectNotFoundError
42
41
  render plain: "id '#{params[:id]}' not found", status: :not_found
43
42
  end
44
43
 
@@ -41,9 +41,9 @@ module Hyrax
41
41
  batch.each do |doc_id|
42
42
  resource = Hyrax.query_service.find_by(id: Valkyrie::ID.new(doc_id))
43
43
  transactions['collection_resource.destroy']
44
- .with_step_args('collection_resource.delete' => { user: current_user })
45
- .call(resource)
46
- .value!
44
+ .with_step_args('collection_resource.delete' => { user: current_user },
45
+ 'collection_resource.remove_from_membership' => { user: current_user })
46
+ .call(resource).value!
47
47
  end
48
48
  flash[:notice] = "Batch delete complete"
49
49
  after_destroy_collection
@@ -52,7 +52,7 @@ module Hyrax
52
52
  def update_document(obj)
53
53
  interpret_visiblity_params(obj)
54
54
  obj.attributes = work_params(admin_set_id: obj.admin_set_id).except(*visibility_params)
55
- obj.date_modified = Time.current.ctime
55
+ obj.date_modified = TimeService.time_in_utc
56
56
 
57
57
  InheritPermissionsJob.perform_now(obj)
58
58
  VisibilityCopyJob.perform_now(obj)
@@ -60,11 +60,30 @@ module Hyrax
60
60
  obj.save
61
61
  end
62
62
 
63
+ def valkyrie_update_document(obj)
64
+ form = form_class.new(obj, current_ability, nil)
65
+ return unless form.validate(params[form_class.model_class.model_name.param_key])
66
+
67
+ cleanup_form_fields form
68
+
69
+ result = transactions['change_set.update_work']
70
+ .with_step_args('work_resource.save_acl' => { permissions_params: form.input_params["permissions"] })
71
+ .call(form)
72
+ obj = result.value!
73
+
74
+ InheritPermissionsJob.perform_now(obj)
75
+ VisibilityCopyJob.perform_now(obj)
76
+ end
77
+
63
78
  def update
64
79
  case params["update_type"]
65
80
  when "update"
66
81
  batch.each do |doc_id|
67
- update_document(Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: doc_id, use_valkyrie: false))
82
+ if Hyrax.config.use_valkyrie?
83
+ valkyrie_update_document(Hyrax.query_service.find_by(id: doc_id))
84
+ else
85
+ update_document(Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: doc_id, use_valkyrie: false))
86
+ end
68
87
  end
69
88
  flash[:notice] = "Batch update complete"
70
89
  after_update
@@ -89,15 +108,15 @@ module Hyrax
89
108
  batch.each do |id|
90
109
  resource = Hyrax.query_service.find_by(id: Valkyrie::ID.new(id))
91
110
  transactions['work_resource.destroy']
92
- .with_step_args('work_resource.delete' => { user: current_user })
93
- .call(resource)
94
- .value!
111
+ .with_step_args('work_resource.delete' => { user: current_user },
112
+ 'work_resource.delete_all_file_sets' => { user: current_user })
113
+ .call(resource).value!
95
114
  end
96
115
  after_update
97
116
  end
98
117
 
99
118
  def form_class
100
- Forms::BatchEditForm
119
+ Hyrax.config.use_valkyrie? ? Forms::ResourceBatchEditForm : Forms::BatchEditForm
101
120
  end
102
121
 
103
122
  def terms
@@ -105,7 +124,7 @@ module Hyrax
105
124
  end
106
125
 
107
126
  def work_params(extra_params = {})
108
- work_params = params[form_class.model_name.param_key] || ActionController::Parameters.new
127
+ work_params = params[form_class.model_class.model_name.param_key] || ActionController::Parameters.new
109
128
  form_class.model_attributes(work_params.merge(extra_params))
110
129
  end
111
130
 
@@ -135,5 +154,15 @@ module Hyrax
135
154
  redirect_to hyrax.dashboard_path
136
155
  end
137
156
  end
157
+
158
+ # Clean up form fields
159
+ # @param form Hyrax::Froms::ResourceBatchEditForm
160
+ def cleanup_form_fields(form)
161
+ form.lease = nil if form.lease && form.lease.fields['lease_expiration_date'].nil?
162
+ form.embargo = nil if form.embargo && form.embargo.fields['embargo_release_date'].nil?
163
+ form.fields.keys.each do |k|
164
+ form.fields[k] = nil if form.fields[k].is_a?(Array) && form.fields[k].blank?
165
+ end
166
+ end
138
167
  end
139
168
  end
@@ -5,7 +5,11 @@ module Hyrax
5
5
  include Hyrax::WorksControllerBehavior
6
6
 
7
7
  # Gives the class of the form.
8
- class BatchUploadFormService < Hyrax::WorkFormService
8
+ class BatchUploadFormService
9
+ def self.build(resource, current_ability, *extra)
10
+ form_class.new(resource, current_ability, *extra)
11
+ end
12
+
9
13
  def self.form_class(_ = nil)
10
14
  ::Hyrax::Forms::BatchUploadForm
11
15
  end
@@ -245,7 +245,10 @@ module Hyrax
245
245
  end
246
246
 
247
247
  def valkyrie_destroy
248
- if transactions['collection_resource.destroy'].call(@collection).success?
248
+ if transactions['collection_resource.destroy']
249
+ .with_step_args('collection_resource.delete' => { user: current_user },
250
+ 'collection_resource.remove_from_membership' => { user: current_user })
251
+ .call(@collection).success?
249
252
  after_destroy(params[:id])
250
253
  else
251
254
  after_destroy_error(params[:id])
@@ -3,6 +3,7 @@ module Hyrax
3
3
  class DownloadsController < ApplicationController
4
4
  include Hydra::Controller::DownloadBehavior
5
5
  include Hyrax::LocalFileDownloadsControllerBehavior
6
+ include Hyrax::ValkyrieDownloadsControllerBehavior
6
7
  include Hyrax::WorkflowsHelper # Provides #workflow_restriction?
7
8
 
8
9
  def self.default_content_path
@@ -12,6 +13,8 @@ module Hyrax
12
13
  # Render the 404 page if the file doesn't exist.
13
14
  # Otherwise renders the file.
14
15
  def show
16
+ return show_valkyrie if Hyrax.config.use_valkyrie?
17
+
15
18
  case file
16
19
  when ActiveFedora::File
17
20
  # For original files that are stored in fedora
@@ -39,7 +42,11 @@ module Hyrax
39
42
  end
40
43
 
41
44
  def file_set_parent(file_set_id)
42
- file_set = Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: file_set_id, use_valkyrie: Hyrax.config.use_valkyrie?)
45
+ file_set = if defined?(Wings) && Hyrax.metadata_adapter.is_a?(Wings::Valkyrie::MetadataAdapter)
46
+ Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: file_set_id, use_valkyrie: Hyrax.config.use_valkyrie?)
47
+ else
48
+ Hyrax.query_service.find_by(id: file_set_id)
49
+ end
43
50
  @parent ||=
44
51
  case file_set
45
52
  when Hyrax::Resource