hyrax 5.0.0.rc3 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/CONTAINERS.md +1 -1
  3. data/app/assets/javascripts/hyrax/autocomplete/linked_data.es6 +3 -0
  4. data/app/assets/javascripts/hyrax/editor/controlled_vocabulary.es6 +38 -5
  5. data/app/assets/stylesheets/hyrax/_file_upload.scss +6 -0
  6. data/app/assets/stylesheets/hyrax/controlled_vocabulary.scss +2 -2
  7. data/app/controllers/hyrax/dashboard/collections_controller.rb +0 -3
  8. data/app/controllers/hyrax/file_sets_controller.rb +1 -1
  9. data/app/controllers/hyrax/single_use_links_viewer_controller.rb +9 -2
  10. data/app/models/collection.rb +13 -1
  11. data/app/models/hyrax/model_registry.rb +1 -1
  12. data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +2 -2
  13. data/app/presenters/hyrax/work_show_presenter.rb +2 -2
  14. data/app/search_builders/hyrax/catalog_search_builder.rb +7 -1
  15. data/app/services/hyrax/file_set_file_service.rb +10 -1
  16. data/app/services/hyrax/listeners/file_listener.rb +39 -0
  17. data/app/services/hyrax/listeners/file_metadata_listener.rb +0 -30
  18. data/app/services/hyrax/lock_manager.rb +2 -2
  19. data/app/services/hyrax/valkyrie_upload.rb +5 -2
  20. data/app/views/hyrax/uploads/_js_templates.html.erb +9 -9
  21. data/app/views/hyrax/uploads/_js_templates_branding.html.erb +3 -3
  22. data/app/views/hyrax/uploads/_js_templates_versioning.html.erb +1 -1
  23. data/chart/hyrax/Chart.yaml +1 -1
  24. data/chart/hyrax/templates/_tmplvalues.tpl +38 -0
  25. data/chart/hyrax/templates/deployment-worker.yaml +6 -2
  26. data/chart/hyrax/templates/deployment.yaml +21 -3
  27. data/chart/hyrax/values.yaml +10 -0
  28. data/documentation/developing-your-hyrax-based-app.md +14 -9
  29. data/hyrax.gemspec +2 -8
  30. data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +1 -1
  31. data/lib/hyrax/publisher.rb +11 -0
  32. data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_work.rb +11 -0
  33. data/lib/hyrax/transactions/steps/delete_all_file_metadata.rb +4 -5
  34. data/lib/hyrax/version.rb +1 -1
  35. data/template.rb +1 -1
  36. metadata +45 -78
  37. data/spec/support/book_resource.rb +0 -36
  38. data/spec/support/can_can_overrides.rb +0 -43
  39. data/spec/support/clean_solr.rb +0 -7
  40. data/spec/support/controller_level_helpers.rb +0 -27
  41. data/spec/support/factory_helpers.rb +0 -94
  42. data/spec/support/fakes/fake_actor.rb +0 -22
  43. data/spec/support/fakes/fake_authority.rb +0 -14
  44. data/spec/support/fakes/fake_search_builder_scope.rb +0 -44
  45. data/spec/support/fakes/indexing_adapter.rb +0 -17
  46. data/spec/support/fakes/test_hydra_group_service.rb +0 -55
  47. data/spec/support/features/batch_edit_actions.rb +0 -37
  48. data/spec/support/features/session_helpers.rb +0 -15
  49. data/spec/support/features/workflow.rb +0 -10
  50. data/spec/support/features.rb +0 -11
  51. data/spec/support/form_with_validations.rb +0 -15
  52. data/spec/support/input_support.rb +0 -12
  53. data/spec/support/logging_formatter.rb +0 -67
  54. data/spec/support/matchers/api_responses.rb +0 -27
  55. data/spec/support/matchers/collection_type_property_matchers.rb +0 -30
  56. data/spec/support/matchers/embargo.rb +0 -9
  57. data/spec/support/matchers/lease.rb +0 -9
  58. data/spec/support/matchers/match_valkyrie_ids_with_af_ids.rb +0 -12
  59. data/spec/support/matchers/pcdm_matchers.rb +0 -34
  60. data/spec/support/matchers/permission.rb +0 -31
  61. data/spec/support/matchers/response_matchers.rb +0 -8
  62. data/spec/support/optional_example.rb +0 -17
  63. data/spec/support/rake.rb +0 -42
  64. data/spec/support/selectors.rb +0 -112
  65. data/spec/support/shared_examples_for_collection_presenter.rb +0 -44
  66. data/spec/support/simple_work.rb +0 -28
  67. data/spec/support/spec_statistic.rb +0 -24
  68. data/spec/support/speedup.rb +0 -7
  69. data/spec/support/statistic_helper.rb +0 -10
  70. data/spec/support/valkyrie_indexing.rb +0 -2
  71. data/spec/support/wings_models.rb +0 -9
  72. /data/{spec → lib/hyrax/specs/shared_specs}/factories/access_control.rb +0 -0
  73. /data/{spec → lib/hyrax/specs/shared_specs}/factories/admin_sets.rb +0 -0
  74. /data/{spec → lib/hyrax/specs/shared_specs}/factories/admin_sets_lw.rb +0 -0
  75. /data/{spec → lib/hyrax/specs/shared_specs}/factories/administrative_sets.rb +0 -0
  76. /data/{spec → lib/hyrax/specs/shared_specs}/factories/api_items.rb +0 -0
  77. /data/{spec → lib/hyrax/specs/shared_specs}/factories/collection_branding_infos.rb +0 -0
  78. /data/{spec → lib/hyrax/specs/shared_specs}/factories/collection_type_participants.rb +0 -0
  79. /data/{spec → lib/hyrax/specs/shared_specs}/factories/collection_types.rb +0 -0
  80. /data/{spec → lib/hyrax/specs/shared_specs}/factories/collections.rb +0 -0
  81. /data/{spec → lib/hyrax/specs/shared_specs}/factories/collections_factory.rb +0 -0
  82. /data/{spec → lib/hyrax/specs/shared_specs}/factories/content_blocks.rb +0 -0
  83. /data/{spec → lib/hyrax/specs/shared_specs}/factories/counter_metrics.rb +0 -0
  84. /data/{spec → lib/hyrax/specs/shared_specs}/factories/featured_works.rb +0 -0
  85. /data/{spec → lib/hyrax/specs/shared_specs}/factories/file_sets.rb +0 -0
  86. /data/{spec → lib/hyrax/specs/shared_specs}/factories/generic_works.rb +0 -0
  87. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_collection.rb +0 -0
  88. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_default_admin_set.rb +0 -0
  89. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_embargo.rb +0 -0
  90. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_file_metadata.rb +0 -0
  91. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_file_set.rb +0 -0
  92. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_lease.rb +0 -0
  93. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_resource.rb +0 -0
  94. /data/{spec → lib/hyrax/specs/shared_specs}/factories/object_id.rb +0 -0
  95. /data/{spec → lib/hyrax/specs/shared_specs}/factories/operations.rb +0 -0
  96. /data/{spec → lib/hyrax/specs/shared_specs}/factories/permission.rb +0 -0
  97. /data/{spec → lib/hyrax/specs/shared_specs}/factories/permission_template_accesses.rb +0 -0
  98. /data/{spec → lib/hyrax/specs/shared_specs}/factories/permission_templates.rb +0 -0
  99. /data/{spec → lib/hyrax/specs/shared_specs}/factories/proxy_deposit_requests.rb +0 -0
  100. /data/{spec → lib/hyrax/specs/shared_specs}/factories/single_use_links.rb +0 -0
  101. /data/{spec → lib/hyrax/specs/shared_specs}/factories/sipity_entities.rb +0 -0
  102. /data/{spec → lib/hyrax/specs/shared_specs}/factories/uploaded_files.rb +0 -0
  103. /data/{spec → lib/hyrax/specs/shared_specs}/factories/users.rb +0 -0
  104. /data/{spec → lib/hyrax/specs/shared_specs}/factories/workflow_actions.rb +0 -0
  105. /data/{spec → lib/hyrax/specs/shared_specs}/factories/workflow_states.rb +0 -0
  106. /data/{spec → lib/hyrax/specs/shared_specs}/factories/workflows.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 020c1b9b867c89474795692fb51cc03751ecfd10feb8dd300750b12891b3687c
