hyrax 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +3 -6
  3. data/.dassie/.env +1 -2
  4. data/.dassie/Gemfile +7 -3
  5. data/.dassie/app/models/user.rb +0 -2
  6. data/.dassie/config/analytics.yml +12 -5
  7. data/.dassie/config/environments/development.rb +2 -0
  8. data/.dassie/config/initializers/hyrax.rb +2 -0
  9. data/.dassie/db/migrate/20210921150120_enable_uuid_extension.valkyrie_engine.rb +7 -0
  10. data/.dassie/db/migrate/20210921150121_create_orm_resources.valkyrie_engine.rb +19 -0
  11. data/.dassie/db/migrate/20210921150122_add_model_type_to_orm_resources.valkyrie_engine.rb +7 -0
  12. data/.dassie/db/migrate/20210921150123_change_model_type_to_internal_model.valkyrie_engine.rb +7 -0
  13. data/.dassie/db/migrate/20210921150124_create_path_gin_index.valkyrie_engine.rb +7 -0
  14. data/.dassie/db/migrate/20210921150125_create_internal_resource_index.valkyrie_engine.rb +7 -0
  15. data/.dassie/db/migrate/20210921150126_create_updated_at_index.valkyrie_engine.rb +7 -0
  16. data/.dassie/db/migrate/20210921150127_add_optimistic_locking_to_orm_resources.valkyrie_engine.rb +7 -0
  17. data/.dassie/db/migrate/20211130181150_create_default_administrative_set.rb +8 -0
  18. data/.dassie/db/schema.rb +20 -1
  19. data/.env +7 -4
  20. data/.github/workflows/main.yml +17 -0
  21. data/.github/workflows/release.yml +17 -0
  22. data/.gitignore +1 -0
  23. data/.regen +1 -1
  24. data/CONTAINERS.md +13 -10
  25. data/README.md +37 -0
  26. data/app/assets/javascripts/hyrax/admin/graphs.es6 +34 -37
  27. data/app/assets/javascripts/hyrax/analytics_events.js +69 -0
  28. data/app/assets/javascripts/hyrax/collapse.js +24 -0
  29. data/app/assets/javascripts/hyrax/collections.js +1 -2
  30. data/app/assets/javascripts/hyrax/ga_events.js +2 -8
  31. data/app/assets/javascripts/hyrax/reports-buttons.js +33 -0
  32. data/app/assets/javascripts/hyrax.js +2 -1
  33. data/app/assets/stylesheets/_bootstrap-default-overrides.scss +9 -0
  34. data/app/authorities/qa/authorities/collections.rb +4 -5
  35. data/app/authorities/qa/authorities/find_works.rb +1 -1
  36. data/app/controllers/concerns/hyrax/breadcrumbs_for_collection_analytics.rb +26 -0
  37. data/app/controllers/concerns/hyrax/breadcrumbs_for_works_analytics.rb +26 -0
  38. data/app/controllers/concerns/hyrax/controller.rb +22 -0
  39. data/app/controllers/hyrax/admin/analytics/analytics_controller.rb +40 -0
  40. data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +61 -0
  41. data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +122 -0
  42. data/app/controllers/hyrax/collections_controller.rb +4 -1
  43. data/app/controllers/hyrax/dashboard/collections_controller.rb +15 -6
  44. data/app/controllers/hyrax/dashboard_controller.rb +8 -0
  45. data/app/controllers/hyrax/stats_controller.rb +3 -1
  46. data/app/forms/hyrax/forms/pcdm_collection_form.rb +3 -0
  47. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +1 -1
  48. data/app/jobs/characterize_job.rb +28 -1
  49. data/app/jobs/valkyrie_ingest_job.rb +56 -0
  50. data/app/models/concerns/hyrax/ability.rb +26 -5
  51. data/app/models/concerns/hyrax/solr_document/metadata.rb +1 -0
  52. data/app/models/file_download_stat.rb +4 -4
  53. data/app/models/hyrax/default_administrative_set.rb +42 -0
  54. data/app/models/hyrax/statistic.rb +31 -4
  55. data/app/presenters/hyrax/admin/dashboard_presenter.rb +8 -6
  56. data/app/presenters/hyrax/admin/repository_growth_presenter.rb +10 -5
  57. data/app/presenters/hyrax/admin/user_activity_presenter.rb +8 -12
  58. data/app/presenters/hyrax/file_set_presenter.rb +2 -0
  59. data/app/presenters/hyrax/menu_presenter.rb +4 -0
  60. data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +1 -1
  61. data/app/presenters/hyrax/work_show_presenter.rb +5 -2
  62. data/app/presenters/hyrax/work_usage.rb +1 -0
  63. data/app/search_builders/hyrax/README.md +1 -1
  64. data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +1 -1
  65. data/app/search_builders/hyrax/my/collections_search_builder.rb +1 -1
  66. data/app/services/hyrax/admin_set_create_service.rb +76 -14
  67. data/app/services/hyrax/analytics/google/events.rb +37 -0
  68. data/app/services/hyrax/analytics/google/events_daily.rb +72 -0
  69. data/app/services/hyrax/analytics/google/visits.rb +44 -0
  70. data/app/services/hyrax/analytics/google/visits_daily.rb +49 -0
  71. data/app/services/hyrax/analytics/google.rb +204 -0
  72. data/app/services/hyrax/analytics/matomo.rb +193 -0
  73. data/app/services/hyrax/analytics/results.rb +79 -0
  74. data/app/services/hyrax/analytics.rb +12 -82
  75. data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +134 -0
  76. data/app/services/hyrax/collections/nested_collection_query_service.rb +8 -3
  77. data/app/services/hyrax/listeners/acl_index_listener.rb +3 -1
  78. data/app/services/hyrax/listeners/active_fedora_acl_index_listener.rb +3 -1
  79. data/app/services/hyrax/listeners/batch_notification_listener.rb +3 -1
  80. data/app/services/hyrax/listeners/file_metadata_listener.rb +19 -0
  81. data/app/services/hyrax/listeners/file_set_lifecycle_listener.rb +6 -2
  82. data/app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb +6 -2
  83. data/app/services/hyrax/listeners/member_cleanup_listener.rb +3 -0
  84. data/app/services/hyrax/listeners/metadata_index_listener.rb +9 -3
  85. data/app/services/hyrax/listeners/object_lifecycle_listener.rb +9 -3
  86. data/app/services/hyrax/listeners/proxy_deposit_listener.rb +3 -1
  87. data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +3 -0
  88. data/app/services/hyrax/listeners/workflow_listener.rb +3 -1
  89. data/app/services/hyrax/listeners.rb +8 -0
  90. data/app/services/hyrax/restriction_service.rb +4 -0
  91. data/app/services/hyrax/statistics/users/over_time.rb +8 -5
  92. data/app/services/hyrax/statistics/works/over_time.rb +10 -0
  93. data/app/services/hyrax/work_uploads_handler.rb +4 -1
  94. data/app/views/hyrax/admin/analytics/_date_range_form.html.erb +11 -0
  95. data/app/views/hyrax/admin/analytics/collection_reports/_custom_range.html.erb +39 -0
  96. data/app/views/hyrax/admin/analytics/collection_reports/_monthly_summary.html.erb +48 -0
  97. data/app/views/hyrax/admin/analytics/collection_reports/_summary.html.erb +55 -0
  98. data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +55 -0
  99. data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +70 -0
  100. data/app/views/hyrax/admin/analytics/collection_reports/show.html.erb +94 -0
  101. data/app/views/hyrax/admin/analytics/work_reports/_custom_range.html.erb +43 -0
  102. data/app/views/hyrax/admin/analytics/work_reports/_monthly_summary.html.erb +35 -0
  103. data/app/views/hyrax/admin/analytics/work_reports/_summary.html.erb +60 -0
  104. data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +33 -0
  105. data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +40 -0
  106. data/app/views/hyrax/admin/analytics/work_reports/_work_counts.html.erb +18 -0
  107. data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +41 -0
  108. data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +77 -0
  109. data/app/views/hyrax/admin/analytics/work_reports/show.html.erb +90 -0
  110. data/app/views/hyrax/admin/stats/show.html.erb +1 -1
  111. data/app/views/hyrax/base/_relationships_parent_row.html.erb +0 -1
  112. data/app/views/hyrax/base/show.html.erb +6 -0
  113. data/app/views/hyrax/collections/show.html.erb +4 -0
  114. data/app/views/hyrax/dashboard/_repository_growth.html.erb +5 -5
  115. data/app/views/hyrax/dashboard/_resource_type_graph.html.erb +41 -0
  116. data/app/views/hyrax/dashboard/_sidebar.html.erb +4 -1
  117. data/app/views/hyrax/dashboard/_tabs.html.erb +11 -0
  118. data/app/views/hyrax/dashboard/_user_activity.html.erb +17 -23
  119. data/app/views/hyrax/dashboard/_user_activity_graph.html.erb +55 -0
  120. data/app/views/hyrax/dashboard/_visibility_graph.html.erb +31 -0
  121. data/app/views/hyrax/dashboard/_work_type_graph.html.erb +41 -0
  122. data/app/views/hyrax/dashboard/collections/_form.html.erb +2 -1
  123. data/app/views/hyrax/dashboard/show_admin.html.erb +24 -45
  124. data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +22 -0
  125. data/app/views/hyrax/file_sets/_actions.html.erb +4 -3
  126. data/app/views/hyrax/file_sets/show.html.erb +6 -0
  127. data/app/views/hyrax/my/collections/index.html.erb +1 -1
  128. data/app/views/hyrax/stats/_downloads.html.erb +18 -0
  129. data/app/views/hyrax/stats/_pageviews.html.erb +18 -0
  130. data/app/views/hyrax/stats/work.html.erb +17 -9
  131. data/app/views/layouts/_head_tag_content.html.erb +7 -2
  132. data/app/views/{_ga.html.erb → shared/_ga.html.erb} +3 -7
  133. data/app/views/shared/_matomo.html.erb +15 -0
  134. data/chart/hyrax/Chart.yaml +1 -1
  135. data/chart/hyrax/values.yaml +1 -1
  136. data/config/i18n-tasks.yml +2 -2
  137. data/config/initializers/listeners.rb +5 -5
  138. data/config/locales/hyrax.de.yml +194 -0
  139. data/config/locales/hyrax.en.yml +190 -12
  140. data/config/locales/hyrax.es.yml +194 -0
  141. data/config/locales/hyrax.fr.yml +194 -0
  142. data/config/locales/hyrax.it.yml +194 -0
  143. data/config/locales/hyrax.pt-BR.yml +194 -0
  144. data/config/locales/hyrax.zh.yml +194 -0
  145. data/config/routes.rb +4 -0
  146. data/docker-compose.yml +3 -1
  147. data/documentation/developing-your-hyrax-based-app.md +2 -2
  148. data/documentation/legacyREADME.md +1 -1
  149. data/hyrax.gemspec +3 -1
  150. data/lib/generators/hyrax/templates/config/analytics.yml +13 -7
  151. data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +0 -13
  152. data/lib/generators/hyrax/templates/db/migrate/20211130181150_create_default_administrative_set.rb.erb +8 -0
  153. data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +3 -1
  154. data/lib/hyrax/configuration.rb +67 -5
  155. data/lib/hyrax/engine.rb +7 -6
  156. data/lib/hyrax/publisher.rb +4 -0
  157. data/lib/hyrax/transactions/admin_set_create.rb +22 -0
  158. data/lib/hyrax/transactions/container.rb +11 -0
  159. data/lib/hyrax/version.rb +1 -1
  160. data/lib/tasks/regenerate_derivatives.rake +1 -1
  161. data/lib/wings/setup.rb +15 -0
  162. data/lib/wings/valkyrie/persister.rb +16 -0
  163. data/template.rb +1 -1
  164. data/vendor/assets/javascripts/morris/morris.min.js +1 -7
  165. data/vendor/assets/stylesheets/morris.js/0.5.1/morris.css +1 -1
  166. metadata +87 -11
  167. data/app/views/hyrax/dashboard/_repository_objects.html.erb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1dfd66c313400a16a149d5bdb7a2495164c18bce86b9bd8f079970b68e328cf
