hyrax 3.0.1 → 3.3.0
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 +49 -19
- data/.dassie/.env +1 -2
- data/.dassie/Gemfile +18 -9
- data/.dassie/app/controllers/catalog_controller.rb +6 -0
- data/.dassie/app/models/user.rb +0 -2
- data/.dassie/config/analytics.yml +12 -5
- data/.dassie/config/environments/development.rb +2 -0
- data/.dassie/config/initializers/hyrax.rb +7 -0
- data/.dassie/config/role_map.yml +2 -0
- data/.dassie/db/migrate/20210921150120_enable_uuid_extension.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150121_create_orm_resources.valkyrie_engine.rb +19 -0
- data/.dassie/db/migrate/20210921150122_add_model_type_to_orm_resources.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150123_change_model_type_to_internal_model.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150124_create_path_gin_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150125_create_internal_resource_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150126_create_updated_at_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150127_add_optimistic_locking_to_orm_resources.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20211130181150_create_default_administrative_set.rb +8 -0
- data/.dassie/db/schema.rb +20 -1
- data/.dassie/db/seeds.rb +1 -1
- data/.dockerignore +3 -0
- data/.env +8 -6
- data/.github/workflows/main.yml +17 -0
- data/.github/workflows/release.yml +17 -0
- data/.gitignore +1 -0
- data/.regen +1 -1
- data/.rubocop.yml +4 -0
- data/CONTAINERS.md +33 -10
- data/Dockerfile +14 -9
- data/Gemfile +21 -27
- data/README.md +37 -0
- data/app/actors/hyrax/actors/base_actor.rb +2 -2
- data/app/actors/hyrax/actors/collections_membership_actor.rb +3 -3
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +85 -63
- data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +7 -42
- data/app/actors/hyrax/actors/file_set_actor.rb +12 -5
- data/app/assets/javascripts/hyrax/admin/graphs.es6 +34 -37
- data/app/assets/javascripts/hyrax/analytics_events.js +69 -0
- data/app/assets/javascripts/hyrax/collapse.js +24 -0
- data/app/assets/javascripts/hyrax/collections.js +1 -2
- data/app/assets/javascripts/hyrax/ga_events.js +2 -8
- data/app/assets/javascripts/hyrax/reports-buttons.js +33 -0
- data/app/assets/javascripts/hyrax.js +2 -1
- data/app/assets/stylesheets/_bootstrap-default-overrides.scss +9 -0
- data/app/assets/stylesheets/hyrax/_styles.scss +5 -0
- data/app/authorities/qa/authorities/collections.rb +4 -5
- data/app/authorities/qa/authorities/find_works.rb +1 -1
- data/app/controllers/concerns/hyrax/breadcrumbs_for_collection_analytics.rb +26 -0
- data/app/controllers/concerns/hyrax/breadcrumbs_for_works_analytics.rb +26 -0
- data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +30 -10
- data/app/controllers/concerns/hyrax/controller.rb +35 -2
- data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +21 -9
- data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +14 -5
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +22 -3
- data/app/controllers/hyrax/admin/admin_sets_controller.rb +2 -19
- data/app/controllers/hyrax/admin/analytics/analytics_controller.rb +40 -0
- data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +61 -0
- data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +122 -0
- data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +5 -6
- data/app/controllers/hyrax/admin/workflows_controller.rb +8 -2
- data/app/controllers/hyrax/collections_controller.rb +6 -1
- data/app/controllers/hyrax/dashboard/collection_members_controller.rb +24 -17
- data/app/controllers/hyrax/dashboard/collections_controller.rb +112 -37
- data/app/controllers/hyrax/dashboard/nest_collections_controller.rb +75 -39
- data/app/controllers/hyrax/dashboard_controller.rb +8 -0
- data/app/controllers/hyrax/file_sets_controller.rb +49 -13
- data/app/controllers/hyrax/my_controller.rb +4 -4
- data/app/controllers/hyrax/permissions_controller.rb +3 -4
- data/app/controllers/hyrax/stats_controller.rb +3 -1
- data/app/controllers/hyrax/workflow_actions_controller.rb +11 -6
- data/app/forms/hyrax/forms/administrative_set_form.rb +62 -0
- data/app/forms/hyrax/forms/collection_form.rb +9 -5
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +38 -6
- data/app/forms/hyrax/forms/file_set_form.rb +46 -0
- data/app/forms/hyrax/forms/pcdm_collection_form.rb +67 -0
- data/app/forms/hyrax/forms/permission.rb +23 -0
- data/app/forms/hyrax/forms/permission_template_form.rb +8 -2
- data/app/forms/hyrax/forms/resource_form.rb +34 -26
- data/app/forms/hyrax/forms/work_form.rb +5 -2
- data/app/forms/hyrax/forms/workflow_action_form.rb +4 -0
- data/app/helpers/hyrax/batch_edits_helper.rb +3 -1
- data/app/helpers/hyrax/collections_helper.rb +88 -2
- data/app/helpers/hyrax/dashboard_helper_behavior.rb +16 -5
- data/app/helpers/hyrax/embargo_helper.rb +4 -0
- data/app/helpers/hyrax/file_set_helper.rb +25 -6
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +9 -0
- data/app/helpers/hyrax/lease_helper.rb +4 -0
- data/app/helpers/hyrax/url_helper.rb +4 -1
- data/app/helpers/hyrax/work_form_helper.rb +53 -0
- data/app/indexers/hyrax/administrative_set_indexer.rb +18 -0
- data/app/indexers/hyrax/pcdm_collection_indexer.rb +2 -0
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +3 -1
- data/app/indexers/hyrax/valkyrie_indexer.rb +3 -3
- data/app/indexers/hyrax/valkyrie_work_indexer.rb +1 -1
- data/app/inputs/controlled_vocabulary_input.rb +2 -5
- data/app/jobs/attach_files_to_work_job.rb +19 -10
- data/app/jobs/attach_files_to_work_with_ordered_members_job.rb +6 -5
- data/app/jobs/characterize_job.rb +28 -1
- data/app/jobs/ingest_local_file_job.rb +18 -2
- data/app/jobs/inherit_permissions_job.rb +9 -5
- data/app/jobs/valkyrie_ingest_job.rb +56 -0
- data/app/models/admin_set.rb +22 -30
- data/app/models/collection_branding_info.rb +25 -9
- data/app/models/concerns/hyrax/ability/admin_set_ability.rb +31 -7
- data/app/models/concerns/hyrax/ability/collection_ability.rb +35 -20
- data/app/models/concerns/hyrax/ability/collection_type_ability.rb +1 -1
- data/app/models/concerns/hyrax/ability.rb +31 -8
- data/app/models/concerns/hyrax/collection_behavior.rb +17 -44
- data/app/models/concerns/hyrax/embargoable.rb +24 -0
- data/app/models/concerns/hyrax/file_set/characterization.rb +18 -12
- data/app/models/concerns/hyrax/solr_document/metadata.rb +1 -0
- data/app/models/concerns/hyrax/solr_document_behavior.rb +11 -54
- data/app/models/concerns/hyrax/suppressible.rb +5 -0
- data/app/models/concerns/hyrax/user.rb +9 -3
- data/app/models/concerns/hyrax/work_behavior.rb +1 -1
- data/app/models/file_download_stat.rb +4 -4
- data/app/models/hyrax/administrative_set.rb +7 -1
- data/app/models/hyrax/default_administrative_set.rb +42 -0
- data/app/models/hyrax/file_set.rb +6 -0
- data/app/models/hyrax/pcdm_collection.rb +1 -0
- data/app/models/hyrax/permission.rb +1 -1
- data/app/models/hyrax/permission_template.rb +112 -12
- data/app/models/hyrax/statistic.rb +31 -4
- data/app/models/hyrax/virus_scanner.rb +27 -18
- data/app/models/hyrax/work.rb +1 -0
- data/app/models/hyrax/workflow_action_info.rb +16 -0
- data/app/models/sipity/agent.rb +1 -0
- data/app/models/sipity/comment.rb +17 -0
- data/app/models/sipity/entity.rb +30 -8
- data/app/models/sipity/workflow.rb +1 -0
- data/app/models/sipity.rb +53 -2
- data/app/presenters/hyrax/admin/dashboard_presenter.rb +8 -6
- data/app/presenters/hyrax/admin/repository_growth_presenter.rb +10 -5
- data/app/presenters/hyrax/admin/user_activity_presenter.rb +8 -12
- data/app/presenters/hyrax/admin_set_options_presenter.rb +12 -8
- data/app/presenters/hyrax/admin_set_presenter.rb +13 -4
- data/app/presenters/hyrax/admin_set_selection_presenter.rb +116 -0
- data/app/presenters/hyrax/collection_presenter.rb +34 -9
- data/app/presenters/hyrax/file_set_presenter.rb +8 -1
- data/app/presenters/hyrax/file_usage.rb +3 -2
- data/app/presenters/hyrax/menu_presenter.rb +4 -0
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +119 -0
- data/app/presenters/hyrax/stats_usage_presenter.rb +2 -1
- data/app/presenters/hyrax/trophy_presenter.rb +33 -4
- data/app/presenters/hyrax/user_profile_presenter.rb +11 -1
- data/app/presenters/hyrax/version_list_presenter.rb +19 -0
- data/app/presenters/hyrax/version_presenter.rb +3 -2
- data/app/presenters/hyrax/work_show_presenter.rb +37 -8
- data/app/presenters/hyrax/work_usage.rb +6 -3
- data/app/renderers/hyrax/renderers/attribute_renderer.rb +10 -2
- data/app/search_builders/hyrax/README.md +1 -1
- data/app/search_builders/hyrax/abstract_type_relation.rb +4 -2
- data/app/search_builders/hyrax/admin_set_search_builder.rb +1 -1
- data/app/search_builders/hyrax/collection_member_search_builder.rb +6 -1
- data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +1 -1
- data/app/search_builders/hyrax/exposed_models_relation.rb +1 -1
- data/app/search_builders/hyrax/filter_by_type.rb +1 -2
- data/app/search_builders/hyrax/my/collections_search_builder.rb +2 -2
- data/app/search_builders/hyrax/nested_collections_parent_search_builder.rb +1 -1
- data/app/search_builders/hyrax/single_collection_search_builder.rb +1 -1
- data/app/services/hyrax/admin_set_create_service.rb +199 -53
- data/app/services/hyrax/analytics/google/events.rb +37 -0
- data/app/services/hyrax/analytics/google/events_daily.rb +72 -0
- data/app/services/hyrax/analytics/google/visits.rb +44 -0
- data/app/services/hyrax/analytics/google/visits_daily.rb +49 -0
- data/app/services/hyrax/analytics/google.rb +204 -0
- data/app/services/hyrax/analytics/matomo.rb +193 -0
- data/app/services/hyrax/analytics/results.rb +79 -0
- data/app/services/hyrax/analytics.rb +12 -82
- data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +134 -0
- data/app/services/hyrax/collection_types/permissions_service.rb +1 -1
- data/app/services/hyrax/collections/collection_member_search_service.rb +72 -0
- data/app/services/hyrax/collections/collection_member_service.rb +122 -27
- data/app/services/hyrax/collections/migration_service.rb +4 -2
- data/app/services/hyrax/collections/nested_collection_persistence_service.rb +12 -13
- data/app/services/hyrax/collections/nested_collection_query_service.rb +10 -3
- data/app/services/hyrax/collections/permissions_create_service.rb +82 -78
- data/app/services/hyrax/collections/permissions_service.rb +1 -1
- data/app/services/hyrax/contextual_path.rb +24 -1
- data/app/services/hyrax/curation_concern.rb +24 -2
- data/app/services/hyrax/custom_queries/find_file_metadata.rb +7 -5
- data/app/services/hyrax/custom_queries/navigators/parent_collections_navigator.rb +46 -0
- data/app/services/hyrax/default_middleware_stack.rb +11 -0
- data/app/services/hyrax/edit_permissions_service.rb +74 -41
- data/app/services/hyrax/ensure_well_formed_admin_set_service.rb +3 -3
- data/app/services/hyrax/find_objects_via_solr_service.rb +31 -0
- data/app/services/hyrax/listeners/acl_index_listener.rb +3 -1
- data/app/services/hyrax/listeners/active_fedora_acl_index_listener.rb +4 -1
- data/app/services/hyrax/listeners/batch_notification_listener.rb +3 -1
- data/app/services/hyrax/listeners/file_metadata_listener.rb +19 -0
- data/app/services/hyrax/listeners/file_set_lifecycle_listener.rb +6 -2
- data/app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb +6 -2
- data/app/services/hyrax/listeners/member_cleanup_listener.rb +3 -0
- data/app/services/hyrax/listeners/metadata_index_listener.rb +33 -11
- data/app/services/hyrax/listeners/object_lifecycle_listener.rb +9 -3
- data/app/services/hyrax/listeners/proxy_deposit_listener.rb +3 -1
- data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +3 -0
- data/app/services/hyrax/listeners/workflow_listener.rb +3 -1
- data/app/services/hyrax/listeners.rb +8 -0
- data/app/services/hyrax/multiple_membership_checker.rb +53 -29
- data/app/services/hyrax/permission_manager.rb +4 -4
- data/app/services/hyrax/resource_status.rb +7 -0
- data/app/services/hyrax/restriction_service.rb +4 -0
- data/app/services/hyrax/search_service.rb +4 -2
- data/app/services/hyrax/solr_query_builder_service.rb +45 -8
- data/app/services/hyrax/solr_query_service.rb +224 -0
- data/app/services/hyrax/solr_service.rb +9 -2
- data/app/services/hyrax/statistics/collections/over_time.rb +2 -1
- data/app/services/hyrax/statistics/depositors/summary.rb +2 -1
- data/app/services/hyrax/statistics/users/over_time.rb +8 -5
- data/app/services/hyrax/statistics/works/over_time.rb +10 -0
- data/app/services/hyrax/visibility_intention.rb +20 -2
- data/app/services/hyrax/work_uploads_handler.rb +21 -3
- data/app/services/hyrax/workflow/abstract_notification.rb +2 -2
- data/app/services/hyrax/workflow/action_taken_service.rb +16 -4
- data/app/services/hyrax/workflow/actionable_objects.rb +70 -0
- data/app/services/hyrax/workflow/activate_object.rb +5 -4
- data/app/services/hyrax/workflow/changes_required_notification.rb +5 -4
- data/app/services/hyrax/workflow/deactivate_object.rb +7 -5
- data/app/services/hyrax/workflow/deposited_notification.rb +8 -4
- data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +7 -3
- data/app/services/hyrax/workflow/grant_read_to_depositor.rb +10 -3
- data/app/services/hyrax/workflow/object_in_workflow_decorator.rb +31 -0
- data/app/services/hyrax/workflow/revoke_edit_from_depositor.rb +8 -2
- data/app/services/hyrax/workflow/status_list_service.rb +43 -13
- data/app/services/hyrax/workflow/workflow_action_service.rb +4 -1
- data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
- data/app/views/hyrax/admin/analytics/_date_range_form.html.erb +11 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_custom_range.html.erb +39 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_monthly_summary.html.erb +48 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_summary.html.erb +55 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +55 -0
- data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +70 -0
- data/app/views/hyrax/admin/analytics/collection_reports/show.html.erb +94 -0
- data/app/views/hyrax/admin/analytics/work_reports/_custom_range.html.erb +43 -0
- data/app/views/hyrax/admin/analytics/work_reports/_monthly_summary.html.erb +35 -0
- data/app/views/hyrax/admin/analytics/work_reports/_summary.html.erb +60 -0
- data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +33 -0
- data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +40 -0
- data/app/views/hyrax/admin/analytics/work_reports/_work_counts.html.erb +18 -0
- data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +41 -0
- data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +77 -0
- data/app/views/hyrax/admin/analytics/work_reports/show.html.erb +90 -0
- data/app/views/hyrax/admin/stats/show.html.erb +1 -1
- data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
- data/app/views/hyrax/base/_form_relationships.html.erb +1 -2
- data/app/views/hyrax/base/_form_rendering.html.erb +1 -1
- data/app/views/hyrax/base/_form_representative.html.erb +1 -1
- data/app/views/hyrax/base/_form_thumbnail.html.erb +1 -1
- data/app/views/hyrax/base/_form_visibility_error.html.erb +2 -0
- data/app/views/hyrax/base/_guts4form.html.erb +3 -3
- data/app/views/hyrax/base/_relationships_parent_row.html.erb +0 -1
- data/app/views/hyrax/base/_representative_media.html.erb +1 -1
- data/app/views/hyrax/base/_show_actions.html.erb +2 -2
- data/app/views/hyrax/base/_work_button_row.html.erb +1 -1
- data/app/views/hyrax/base/show.html.erb +6 -0
- data/app/views/hyrax/batch_uploads/_form.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +4 -0
- data/app/views/hyrax/dashboard/_repository_growth.html.erb +5 -5
- data/app/views/hyrax/dashboard/_resource_type_graph.html.erb +41 -0
- data/app/views/hyrax/dashboard/_sidebar.html.erb +4 -1
- data/app/views/hyrax/dashboard/_tabs.html.erb +11 -0
- data/app/views/hyrax/dashboard/_user_activity.html.erb +17 -23
- data/app/views/hyrax/dashboard/_user_activity_graph.html.erb +55 -0
- data/app/views/hyrax/dashboard/_visibility_graph.html.erb +31 -0
- data/app/views/hyrax/dashboard/_work_type_graph.html.erb +41 -0
- data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form.html.erb +6 -5
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/edit.html.erb +4 -2
- data/app/views/hyrax/dashboard/collections/new.html.erb +4 -2
- data/app/views/hyrax/dashboard/collections/show.html.erb +1 -1
- data/app/views/hyrax/dashboard/show_admin.html.erb +24 -45
- data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +22 -0
- data/app/views/hyrax/file_sets/_actions.html.erb +4 -3
- data/app/views/hyrax/file_sets/edit.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_image.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_office_document.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_pdf.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +1 -1
- data/app/views/hyrax/file_sets/show.html.erb +7 -1
- data/app/views/hyrax/homepage/index.html.erb +1 -1
- data/app/views/hyrax/my/_admin_set_action_menu.html.erb +0 -11
- data/app/views/hyrax/my/_collection_action_menu.html.erb +1 -2
- data/app/views/hyrax/my/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +3 -5
- data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +1 -1
- data/app/views/hyrax/my/collections/index.html.erb +1 -1
- data/app/views/hyrax/stats/_downloads.html.erb +18 -0
- data/app/views/hyrax/stats/_pageviews.html.erb +18 -0
- data/app/views/hyrax/stats/work.html.erb +17 -9
- data/app/views/layouts/_head_tag_content.html.erb +7 -2
- data/app/views/layouts/hyrax/dashboard.html.erb +1 -0
- data/app/views/layouts/hyrax.html.erb +1 -0
- data/app/views/{_ga.html.erb → shared/_ga.html.erb} +3 -7
- data/app/views/shared/_matomo.html.erb +15 -0
- data/app/views/shared/_read_only.html.erb +5 -0
- data/bin/db-migrate-seed.sh +3 -1
- data/bin/hyrax-entrypoint.sh +0 -14
- data/bin/solrcloud-assign-configset.sh +11 -3
- data/bin/solrcloud-upload-configset.sh +17 -6
- data/chart/hyrax/Chart.yaml +9 -5
- data/chart/hyrax/README.md +52 -5
- data/chart/hyrax/templates/_helpers.tpl +15 -1
- data/chart/hyrax/templates/branding-pvc.yaml +2 -2
- data/chart/hyrax/templates/configmap-env.yaml +6 -2
- data/chart/hyrax/templates/deployment-worker.yaml +42 -5
- data/chart/hyrax/templates/deployment.yaml +53 -0
- data/chart/hyrax/templates/derivatives-pvc.yaml +2 -2
- data/chart/hyrax/templates/ingress.yaml +13 -4
- data/chart/hyrax/templates/secrets.yaml +8 -0
- data/chart/hyrax/templates/uploads-pvc.yaml +2 -2
- data/chart/hyrax/values.yaml +84 -2
- data/config/brakeman.ignore +2 -2
- data/config/features.rb +3 -0
- data/config/i18n-tasks.yml +2 -2
- data/config/initializers/1_healthz.rb +1 -0
- data/config/initializers/listeners.rb +5 -4
- data/config/initializers/valkryrie_storage.rb +7 -0
- data/config/locales/hyrax.de.yml +195 -1
- data/config/locales/hyrax.en.yml +192 -13
- data/config/locales/hyrax.es.yml +195 -1
- data/config/locales/hyrax.fr.yml +195 -1
- data/config/locales/hyrax.it.yml +195 -1
- data/config/locales/hyrax.pt-BR.yml +195 -1
- data/config/locales/hyrax.zh.yml +195 -1
- data/config/routes.rb +4 -0
- data/db/seeds.rb +1 -1
- data/docker-compose.yml +42 -9
- data/documentation/developing-your-hyrax-based-app.md +4 -4
- data/documentation/legacyREADME.md +4 -4
- data/hyrax.gemspec +4 -2
- data/lib/generators/hyrax/templates/catalog_controller.rb +3 -1
- data/lib/generators/hyrax/templates/config/analytics.yml +13 -7
- data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +15 -13
- data/lib/generators/hyrax/templates/db/migrate/20211130181150_create_default_administrative_set.rb.erb +8 -0
- data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +4 -2
- data/lib/generators/hyrax/work_resource/templates/indexer_spec.rb.erb +1 -0
- data/lib/hyrax/active_fedora_dummy_model.rb +62 -0
- data/lib/hyrax/collection_name.rb +6 -2
- data/lib/hyrax/configuration.rb +114 -4
- data/lib/hyrax/engine.rb +9 -6
- data/lib/hyrax/errors.rb +2 -0
- data/lib/hyrax/form_fields.rb +1 -0
- data/lib/hyrax/publisher.rb +16 -0
- data/lib/hyrax/resource_name.rb +1 -0
- data/lib/hyrax/resource_sync/change_list_writer.rb +2 -2
- data/lib/hyrax/resource_sync/resource_list_writer.rb +2 -2
- data/lib/hyrax/specs/capybara.rb +5 -3
- data/lib/hyrax/specs/shared_specs/hydra_works.rb +2 -0
- data/lib/hyrax/specs/shared_specs/indexers.rb +6 -0
- data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +9 -0
- data/lib/hyrax/transactions/admin_set_create.rb +22 -0
- data/lib/hyrax/transactions/collection_create.rb +25 -0
- data/lib/hyrax/transactions/collection_update.rb +20 -0
- data/lib/hyrax/transactions/container.rb +58 -0
- data/lib/hyrax/transactions/file_set_destroy.rb +21 -0
- data/lib/hyrax/transactions/steps/add_file_sets.rb +3 -2
- data/lib/hyrax/transactions/steps/add_to_collections.rb +13 -1
- data/lib/hyrax/transactions/steps/add_to_parent.rb +36 -0
- data/lib/hyrax/transactions/steps/apply_collection_type_permissions.rb +29 -0
- data/lib/hyrax/transactions/steps/remove_file_set_from_work.rb +47 -0
- data/lib/hyrax/transactions/steps/save.rb +18 -6
- data/lib/hyrax/transactions/steps/set_collection_type_gid.rb +35 -0
- data/lib/hyrax/transactions/work_create.rb +2 -1
- data/lib/hyrax/valkyrie_can_can_adapter.rb +1 -0
- data/lib/hyrax/valkyrie_simple_path_generator.rb +20 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/hyrax.rb +9 -0
- data/lib/tasks/collection_type_global_id.rake +1 -1
- data/lib/tasks/default_admin_set.rake +12 -11
- data/lib/tasks/regenerate_derivatives.rake +12 -0
- data/lib/wings/active_fedora_converter/default_work.rb +15 -0
- data/lib/wings/model_transformer.rb +17 -1
- data/lib/wings/orm_converter.rb +18 -2
- data/lib/wings/setup.rb +17 -0
- data/lib/wings/valkyrie/persister.rb +16 -0
- data/lib/wings/valkyrie/storage.rb +56 -1
- data/lib/wings.rb +0 -21
- data/template.rb +1 -1
- data/vendor/assets/javascripts/morris/morris.min.js +1 -7
- data/vendor/assets/stylesheets/morris.js/0.5.1/morris.css +1 -1
- metadata +120 -17
- data/app/views/hyrax/dashboard/_repository_objects.html.erb +0 -28
data/Dockerfile
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
ARG RUBY_VERSION=2.7.
|
2
|
-
|
3
|
-
FROM ruby:$RUBY_VERSION-alpine3.12 as hyrax-base
|
1
|
+
ARG RUBY_VERSION=2.7.4
|
2
|
+
FROM ruby:$RUBY_VERSION-alpine3.14 as hyrax-base
|
4
3
|
|
5
4
|
ARG DATABASE_APK_PACKAGE="postgresql-dev"
|
6
5
|
ARG EXTRA_APK_PACKAGES="git"
|
@@ -44,7 +43,7 @@ ONBUILD RUN bundle install --jobs "$(nproc)"
|
|
44
43
|
ONBUILD RUN RAILS_ENV=production SECRET_KEY_BASE=`bin/rake secret` DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile
|
45
44
|
|
46
45
|
|
47
|
-
FROM hyrax-base as hyrax-worker
|
46
|
+
FROM hyrax-base as hyrax-worker-base
|
48
47
|
|
49
48
|
ENV MALLOC_ARENA_MAX=2
|
50
49
|
|
@@ -64,13 +63,17 @@ RUN mkdir -p /app/fits && \
|
|
64
63
|
chmod a+x /app/fits/fits.sh
|
65
64
|
ENV PATH="${PATH}:/app/fits"
|
66
65
|
|
66
|
+
CMD bundle exec sidekiq
|
67
|
+
|
68
|
+
|
69
|
+
FROM hyrax-worker-base as hyrax-worker
|
70
|
+
|
67
71
|
ARG APP_PATH=.
|
68
72
|
ARG BUNDLE_WITHOUT="development test"
|
69
73
|
|
70
74
|
ONBUILD COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
|
71
75
|
ONBUILD RUN bundle install --jobs "$(nproc)"
|
72
|
-
|
73
|
-
CMD bundle exec sidekiq
|
76
|
+
ONBUILD RUN RAILS_ENV=production SECRET_KEY_BASE=`bin/rake secret` DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile
|
74
77
|
|
75
78
|
|
76
79
|
FROM hyrax-base as hyrax-engine-dev
|
@@ -83,11 +86,13 @@ ENV HYRAX_ENGINE_PATH /app/samvera/hyrax-engine
|
|
83
86
|
COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
|
84
87
|
COPY --chown=1001:101 . /app/samvera/hyrax-engine
|
85
88
|
|
86
|
-
RUN
|
89
|
+
RUN gem update bundler && gem cleanup bundler && bundle -v && \
|
90
|
+
bundle install --jobs "$(nproc)" && \
|
91
|
+
cd $HYRAX_ENGINE_PATH && bundle install --jobs "$(nproc)"
|
87
92
|
RUN RAILS_ENV=production SECRET_KEY_BASE='fakesecret1234' DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile
|
88
93
|
|
89
94
|
|
90
|
-
FROM hyrax-worker as hyrax-engine-dev-worker
|
95
|
+
FROM hyrax-worker-base as hyrax-engine-dev-worker
|
91
96
|
|
92
97
|
ARG APP_PATH=.dassie
|
93
98
|
ARG BUNDLE_WITHOUT=
|
@@ -97,4 +102,4 @@ ENV HYRAX_ENGINE_PATH /app/samvera/hyrax-engine
|
|
97
102
|
COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
|
98
103
|
COPY --chown=1001:101 . /app/samvera/hyrax-engine
|
99
104
|
|
100
|
-
RUN
|
105
|
+
RUN bundle install --jobs "$(nproc)"
|
data/Gemfile
CHANGED
@@ -1,44 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
source 'https://rubygems.org'
|
3
|
-
|
4
|
-
|
2
|
+
source 'https://rubygems.org'
|
3
|
+
# Please see hyrax.gemspec for dependency information.
|
4
|
+
gemspec
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
6
|
+
group :development, :test do
|
7
|
+
gem 'benchmark-ips'
|
8
|
+
gem 'easy_translate'
|
9
|
+
gem 'i18n-tasks'
|
10
|
+
gem 'okcomputer'
|
11
|
+
gem 'pry' unless ENV['CI']
|
12
|
+
gem 'pry-byebug' unless ENV['CI']
|
13
|
+
gem 'ruby-prof', require: false
|
14
|
+
gem "simplecov", require: false
|
16
15
|
end
|
17
16
|
|
18
17
|
test_app_path = ENV['RAILS_ROOT'] ||
|
19
18
|
ENV.fetch('ENGINE_CART_DESTINATION', File.expand_path('.internal_test_app', File.dirname(__FILE__)))
|
20
19
|
test_app_gemfile = File.expand_path('Gemfile', test_app_path)
|
21
20
|
|
21
|
+
# rubocop:disable Bundler/DuplicatedGem
|
22
22
|
if File.exist?(test_app_gemfile)
|
23
23
|
begin
|
24
|
+
Bundler.ui.info "[Hyrax] Including test application dependencies from #{test_app_gemfile}"
|
24
25
|
eval_gemfile test_app_gemfile
|
25
26
|
rescue Bundler::GemfileError => e
|
26
27
|
Bundler.ui.warn '[Hyrax] Skipping Rails application dependencies:'
|
27
28
|
Bundler.ui.warn e.message
|
28
29
|
end
|
30
|
+
elsif ENV['RAILS_VERSION'] == 'edge'
|
31
|
+
gem 'rails', github: 'rails/rails', source: 'https://rubygems.org'
|
32
|
+
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
|
33
|
+
elsif ENV['RAILS_VERSION']
|
34
|
+
gem 'rails', ENV['RAILS_VERSION'], source: 'https://rubygems.org'
|
29
35
|
else
|
30
|
-
Bundler.ui.warn
|
31
|
-
|
32
|
-
# rubocop:disable Bundler/DuplicatedGem
|
33
|
-
if ENV['RAILS_VERSION']
|
34
|
-
if ENV['RAILS_VERSION'] == 'edge'
|
35
|
-
gem 'rails', github: 'rails/rails', source: 'https://rubygems.org'
|
36
|
-
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
|
37
|
-
else
|
38
|
-
gem 'rails', ENV['RAILS_VERSION'], source: 'https://rubygems.org'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
# rubocop:enable Bundler/DuplicatedGem
|
42
|
-
|
43
|
-
eval_gemfile File.expand_path('spec/test_app_templates/Gemfile.extra', File.dirname(__FILE__))
|
36
|
+
Bundler.ui.warn '[Hyrax] Skipping all Rails dependency injection'
|
44
37
|
end
|
38
|
+
# rubocop:enable Bundler/DuplicatedGem
|
data/README.md
CHANGED
@@ -77,6 +77,43 @@ This is where you work on the code-base that will be used by yours and other Hyr
|
|
77
77
|
<p>By moving to Docker, we are encoding the documentation steps for standing up a Hyrax-engine development environment.</p>
|
78
78
|
</aside>
|
79
79
|
|
80
|
+
### Installing Analytics
|
81
|
+
|
82
|
+
Hyrax supports your choice of either Google Analytics or Matomo. To enable analytics tracking and reporting features, follow the directions below.
|
83
|
+
|
84
|
+
Enable Analytics Features
|
85
|
+
|
86
|
+
Analytics can be enabled and configured using environment variables. Set HYRAX_ANALYTICS to true, set either 'google' or 'matomo' for HYRAX_ANALYTICS_PROVIDER, and set the date you would like reporting to start (ANALYTICS_START_DATE).
|
87
|
+
|
88
|
+
```
|
89
|
+
HYRAX_ANALYTICS=true
|
90
|
+
HYRAX_ANALYTICS_PROVIDER=google
|
91
|
+
ANALYTICS_START_DATE=2021-08-21
|
92
|
+
```
|
93
|
+
|
94
|
+
If using google, you'll also need the following ENV variables:
|
95
|
+
|
96
|
+
```
|
97
|
+
GOOGLE_ANALYTICS_ID=UA-111111-1 # Universal ID (Currently Hyrax Analytics only works with Univeral (UA) accounts)
|
98
|
+
GOOGLE_OAUTH_APP_NAME=
|
99
|
+
GOOGLE_OAUTHAPP_VERSION=
|
100
|
+
GOOGLE_OAUTH_PRIVATE_KEY_PATH= # store the .p12 file in the root of your application
|
101
|
+
GOOGLE_OAUTH_PRIVATE_KEY_SECRET=
|
102
|
+
GOOGLE_OAUTH_CLIENT_EMAIL=
|
103
|
+
```
|
104
|
+
|
105
|
+
Add these ENV variables if using Matomo:
|
106
|
+
|
107
|
+
```
|
108
|
+
MATOMO_SITE_ID=
|
109
|
+
MATOMO_BASE_URL=
|
110
|
+
MATOMO_AUTH_TOKEN=
|
111
|
+
```
|
112
|
+
|
113
|
+
#### Analytics Features
|
114
|
+
|
115
|
+
Once analytics is enabled, Hyrax will automatically install the JS tracking code. Page views and downloads of a file set are recorded and sent to the selected analytics provider. Admin users will have access to an expanded dashboard with details about how many vistors viewed a page, and how many visitors downloaded a file. Easily find the top works by views, and most popular file downloads!
|
116
|
+
|
80
117
|
#### Contributing
|
81
118
|
|
82
119
|
We'd love to accept your contributions. Please see our guide to [contributing to Hyrax](./.github/CONTRIBUTING.md).
|
@@ -37,7 +37,7 @@ module Hyrax
|
|
37
37
|
# @return [Boolean] true if destroy was successful
|
38
38
|
def destroy(env)
|
39
39
|
env.curation_concern.in_collection_ids.each do |id|
|
40
|
-
destination_collection =
|
40
|
+
destination_collection = Hyrax.config.collection_class.find(id)
|
41
41
|
destination_collection.members.delete(env.curation_concern)
|
42
42
|
destination_collection.update_index
|
43
43
|
end
|
@@ -95,7 +95,7 @@ module Hyrax
|
|
95
95
|
def clean_attributes(attributes)
|
96
96
|
attributes[:license] = Array(attributes[:license]) if attributes.key? :license
|
97
97
|
attributes[:rights_statement] = Array(attributes[:rights_statement]) if attributes.key? :rights_statement
|
98
|
-
remove_blank_attributes!(attributes)
|
98
|
+
remove_blank_attributes!(attributes).except('file_set')
|
99
99
|
end
|
100
100
|
|
101
101
|
# If any attributes are blank remove them
|
@@ -69,7 +69,7 @@ module Hyrax
|
|
69
69
|
# Adds the item to the ordered members so that it displays in the items
|
70
70
|
# along side the FileSets on the show page
|
71
71
|
def add(env, id)
|
72
|
-
collection =
|
72
|
+
collection = Hyrax.config.collection_class.find(id)
|
73
73
|
collection.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX
|
74
74
|
|
75
75
|
return unless env.current_ability.can?(:deposit, collection)
|
@@ -78,7 +78,7 @@ module Hyrax
|
|
78
78
|
|
79
79
|
# Remove the object from the members set and the ordered members list
|
80
80
|
def remove(curation_concern, id)
|
81
|
-
collection =
|
81
|
+
collection = Hyrax.config.collection_class.find(id)
|
82
82
|
curation_concern.member_of_collections.delete(collection)
|
83
83
|
end
|
84
84
|
|
@@ -107,7 +107,7 @@ module Hyrax
|
|
107
107
|
collection_id = attributes_collection.first.second['id']
|
108
108
|
|
109
109
|
# Do not apply permissions to work if collection type is configured not to
|
110
|
-
collection =
|
110
|
+
collection = Hyrax.config.collection_class.find(collection_id)
|
111
111
|
return unless collection.share_applies_to_new_works?
|
112
112
|
|
113
113
|
# Save the collection id in env for use in apply_permission_template_actor
|
@@ -26,90 +26,112 @@ module Hyrax
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
-
def
|
30
|
-
|
29
|
+
def attach_files(env, remote_files)
|
30
|
+
ingest_remote_files_service_class.new(user: env.user,
|
31
|
+
curation_concern: env.curation_concern,
|
32
|
+
remote_files: remote_files,
|
33
|
+
file_set_actor_class: file_set_actor_class).attach!
|
31
34
|
end
|
32
35
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
class IngestRemoteFilesService
|
37
|
+
##
|
38
|
+
# @parm user [User]
|
39
|
+
# @parm curation_concern [Hyrax::Work]
|
40
|
+
# @param remote_files [HashWithIndifferentAccess]
|
41
|
+
# @param file_set_actor_class
|
42
|
+
# @param ordered_members [Array]
|
43
|
+
# @param ordered [Boolean]
|
44
|
+
# rubocop:disable Metrics/ParameterLists
|
45
|
+
def initialize(user:, curation_concern:, remote_files:, file_set_actor_class:, ordered_members: [], ordered: false)
|
46
|
+
@remote_files = remote_files
|
47
|
+
@user = user
|
48
|
+
@curation_concern = curation_concern
|
49
|
+
@file_set_actor_class = file_set_actor_class
|
50
|
+
@ordered_members = ordered_members
|
51
|
+
@ordered = ordered
|
52
|
+
end
|
53
|
+
# rubocop:enable Metrics/ParameterLists
|
54
|
+
attr_reader :remote_files, :user, :curation_concern, :ordered_members, :ordered, :file_set_actor_class
|
55
|
+
|
56
|
+
##
|
57
|
+
# @return true
|
58
|
+
def attach!
|
59
|
+
return true unless remote_files
|
60
|
+
remote_files.each do |file_info|
|
61
|
+
next if file_info.blank? || file_info[:url].blank?
|
62
|
+
# Escape any space characters, so that this is a legal URI
|
63
|
+
uri = URI.parse(Addressable::URI.escape(file_info[:url]))
|
64
|
+
unless self.class.validate_remote_url(uri)
|
65
|
+
Rails.logger.error "User #{user.user_key} attempted to ingest file from url #{file_info[:url]}, which doesn't pass validation"
|
66
|
+
return false
|
67
|
+
end
|
68
|
+
auth_header = file_info.fetch(:auth_header, {})
|
69
|
+
create_file_from_url(uri, file_info[:file_name], auth_header)
|
39
70
|
end
|
40
|
-
|
41
|
-
Rails.logger.debug "Assuming #{uri.scheme} uri is valid without a serious attempt to validate: #{uri}"
|
71
|
+
add_ordered_members! if ordered
|
42
72
|
true
|
43
73
|
end
|
44
|
-
end
|
45
74
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
75
|
+
def self.registered_ingest_dirs
|
76
|
+
Hyrax.config.registered_ingest_dirs
|
77
|
+
end
|
78
|
+
|
79
|
+
# @param uri [URI] the uri fo the resource to import
|
80
|
+
def self.validate_remote_url(uri)
|
81
|
+
if uri.scheme == 'file'
|
82
|
+
path = File.absolute_path(CGI.unescape(uri.path))
|
83
|
+
registered_ingest_dirs.any? do |dir|
|
84
|
+
path.start_with?(dir) && path.length > dir.length
|
85
|
+
end
|
86
|
+
else
|
87
|
+
Rails.logger.debug "Assuming #{uri.scheme} uri is valid without a serious attempt to validate: #{uri}"
|
88
|
+
true
|
57
89
|
end
|
58
|
-
auth_header = file_info.fetch(:auth_header, {})
|
59
|
-
create_file_from_url(env, uri, file_info[:file_name], auth_header)
|
60
90
|
end
|
61
|
-
true
|
62
|
-
end
|
63
91
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
92
|
+
private
|
93
|
+
|
94
|
+
def create_file_from_url(uri, file_name, auth_header)
|
95
|
+
import_url = URI.decode_www_form_component(uri.to_s)
|
96
|
+
use_valkyrie = false
|
97
|
+
case curation_concern
|
98
|
+
when Valkyrie::Resource
|
99
|
+
file_set = Hyrax.persister.save(resource: Hyrax::FileSet.new(import_url: import_url, label: file_name))
|
100
|
+
use_valkyrie = true
|
101
|
+
else
|
102
|
+
file_set = ::FileSet.new(import_url: import_url, label: file_name)
|
103
|
+
end
|
104
|
+
__create_file_from_url(file_set: file_set, uri: uri, auth_header: auth_header, use_valkyrie: use_valkyrie)
|
70
105
|
end
|
71
|
-
end
|
72
106
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
actor.attach_to_work(env.curation_concern)
|
81
|
-
fs.save!
|
107
|
+
def __create_file_from_url(file_set:, uri:, auth_header:, use_valkyrie: Hyrax.config.use_valkyrie?)
|
108
|
+
actor = file_set_actor_class.new(file_set, user, use_valkyrie: use_valkyrie)
|
109
|
+
actor.create_metadata(visibility: curation_concern.visibility)
|
110
|
+
actor.attach_to_work(curation_concern)
|
111
|
+
file_set.save! if file_set.respond_to?(:save!)
|
112
|
+
# We'll remember the order, but if it's not `@ordered` we won't do anything.
|
113
|
+
ordered_members << file_set
|
82
114
|
if uri.scheme == 'file'
|
83
115
|
# Turn any %20 into spaces.
|
84
116
|
file_path = CGI.unescape(uri.path)
|
85
|
-
IngestLocalFileJob.perform_later(
|
117
|
+
IngestLocalFileJob.perform_later(file_set, file_path, user)
|
86
118
|
else
|
87
|
-
ImportUrlJob.perform_later(
|
119
|
+
ImportUrlJob.perform_later(file_set, operation_for(user: user), auth_header)
|
88
120
|
end
|
89
121
|
end
|
90
|
-
end
|
91
122
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
import_url = URI.decode_www_form_component(uri.to_s)
|
96
|
-
fs = Hyrax.persister.save(resource: Hyrax::FileSet.new(import_url: import_url, label: file_name))
|
97
|
-
actor = Hyrax::Actors::FileSetActor.new(fs, env.user, use_valkyrie: true)
|
98
|
-
actor.create_metadata(visibility: env.curation_concern.visibility)
|
99
|
-
actor.attach_to_work(env.curation_concern)
|
100
|
-
if uri.scheme == 'file'
|
101
|
-
# Turn any %20 into spaces.
|
102
|
-
file_path = CGI.unescape(uri.path)
|
103
|
-
IngestLocalFileJob.perform_later(fs, file_path, env.user)
|
104
|
-
else
|
105
|
-
ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)
|
123
|
+
def operation_for(user:)
|
124
|
+
Hyrax::Operation.create!(user: user,
|
125
|
+
operation_type: "Attach Remote File")
|
106
126
|
end
|
107
|
-
end
|
108
127
|
|
109
|
-
|
110
|
-
|
111
|
-
|
128
|
+
def add_ordered_members!
|
129
|
+
actor = Hyrax::Actors::OrderedMembersActor.new(ordered_members, user)
|
130
|
+
actor.attach_ordered_members_to_work(curation_concern)
|
131
|
+
end
|
112
132
|
end
|
133
|
+
class_attribute :file_set_actor_class, default: ::Hyrax::Actors::FileSetActor
|
134
|
+
class_attribute :ingest_remote_files_service_class, default: ::Hyrax::Actors::CreateWithRemoteFilesActor::IngestRemoteFilesService
|
113
135
|
end
|
114
136
|
end
|
115
137
|
end
|
@@ -39,54 +39,19 @@ module Hyrax
|
|
39
39
|
# url property, it may have spaces, and not be a valid URI.
|
40
40
|
class CreateWithRemoteFilesOrderedMembersActor < CreateWithRemoteFilesActor
|
41
41
|
attr_reader :ordered_members
|
42
|
+
self.file_set_actor_class = Hyrax::Actors::FileSetOrderedMembersActor
|
42
43
|
|
43
44
|
# @param [HashWithIndifferentAccess] remote_files
|
44
45
|
# @return [TrueClass]
|
45
46
|
def attach_files(env, remote_files)
|
46
|
-
return true unless remote_files
|
47
47
|
@ordered_members = env.curation_concern.ordered_members.to_a
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
return false
|
55
|
-
end
|
56
|
-
auth_header = file_info.fetch(:auth_header, {})
|
57
|
-
create_file_from_url(env, uri, file_info[:file_name], auth_header)
|
58
|
-
end
|
59
|
-
add_ordered_members(env.user, env.curation_concern)
|
60
|
-
true
|
61
|
-
end
|
62
|
-
|
63
|
-
# Generic utility for creating FileSet from a URL
|
64
|
-
# Used in to import files using URLs from a file picker like browse_everything
|
65
|
-
def create_file_from_url(env, uri, file_name, auth_header = {})
|
66
|
-
::FileSet.new(import_url: uri.to_s, label: file_name) do |fs|
|
67
|
-
actor = file_set_actor_class.new(fs, env.user)
|
68
|
-
actor.create_metadata(visibility: env.curation_concern.visibility)
|
69
|
-
actor.attach_to_work(env.curation_concern)
|
70
|
-
fs.save!
|
71
|
-
ordered_members << fs
|
72
|
-
if uri.scheme == 'file'
|
73
|
-
# Turn any %20 into spaces.
|
74
|
-
file_path = CGI.unescape(uri.path)
|
75
|
-
IngestLocalFileJob.perform_later(fs, file_path, env.user)
|
76
|
-
else
|
77
|
-
ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)
|
78
|
-
end
|
79
|
-
end
|
48
|
+
ingest_remote_files_service_class.new(user: env.user,
|
49
|
+
curation_concern: env.curation_concern,
|
50
|
+
remote_files: remote_files,
|
51
|
+
ordered_members: @ordered_members,
|
52
|
+
ordered: true,
|
53
|
+
file_set_actor_class: file_set_actor_class).attach!
|
80
54
|
end
|
81
|
-
|
82
|
-
# Add all file_sets as ordered_members in a single action
|
83
|
-
def add_ordered_members(user, work)
|
84
|
-
actor = Hyrax::Actors::OrderedMembersActor.new(ordered_members, user)
|
85
|
-
actor.attach_ordered_members_to_work(work)
|
86
|
-
end
|
87
|
-
|
88
|
-
class_attribute :file_set_actor_class
|
89
|
-
self.file_set_actor_class = Hyrax::Actors::FileSetOrderedMembersActor
|
90
55
|
end
|
91
56
|
end
|
92
57
|
end
|
@@ -31,10 +31,9 @@ module Hyrax
|
|
31
31
|
# hand. Do this because we don't have the underlying UploadedFile instance
|
32
32
|
file_actor = build_file_actor(relation)
|
33
33
|
file_actor.ingest_file(wrapper!(file: file, relation: relation))
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
InheritPermissionsJob.perform_later(file_set.parent)
|
34
|
+
parent = parent_for(file_set: file_set)
|
35
|
+
VisibilityCopyJob.perform_later(parent)
|
36
|
+
InheritPermissionsJob.perform_later(parent)
|
38
37
|
else
|
39
38
|
IngestJob.perform_later(wrapper!(file: file, relation: relation))
|
40
39
|
end
|
@@ -138,6 +137,12 @@ module Hyrax
|
|
138
137
|
@ability ||= ::Ability.new(user)
|
139
138
|
end
|
140
139
|
|
140
|
+
# @param file_set [FileSet]
|
141
|
+
# @return [ActiveFedora::Base]
|
142
|
+
def parent_for(file_set:)
|
143
|
+
file_set.parent
|
144
|
+
end
|
145
|
+
|
141
146
|
def build_file_actor(relation)
|
142
147
|
fs = use_valkyrie ? file_set.valkyrie_resource : file_set
|
143
148
|
file_actor_class.new(fs, relation, user, use_valkyrie: use_valkyrie)
|
@@ -160,6 +165,8 @@ module Hyrax
|
|
160
165
|
elsif file_set.import_url.present?
|
161
166
|
# This path is taken when file is a Tempfile (e.g. from ImportUrlJob)
|
162
167
|
File.basename(Addressable::URI.unencode(file.file_url))
|
168
|
+
elsif file.respond_to?(:original_filename) # e.g. Rack::Test::UploadedFile
|
169
|
+
file.original_filename
|
163
170
|
else
|
164
171
|
File.basename(file)
|
165
172
|
end
|
@@ -179,7 +186,7 @@ module Hyrax
|
|
179
186
|
# Although ActiveFedora clears the children nodes it leaves those fields in Solr populated.
|
180
187
|
# rubocop:disable Metrics/CyclomaticComplexity
|
181
188
|
def unlink_from_work
|
182
|
-
work = file_set
|
189
|
+
work = parent_for(file_set: file_set)
|
183
190
|
return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))
|
184
191
|
work.thumbnail = nil if work.thumbnail_id == file_set.id
|
185
192
|
work.representative = nil if work.representative_id == file_set.id
|
@@ -1,46 +1,44 @@
|
|
1
1
|
export default class {
|
2
|
-
|
3
2
|
constructor(data) {
|
4
3
|
this.userSelector = 'user-activity'
|
5
4
|
this.growthSelector = 'dashboard-growth'
|
6
5
|
this.statusSelector = 'dashboard-repository-objects'
|
7
|
-
|
8
6
|
if (this.hasSelector(this.userSelector))
|
9
7
|
this.userActivity(data.userActivity);
|
10
8
|
if (this.hasSelector(this.growthSelector))
|
11
9
|
this.repositoryGrowth(data.repositoryGrowth);
|
12
10
|
if (this.hasSelector(this.statusSelector))
|
13
11
|
this.objectStatus(data.repositoryObjects);
|
14
|
-
|
15
12
|
}
|
16
|
-
|
17
13
|
// Don't attempt to initialize Morris if the selector is not on the page
|
18
14
|
// otherwise it raises a "Graph container element not found" error
|
19
15
|
hasSelector(selector) {
|
20
|
-
|
16
|
+
return $(`#${selector}`).length > 0;
|
21
17
|
}
|
22
|
-
|
23
18
|
// Draws a bar chart of new user signups
|
24
19
|
userActivity(data) {
|
25
|
-
if (typeof data ===
|
26
|
-
return
|
20
|
+
if (typeof data === 'undefined') return
|
27
21
|
Morris.Bar({
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
22
|
+
element: this.userSelector,
|
23
|
+
data: data,
|
24
|
+
xkey: 'y',
|
25
|
+
ykeys: ['new_users', 'new_visitors', 'returning_visitors', 'total_visitors'],
|
26
|
+
labels: ['New Users', 'New Visitors', 'Returning Visitors', 'Total Visitors'],
|
27
|
+
// TODO: use the ykeys and labels below when the returning_users method in
|
28
|
+
// user_activity_presenter.rb returns data
|
29
|
+
// ykeys: ['new_users', 'returning_users', 'new_visitors', 'returning_visitors', 'total_visitors'],
|
30
|
+
// labels: ['New Users', 'Returning Users', 'New Visitors', 'Returning Visitors', 'Total Visitors'],
|
31
|
+
barColors: [
|
32
|
+
'#001219','#005f73','#0a9396','#94d2bd','#e9d8a6',
|
33
|
+
'#ee9b00','#ca6702','#bb3e03','#ae2012','#9b2226'
|
34
|
+
],
|
35
|
+
gridTextSize: '12px',
|
36
|
+
hideHover: true,
|
37
|
+
resize: true,
|
38
|
+
gridLineColor: '#E5E5E5',
|
39
|
+
stacked: true
|
40
|
+
});
|
42
41
|
}
|
43
|
-
|
44
42
|
// Draws a donut chart of active/inactive objects
|
45
43
|
objectStatus(data) {
|
46
44
|
if (typeof data === "undefined")
|
@@ -48,28 +46,27 @@ export default class {
|
|
48
46
|
Morris.Donut({
|
49
47
|
element: this.statusSelector,
|
50
48
|
data: data,
|
51
|
-
colors: ['#
|
52
|
-
gridTextSize: '
|
49
|
+
colors: ['#001219','#005f73','#0a9396','#94d2bd','#e9d8a6','#ee9b00','#ca6702','#bb3e03','#ae2012','#9b2226'],
|
50
|
+
gridTextSize: '12px',
|
53
51
|
resize: true
|
54
52
|
});
|
55
53
|
}
|
56
|
-
|
57
54
|
// Creates a line graph of collections and object in the last 90 days
|
58
55
|
repositoryGrowth(data) {
|
59
56
|
if (typeof data === "undefined")
|
60
57
|
return
|
61
58
|
Morris.Line({
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
59
|
+
element: this.growthSelector,
|
60
|
+
data: data,
|
61
|
+
xkey: 'y',
|
62
|
+
ykeys: ['works','collections'],
|
63
|
+
labels: ['Works','Collections'],
|
64
|
+
resize: true,
|
65
|
+
hideHover: true,
|
66
|
+
xLabels: 'day',
|
67
|
+
gridTextSize: '12px',
|
68
|
+
lineColors: ['#001219','#005f73','#0a9396','#94d2bd','#e9d8a6','#ee9b00','#ca6702','#bb3e03','#ae2012','#9b2226'],
|
69
|
+
gridLineColor: '#E5E5E5'
|
73
70
|
});
|
74
71
|
}
|
75
72
|
}
|