4
- data.tar.gz: 41385b0600e001653ed3eb30b239b1520125fb52192af6543d6be53ffb76d0e4
3
+ metadata.gz: 791fb1a29523524e62036fd25aed45e6297d4d010e4b20bbcd9abe468bb30278
4
+ data.tar.gz: fbfdf5b3523294fe5dff601c92412967da57fdd02ac6c28d2384f18e8033cb4e
5
5
  SHA512:
6
- metadata.gz: 1c56457afe4451c9bd228ef1b45e2d431c60855ba1b744c14f4320ceefa92020d9c4bff083d0d39271c8e8cf2d3db3a79ff0630ece9f676180c21a6b928fee13
7
- data.tar.gz: 144eda52bc5bee7caba33a113324e27fa5c00102c9422264758f68ab28f59844d6a1bb8ff6301d251cd17fc34e6e8cc4aa089c1b22c11249d3988070e935dcb8
6
+ metadata.gz: 98fbab4485f2bb977cfb0fe755a05a98f39a2ba6f575420bae41a70d5e361aae482d81da902203afc49aa9171decafa3d4b87d6d58c0ee05e14a9ff8221f545b
7
+ data.tar.gz: 8846f839b4040ce79e52738da5fe3585fa176041cc6805c8c124724c8db006d6fee2ff30e5d286bfc0ca76de1e10a331bf608c9f88109208b6bdffc2d90d3023
data/CONTAINERS.md CHANGED
@@ -226,7 +226,7 @@ We publish several Hyrax images to the [GitHub container registry][ghcr] under
226
226
  the [Samvera organization][samvera-packages]. To build them:
227
227
 
228
228
  ```sh
229
- export HYRAX_VERSION=v5.0.0.rc3 # or desired version
229
+ export HYRAX_VERSION=v5.0.0 # or desired version
230
230
  git checkout hyrax-$HYRAX_VERSION
231
231
 
232
232
  docker build --target hyrax-base --tag ghcr.io/samvera/hyrax/hyrax-base:$(git rev-parse HEAD) .
@@ -18,6 +18,9 @@ export default class LinkedData {
18
18
  let result = this.element.select2("data")
19
19
  this.element.select2("destroy")
20
20
  this.element.val(result.label).attr("readonly", "readonly")
21
+ // Adding d-block class to the remove button to show it after a selection is made.
22
+ let removeButton = this.element.closest('.field-wrapper').find('.input-group-btn.field-controls .remove')
23
+ removeButton.addClass('d-block')
21
24
  this.setIdentifier(result.id)
22
25
  }
23
26
 
@@ -31,6 +31,8 @@ export default class ControlledVocabulary extends FieldManager {
31
31
  this.paramKey = paramKey
32
32
  this.fieldName = this.element.data('fieldName')
33
33
  this.searchUrl = this.element.data('autocompleteUrl')
34
+ // Used to prevent index collisions for existing words when removing and adding back in values.
35
+ this.postRemovalAdjustment = 0
34
36
  }
35
37
 
36
38
  // Overrides FieldManager, because field manager uses the wrong selector
@@ -49,6 +51,15 @@ export default class ControlledVocabulary extends FieldManager {
49
51
  // this._manageFocus()
50
52
  // }
51
53
 
54
+ // Overrides FieldManager in order to display Remove button for values that exist at initial load time
55
+ _createRemoveControl() {
56
+ if (this.element.find('input.multi-text-field').val()) {
57
+ this.remover.addClass('d-block')
58
+ this.remover.addClass('has-existing-value')
59
+ }
60
+ $(this.fieldWrapperClass + ' .field-controls', this.element).append(this.remover)
61
+ }
62
+
52
63
  // Overrides FieldManager in order to avoid doing a clone of the existing field
53
64
  createNewField($activeField) {
54
65
  let $newField = this._newFieldTemplate()
@@ -68,20 +79,24 @@ export default class ControlledVocabulary extends FieldManager {
68
79
  }
69
80
 
70
81
  _newFieldTemplate() {
71
- let index = this._maxIndex()
82
+ let index = this._maxIndex() + this.postRemovalAdjustment
72
83
  let rowTemplate = this._template()
73
84
  let controls = this.controls.clone()//.append(this.remover)
74
85
  let row = $(rowTemplate({ "paramKey": this.paramKey,
75
86
  "name": this.fieldName,
76
87
  "index": index,
77
- "class": "controlled_vocabulary" }))
88
+ "class": "controlled_vocabulary",
89
+ "placeholder": "Search for a location..." }))
78
90
  .append(controls)
91
+ let removeButton = row.find('.remove');
92
+ removeButton.removeClass('d-block')
93
+ removeButton.removeClass('has-existing-value')
79
94
  return row
80
95
  }
81
96
 
82
97
  get _source() {
83
98
  return "<li class=\"field-wrapper input-group input-append\">" +
84
- "<input class=\"string {{class}} optional form-control {{paramKey}}_{{name}} form-control multi-text-field\" name=\"{{paramKey}}[{{name}}_attributes][{{index}}][hidden_label]\" value=\"\" id=\"{{paramKey}}_{{name}}_attributes_{{index}}_hidden_label\" data-attribute=\"{{name}}\" type=\"text\">" +
99
+ "<input class=\"string {{class}} optional form-control {{paramKey}}_{{name}} form-control multi-text-field\" name=\"{{paramKey}}[{{name}}_attributes][{{index}}][hidden_label]\" value=\"\" id=\"{{paramKey}}_{{name}}_attributes_{{index}}_hidden_label\" data-attribute=\"{{name}}\" type=\"text\" placeholder=\"{{placeholder}}\">" +
85
100
  "<input name=\"{{paramKey}}[{{name}}_attributes][{{index}}][id]\" value=\"\" id=\"{{paramKey}}_{{name}}_attributes_{{index}}_id\" type=\"hidden\" data-id=\"remote\">" +
86
101
  "<input name=\"{{paramKey}}[{{name}}_attributes][{{index}}][_destroy]\" id=\"{{paramKey}}_{{name}}_attributes_{{index}}__destroy\" value=\"\" data-destroy=\"true\" type=\"hidden\"></li>"
87
102
  }
@@ -114,9 +129,27 @@ export default class ControlledVocabulary extends FieldManager {
114
129
  // '_destroy' hidden parameter
115
130
  removeFromList( event ) {
116
131
  event.preventDefault()
132
+ // Changing behavior of the remove button to add a new field if the last field is removed
133
+ // Using querySelector to find elements with data-attribute="based_near"
134
+ const inputElements = this.element.find('input' + this.inputTypeClass)
135
+ const parentsArray = Array.from(inputElements).map(element => element.parentElement)
136
+ const nonHiddenElements = parentsArray.filter(element => element.style.display !== 'none')
137
+ const nonHiddenCount = nonHiddenElements.length
138
+ if (nonHiddenCount < 2){
139
+ let $listing = $(event.target).closest(this.inputTypeClass).find(this.listClass)
140
+ let $activeField = $listing.children('li').last()
141
+ $listing.append(this.createNewField($activeField))
142
+ this.postRemovalAdjustment += 1
143
+ }
117
144
  let field = $(event.target).parents(this.fieldWrapperClass)
118
- field.find('[data-destroy]').val('true')
119
- field.hide()
145
+ // Removes field if a value hasn't been selected, otherwise marks it for destruction.
146
+ // Prevents bug caused by marking empty fields for destruction.
147
+ if (field.find('.has-existing-value').length > 0) {
148
+ field.find('[data-destroy]').val('true')
149
+ field.hide()
150
+ } else {
151
+ field.remove()
152
+ }
120
153
  this.element.trigger("managed_field:remove", field)
121
154
  }
122
155
  }
@@ -34,3 +34,9 @@
34
34
  padding-bottom: 10px;
35
35
  }
36
36
  }
37
+
38
+ // fix blueimp jQuery-File-Upload display problems under Bootstrap 4+
39
+ // found here: https://stackoverflow.com/a/48162651
40
+ .fade.in {
41
+ opacity: 1
42
+ }
@@ -1,7 +1,7 @@
1
1
  .controlled_vocabulary {
2
2
  @extend .multi_value;
3
3
 
4
- .listing li:only-of-type .remove {
5
- display: block;
4
+ .listing li .remove {
5
+ display: none;
6
6
  }
7
7
  }
@@ -26,9 +26,6 @@ module Hyrax
26
26
  # Catch permission errors
27
27
  rescue_from Hydra::AccessDenied, CanCan::AccessDenied, with: :deny_collection_access
28
28
 
29
- # actions: index, create, new, edit, show, update, destroy, permissions, citation
30
- before_action :authenticate_user!, except: [:index]
31
-
32
29
  class_attribute :presenter_class,
33
30
  :form_class,
34
31
  :single_item_search_builder_class,
@@ -292,7 +292,7 @@ module Hyrax
292
292
  end
293
293
 
294
294
  def file_metadata
295
- @file_metadata ||= Hyrax.query_service.custom_queries.find_file_metadata_by(id: curation_concern.original_file_id)
295
+ @file_metadata ||= Hyrax.config.file_set_file_service.primary_file_for(file_set: file_set)
296
296
  end
297
297
 
298
298
  # Override this method to add additional response formats to your local app
@@ -84,7 +84,13 @@ module Hyrax
84
84
  end
85
85
 
86
86
  def current_ability
87
- @current_ability ||= SingleUseLinksViewerController::Ability.new current_user, single_use_link
87
+ link_instance = nil
88
+ begin
89
+ link_instance = single_use_link
90
+ rescue ActiveRecord::RecordNotFound
91
+ Rails.logger.debug("Single user link was not found while getting current ability")
92
+ end
93
+ @current_ability ||= SingleUseLinksViewerController::Ability.new current_user, link_instance
88
94
  end
89
95
 
90
96
  def render_single_use_error(exception)
@@ -102,9 +108,10 @@ module Hyrax
102
108
  include CanCan::Ability
103
109
 
104
110
  attr_reader :single_use_link
111
+ attr_reader :current_user
105
112
 
106
113
  def initialize(user, single_use_link)
107
- @user = user || ::User.new
114
+ @current_user = user || ::User.new
108
115
  return unless single_use_link
109
116
 
110
117
  @single_use_link = single_use_link
@@ -2,4 +2,16 @@
2
2
 
3
3
  # Provide plain collection model if not defined by the application.
4
4
  # Needed until Hyrax internals do not assume its existence.
5
- class ::Collection < Hyrax.config.collection_class; end unless '::Collection'.safe_constantize
5
+ class ::Collection < Hyrax.config.collection_class; end unless ActiveSupport::Dependencies.then do |deps|
6
+ # In autoloading environments, when referencing +::Collection+ from the
7
+ # initializer, make sure that +safe_constantize+ wouldn’t just try loading
8
+ # this file again (which would produce a runtime error). Do this by manually
9
+ # searching for the file which should define +::Collection+ and checking if it
10
+ # is the one being currently loaded.
11
+ break true if Object.const_defined?(:Collection)
12
+ file_path = deps.search_for_file("collection")
13
+ expanded = File.expand_path(file_path)
14
+ expanded.delete_suffix!(".rb")
15
+ break false if deps.loading.include?(expanded)
16
+ '::Collection'.safe_constantize
17
+ end
@@ -99,7 +99,7 @@ module Hyrax
99
99
  end
100
100
 
101
101
  def self.classes_from(strings)
102
- strings.map(&:safe_constantize).flatten.uniq
102
+ strings.map(&:safe_constantize).compact.uniq
103
103
  end
104
104
  private_class_method :classes_from
105
105
 
@@ -98,9 +98,9 @@ module Hyrax
98
98
  def presenter_for(document:, ability:)
99
99
  case document['has_model_ssim'].first
100
100
  when *Hyrax::ModelRegistry.file_set_rdf_representations
101
- Hyrax::FileSetPresenter.new(document, ability)
101
+ file_presenter_class.new(document, ability)
102
102
  else
103
- Hyrax::WorkShowPresenter.new(document, ability)
103
+ work_presenter_class.new(document, ability)
104
104
  end
105
105
  end
106
106
 
@@ -63,10 +63,10 @@ module Hyrax
63
63
 
64
64
  # @return [Boolean] render a IIIF viewer
65
65
  def iiif_viewer?
66
- representative_id.present? &&
66
+ Hyrax.config.iiif_image_server? &&
67
+ representative_id.present? &&
67
68
  representative_presenter.present? &&
68
69
  representative_presenter.image? &&
69
- Hyrax.config.iiif_image_server? &&
70
70
  members_include_viewable_image?
71
71
  end
72
72
 
@@ -80,6 +80,12 @@ class Hyrax::CatalogSearchBuilder < Hyrax::SearchBuilder
80
80
 
81
81
  # join from file id to work relationship solrized member_ids_ssim
82
82
  def join_for_works_from_files
83
- "{!join from=#{Hyrax.config.id_field} to=member_ids_ssim v=has_model_ssim:*FileSet}#{dismax_query}"
83
+ "{!join from=#{Hyrax.config.id_field} to=member_ids_ssim}#{file_set_filter}#{dismax_query}"
84
+ end
85
+
86
+ # Query segment to filter out non-FileSet documents
87
+ # A wildcard * is used to avoid attempting to escape the :: in Hyrax::FileSet
88
+ def file_set_filter
89
+ "{!lucene q.op=AND}has_model_ssim:*FileSet"
84
90
  end
85
91
  end
@@ -32,7 +32,16 @@ module Hyrax
32
32
  end
33
33
 
34
34
  ##
35
- # Return the Hyrax::FileMetadata which should be considered “primary” for
35
+ # Return the {Hyrax::FileMetadata} which should be considered “primary” for
36
+ # indexing and version‐tracking.
37
+ #
38
+ # @return [Hyrax::FileMetadata]
39
+ def self.primary_file_for(file_set:, query_service: Hyrax.query_service)
40
+ new(file_set: file_set, query_service: query_service).primary_file
41
+ end
42
+
43
+ ##
44
+ # Return the {Hyrax::FileMetadata} which should be considered “primary” for
36
45
  # indexing and version‐tracking.
37
46
  #
38
47
  # If +file_set.original_file_id+ is defined, it will be used; otherwise,
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hyrax
4
+ module Listeners
5
+ ##
6
+ # Listens for events related to Files ({Valkyrie::StorageAdapter::File})
7
+ class FileListener
8
+ ##
9
+ # Called when 'file.characterized' event is published;
10
+ # allows post-characterization handling, like derivatives generation.
11
+ #
12
+ # @param [Dry::Events::Event] event
13
+ # @return [void]
14
+ def on_file_characterized(event)
15
+ file_set = event[:file_set]
16
+
17
+ case file_set
18
+ when ActiveFedora::Base # ActiveFedora
19
+ CreateDerivativesJob
20
+ .perform_later(file_set, event[:file_id], event[:path_hint])
21
+ else
22
+ ValkyrieCreateDerivativesJob
23
+ .perform_later(file_set.id.to_s, event[:file_id])
24
+ end
25
+ end
26
+
27
+ ##
28
+ # Called when 'file.uploaded' event is published
29
+ # @param [Dry::Events::Event] event
30
+ # @return [void]
31
+ def on_file_uploaded(event)
32
+ # Run characterization for original file only
33
+ return unless event[:metadata]&.original_file?
34
+
35
+ ValkyrieCharacterizationJob.perform_later(event[:metadata].id.to_s)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -5,25 +5,6 @@ module Hyrax
5
5
  ##
6
6
  # Listens for events related to {Hyrax::FileMetadata}
7
7
  class FileMetadataListener
8
- ##
9
- # Called when 'file.characterized' event is published;
10
- # allows post-characterization handling, like derivatives generation.
11
- #
12
- # @param [Dry::Events::Event] event
13
- # @return [void]
14
- def on_file_characterized(event)
15
- file_set = event[:file_set]
16
-
17
- case file_set
18
- when ActiveFedora::Base # ActiveFedora
19
- CreateDerivativesJob
20
- .perform_later(file_set, event[:file_id], event[:path_hint])
21
- else
22
- ValkyrieCreateDerivativesJob
23
- .perform_later(file_set.id.to_s, event[:file_id])
24
- end
25
- end
26
-
27
8
  ##
28
9
  # Called when 'file.metadata.updated' event is published; reindexes a
29
10
  # {Hyrax::FileSet} when a file claiming to be its `pcdm_use:OriginalFile`
@@ -41,17 +22,6 @@ module Hyrax
41
22
  "encountered an error #{err.message}. should this " \
42
23
  "object be in a FileSet #{event[:metadata]}"
43
24
  end
44
-
45
- ##
46
- # Called when 'file.uploaded' event is published
47
- # @param [Dry::Events::Event] event
48
- # @return [void]
49
- def on_file_uploaded(event)
50
- # Run characterization for original file only
51
- return unless event[:metadata]&.original_file?
52
-
53
- ValkyrieCharacterizationJob.perform_later(event[:metadata].id.to_s)
54
- end
55
25
  end
56
26
  end
57
27
  end
@@ -30,8 +30,8 @@ module Hyrax
30
30
  rescue ConnectionPool::TimeoutError => err
31
31
  Hyrax.logger.error(err.message)
32
32
  raise(ConnectionPool::TimeoutError,
33
- "Failed to aquire a lock from Redlock due to a Redis connection " /
34
- "timeout: #{err}. If you are using Redis via `ConnectionPool` " /
33
+ "Failed to acquire a lock from Redlock due to a Redis connection " \
34
+ "timeout: #{err}. If you are using Redis via `ConnectionPool` " \
35
35
  "you may wish to increase the pool size.")
36
36
  end
37
37
 
@@ -30,8 +30,10 @@ class Hyrax::ValkyrieUpload
30
30
  attr_reader :storage_adapter
31
31
  ##
32
32
  # @param [Valkyrie::StorageAdapter] storage_adapter
33
- def initialize(storage_adapter: Hyrax.storage_adapter)
33
+ # @param [Class] file_set_file_service implementer of {Hyrax::FileSetFileService}
34
+ def initialize(storage_adapter: Hyrax.storage_adapter, file_set_file_service: Hyrax.config.file_set_file_service)
34
35
  @storage_adapter = storage_adapter
36
+ @file_set_file_service = file_set_file_service
35
37
  end
36
38
 
37
39
  def upload(filename:, file_set:, io:, use: Hyrax::FileMetadata::Use::ORIGINAL_FILE, user: nil, mime_type: nil) # rubocop:disable Metrics/AbcSize
@@ -67,7 +69,8 @@ class Hyrax::ValkyrieUpload
67
69
  end
68
70
 
69
71
  def version_upload(file_set:, io:, user:)
70
- file_metadata = Hyrax.query_service.custom_queries.find_file_metadata_by(id: file_set.original_file_id)
72
+ file_metadata = @file_set_file_service.primary_file_for(file_set: file_set)
73
+
71
74
  Hyrax::VersioningService.create(file_metadata, user, io)
72
75
  Hyrax.publisher.publish("file.uploaded", metadata: file_metadata)
73
76
  ContentNewVersionEventJob.perform_later(file_set, user)
@@ -1,20 +1,20 @@
1
1
  <!-- The template to display files available for upload -->
2
- <% fade_class_if_not_test = Rails.env.test? ? 'show' : 'fade show' %>
2
+ <% fade_class_if_not_test = Rails.env.test? ? '' : 'fade' %>
3
3
  <script id="template-upload" type="text/x-tmpl">
4
4
  {% for (var i=0, file; file=o.files[i]; i++) { %}
5
5
  <tr class="template-upload <%= fade_class_if_not_test %>">
6
- <span>
6
+ <td>
7
7
  <span class="preview"></span>
8
- </span>
9
- <span>
8
+ </td>
9
+ <td>
10
10
  <p class="name">{%=file.name%}</p>
11
11
  <strong class="error text-danger"></strong>
12
- </span>
13
- <span>
12
+ </td>
13
+ <td>
14
14
  <p class="size">Processing...</p>
15
15
  <div class="progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-striped progress-bar-animated bg-success" style="width:0%;"></div></div>
16
- </span>
17
- <span class="text-right">
16
+ </td>
17
+ <td class="text-right">
18
18
  {% if (!i && !o.options.autoUpload) { %}
19
19
  <button class="btn btn-primary start" disabled>
20
20
  <span class="fa fa-upload"></span>
@@ -27,7 +27,7 @@
27
27
  <span><%= t('helpers.action.cancel') %></span>
28
28
  </button>
29
29
  {% } %}
30
- </span>
30
+ </td>
31
31
  </tr>
32
32
  {% } %}
33
33
  </script>
@@ -1,7 +1,7 @@
1
1
  <!-- The template to display files available for upload -->
2
2
  <script id="template-upload" type="text/x-tmpl">
3
3
  {% for (var i=0, file; file=o.files[i]; i++) { %}
4
- <tr class="template-upload fade show">
4
+ <tr class="template-upload fade">
5
5
  <td>
6
6
  <span class="preview"></span>
7
7
  </td>
@@ -37,7 +37,7 @@
37
37
  <!-- The template to display the banner once upload is complete -->
38
38
  <script id="template-download" type="text/x-tmpl">
39
39
  {% for (var i=0, file; file=o.files[i]; i++) { %}
40
- <span class="template-download fade show">
40
+ <span class="template-download fade">
41
41
  <div id="banner">
42
42
  <div class="row branding-banner-row">
43
43
  <div class="col-sm-3">
@@ -69,7 +69,7 @@
69
69
  <!-- The template to display logo in the table once upload is complete -->
70
70
  <script id="logo-template-download" type="text/x-tmpl">
71
71
  {% for (var i=0, file; file=o.files[i]; i++) { %}
72
- <span class="template-download fade show">
72
+ <span class="template-download fade">
73
73
  <div class="row branding-logo-row">
74
74
  <div class="col-sm-3">
75
75
  <span class="preview">
@@ -1,5 +1,5 @@
1
1
  <!-- The template to display files available for upload -->
2
- <% fade_class_if_not_test = Rails.env.test? ? 'show' : 'fade show' %>
2
+ <% fade_class_if_not_test = Rails.env.test? ? '' : 'fade' %>
3
3
  <script id="versioning-template-upload" type="text/x-tmpl">
4
4
  {% for (var i=0, file; file=o.files[i]; i++) { %}
5
5
  <tr class="template-upload <%= fade_class_if_not_test %>">
@@ -2,7 +2,7 @@ apiVersion: v2
2
2
  name: hyrax
3
3
  description: An open-source, Samvera-powered digital repository system
4
4
  type: application
5
- version: 3.6.0
5
+ version: 3.7.0
6
6
  appVersion: 5.0.0
7
7
  dependencies:
8
8
  - name: fcrepo
@@ -0,0 +1,38 @@
1
+ {{/*
2
+ Copyright VMware, Inc.
3
+ SPDX-License-Identifier: APACHE-2.0
4
+ */}}
5
+
6
+ {{/* vim: set filetype=mustache: */}}
7
+ {{/*
8
+ Renders a value that contains template perhaps with scope if the scope is present.
9
+ Usage:
10
+ {{ include "hyrax.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }}
11
+ {{ include "hyrax.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }}
12
+ */}}
13
+ {{- define "hyrax.tplvalues.render" -}}
14
+ {{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }}
15
+ {{- if contains "{{" (toJson .value) }}
16
+ {{- if .scope }}
17
+ {{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }}
18
+ {{- else }}
19
+ {{- tpl $value .context }}
20
+ {{- end }}
21
+ {{- else }}
22
+ {{- $value }}
23
+ {{- end }}
24
+ {{- end -}}
25
+
26
+ {{/*
27
+ Merge a list of values that contains template after rendering them.
28
+ Merge precedence is consistent with http://masterminds.github.io/sprig/dicts.html#merge-mustmerge
29
+ Usage:
30
+ {{ include "hyrax.tplvalues.merge" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }}
31
+ */}}
32
+ {{- define "hyrax.tplvalues.merge" -}}
33
+ {{- $dst := dict -}}
34
+ {{- range .values -}}
35
+ {{- $dst = include "hyrax.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}}
36
+ {{- end -}}
37
+ {{ $dst | toYaml }}
38
+ {{- end -}}
@@ -29,7 +29,9 @@ spec:
29
29
  - secretRef:
30
30
  name: {{ template "hyrax.fullname" . }}
31
31
  env:
32
- {{- toYaml .Values.worker.extraEnvVars | nindent 12 }}
32
+ {{- if .Values.extraEnvVars }}
33
+ {{- include "hyrax.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
34
+ {{- end }}
33
35
  command:
34
36
  - sh
35
37
  - -c
@@ -63,7 +65,9 @@ spec:
63
65
  {{- toYaml . | nindent 12 }}
64
66
  {{- end }}
65
67
  env:
66
- {{- toYaml .Values.worker.extraEnvVars | nindent 12 }}
68
+ {{- if .Values.extraEnvVars }}
69
+ {{- include "hyrax.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
70
+ {{- end }}
67
71
  {{- if .Values.worker.readinessProbe.enabled }}
68
72
  readinessProbe:
69
73
  exec:
@@ -38,7 +38,9 @@ spec:
38
38
  name: {{ .Values.solrExistingSecret }}
39
39
  {{- end }}
40
40
  env:
41
- {{- toYaml .Values.extraEnvVars | nindent 12 }}
41
+ {{- if .Values.extraEnvVars }}
42
+ {{- include "hyrax.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
43
+ {{- end }}
42
44
  command:
43
45
  - sh
44
46
  - -c
@@ -66,7 +68,9 @@ spec:
66
68
  {{- toYaml . | nindent 12 }}
67
69
  {{- end }}
68
70
  env:
69
- {{- toYaml .Values.extraEnvVars | nindent 12 }}
71
+ {{- if .Values.extraEnvVars }}
72
+ {{- include "hyrax.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
73
+ {{- end }}
70
74
  command:
71
75
  - sh
72
76
  - -c
@@ -101,11 +105,25 @@ spec:
101
105
  {{- toYaml . | nindent 12 }}
102
106
  {{- end }}
103
107
  env:
104
- {{- toYaml .Values.extraEnvVars | nindent 12 }}
108
+ {{- if .Values.extraEnvVars }}
109
+ {{- include "hyrax.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
110
+ {{- end }}
105
111
  ports:
106
112
  - name: http
107
113
  containerPort: 3000
108
114
  protocol: TCP
115
+ {{- if .Values.startupProbe.enabled }}
116
+ startupProbe:
117
+ initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds | default 5 }}
118
+ timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds | default 5 }}
119
+ failureThreshold: {{ .Values.startupProbe.failureThreshold | default 3 }}
120
+ periodSeconds: {{ .Values.startupProbe.periodSeconds | default 10}}
121
+ successThreshold: {{ .Values.startupProbe.successThreshold | default 1 }}
122
+ httpGet:
123
+ scheme: "HTTP"
124
+ path: {{ .Values.startupProbe.path | default "/" }}
125
+ port: 3000
126
+ {{- end }}
109
127
  {{- if .Values.livenessProbe.enabled }}
110
128
  livenessProbe:
111
129
  initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds | default 5 }}
@@ -188,6 +188,16 @@ readinessProbe:
188
188
  # failureThreshold: 6
189
189
  # successThreshold: 1
190
190
 
191
+ # consider enabling if you are experiencing slow startup times
192
+ startupProbe:
193
+ enabled: false
194
+ # path: "/healthz"
195
+ # initialDelaySeconds: 30
196
+ # periodSeconds: 30
197
+ # timeoutSeconds: 5
198
+ # failureThreshold: 3
199
+ # successThreshold: 1
200
+
191
201
  resources: {}
192
202
 
193
203
  worker: