hyrax 5.0.0 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +7 -176
- data/.dassie/.env +8 -3
- data/.dassie/Gemfile +13 -2
- data/.dassie/app/controllers/hyrax/generic_work_resources_controller.rb +17 -0
- data/.dassie/app/controllers/hyrax/generic_works_controller.rb +7 -1
- data/.dassie/app/forms/generic_work_resource_form.rb +20 -0
- data/.dassie/app/indexers/generic_work_resource_indexer.rb +16 -0
- data/.dassie/app/models/admin_set_resource.rb +9 -0
- data/.dassie/app/models/collection_resource.rb +2 -0
- data/.dassie/app/models/file_set.rb +2 -0
- data/.dassie/app/models/generic_work_resource.rb +10 -0
- data/.dassie/app/views/hyrax/generic_work_resources/_generic_work_resource.html.erb +2 -0
- data/.dassie/config/analytics.yml +6 -1
- data/.dassie/config/application.rb +24 -0
- data/.dassie/config/initializers/hyrax.rb +13 -3
- data/.dassie/config/initializers/wings.rb +109 -0
- data/.dassie/config/metadata/generic_work_resource.yaml +22 -0
- data/.dassie/config/valkyrie_index.yml +4 -10
- data/.dassie/db/migrate/20240506070809_valkyrie_id_to_string.rb +5 -0
- data/.dassie/db/schema.rb +2 -2
- data/.dassie/spec/indexers/generic_work_resource_indexer_spec.rb +13 -0
- data/.dassie/spec/models/generic_work_resource_spec.rb +12 -0
- data/.dassie/spec/views/generic_work_resources/_generic_work_resource.html.erb_spec.rb +7 -0
- data/.dockerignore +6 -4
- data/.github/release.yml +3 -0
- data/.github/workflows/lint-build-test.yml +130 -0
- data/.github/workflows/test-results.yml +40 -0
- data/.koppie/.env +7 -5
- data/.koppie/Gemfile +12 -1
- data/.koppie/config/analytics.yml +6 -1
- data/.koppie/config/environments/test.rb +2 -0
- data/.koppie/config/initializers/1_valkyrie.rb +6 -2
- data/.koppie/config/solr.yml +1 -1
- data/.regen +1 -1
- data/.rubocop.yml +5 -0
- data/Dockerfile +16 -36
- data/Gemfile +2 -0
- data/app/assets/javascripts/hydra-editor/field_manager.es6 +187 -0
- data/app/assets/javascripts/hyrax/analytics_events.js +48 -24
- data/app/assets/javascripts/hyrax/autocomplete/linked_data.es6 +3 -0
- data/app/assets/javascripts/hyrax/collapse.js +4 -4
- data/app/assets/javascripts/hyrax/editor/controlled_vocabulary.es6 +38 -5
- data/app/assets/javascripts/hyrax/file_manager/save_manager.es6 +2 -0
- data/app/assets/javascripts/hyrax/search.js +2 -3
- data/app/assets/javascripts/hyrax/select_work_type.es6 +3 -1
- data/app/assets/javascripts/hyrax/uploader.js +20 -18
- data/app/assets/javascripts/hyrax.js +1 -0
- data/app/assets/stylesheets/_bootstrap-default-overrides.scss +4 -0
- data/app/assets/stylesheets/hyrax/_card.scss +4 -0
- data/app/assets/stylesheets/hyrax/_catalog.scss +21 -0
- data/app/assets/stylesheets/hyrax/_collections.scss +1 -1
- data/app/assets/stylesheets/hyrax/_facets.scss +15 -3
- data/app/assets/stylesheets/hyrax/_featured.scss +4 -0
- data/app/assets/stylesheets/hyrax/_file_upload.scss +6 -0
- data/app/assets/stylesheets/hyrax/_form.scss +4 -0
- data/app/assets/stylesheets/hyrax/_forms.scss +2 -1
- data/app/assets/stylesheets/hyrax/_nestable.scss +9 -8
- data/app/assets/stylesheets/hyrax/_select_work_type.scss +12 -0
- data/app/assets/stylesheets/hyrax/_styles.scss +4 -0
- data/app/assets/stylesheets/hyrax/_work-show.scss +3 -0
- data/app/assets/stylesheets/hyrax/controlled_vocabulary.scss +2 -2
- data/app/controllers/concerns/hyrax/singular_subresource_controller.rb +7 -2
- data/app/controllers/concerns/hyrax/valkyrie_downloads_controller_behavior.rb +11 -2
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +9 -2
- data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +2 -2
- data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +7 -8
- data/app/controllers/hyrax/dashboard/collections_controller.rb +2 -1
- data/app/controllers/hyrax/downloads_controller.rb +24 -3
- data/app/controllers/hyrax/file_sets_controller.rb +33 -7
- data/app/controllers/hyrax/my/works_controller.rb +20 -0
- data/app/controllers/hyrax/single_use_links_viewer_controller.rb +9 -2
- data/app/controllers/hyrax/stats_controller.rb +1 -1
- data/app/controllers/hyrax/uploads_controller.rb +28 -2
- data/app/forms/hyrax/forms/admin/appearance.rb +1 -1
- data/app/forms/hyrax/forms/admin/collection_type_form.rb +1 -7
- data/app/forms/hyrax/forms/pcdm_collection_form.rb +9 -0
- data/app/forms/hyrax/forms/work_embargo_form.rb +6 -0
- data/app/forms/hyrax/forms/work_lease_form.rb +6 -0
- data/app/indexers/concerns/hyrax/location_indexer.rb +2 -2
- data/app/indexers/hyrax/indexers/file_set_indexer.rb +4 -0
- data/app/indexers/hyrax/indexers/resource_indexer.rb +1 -0
- data/app/indexers/hyrax/valkyrie_indexer.rb +3 -5
- data/app/jobs/migrate_files_to_valkyrie_job.rb +109 -0
- data/app/jobs/migrate_resources_job.rb +34 -0
- data/app/jobs/valkyrie_create_derivatives_job.rb +2 -1
- data/app/models/admin_set.rb +1 -0
- data/app/models/collection.rb +13 -1
- data/app/models/concerns/hyrax/ar_resource.rb +104 -0
- data/app/models/concerns/hyrax/solr_document/ordered_members.rb +2 -1
- data/app/models/concerns/hyrax/solr_document_behavior.rb +13 -2
- data/app/models/concerns/hyrax/valkyrie_lazy_migration.rb +82 -0
- data/app/models/file_download_stat.rb +1 -1
- data/app/models/file_view_stat.rb +1 -1
- data/app/models/hyrax/collection_type.rb +12 -4
- data/app/models/hyrax/file_metadata.rb +19 -0
- data/app/models/hyrax/file_set.rb +25 -0
- data/app/models/hyrax/model_registry.rb +3 -4
- data/app/models/hyrax/resource.rb +5 -0
- data/app/models/hyrax/statistic.rb +12 -37
- data/app/presenters/hyrax/file_set_presenter.rb +2 -1
- data/app/presenters/hyrax/file_usage.rb +3 -3
- data/app/presenters/hyrax/iiif_manifest_presenter.rb +2 -1
- data/app/presenters/hyrax/member_presenter_factory.rb +7 -1
- data/app/presenters/hyrax/menu_presenter.rb +1 -1
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +2 -2
- data/app/presenters/hyrax/stats_usage_presenter.rb +2 -1
- data/app/presenters/hyrax/work_show_presenter.rb +15 -19
- data/app/presenters/hyrax/work_usage.rb +5 -2
- data/app/search_builders/hyrax/expired_embargo_search_builder.rb +7 -1
- data/app/search_builders/hyrax/expired_lease_search_builder.rb +7 -1
- data/app/search_builders/hyrax/filter_by_type.rb +1 -3
- data/app/search_builders/hyrax/valkyrie_abstract_type_relation.rb +7 -2
- data/app/services/hyrax/access_control_list.rb +1 -1
- data/app/services/hyrax/admin_set_create_service.rb +16 -5
- data/app/services/hyrax/admin_set_service.rb +2 -1
- data/app/services/hyrax/analytics/ga4/base.rb +96 -0
- data/app/services/hyrax/analytics/ga4/events.rb +25 -0
- data/app/services/hyrax/analytics/ga4/events_daily.rb +36 -0
- data/app/services/hyrax/analytics/ga4/visits.rb +33 -0
- data/app/services/hyrax/analytics/ga4/visits_daily.rb +24 -0
- data/app/services/hyrax/analytics/ga4.rb +204 -0
- data/app/services/hyrax/analytics/google.rb +16 -2
- data/app/services/hyrax/analytics/matomo.rb +16 -3
- data/app/services/hyrax/analytics/results.rb +6 -0
- data/app/services/hyrax/custom_queries/find_access_control.rb +1 -1
- data/app/services/hyrax/custom_queries/find_by_date_range.rb +6 -23
- data/app/services/hyrax/custom_queries/find_collections_by_type.rb +2 -2
- data/app/services/hyrax/custom_queries/find_count_by.rb +3 -31
- data/app/services/hyrax/custom_queries/find_file_metadata.rb +2 -2
- data/app/services/hyrax/custom_queries/find_models_by_access.rb +5 -27
- data/app/services/hyrax/embargo_manager.rb +2 -1
- data/app/services/hyrax/file_set_file_service.rb +10 -1
- data/app/services/hyrax/listeners/file_listener.rb +39 -0
- data/app/services/hyrax/listeners/file_metadata_listener.rb +0 -30
- data/app/services/hyrax/lock_manager.rb +7 -7
- data/app/services/hyrax/lockable.rb +4 -3
- data/app/services/hyrax/simple_schema_loader.rb +1 -1
- data/app/services/hyrax/solr_service.rb +22 -8
- data/app/services/hyrax/statistics/query_service.rb +1 -1
- data/app/services/hyrax/statistics/works/over_time.rb +1 -1
- data/app/services/hyrax/thumbnail_path_service.rb +2 -0
- data/app/services/hyrax/user_stat_importer.rb +5 -5
- data/app/services/hyrax/valkyrie_upload.rb +14 -9
- data/app/services/hyrax/versioning_service.rb +10 -2
- data/app/services/hyrax/work_query_service.rb +2 -2
- data/app/services/migrate_resource_service.rb +55 -0
- data/app/views/_controls.html.erb +5 -5
- data/app/views/_masthead.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +9 -16
- data/app/views/catalog/_thumbnail_list_collection.html.erb +1 -1
- data/app/views/catalog/_thumbnail_list_default.html.erb +2 -2
- data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +4 -4
- data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +1 -1
- data/app/views/hyrax/admin/collection_types/_form.html.erb +4 -4
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/admin/features/index.html.erb +1 -1
- data/app/views/hyrax/base/_file_manager_actions.html.erb +1 -1
- data/app/views/hyrax/base/_file_manager_member.html.erb +7 -4
- data/app/views/hyrax/base/_file_manager_thumbnail.html.erb +1 -1
- data/app/views/hyrax/base/_form_files.html.erb +1 -1
- data/app/views/hyrax/base/_form_member_of_collections.html.erb +4 -0
- data/app/views/hyrax/base/_show_actions.html.erb +7 -8
- data/app/views/hyrax/base/_work_button_row.html.erb +1 -1
- data/app/views/hyrax/batch_select/_add_button.html.erb +1 -1
- data/app/views/hyrax/content_blocks/_form.html.erb +3 -3
- data/app/views/hyrax/dashboard/_sidebar.html.erb +1 -1
- data/app/views/hyrax/dashboard/_user_activity.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form.html.erb +4 -4
- data/app/views/hyrax/dashboard/collections/_form_share.html.erb +6 -4
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/show_admin.html.erb +18 -19
- data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +1 -1
- data/app/views/hyrax/embargoes/_list_expired_active_embargoes.html.erb +7 -7
- data/app/views/hyrax/file_sets/_actions.html.erb +9 -1
- data/app/views/hyrax/file_sets/_permission_form.html.erb +4 -2
- data/app/views/hyrax/file_sets/_show_actions.html.erb +1 -1
- data/app/views/hyrax/homepage/_featured.html.erb +1 -1
- data/app/views/hyrax/homepage/_recent_document.html.erb +2 -2
- data/app/views/hyrax/leases/_list_expired_active_leases.html.erb +6 -6
- data/app/views/hyrax/my/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/my/collections/_tabs.html.erb +1 -1
- data/app/views/hyrax/pages/_form.html.erb +8 -8
- data/app/views/hyrax/transfers/_received.html.erb +1 -1
- data/app/views/hyrax/uploads/_js_templates.html.erb +9 -9
- data/app/views/hyrax/uploads/_js_templates_branding.html.erb +3 -3
- data/app/views/hyrax/uploads/_js_templates_versioning.html.erb +1 -1
- data/app/views/hyrax/uploads/create.json.jbuilder +2 -2
- data/app/views/hyrax/users/_activity_log.html.erb +15 -9
- data/app/views/hyrax/users/_user_row.html.erb +6 -3
- data/app/views/hyrax/users/_vitals.html.erb +3 -2
- data/app/views/layouts/_head_tag_content.html.erb +2 -0
- data/app/views/shared/_appearance_styles.html.erb +5 -1
- data/app/views/shared/_ga4.html.erb +11 -0
- data/app/views/shared/_select_work_type_modal.html.erb +10 -1
- data/bin/db-migrate-seed.sh +3 -3
- data/bin/dev-entrypoint.sh +7 -2
- data/bin/{db-wait.sh → service-wait.sh} +1 -1
- data/bin/worker-entrypoint.sh +8 -0
- data/chart/hyrax/Chart.yaml +1 -1
- data/chart/hyrax/templates/deployment-worker.yaml +2 -2
- data/chart/hyrax/templates/deployment.yaml +12 -0
- data/chart/hyrax/values.yaml +10 -0
- data/config/locales/hyrax.en.yml +4 -2
- data/config/metadata/basic_metadata.yaml +20 -0
- data/config/metadata/hyrax_internal_metadata.yaml +1 -1
- data/docker-compose-dassie.yml +167 -0
- data/docker-compose-koppie.yml +21 -36
- data/docker-compose-sirenia.yml +50 -44
- data/docker-compose.yml +2 -183
- data/documentation/developing-your-hyrax-based-app.md +4 -4
- data/hyrax.gemspec +7 -12
- data/lib/freyja/custom_query_container.rb +5 -0
- data/lib/freyja/metadata_adapter.rb +32 -0
- data/lib/freyja/persister.rb +42 -0
- data/lib/freyja/query_service.rb +20 -0
- data/lib/freyja/resource_factory.rb +8 -0
- data/lib/freyja.rb +14 -0
- data/lib/frigg/custom_query_container.rb +5 -0
- data/lib/frigg/metadata_adapter.rb +22 -0
- data/lib/frigg/persister.rb +33 -0
- data/lib/frigg/query_service.rb +15 -0
- data/lib/frigg.rb +13 -0
- data/lib/generators/hyrax/install_generator.rb +5 -0
- data/lib/generators/hyrax/templates/config/analytics.yml +6 -1
- data/lib/generators/hyrax/templates/config/initializers/1_valkyrie.rb +6 -2
- data/lib/generators/hyrax/templates/config/valkyrie_index.yml +1 -1
- data/lib/goddess/custom_query_container.rb +71 -0
- data/lib/goddess/metadata.rb +13 -0
- data/lib/goddess/query.rb +176 -0
- data/lib/hyrax/configuration.rb +83 -0
- data/lib/hyrax/engine.rb +2 -0
- data/lib/hyrax/form_fields.rb +1 -3
- data/lib/hyrax/name.rb +5 -0
- data/lib/hyrax/publisher.rb +11 -0
- data/lib/hyrax/rubocop/custom_cops.rb +30 -0
- data/lib/hyrax/specs/capybara.rb +10 -6
- data/{spec → lib/hyrax/specs/shared_specs}/factories/admin_sets.rb +2 -0
- data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_embargo.rb +4 -0
- data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_lease.rb +4 -0
- data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_work.rb +26 -1
- data/lib/hyrax/specs/shared_specs/hydra_works.rb +1 -1
- data/lib/hyrax/transactions/admin_set_destroy.rb +2 -1
- data/lib/hyrax/transactions/collection_destroy.rb +2 -1
- data/lib/hyrax/transactions/container.rb +9 -0
- data/lib/hyrax/transactions/steps/add_file_sets.rb +2 -1
- data/lib/hyrax/transactions/steps/delete_all_file_metadata.rb +4 -5
- data/lib/hyrax/transactions/steps/delete_permission_template.rb +30 -0
- data/lib/hyrax/transactions/steps/delete_resource.rb +1 -1
- data/lib/hyrax/transactions/steps/save_collection_logo.rb +2 -1
- data/lib/hyrax/valkyrie_can_can_adapter.rb +8 -1
- data/lib/hyrax/version.rb +1 -1
- data/lib/wings/active_fedora_converter.rb +13 -5
- data/lib/wings/converter_value_mapper.rb +1 -0
- data/lib/wings/services/custom_queries/find_collections_by_type.rb +2 -1
- data/lib/wings/services/custom_queries/find_file_metadata.rb +2 -2
- data/lib/wings/setup.rb +12 -3
- data/lib/wings/transformer_value_mapper.rb +5 -1
- data/lib/wings/valkyrie/persister.rb +3 -1
- data/template.rb +1 -1
- metadata +118 -94
- data/.koppie/scripts/db-migrate-seed.sh +0 -9
- data/.koppie/scripts/entrypoint.sh +0 -10
- data/spec/support/book_resource.rb +0 -36
- data/spec/support/can_can_overrides.rb +0 -43
- data/spec/support/clean_solr.rb +0 -7
- data/spec/support/controller_level_helpers.rb +0 -27
- data/spec/support/factory_helpers.rb +0 -94
- data/spec/support/fakes/fake_actor.rb +0 -22
- data/spec/support/fakes/fake_authority.rb +0 -14
- data/spec/support/fakes/fake_search_builder_scope.rb +0 -44
- data/spec/support/fakes/indexing_adapter.rb +0 -17
- data/spec/support/fakes/test_hydra_group_service.rb +0 -55
- data/spec/support/features/batch_edit_actions.rb +0 -37
- data/spec/support/features/session_helpers.rb +0 -15
- data/spec/support/features/workflow.rb +0 -10
- data/spec/support/features.rb +0 -11
- data/spec/support/form_with_validations.rb +0 -15
- data/spec/support/input_support.rb +0 -12
- data/spec/support/logging_formatter.rb +0 -67
- data/spec/support/matchers/api_responses.rb +0 -27
- data/spec/support/matchers/collection_type_property_matchers.rb +0 -30
- data/spec/support/matchers/embargo.rb +0 -9
- data/spec/support/matchers/lease.rb +0 -9
- data/spec/support/matchers/match_valkyrie_ids_with_af_ids.rb +0 -12
- data/spec/support/matchers/pcdm_matchers.rb +0 -34
- data/spec/support/matchers/permission.rb +0 -31
- data/spec/support/matchers/response_matchers.rb +0 -8
- data/spec/support/optional_example.rb +0 -17
- data/spec/support/rake.rb +0 -42
- data/spec/support/selectors.rb +0 -112
- data/spec/support/shared_examples_for_collection_presenter.rb +0 -44
- data/spec/support/simple_work.rb +0 -28
- data/spec/support/spec_statistic.rb +0 -24
- data/spec/support/speedup.rb +0 -7
- data/spec/support/statistic_helper.rb +0 -10
- data/spec/support/valkyrie_indexing.rb +0 -2
- data/spec/support/wings_models.rb +0 -9
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/access_control.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/admin_sets_lw.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/administrative_sets.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/api_items.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/collection_branding_infos.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/collection_type_participants.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/collection_types.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/collections.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/collections_factory.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/content_blocks.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/counter_metrics.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/featured_works.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/file_sets.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/generic_works.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_collection.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_default_admin_set.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_file_metadata.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_file_set.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_resource.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/object_id.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/operations.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/permission.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/permission_template_accesses.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/permission_templates.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/proxy_deposit_requests.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/single_use_links.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/sipity_entities.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/uploaded_files.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/users.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/workflow_actions.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/workflow_states.rb +0 -0
- /data/{spec → lib/hyrax/specs/shared_specs}/factories/workflows.rb +0 -0
@@ -25,30 +25,13 @@ module Hyrax
|
|
25
25
|
# @param models [Array]
|
26
26
|
# @param start_datetime [DateTime]
|
27
27
|
# @param end_datetime [DateTime]
|
28
|
+
# @return [Array<Hyrax::Resource>]
|
28
29
|
def find_by_date_range(start_datetime:, end_datetime: nil, models: nil)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def find_models_by_date_range_query
|
38
|
-
<<-SQL
|
39
|
-
SELECT * FROM orm_resources
|
40
|
-
WHERE created_at >= ?
|
41
|
-
AND created_at <= ?
|
42
|
-
AND internal_resource IN (?);
|
43
|
-
SQL
|
44
|
-
end
|
45
|
-
|
46
|
-
def find_by_date_range_query
|
47
|
-
<<-SQL
|
48
|
-
SELECT * FROM orm_resources
|
49
|
-
WHERE created_at >= ?
|
50
|
-
AND created_at <= ?;
|
51
|
-
SQL
|
30
|
+
end_range = end_datetime.blank? ? '*' : end_datetime.utc.xmlschema
|
31
|
+
query = "system_create_dtsi:[#{start_datetime.utc.xmlschema} TO #{end_range}]"
|
32
|
+
query += " AND has_model_ssim: (#{models.map { |m| "\"#{m}\"" }.join(' OR ')})" unless models.empty?
|
33
|
+
ids = Hyrax::SolrService.query_result(query, fl: 'id')['response']['docs'].map { |doc| doc['id'] }
|
34
|
+
Hyrax.query_service.find_many_by_ids(ids: ids)
|
52
35
|
end
|
53
36
|
end
|
54
37
|
end
|
@@ -28,9 +28,9 @@ module Hyrax
|
|
28
28
|
# @param global_id [GlobalID] global id for a Hyrax::CollectionType
|
29
29
|
#
|
30
30
|
# @return [Enumerable<PcdmCollection>]
|
31
|
-
def find_collections_by_type(global_id:)
|
31
|
+
def find_collections_by_type(global_id:, model: Hyrax.config.collection_class)
|
32
32
|
query_service
|
33
|
-
.find_all_of_model(model:
|
33
|
+
.find_all_of_model(model:)
|
34
34
|
.select { |collection| collection.collection_type_gid == global_id }
|
35
35
|
end
|
36
36
|
end
|
@@ -25,37 +25,9 @@ module Hyrax
|
|
25
25
|
# @param hash [Hash] the hash representation of the query
|
26
26
|
def find_count_by(hash = {}, models: nil)
|
27
27
|
return nil if models.empty? && hash.blank?
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
query_service.orm_class.count_by_sql(([find_count_by_properties_query] + internal_array))
|
32
|
-
elsif hash.blank?
|
33
|
-
query_service.orm_class.count_by_sql([find_count_by_models_query] + [models])
|
34
|
-
else
|
35
|
-
query_service.orm_class.count_by_sql(([find_count_by_properties_and_models_query] + internal_array + [models]))
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def find_count_by_properties_and_models_query
|
40
|
-
<<-SQL
|
41
|
-
SELECT count(*) FROM orm_resources
|
42
|
-
WHERE metadata @> ?
|
43
|
-
AND internal_resource IN (?);
|
44
|
-
SQL
|
45
|
-
end
|
46
|
-
|
47
|
-
def find_count_by_models_query
|
48
|
-
<<-SQL
|
49
|
-
SELECT count(*) FROM orm_resources
|
50
|
-
WHERE internal_resource IN (?);
|
51
|
-
SQL
|
52
|
-
end
|
53
|
-
|
54
|
-
def find_count_by_properties_query
|
55
|
-
<<-SQL
|
56
|
-
SELECT count(*) FROM orm_resources
|
57
|
-
WHERE metadata @> ?;
|
58
|
-
SQL
|
28
|
+
flat_hash = hash.map { |k, v| "#{k}: \"#{v}\"" }.join(' ')
|
29
|
+
flat_hash += " has_model_ssim: (#{models.map { |m| "\"#{m}\"" }.join(' OR ')})" unless models.empty?
|
30
|
+
Hyrax::SolrService.count(flat_hash)
|
59
31
|
end
|
60
32
|
end
|
61
33
|
end
|
@@ -31,7 +31,7 @@ module Hyrax
|
|
31
31
|
result = query_service.find_by(id: id)
|
32
32
|
unless result.is_a? Hyrax::FileMetadata
|
33
33
|
raise ::Valkyrie::Persistence::ObjectNotFoundError,
|
34
|
-
"Result type #{result
|
34
|
+
"Result type #{result&.internal_resource} for id #{id} is not a `Hyrax::FileMetadata`"
|
35
35
|
end
|
36
36
|
result
|
37
37
|
end
|
@@ -44,7 +44,7 @@ module Hyrax
|
|
44
44
|
result = query_service.find_by_alternate_identifier(alternate_identifier: alternate_identifier)
|
45
45
|
unless result.is_a? Hyrax::FileMetadata
|
46
46
|
raise ::Valkyrie::Persistence::ObjectNotFoundError,
|
47
|
-
"Result type #{result
|
47
|
+
"Result type #{result&.internal_resource} for alternate_identifier #{alternate_identifier} is not a `Hyrax::FileMetadata`"
|
48
48
|
end
|
49
49
|
result
|
50
50
|
end
|
@@ -24,35 +24,13 @@ module Hyrax
|
|
24
24
|
#
|
25
25
|
# @param model [Class]
|
26
26
|
# @param ids [Enumerable<#to_s>, Symbol]
|
27
|
+
# @return [Array<Hyrax::Resource>]
|
27
28
|
#
|
28
29
|
def find_models_by_access(mode:, models: nil, agent:, group: nil)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
else
|
34
|
-
query_service.run_query(find_by_access_query, internal_array)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def find_models_by_access_query
|
39
|
-
<<-SQL
|
40
|
-
SELECT * FROM orm_resources
|
41
|
-
WHERE id IN (
|
42
|
-
SELECT uuid(metadata::json#>'{access_to,0}'->>'id') FROM orm_resources
|
43
|
-
WHERE metadata @> ?
|
44
|
-
) AND internal_resource IN (?);
|
45
|
-
SQL
|
46
|
-
end
|
47
|
-
|
48
|
-
def find_by_access_query
|
49
|
-
<<-SQL
|
50
|
-
SELECT * FROM orm_resources
|
51
|
-
WHERE id IN (
|
52
|
-
SELECT uuid(metadata::json#>'{access_to,0}'->>'id') FROM orm_resources
|
53
|
-
WHERE metadata @> ?
|
54
|
-
);
|
55
|
-
SQL
|
30
|
+
query = "#{Hydra.config.permissions[mode.to_sym][(group ? 'group' : 'individual').to_sym]}:#{agent}"
|
31
|
+
query += " AND has_model_ssim: (#{models.map { |m| "\"#{m}\"" }.join(' OR ')})" unless models.empty?
|
32
|
+
ids = Hyrax::SolrService.query_result(query, fl: 'id')['response']['docs'].map { |doc| doc['id'] }
|
33
|
+
Hyrax.query_service.find_many_by_ids(ids: ids)
|
56
34
|
end
|
57
35
|
end
|
58
36
|
end
|
@@ -140,8 +140,9 @@ module Hyrax
|
|
140
140
|
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
141
141
|
def create_or_update_embargo_on_members(members, work)
|
142
142
|
# TODO: account for all members and levels, not just file sets. ref: #6131
|
143
|
-
|
144
143
|
members.each do |member|
|
144
|
+
# reload member to make sure nothing in the transaction has changed it already
|
145
|
+
member = Hyrax.query_service.find_by(id: member.id)
|
145
146
|
member_embargo_needs_updating = work.embargo.updated_at > member.embargo&.updated_at if member.embargo
|
146
147
|
|
147
148
|
if member.embargo && member_embargo_needs_updating
|
@@ -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 and allow optional skip paramater
|
33
|
+
return if event.payload[:skip_derivatives] || !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
|
@@ -16,11 +16,11 @@ module Hyrax
|
|
16
16
|
|
17
17
|
##
|
18
18
|
# Blocks until lock is acquired or timeout.
|
19
|
-
def lock(key)
|
19
|
+
def lock(key, ttl: @ttl, retry_count: @retry_count, retry_delay: @retry_delay)
|
20
20
|
returned_from_block = nil
|
21
21
|
|
22
22
|
pool.then do |conn|
|
23
|
-
client(conn).lock(key,
|
23
|
+
client(conn, retry_count: retry_count, retry_delay: retry_delay).lock(key, ttl) do |locked|
|
24
24
|
raise UnableToAcquireLockError unless locked
|
25
25
|
returned_from_block = yield
|
26
26
|
end
|
@@ -30,17 +30,17 @@ module Hyrax
|
|
30
30
|
rescue ConnectionPool::TimeoutError => err
|
31
31
|
Hyrax.logger.error(err.message)
|
32
32
|
raise(ConnectionPool::TimeoutError,
|
33
|
-
"Failed to
|
34
|
-
|
35
|
-
|
33
|
+
"Failed to acquire a lock from Redlock due to a Redis connection " \
|
34
|
+
"timeout: #{err}. If you are using Redis via `ConnectionPool` " \
|
35
|
+
"you may wish to increase the pool size.")
|
36
36
|
end
|
37
37
|
|
38
38
|
private
|
39
39
|
|
40
40
|
##
|
41
41
|
# @api_private
|
42
|
-
def client(conn)
|
43
|
-
Redlock::Client.new([conn], retry_count:
|
42
|
+
def client(conn, retry_count:, retry_delay:)
|
43
|
+
Redlock::Client.new([conn], retry_count: retry_count, retry_delay: retry_delay)
|
44
44
|
end
|
45
45
|
|
46
46
|
##
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require 'forwardable'
|
3
|
+
|
2
4
|
module Hyrax
|
3
5
|
module Lockable
|
6
|
+
extend Forwardable
|
4
7
|
extend ActiveSupport::Concern
|
5
8
|
|
6
|
-
|
7
|
-
lock_manager.lock(lock_key, &block)
|
8
|
-
end
|
9
|
+
def_delegator :lock_manager, :lock, :acquire_lock_for
|
9
10
|
|
10
11
|
def lock_manager
|
11
12
|
@lock_manager ||= LockManager.new(
|
@@ -54,7 +54,7 @@ module Hyrax
|
|
54
54
|
end
|
55
55
|
|
56
56
|
delegate :add, :commit, :count, :delete, :get, :instance, :ping, :post,
|
57
|
-
:query, :query_result, :delete_by_query, :search_by_id, :wipe!, to: :new
|
57
|
+
:query, :query_result, :query_in_batches, :delete_by_query, :search_by_id, :wipe!, to: :new
|
58
58
|
end
|
59
59
|
|
60
60
|
# Wraps rsolr get
|
@@ -111,6 +111,20 @@ module Hyrax
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
+
def query_in_batches(query, **args)
|
115
|
+
args[:rows] ||= 500
|
116
|
+
args[:start] ||= 0
|
117
|
+
loop do
|
118
|
+
result = query_result(query, **args)
|
119
|
+
break if result['response']['docs'].blank? || result['response']['numFound'] <= args[:start]
|
120
|
+
result['response']['docs'].select do |doc|
|
121
|
+
yield ::SolrHit.new(doc)
|
122
|
+
nil
|
123
|
+
end
|
124
|
+
args[:start] += args[:rows]
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
114
128
|
# Wraps rsolr :delete_by_query
|
115
129
|
def delete_by_query(query, **args)
|
116
130
|
connection.delete_by_query(query, params: args)
|
@@ -149,6 +163,13 @@ module Hyrax
|
|
149
163
|
result.first
|
150
164
|
end
|
151
165
|
|
166
|
+
##
|
167
|
+
# @api private
|
168
|
+
def connection
|
169
|
+
return self.class.instance.conn unless use_valkyrie
|
170
|
+
valkyrie_index.connection
|
171
|
+
end
|
172
|
+
|
152
173
|
private
|
153
174
|
|
154
175
|
##
|
@@ -163,13 +184,6 @@ module Hyrax
|
|
163
184
|
Hyrax.index_adapter
|
164
185
|
end
|
165
186
|
|
166
|
-
##
|
167
|
-
# @api private
|
168
|
-
def connection
|
169
|
-
return self.class.instance.conn unless use_valkyrie
|
170
|
-
valkyrie_index.connection
|
171
|
-
end
|
172
|
-
|
173
187
|
def rows_warning
|
174
188
|
"Calling Hyrax::SolrService.get without passing an explicit value for ':rows' is not recommended. You will end up with Solr's default (usually set to 10)\nCalled by #{caller[0]}"
|
175
189
|
end
|
@@ -31,6 +31,8 @@ module Hyrax
|
|
31
31
|
return object if object.thumbnail_id == object.id ||
|
32
32
|
object.try(:file_ids)&.detect { |fid| fid == object.thumbnail_id }
|
33
33
|
begin
|
34
|
+
# In some implmentations (e.g. Wings), `find_by(id:)` aliases
|
35
|
+
# `find_by_alternate_identifier` but that is not guaranteed.
|
34
36
|
return Hyrax.query_service.find_by(id: object.thumbnail_id)
|
35
37
|
rescue
|
36
38
|
nil
|
@@ -61,7 +61,7 @@ module Hyrax
|
|
61
61
|
|
62
62
|
def process_works(stats, user, start_date)
|
63
63
|
work_ids_for_user(user).each do |work_id|
|
64
|
-
work = Hyrax
|
64
|
+
work = Hyrax.query_service.find_by(id: work_id)
|
65
65
|
work_stats = extract_stats_for(object: work, from: WorkViewStat, start_date: start_date, user: user)
|
66
66
|
stats = tally_results(work_stats, :work_views, stats) if work_stats.present?
|
67
67
|
delay
|
@@ -94,7 +94,7 @@ module Hyrax
|
|
94
94
|
if last_cached_stat
|
95
95
|
last_cached_stat.date + 1.day
|
96
96
|
else
|
97
|
-
Hyrax.config.analytic_start_date
|
97
|
+
Hyrax.config.analytic_start_date || 1.week.ago
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -108,8 +108,8 @@ module Hyrax
|
|
108
108
|
|
109
109
|
def work_ids_for_user(user)
|
110
110
|
ids = []
|
111
|
-
Hyrax::
|
112
|
-
ids
|
111
|
+
Hyrax::SolrService.query_in_batches("#{depositor_field}:\"#{user.user_key}\"", fl: "id") do |hit|
|
112
|
+
ids << hit.id
|
113
113
|
end
|
114
114
|
ids
|
115
115
|
end
|
@@ -124,7 +124,7 @@ module Hyrax
|
|
124
124
|
|
125
125
|
date_key = stats.date.to_s
|
126
126
|
old_count = total_stats[date_key] ? total_stats[date_key].fetch(stat_name) { 0 } : 0
|
127
|
-
new_count = old_count + stats.method(stat_name).call
|
127
|
+
new_count = old_count + stats.method(stat_name).call.to_i
|
128
128
|
|
129
129
|
old_values = total_stats[date_key] || {}
|
130
130
|
total_stats.store(date_key, old_values)
|
@@ -18,10 +18,12 @@ class Hyrax::ValkyrieUpload
|
|
18
18
|
io:,
|
19
19
|
storage_adapter: Hyrax.storage_adapter,
|
20
20
|
use: Hyrax::FileMetadata::Use::ORIGINAL_FILE,
|
21
|
-
user: nil
|
21
|
+
user: nil,
|
22
|
+
mime_type: nil,
|
23
|
+
skip_derivatives: false
|
22
24
|
)
|
23
25
|
new(storage_adapter: storage_adapter)
|
24
|
-
.upload(filename: filename, file_set: file_set, io: io, use: use, user: user)
|
26
|
+
.upload(filename: filename, file_set: file_set, io: io, use: use, user: user, mime_type: mime_type, skip_derivatives: skip_derivatives)
|
25
27
|
end
|
26
28
|
|
27
29
|
##
|
@@ -30,17 +32,19 @@ class Hyrax::ValkyrieUpload
|
|
30
32
|
attr_reader :storage_adapter
|
31
33
|
##
|
32
34
|
# @param [Valkyrie::StorageAdapter] storage_adapter
|
33
|
-
|
35
|
+
# @param [Class] file_set_file_service implementer of {Hyrax::FileSetFileService}
|
36
|
+
def initialize(storage_adapter: Hyrax.storage_adapter, file_set_file_service: Hyrax.config.file_set_file_service)
|
34
37
|
@storage_adapter = storage_adapter
|
38
|
+
@file_set_file_service = file_set_file_service
|
35
39
|
end
|
36
40
|
|
37
|
-
def upload(filename:, file_set:, io:, use: Hyrax::FileMetadata::Use::ORIGINAL_FILE, user: nil, mime_type: nil) # rubocop:disable Metrics/AbcSize
|
41
|
+
def upload(filename:, file_set:, io:, use: Hyrax::FileMetadata::Use::ORIGINAL_FILE, user: nil, mime_type: nil, skip_derivatives: false) # rubocop:disable Metrics/AbcSize
|
38
42
|
return version_upload(file_set: file_set, io: io, user: user) if use == Hyrax::FileMetadata::Use::ORIGINAL_FILE && file_set.original_file_id && storage_adapter.supports?(:versions)
|
39
43
|
streamfile = storage_adapter.upload(file: io, original_filename: filename, resource: file_set)
|
40
44
|
file_metadata = Hyrax::FileMetadata(streamfile)
|
41
45
|
file_metadata.file_set_id = file_set.id
|
42
|
-
file_metadata.pcdm_use =
|
43
|
-
file_metadata.recorded_size =
|
46
|
+
file_metadata.pcdm_use = Array(use)
|
47
|
+
file_metadata.recorded_size = Array(io.size)
|
44
48
|
file_metadata.mime_type = mime_type if mime_type
|
45
49
|
file_metadata.original_filename = File.basename(filename).to_s || File.basename(io)
|
46
50
|
|
@@ -60,14 +64,15 @@ class Hyrax::ValkyrieUpload
|
|
60
64
|
file_metadata: saved_metadata,
|
61
65
|
user: user)
|
62
66
|
|
63
|
-
Hyrax.publisher.publish("file.uploaded", metadata: saved_metadata)
|
64
|
-
Hyrax.publisher.publish('file.metadata.updated', metadata: saved_metadata, user: user)
|
67
|
+
Hyrax.publisher.publish("file.uploaded", metadata: saved_metadata, skip_derivatives: skip_derivatives)
|
68
|
+
Hyrax.publisher.publish('file.metadata.updated', metadata: saved_metadata, user: user, skip_derivatices: skip_derivatives)
|
65
69
|
|
66
70
|
saved_metadata
|
67
71
|
end
|
68
72
|
|
69
73
|
def version_upload(file_set:, io:, user:)
|
70
|
-
file_metadata =
|
74
|
+
file_metadata = @file_set_file_service.primary_file_for(file_set: file_set)
|
75
|
+
|
71
76
|
Hyrax::VersioningService.create(file_metadata, user, io)
|
72
77
|
Hyrax.publisher.publish("file.uploaded", metadata: file_metadata)
|
73
78
|
ContentNewVersionEventJob.perform_later(file_set, user)
|
@@ -20,8 +20,16 @@ module Hyrax
|
|
20
20
|
|
21
21
|
##
|
22
22
|
# @param resource [ActiveFedora::File | Hyrax::FileMetadata | NilClass]
|
23
|
-
def initialize(resource:, storage_adapter:
|
24
|
-
@storage_adapter = storage_adapter
|
23
|
+
def initialize(resource:, storage_adapter: nil)
|
24
|
+
@storage_adapter = if storage_adapter.nil?
|
25
|
+
if resource.respond_to?(:file_identifier)
|
26
|
+
Valkyrie::StorageAdapter.adapter_for(id: resource.file_identifier)
|
27
|
+
else
|
28
|
+
Hyrax.storage_adapter
|
29
|
+
end
|
30
|
+
else
|
31
|
+
storage_adapter
|
32
|
+
end
|
25
33
|
self.resource = resource
|
26
34
|
end
|
27
35
|
|
@@ -3,7 +3,7 @@ module Hyrax
|
|
3
3
|
# Responsible for retrieving information based on the given work.
|
4
4
|
#
|
5
5
|
# @see ProxyDepositRequest
|
6
|
-
# @see Hyrax::
|
6
|
+
# @see Hyrax::VaklyrieWorkRelation
|
7
7
|
# @see SolrDocument
|
8
8
|
# @see Hyrax::SolrService
|
9
9
|
# @see ActiveFedora::SolrQueryBuilder
|
@@ -20,7 +20,7 @@ module Hyrax
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def default_work_relation
|
23
|
-
Hyrax::WorkRelation.new
|
23
|
+
Hyrax.config.disable_wings ? Hyrax::ValkyrieWorkRelation.new : Hyrax::WorkRelation.new
|
24
24
|
end
|
25
25
|
|
26
26
|
public
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# migrates models from AF to valkyrie
|
4
|
+
class MigrateResourceService
|
5
|
+
attr_accessor :resource
|
6
|
+
def initialize(resource:)
|
7
|
+
@resource = resource
|
8
|
+
end
|
9
|
+
|
10
|
+
def model
|
11
|
+
@model || Wings::ModelRegistry.lookup(resource.class).to_s
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
prep_resource
|
16
|
+
Hyrax::Transactions::Container[model_events(model)]
|
17
|
+
.with_step_args(**model_steps(model)).call(resource_form)
|
18
|
+
end
|
19
|
+
|
20
|
+
def prep_resource
|
21
|
+
case model
|
22
|
+
when 'FileSet'
|
23
|
+
resource.creator << ::User.batch_user.email if resource.creator.blank?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def resource_form
|
28
|
+
@resource_form ||= Hyrax::Forms::ResourceForm.for(resource: resource)
|
29
|
+
end
|
30
|
+
|
31
|
+
def model_events(model)
|
32
|
+
{
|
33
|
+
'AdminSet' => 'admin_set_resource.update',
|
34
|
+
'Collection' => 'change_set.update_collection',
|
35
|
+
'FileSet' => 'change_set.update_file_set'
|
36
|
+
}[model] || 'change_set.update_work'
|
37
|
+
end
|
38
|
+
|
39
|
+
def model_steps(model)
|
40
|
+
{
|
41
|
+
'AdminSet' => {},
|
42
|
+
'Collection' => {
|
43
|
+
'collection_resource.save_collection_banner' => { banner_unchanged_indicator: true },
|
44
|
+
'collection_resource.save_collection_logo' => { logo_unchanged_indicator: true }
|
45
|
+
},
|
46
|
+
'FileSet' => {
|
47
|
+
'file_set.save_acl' => {}
|
48
|
+
}
|
49
|
+
}[model] || {
|
50
|
+
'work_resource.add_file_sets' => { uploaded_files: [], file_set_params: [] },
|
51
|
+
'work_resource.update_work_members' => { work_members_attributes: [] },
|
52
|
+
'work_resource.save_acl' => { permissions_params: [] }
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
<nav class="navbar
|
1
|
+
<nav class="navbar bg-light navbar-expand-sm justify-content-between align-items-center px-2 py-3 border-bottom" role="navigation" aria-label="Root Menu">
|
2
2
|
<ul class="nav navbar-nav col-sm-5">
|
3
|
-
<li class="nav-item <%= 'active' if current_page?(hyrax.root_path) %>">
|
3
|
+
<li class="nav-item <%= 'active font-weight-bold' if current_page?(hyrax.root_path) %>">
|
4
4
|
<%= link_to t(:'hyrax.controls.home'), hyrax.root_path, class: "nav-link", aria: current_page?(hyrax.root_path) ? {current: 'page'} : nil %></li>
|
5
|
-
<li class="nav-item <%= 'active' if current_page?(hyrax.about_path) %>">
|
5
|
+
<li class="nav-item <%= 'active font-weight-bold' if current_page?(hyrax.about_path) %>">
|
6
6
|
<%= link_to t(:'hyrax.controls.about'), hyrax.about_path, class: "nav-link", aria: current_page?(hyrax.about_path) ? {current: 'page'} : nil %></li>
|
7
|
-
<li class="nav-item <%= 'active' if current_page?(hyrax.help_path) %>">
|
7
|
+
<li class="nav-item <%= 'active font-weight-bold' if current_page?(hyrax.help_path) %>">
|
8
8
|
<%= link_to t(:'hyrax.controls.help'), hyrax.help_path, class: "nav-link", aria: current_page?(hyrax.help_path) ? {current: 'page'} : nil %></li>
|
9
|
-
<li class="nav-item <%= 'active' if current_page?(hyrax.contact_path) %>">
|
9
|
+
<li class="nav-item <%= 'active font-weight-bold' if current_page?(hyrax.contact_path) %>">
|
10
10
|
<%= link_to t(:'hyrax.controls.contact'), hyrax.contact_path, class: "nav-link", aria: current_page?(hyrax.contact_path) ? {current: 'page'} : nil %></li>
|
11
11
|
</ul><!-- /.nav -->
|
12
12
|
<div class="col-sm-7">
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<header aria-label="header" class="top-header">
|
2
2
|
<nav id="masthead" class="navbar navbar-expand-lg navbar-dark bg-dark justify-content-between <%= placement_class %>" role="navigation" aria-label="masthead">
|
3
|
-
<h1 class="sr-only"><%= application_name %></h1>
|
3
|
+
<h1 class="sr-only navbar-text"><%= application_name %></h1>
|
4
4
|
<%= render '/logo' %>
|
5
5
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#top-navbar-collapse" aria-expanded="false" aria-label="Toggle navigation">
|
6
6
|
<span class="navbar-toggler-icon"></span>
|