4
- data.tar.gz: 66c678a483a9f2822712dea5f8448e55d9019dbdc47605b9a03177d0465ab775
3
+ metadata.gz: 95d9c34fb76fd8e3ac06d6605962c16bbdad32ffa2c1f5ab24958740fc175507
4
+ data.tar.gz: 8be6a02dc887f93076d84a5dc47b8e4cc7ecf916415e23fd00df24078f20ebbf
5
5
  SHA512:
6
- metadata.gz: 8309e7eb25d84767fd2395e04326df0c1f925bef0a2618818b0430327ac623f0f4078abbd45b5a966ccb6ccbc4c6bc233823e7d1b00d08b5e977771c97be4306
7
- data.tar.gz: dd759280930d7cbc3448b3fafbfae5bbb631f9eb8fb93a9dca2e9ee73b3226f71d5b453ec29a40ac087dacf076059b752e8e72b2b9e35c5efab1b54743a1e958
6
+ metadata.gz: b6e519190cda4bdcdb4a68577b682ad6fd138756da25ce69228429755e3ee3a2fb3ac95d9140831d623f75e0aa8a9115d378abafe8f301850c200fb8080b9942
7
+ data.tar.gz: 90610095bd1b82e79bc7ebaa8de11a2f3c8452803a15d60a4595308b67ab85724b118c7343b2a46fb2bafb3a138365fdb94540e948965cc1a96d4259fd8b07d6
data/.circleci/config.yml CHANGED
@@ -33,10 +33,9 @@ jobs:
33
33
  fi
34
34
  [[ -z "$(git branch --all --list master */master)" ]]
35
35
 
36
- - samvera/bundle_for_gem:
36
+ - samvera/bundle:
37
37
  ruby_version: << parameters.ruby_version >>
38
38
  bundler_version: << parameters.bundler_version >>
39
- project: hyrax
40
39
 
41
40
  # Run rubocop in parallel with caching
42
41
  # This should get added to the orb once proven here
@@ -89,10 +88,9 @@ jobs:
89
88
  at: ~/
90
89
  - samvera/engine_cart_generate:
91
90
  cache_key: v1-internal-test-app-{{ checksum "hyrax.gemspec" }}-{{ checksum ".regen" }}-{{ checksum ".circleci/config.yml" }}-<< parameters.rails_version >>-<< parameters.ruby_version >>
92
- - samvera/bundle_for_gem:
91
+ - samvera/bundle:
93
92
  ruby_version: << parameters.ruby_version >>
94
93
  bundler_version: << parameters.bundler_version >>
95
- project: hyrax
96
94
  - persist_to_workspace:
97
95
  root: ~/
98
96
  paths:
@@ -128,10 +126,9 @@ jobs:
128
126
  solr_config_path: .internal_test_app/solr/conf
129
127
  core_name: hyrax-valkyrie-test
130
128
  # Rerun bundler in case this is a different ruby version than bundle and build steps
131
- - samvera/bundle_for_gem:
129
+ - samvera/bundle:
132
130
  ruby_version: << parameters.ruby_version >>
133
131
  bundler_version: << parameters.bundler_version >>
134
- project: hyrax
135
132
  - run:
136
133
  command: bundle exec rake app:db:migrate
137
134
  - samvera/parallel_rspec
data/.dassie/.env CHANGED
@@ -1,4 +1,3 @@
1
1
  MEMCACHED_HOST=memcached
2
- HYRAX_ANALYTICS=1
3
2
  REDIS_PROVIDER=SIDEKIQ_REDIS_URL
4
- SIDEKIQ_REDIS_URL=redis://redis:6379/0
3
+ SIDEKIQ_REDIS_URL=redis://redis:6379/0
data/.dassie/Gemfile CHANGED
@@ -52,11 +52,15 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
52
52
 
53
53
  gemspec name: 'hyrax', path: ENV.fetch('HYRAX_ENGINE_PATH', '..')
54
54
 
55
- gem 'rsolr', '>= 1.0', '< 3'
56
55
  gem 'bootstrap-sass', '~> 3.0'
57
- gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
58
- gem 'jquery-rails'
59
56
  gem 'devise'
60
57
  gem 'devise-guests', '~> 0.6'
58
+ gem 'jquery-rails'
59
+ gem 'pry-byebug'
60
+ gem 'pry-doc'
61
+ gem 'pry-rails'
62
+ gem 'pry-rescue'
61
63
  gem 'riiif', '~> 2.1'
64
+ gem 'rsolr', '>= 1.0', '< 3'
62
65
  gem 'sidekiq', '~> 6.0'
66
+ gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
@@ -5,8 +5,6 @@ class User < ApplicationRecord
5
5
  include Hyrax::User
6
6
  include Hyrax::UserUsageStats
7
7
 
8
-
9
-
10
8
  if Blacklight::Utils.needs_attr_accessible?
11
9
  attr_accessible :email, :password, :password_confirmation
12
10
  end
@@ -1,6 +1,13 @@
1
1
  analytics:
2
- app_name: My App Name
3
- app_version: 0.0.1
4
- privkey_path: /tmp/privkey.p12
5
- privkey_secret: s00pers3kr1t
6
- client_email: oauth@example.org
2
+ google:
3
+ analytics_id: <%= ENV['GOOGLE_ANALYTICS_ID'] %>
4
+ app_name: <%= ENV['GOOGLE_OAUTH_APP_NAME'] %>
5
+ app_version: <%= ENV['GOOGLE_OAUTH_APP_VERSION'] %>
6
+ privkey_path: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_PATH'] %>
7
+ privkey_secret: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_SECRET'] %>
8
+ client_email: <%= ENV['GOOGLE_OAUTH_CLIENT_EMAIL'] %>
9
+ matomo:
10
+ base_url: <%= ENV['MATOMO_BASE_URL'] %>
11
+ site_id: <%= ENV['MATOMO_SITE_ID'] %>
12
+ auth_token: <%= ENV['MATOMO_AUTH_TOKEN'] %>
13
+
@@ -29,6 +29,8 @@ Rails.application.configure do
29
29
  config.cache_store = :null_store
30
30
  end
31
31
 
32
+ config.web_console.whitelisted_ips = ['172.18.0.0/16', '172.27.0.0/16', '0.0.0.0/0']
33
+
32
34
  # Store uploaded files on the local file system (see config/storage.yml for options)
33
35
  config.active_storage.service = :local
34
36
 
@@ -5,6 +5,8 @@ Hyrax.config do |config|
5
5
  # Defaults to false. See README for more info
6
6
  config.arkivo_api = true
7
7
 
8
+ config.analytics = ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_ANALYTICS', 'false'))
9
+ config.analytics_provider = ENV.fetch('HYRAX_ANALYTICS_PROVIDER', 'google')
8
10
  # Injected via `rails g hyrax:work GenericWork`
9
11
  config.register_curation_concern :generic_work
10
12
  # Injected via `rails g hyrax:work NamespacedWorks::NestedWork`
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ # This migration comes from valkyrie_engine (originally 20160111215816)
3
+ class EnableUuidExtension < ActiveRecord::Migration[5.0]
4
+ def change
5
+ enable_extension 'uuid-ossp'
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ # This migration comes from valkyrie_engine (originally 20161007101725)
3
+ class CreateOrmResources < ActiveRecord::Migration[5.0]
4
+ def options
5
+ if ENV["VALKYRIE_ID_TYPE"] == "string"
6
+ { id: :text, default: -> { '(uuid_generate_v4())::text' } }
7
+ else
8
+ { id: :uuid }
9
+ end
10
+ end
11
+
12
+ def change
13
+ create_table :orm_resources, **options do |t|
14
+ t.jsonb :metadata, null: false, default: {}
15
+ t.timestamps
16
+ end
17
+ add_index :orm_resources, :metadata, using: :gin
18
+ end
19
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ # This migration comes from valkyrie_engine (originally 20170124135846)
3
+ class AddModelTypeToOrmResources < ActiveRecord::Migration[5.0]
4
+ def change
5
+ add_column :orm_resources, :resource_type, :string
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ # This migration comes from valkyrie_engine (originally 20170531004548)
3
+ class ChangeModelTypeToInternalModel < ActiveRecord::Migration[5.1]
4
+ def change
5
+ rename_column :orm_resources, :resource_type, :internal_resource
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ # This migration comes from valkyrie_engine (originally 20171011224121)
3
+ class CreatePathGinIndex < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_index :orm_resources, 'metadata jsonb_path_ops', using: :gin
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ # This migration comes from valkyrie_engine (originally 20171204224121)
3
+ class CreateInternalResourceIndex < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_index :orm_resources, :internal_resource
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ # This migration comes from valkyrie_engine (originally 20180212092225)
3
+ class CreateUpdatedAtIndex < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_index :orm_resources, :updated_at
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ # This migration comes from valkyrie_engine (originally 20180802220739)
3
+ class AddOptimisticLockingToOrmResources < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :orm_resources, :lock_version, :integer
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ class CreateDefaultAdministrativeSet < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :hyrax_default_administrative_set do |t|
4
+ t.string :default_admin_set_id, null: false
5
+ t.timestamps null: false
6
+ end
7
+ end
8
+ end
data/.dassie/db/schema.rb CHANGED
@@ -10,10 +10,11 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 2020_08_21_212903) do
13
+ ActiveRecord::Schema.define(version: 2021_11_30_181150) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "plpgsql"
17
+ enable_extension "uuid-ossp"
17
18
 
18
19
  create_table "bookmarks", id: :serial, force: :cascade do |t|
19
20
  t.integer "user_id", null: false
@@ -139,6 +140,12 @@ ActiveRecord::Schema.define(version: 2020_08_21_212903) do
139
140
  t.index ["machine_id"], name: "index_hyrax_collection_types_on_machine_id", unique: true
140
141
  end
141
142
 
143
+ create_table "hyrax_default_administrative_set", force: :cascade do |t|
144
+ t.string "default_admin_set_id", null: false
145
+ t.datetime "created_at", null: false
146
+ t.datetime "updated_at", null: false
147
+ end
148
+
142
149
  create_table "hyrax_features", force: :cascade do |t|
143
150
  t.string "key", null: false
144
151
  t.boolean "enabled", default: false, null: false
@@ -225,6 +232,18 @@ ActiveRecord::Schema.define(version: 2020_08_21_212903) do
225
232
  t.index ["namespace"], name: "index_minter_states_on_namespace", unique: true
226
233
  end
227
234
 
235
+ create_table "orm_resources", id: :uuid, default: -> { "uuid_generate_v4()" }, force: :cascade do |t|
236
+ t.jsonb "metadata", default: {}, null: false
237
+ t.datetime "created_at", null: false
238
+ t.datetime "updated_at", null: false
239
+ t.string "internal_resource"
240
+ t.integer "lock_version"
241
+ t.index ["internal_resource"], name: "index_orm_resources_on_internal_resource"
242
+ t.index ["metadata"], name: "index_orm_resources_on_metadata", using: :gin
243
+ t.index ["metadata"], name: "index_orm_resources_on_metadata_jsonb_path_ops", opclass: :jsonb_path_ops, using: :gin
244
+ t.index ["updated_at"], name: "index_orm_resources_on_updated_at"
245
+ end
246
+
228
247
  create_table "permission_template_accesses", force: :cascade do |t|
229
248
  t.bigint "permission_template_id"
230
249
  t.string "agent_type"
data/.env CHANGED
@@ -1,14 +1,17 @@
1
+ ANALYTICS_START_DATE=2021-08-21
1
2
  CHROME_HEADLESS_MODE=false
2
3
  DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true
3
4
  DATABASE_TEST_URL=postgresql://hyrax_user:hyrax_password@postgres/hyrax_test?pool=5
4
5
  DATABASE_URL=postgresql://hyrax_user:hyrax_password@postgres/hyrax?pool=5
5
- DB_PORT=5432
6
6
  DB_HOST=postgres
7
- FCREPO_PORT=8080
7
+ DB_PORT=5432
8
8
  FCREPO_HOST=fcrepo
9
+ FCREPO_PORT=8080
9
10
  FCREPO_REST_PATH=rest
10
11
  FCREPO_TEST_BASE_PATH=/test
11
12
  HUB_URL=http://chrome:4444/wd/hub
13
+ HYRAX_ANALYTICS=false
14
+ HYRAX_ANALYTICS_PROVIDER=google
12
15
  HYRAX_DERIVATIVES_PATH=/app/samvera/hyrax-webapp/derivatives/
13
16
  HYRAX_ENGINE_PATH=/app/samvera/hyrax-engine
14
17
  HYRAX_UPLOAD_PATH=/app/samvera/hyrax-webapp/uploads/
@@ -17,9 +20,9 @@ RACK_ENV=development
17
20
  RAILS_ENV=development
18
21
  RAILS_ROOT=.dassie
19
22
  REDIS_HOST=redis
20
- SOLR_PORT=8983
21
23
  SOLR_HOST=solr
24
+ SOLR_PORT=8983
22
25
  SOLR_TEST_URL=http://solr:8983/solr/hyrax_test
23
26
  SOLR_URL=http://solr:8983/solr/hyrax
24
- VALKYRIE_SOLR_PORT=8983
25
27
  VALKYRIE_SOLR_HOST=solr
28
+ VALKYRIE_SOLR_PORT=8983
@@ -0,0 +1,17 @@
1
+ name: Trigger Nurax build
2
+ on:
3
+ workflow_dispatch:
4
+ push:
5
+
6
+ jobs:
7
+ trigger:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: peter-evans/repository-dispatch@v1
11
+ with:
12
+ token: ${{ secrets.NURAX_ACCESS_TOKEN }}
13
+ event-type: push
14
+ repository: curationexperts/nurax
15
+ client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
16
+
17
+
@@ -0,0 +1,17 @@
1
+ name: Trigger Nurax build
2
+ on:
3
+ workflow_dispatch:
4
+ release:
5
+
6
+ jobs:
7
+ trigger:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: peter-evans/repository-dispatch@v1
11
+ with:
12
+ token: ${{ secrets.NURAX_ACCESS_TOKEN }}
13
+ event-type: release
14
+ repository: curationexperts/nurax
15
+ client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
16
+
17
+
data/.gitignore CHANGED
@@ -82,3 +82,4 @@ lib/bundler/man
82
82
  spec/reports
83
83
  /spec/examples.txt
84
84
  node_modules
85
+ .env.*
data/.regen CHANGED
@@ -1 +1 @@
1
- 36
1
+ 40
data/CONTAINERS.md CHANGED
@@ -1,15 +1,12 @@
1
1
  Hyrax-in-a-Container
2
2
  ====================
3
3
 
4
- Our goal is to provide a practical, reusable "reference environment for applications. The first step is providing
5
- on on-ramp for Hyrax engine development. Then providing help with Hyrax-based application development. Finally,
6
- providing better guidance around deployment.
7
-
8
- Where are we at? It's complicated. What we have below is experimental support, but one that we want to push
9
- towards. We need your help to keep pushing in this direction. So dig in and prepare to get your hands dirty.
4
+ Our goal is to provide a practical, reusable reference environment for applications. The first step is providing an on-ramp for Hyrax engine development. Then providing help with Hyrax-based application development. Finally, providing better guidance around deployment.
10
5
 
11
6
  The [Hyrax Engine Development](#hyrax-engine-development) is further along than the [Docker Image for Hyrax-based Applications](#docker-image-for-hyrax-based-applications) which is further along than [Deploying to Production](#deploying-to-production).
12
7
 
8
+ See the [Troubleshooting](#troubleshooting) section if you encounter any issues.
9
+
13
10
  <!-- NOTE: This title is referenced in the top-level README.md. Keep that in mind if you change it. -->
14
11
  ## Hyrax Engine Development
15
12
 
@@ -42,8 +39,6 @@ To stop the containers for the Hyrax-based application, type <kbd>Ctrl</kbd>+<kb
42
39
 
43
40
  _**Note:** Starting and stopping Docker in this way will preserve your data between restarts._
44
41
 
45
- _**Note:** I (Jeremy) encountered a problem using `docker-compose build`. I ran `bundle update` in `./hyrax` as well as within `./hyrax/.dassie`. That appeared to clear up the problem of a failure to build a gem._
46
-
47
42
  ### Code Changes and Testing
48
43
 
49
44
  With `docker-compose up` running, any changes you make to your cloned Hyrax code-base should show up in `http://localhost:3000`; There may be cases where you need to restart your test application (e.g. stop the containers and start them up again).
@@ -99,7 +94,7 @@ In the two examples, note the difference in the `-w` switch. In the first case,
99
94
 
100
95
  ### Debugging
101
96
 
102
- I (Jeremy) find myself wanting to debug the application. This requires a somewhat different approach than running Hyrax bare-metal. You need to use `docker attach` to debug the running docker instance.
97
+ If you are interested in running Hyrax in debug mode, this requires a somewhat different approach than running Hyrax bare-metal. You need to use `docker attach` to debug the running docker instance.
103
98
 
104
99
  1. With `docker-compose up` running open a new Terminal session.
105
100
  2. In that new Terminal session, using `docker container ls` find the "CONTAINER ID" for the `hyrax-engine-dev`.
@@ -127,6 +122,14 @@ cp: cannot create directory '/var/solr/data/hyrax_test': Permission denied
127
122
 
128
123
  The solution that appears to work is to `docker-compose down --volumes`; This will tear down the docker instance, and remove the volumes. You can then run `docker-compose up` to get back to work. _**Note:** the `--volumes` switch will remove all custom data._
129
124
 
125
+ #### Errors building the Docker image
126
+
127
+ If you encounter errors running `docker-compose build`, try running `bundle update` in `./hyrax` as well as within `./hyrax/.dassie`. That can help clear up the problem of a failure to build a particular gem.
128
+
129
+ #### Containers do not all start
130
+
131
+ If any of the services fail to start on `docker-compose up`, try clearing out any `Gemfile.lock` files that might exist in `./hyrax` or `./hyrax/.dassie` and run `docker-compose build` again, then `docker-compose up` again.
132
+
130
133
  <!-- NOTE: This title is referenced in the top-level documentation/developing-your-hyrax-based-app.md. Keep that in mind if you change it. -->
131
134
  ## Docker Image for Hyrax-based Applications
132
135
 
@@ -177,4 +180,4 @@ helm dependency update chart/hyrax
177
180
  helm install -n hyrax --set image.tag=(git rev-parse HEAD) dassie chart/hyrax
178
181
  ```
179
182
 
180
- [dockerhub-samveralabs]: https://hub.docker.com/r/samveralabs
183
+ [dockerhub-samveralabs]: https://hub.docker.com/r/samveralabs
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).
@@ -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
- return $(`#${selector}`).length > 0;
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 === "undefined")
26
- return
20
+ if (typeof data === 'undefined') return
27
21
  Morris.Bar({
28
- element: this.userSelector,
29
- data: data,
30
- xkey: 'y',
31
- // TODO: when we add returning users:
32
- // ykeys: ['a', 'b'],
33
- // labels: ['New Users', 'Returning'],
34
- ykeys: ['a'],
35
- labels: ['New Users', 'Returning'],
36
- barColors: ['#33414E', '#3FBAE4'],
37
- gridTextSize: '10px',
38
- hideHover: true,
39
- resize: true,
40
- gridLineColor: '#E5E5E5'
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: ['#33414E', '#3FBAE4', '#FEA223'],
52
- gridTextSize: '9px',
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
- element: this.growthSelector,
63
- data: data,
64
- xkey: 'y',
65
- ykeys: ['a','b'],
66
- labels: ['Objects','Collections'],
67
- resize: true,
68
- hideHover: true,
69
- xLabels: 'day',
70
- gridTextSize: '10px',
71
- lineColors: ['#3FBAE4','#33414E'],
72
- gridLineColor: '#E5E5E5'
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
  }
@@ -0,0 +1,69 @@
1
+ class TrackingTags {
2
+ constructor(provider) {
3
+ this.provider = provider
4
+ }
5
+
6
+ analytics() {
7
+ if(this.provider === "matomo") {
8
+ return _paq;
9
+ }
10
+ else {
11
+ return _gaq
12
+ }
13
+ }
14
+
15
+ pageView() {
16
+ if(this.provider === "matomo") {
17
+ return 'trackPageView'
18
+ } else {
19
+ return '_trackPageview'
20
+ }
21
+ }
22
+
23
+ trackEvent() {
24
+ if(this.provider === "matomo") {
25
+ return 'trackEvent'
26
+ } else {
27
+ return '_trackEvent'
28
+ }
29
+ }
30
+ }
31
+
32
+ function trackPageView() {
33
+ window.trackingTags.analytics().push([window.trackingTags.pageView()]);
34
+ }
35
+
36
+ function trackAnalyticsEvents() {
37
+ $('span.analytics-event').each(function(){
38
+ var eventSpan = $(this)
39
+ window.trackingTags.analytics().push([window.trackingTags.trackEvent(), eventSpan.data('category'), eventSpan.data('action'), eventSpan.data('name')]);
40
+ })
41
+ }
42
+
43
+ function setupTracking() {
44
+ var provider = $('meta[name="analytics-provider"]').prop('content')
45
+ window.trackingTags = new TrackingTags(provider)
46
+ trackPageView()
47
+ trackAnalyticsEvents()
48
+ }
49
+
50
+ if (typeof Turbolinks !== 'undefined') {
51
+ $(document).on('turbolinks:load', function() {
52
+ setupTracking()
53
+ })
54
+ } else {
55
+ $(document).on('ready', function() {
56
+ setupTracking()
57
+ })
58
+ }
59
+
60
+ $(document).on('click', '#file_download', function(e) {
61
+ var provider = $('meta[name="analytics-provider"]').prop('content')
62
+ window.trackingTags = new TrackingTags(provider)
63
+ window.trackingTags.analytics().push([trackingTags.trackEvent(), 'file-set', 'file-set-download', $(this).data('label')]);
64
+ window.trackingTags.analytics().push([trackingTags.trackEvent(), 'file-set-in-work', 'file-set-in-work-download', $(this).data('work-id')]);
65
+ $(this).data('collection-ids').forEach(function (collection) {
66
+ window.trackingTags.analytics().push([trackingTags.trackEvent(), 'file-set-in-collection', 'file-set-in-collection-download', collection]);
67
+ window.trackingTags.analytics().push([trackingTags.trackEvent(), 'work-in-collection', 'work-in-collection-download', collection]);
68
+ });
69
+ });