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
@@ -4,4 +4,4 @@
4
4
  <hr />
5
5
  <%= render "top_data" %>
6
6
  </div>
7
- </div>
7
+ </div>
@@ -12,4 +12,3 @@
12
12
  </ul>
13
13
  <% end %>
14
14
  </dd>
15
-
@@ -53,5 +53,11 @@
53
53
  <%# = render 'sharing_with', presenter: @presenter %>
54
54
  <%# = render 'user_activity', presenter: @presenter %>
55
55
 
56
+ <span class='hide analytics-event' data-category="work" data-action="work-view" data-name="<%= @presenter.id %>" >
57
+ <% @presenter.member_of_collection_ids.each do |collection_id| %>
58
+ <span class='hide analytics-event' data-category="work-in-collection" data-action="work-in-collection-view" data-name="<%= collection_id %>" >
59
+ <% end %>
60
+
56
61
  </div>
57
62
  </div>
63
+
@@ -124,3 +124,7 @@
124
124
  </div>
125
125
  <% end # if @members_count > 0 %>
126
126
  </div>
127
+
128
+
129
+ <span class='hide analytics-event' data-category="collection" data-action="collection-page-view" data-name="<%= @presenter.id %>" >
130
+
@@ -1,19 +1,19 @@
1
1
  <div class="panel-heading">
2
2
  <h3 class="panel-title"><%= t('.title') %></h3>
3
- <div><%= t('.subtitle') %></div>
4
3
  </div>
5
4
  <div class="panel-body text-center">
6
- <% repository_growth = @presenter.repository_growth.to_json %>
7
- <div id="dashboard-growth" aria-hidden="true" style="height: 200px"><script>
5
+ <div id="dashboard-growth" aria-hidden="true" style="height: 200px">
6
+ <% repository_growth = @presenter.repository_growth(@start_date.to_datetime, @end_date.to_datetime).to_json %>
7
+ <script>
8
8
  //<![CDATA[
9
9
  Hyrax.statistics.repositoryGrowth = <%== repository_growth %>
10
10
  //]]>
11
11
  </script></div>
12
- <table aria-label="<%= t('.title') %>, <%= t('.subtitle') %>" class="table table-striped sr-only text-left">
12
+ <table aria-label="<%= t('.title') %>" class="table table-striped sr-only text-left">
13
13
  <thead>
14
14
  <tr>
15
15
  <th><%= t('.date') %></th>
16
- <th><%= t('.objects') %></th>
16
+ <th><%= t('.works') %></th>
17
17
  <th><%= t('.collections') %></th>
18
18
  </tr>
19
19
  </thead>
@@ -0,0 +1,41 @@
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading">
3
+ <h3 class="panel-title"><%= t('.title') %></h3>
4
+ </div>
5
+ <div class="panel-body">
6
+ <div id="dashboard-resource-types" aria-hidden="true" style="height: 200px">
7
+ <% @resource_types = Hyrax::Statistic.resource_types %>
8
+ <script>
9
+ Morris.Donut({
10
+ element: 'dashboard-resource-types',
11
+ data: [
12
+ <% @resource_types.each do |row| %>
13
+ { label: "<%= row[0] %>", value: <%= row[1].to_i %> },
14
+ <% end %>
15
+ ],
16
+ colors: ['#001219','#005f73','#0a9396','#94d2bd','#e9d8a6','#ee9b00','#ca6702','#bb3e03','#ae2012','#9b2226'],
17
+ gridTextSize: '12px',
18
+ resize: true
19
+ });
20
+ </script>
21
+ </div>
22
+
23
+ <table aria-label="<%= t('.title') %>" class="table table-striped sr-only text-left">
24
+ <thead>
25
+ <tr>
26
+ <th><%= t('.resource_type') %></th>
27
+ <th><%= t('.count') %></th>
28
+ </tr>
29
+ </thead>
30
+ <tbody>
31
+ <% @resource_types.each do |row| %>
32
+ <tr>
33
+ <td><%= row[0] %></td>
34
+ <td><%= row[1] %></td>
35
+ </tr>
36
+ <% end %>
37
+ </tbody>
38
+ </table>
39
+ </div>
40
+ </div>
41
+
@@ -12,7 +12,10 @@
12
12
  </div>
13
13
  </div>
14
14
  </li>
15
-
15
+ <li><%= link_to hyrax.dashboard_path do %>
16
+ <span class="fa fa-home" aria-hidden="true"></span> <span class="sidebar-action-text"><%= t('hyrax.admin.sidebar.dashboard') %></span>
17
+ <% end %>
18
+ </li>
16
19
  <%= render 'hyrax/dashboard/sidebar/activity', menu: menu %>
17
20
  <%= render 'hyrax/dashboard/sidebar/repository_content', menu: menu %>
18
21
  <%= render 'hyrax/dashboard/sidebar/tasks', menu: menu %>
@@ -0,0 +1,11 @@
1
+ <!-- Nav tabs -->
2
+ <ul class="nav nav-tabs" role="tablist">
3
+ <li role="presentation" class="active"><a href="#admin_sets" aria-selected="true" role="tab" data-toggle="tab"><%= t('.admin_sets') %></a></li>
4
+ </ul>
5
+
6
+ <!-- Tab panes -->
7
+ <div class="tab-content">
8
+ <div role="tabpanel" class="tab-pane active" id="admin_sets">
9
+ <%= render 'admin_sets' %>
10
+ </div>
11
+ </div>
@@ -1,28 +1,22 @@
1
1
  <div class="panel-heading">
2
2
  <h3 class="panel-title"><%= t('.title') %></h3>
3
- <div><%= t('.subtitle') %></div>
4
3
  </div>
5
4
  <div class="panel-body text-center">
6
- <% user_activity = @presenter.user_activity.to_json %>
7
- <div id="user-activity" aria-hidden="true" style="height: 200px"><script>
8
- //<![CDATA[
9
- Hyrax.statistics.userActivity = <%== user_activity %>
10
- //]]>
11
- </script></div>
12
- <table aria-label="<%= t('.title') %>, <%= t('.subtitle') %>" class="table table-striped sr-only text-left">
13
- <thead>
14
- <tr>
15
- <th><%= t('.date') %></th>
16
- <th><%= t('.new_users') %></th>
17
- </tr>
18
- </thead>
19
- <tbody>
20
- <% JSON.parse(user_activity).each do |row| %>
21
- <tr>
22
- <td><%= row["y"] %></td>
23
- <td><%= row["a"] %></td>
24
- </tr>
25
- <% end %>
26
- </tbody>
27
- </table>
5
+ <% if Hyrax.config.analytics? %>
6
+ <%= render 'user_activity_graph' %>
7
+
8
+ <div class="col-md-3">
9
+ <div class="panel panel-default">
10
+ <div class="panel-heading">
11
+ <h2 class="panel-title text-center"><%= t('.user_summary') %></h2>
12
+ </div>
13
+ <div class="panel-body text-center">
14
+ <p><%= t('.registered_users') %>: <%= @presenter.user_count(@start_date.to_date, @end_date.to_date) %></p>
15
+ <p><%= t('.new_visitors') %>: <%= Hyrax::Analytics.new_visitors('range', "#{@start_date},#{@end_date}") %></p>
16
+ <p><%= t('.returning_visitors') %>: <%= Hyrax::Analytics.returning_visitors('range', "#{@start_date},#{@end_date}") %></p>
17
+ <p><%= t('.total_visitors') %>: <%= Hyrax::Analytics.total_visitors('range', "#{@start_date},#{@end_date}") %></p>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ <% end %>
28
22
  </div>
@@ -0,0 +1,55 @@
1
+ <div id="user-activity" class="col-md-9" aria-hidden="true" style="height: 200px">
2
+ <% users = Hyrax::Admin::UserActivityPresenter.new(@start_date.to_date,@end_date.to_date).as_json %>
3
+ <% return_visits = Hyrax::Analytics.returning_visits_by_day("#{@start_date},#{@end_date}").list.reverse %>
4
+ <% new_visits = Hyrax::Analytics.new_visits_by_day("#{@start_date},#{@end_date}").list.reverse %>
5
+ <script>
6
+ //Draws a bar chart of new user signups, and visitors from analytics
7
+ Morris.Bar({
8
+ element: 'user-activity',
9
+ data: [
10
+ <% users.zip(return_visits, new_visits).each do |e| %>
11
+ <% unless e[1].nil? or e[2].nil? %>
12
+ { date: "<%= e[0][0] %>", users: <%= e[0][1] %>, return_visits: <%= e[1][1] %>, new_visits: <%= e[2][1] %>, total_visits: <%= e[1][1] + e[2][1] %>},
13
+ <% end %>
14
+ <% end %>
15
+ ],
16
+ xkey: 'date',
17
+ ykeys: ['total_visits', 'new_visits', 'return_visits', 'users'],
18
+ labels: ['<%= t('.total_visits') %>', '<%= t('.new_visits') %>', '<%= t('.return_visits') %>', '<%= t('.new_users') %>'],
19
+ barColors: [
20
+ '#005f73','#0a9396','#94d2bd','#e9d8a6',
21
+ '#ee9b00','#ca6702','#bb3e03','#ae2012','#9b2226'
22
+ ],
23
+ gridTextSize: '12px',
24
+ hideHover: true,
25
+ resize: true,
26
+ gridLineColor: '#E5E5E5',
27
+ stacked: true
28
+ });
29
+ </script>
30
+ </div>
31
+
32
+ <table aria-label="User Activity" class="table table-striped sr-only text-left">
33
+ <thead>
34
+ <tr>
35
+ <th><%= t('.date') %></th>
36
+ <th><%= t('.total_visits') %></th>
37
+ <th><%= t('.new_visits') %></th>
38
+ <th><%= t('.return_visits') %></th>
39
+ <th><%= t('.new_users') %></th>
40
+ </tr>
41
+ </thead>
42
+ <tbody>
43
+ <% users.zip(return_visits, new_visits).each do |e| %>
44
+ <% unless e[1].nil? or e[2].nil? %>
45
+ <tr>
46
+ <td><%= e[0][0] %></td>
47
+ <td><%= e[1][1] + e[2][1] %></td>
48
+ <td><%= e[2][1] %></td>
49
+ <td><%= e[1][1] %></td>
50
+ <td><%= e[0][1] %></td>
51
+ </tr>
52
+ <% end %>
53
+ <% end %>
54
+ </tbody>
55
+ </table>
@@ -0,0 +1,31 @@
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading">
3
+ <h3 class="panel-title"><%= t('.visibility') %></h3>
4
+ </div>
5
+ <div class="panel-body">
6
+ <% repository_objects = @presenter.repository_objects.to_json %>
7
+ <div id="dashboard-repository-objects" aria-hidden="true" style="height: 200px">
8
+ <script>
9
+ //<![CDATA[
10
+ Hyrax.statistics.repositoryObjects = <%== repository_objects %>
11
+ //]]>
12
+ </script>
13
+ </div>
14
+ <table class="table table-striped sr-only text-left">
15
+ <thead>
16
+ <tr>
17
+ <th></th>
18
+ <th></th>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <% JSON.parse(repository_objects).each do |row| %>
23
+ <tr>
24
+ <td><%= row["label"] %></td>
25
+ <td><%= row["value"] %></td>
26
+ </tr>
27
+ <% end %>
28
+ </tbody>
29
+ </table>
30
+ </div>
31
+ </div>
@@ -0,0 +1,41 @@
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading">
3
+ <h3 class="panel-title"><%= t('.title') %></h3>
4
+ </div>
5
+ <div class="panel-body">
6
+ <div id="dashboard-work-types" aria-hidden="true" style="height: 200px">
7
+ <% @work_types = Hyrax::Statistic.work_types %>
8
+ <script>
9
+ Morris.Donut({
10
+ element: 'dashboard-work-types',
11
+ data: [
12
+ <% @work_types.each do |row| %>
13
+ { label: "<%= row[0] %>", value: <%= row[1].to_i %> },
14
+ <% end %>
15
+ ],
16
+ colors: ['#001219','#005f73','#0a9396','#94d2bd','#e9d8a6','#ee9b00','#ca6702','#bb3e03','#ae2012','#9b2226'],
17
+ gridTextSize: '12px',
18
+ resize: true
19
+ });
20
+ </script>
21
+ </div>
22
+
23
+ <table aria-label="<%= t('.title') %>" class="table table-striped sr-only text-left">
24
+ <thead>
25
+ <tr>
26
+ <th><%= t('.work_type') %></th>
27
+ <th><%= t('.count') %></th>
28
+ </tr>
29
+ </thead>
30
+ <tbody>
31
+ <% @work_types.each do |row| %>
32
+ <tr>
33
+ <td><%= row[0] %></td>
34
+ <td><%= row[1] %></td>
35
+ </tr>
36
+ <% end %>
37
+ </tbody>
38
+ </table>
39
+
40
+ </div>
41
+ </div>
@@ -34,7 +34,8 @@
34
34
  <%= render_edit_field_partial(term, f: f) %>
35
35
  <% end %>
36
36
 
37
- <% if f.object.persisted? %>
37
+ <% # TODO: Remove check for PcdmCollection when Issue #5286 is resolved. %>
38
+ <% if f.object.persisted? && Hyrax.config.collection_class != Hyrax::PcdmCollection %>
38
39
  <%# we're loading these values dynamically to speed page load %>
39
40
  <%= f.input :thumbnail_id,
40
41
  input_html: { data: { text: thumbnail_label_for(object: f.object) } } %>
@@ -2,71 +2,50 @@
2
2
  <h1><%= t("hyrax.dashboard.title") %></h1>
3
3
  <% end %>
4
4
 
5
+ <% if Hyrax.config.analytics? %>
5
6
  <div class="row">
6
- <div class="col-md-3">
7
+ <div class="col-md-12">
7
8
  <div class="panel panel-default">
8
9
  <div class="panel-heading">
9
- <h2 class="panel-title text-center"><%= t('.registered_users') %></h2>
10
+ <h2 class="panel-title"><%= t(".graph_reports") %>:</h2>
11
+ <%= params[:start_date].present? ? params[:start_date].to_date : 1.month.ago.beginning_of_day.to_date %> -
12
+ <%= params[:end_date].present? ? params[:end_date].to_date : Time.zone.now.end_of_day.to_date %>
10
13
  </div>
11
- <div class="panel-body text-center">
12
- <%= t('.current_registered_users') %>
13
- <div class="h3"><%= @presenter.user_count %></div>
14
+ <div class="panel-body">
15
+ <%= render "hyrax/admin/analytics/date_range_form", redirect_path: hyrax.dashboard_path %>
14
16
  </div>
15
17
  </div>
16
18
  </div>
17
-
18
- <div class="col-md-3">
19
- <div class="panel panel-default">
20
- <div class="panel-heading">
21
- <h2 class="panel-title text-center"><%= t('.total_visitors') %></h2>
22
- </div>
23
- <div class="panel-body text-center"><%= t('.past_30_days') %>
24
- <div class="h3">n/a</div>
25
- </div>
26
- </div>
27
- </div>
28
-
29
- <div class="col-md-3">
30
- <div class="panel panel-default">
31
- <div class="panel-heading">
32
- <h2 class="panel-title text-center"><%= t('.returning_visitors') %></h2>
33
- </div>
34
- <div class="panel-body text-center"><%= t('.past_30_days') %>
35
- <div class="h3">n/a</div>
36
- </div>
37
- </div>
38
- </div>
39
-
40
- <div class="col-md-3">
41
- <div class="panel panel-default">
42
- <div class="panel-heading">
43
- <h2 class="panel-title text-center"><%= t('.new_visitors') %></h2>
44
- </div>
45
- <div class="panel-body text-center"><%= t('.past_30_days') %>
46
- <div class="h3">n/a</div>
47
- </div>
48
- </div>
49
- </div>
50
19
  </div>
51
20
 
52
- <%= render 'admin_sets' %>
53
-
54
21
  <div class="row">
55
- <div class="col-md-4">
22
+ <div class="col-md-12">
56
23
  <div class="panel panel-default">
57
24
  <%= render 'user_activity' %>
58
25
  </div>
59
26
  </div>
27
+ </div>
28
+ <% end %>
60
29
 
61
- <div class="col-md-4">
30
+ <div class="row">
31
+ <div class="col-md-12">
62
32
  <div class="panel panel-default">
63
33
  <%= render 'repository_growth' %>
64
34
  </div>
65
35
  </div>
36
+ </div>
66
37
 
38
+ <div class="row">
67
39
  <div class="col-md-4">
68
- <div class="panel panel-default">
69
- <%= render 'repository_objects' %>
70
- </div>
40
+ <%= render 'visibility_graph' %>
41
+ </div>
42
+ <div class="col-md-4">
43
+ <%= render 'work_type_graph' %>
44
+ </div>
45
+ <div class="col-md-4">
46
+ <%= render "resource_type_graph" %>
71
47
  </div>
72
48
  </div>
49
+ <br>
50
+ <br>
51
+ <%= render 'tabs' %>
@@ -32,4 +32,26 @@
32
32
  <% end %>
33
33
  <% end %>
34
34
 
35
+ <% if current_ability.can_create_any_work? %>
36
+ <li>
37
+ <%= menu.collapsable_section t('hyrax.admin.sidebar.analytics'),
38
+ icon_class: "fa fa-pie-chart",
39
+ id: 'collapseAnalytics',
40
+ open: menu.analytics_reporting_section? do %>
41
+ <% if can? :read, :admin_dashboard %>
42
+ <%= menu.nav_link(hyrax.admin_analytics_collection_reports_path,
43
+ onclick: "dontChangeAccordion(event);") do %>
44
+ <span class="fa fa-folder-open" aria-hidden="true"></span> <span class="sidebar-action-text"><%= t('hyrax.admin.sidebar.collections_report') %></span>
45
+ <% end %>
46
+ <% end %>
47
+
48
+ <%= menu.nav_link(hyrax.admin_analytics_work_reports_path,
49
+ onclick: "dontChangeAccordion(event);") do %>
50
+ <span class="fa fa-file" aria-hidden="true"></span> <span class="sidebar-action-text"><%= t('hyrax.admin.sidebar.works_report') %></span>
51
+ <% end %>
52
+
53
+ <% end %>
54
+ </li>
55
+ <% end %>
56
+
35
57
  <%= render 'hyrax/dashboard/sidebar/menu_partials', menu: menu, section: :activity %>
@@ -6,7 +6,7 @@
6
6
  title: t('.download_title', file_set: file_set),
7
7
  target: "_blank",
8
8
  id: "file_download",
9
- data: { label: file_set.id } %>
9
+ data: { label: file_set.id, work_id: @presenter.id, collection_ids: @presenter.member_of_collection_ids } %>
10
10
  <% else %>
11
11
  <div class="btn-group">
12
12
  <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button" id="dropdownMenu_<%= file_set.id %>" aria-haspopup="true" aria-expanded="false">
@@ -43,11 +43,12 @@
43
43
  title: t('.download_title', file_set: file_set),
44
44
  target: "_blank",
45
45
  id: "file_download",
46
- data: { label: file_set.id } %>
46
+ class: "download",
47
+ data: { label: file_set.id, work_id: @presenter.id, collection_ids: @presenter.member_of_collection_ids } %>
47
48
  </li>
48
49
  <% end %>
49
50
 
50
51
  </ul>
51
52
  </div>
52
53
  <% end %>
53
- <% end %>
54
+ <% end %>
@@ -17,3 +17,9 @@
17
17
  </div><!-- /columns second -->
18
18
  </div> <!-- /.row -->
19
19
  </div><!-- /.container-fluid -->
20
+
21
+ <% @presenter.member_of_collection_ids.each do |collection_id| %>
22
+ <span class='hide analytics-event' data-category="file-set-in-collection" data-action="file-set-in-collection-view" data-name="<%= collection_id %>" >
23
+ <% end %>
24
+ <span class='hide analytics-event' data-category="file-set-in-work" data-action="file-set-in-work-view" data-name="<%= @presenter.parent.id %>" >
25
+ <span class='hide analytics-event' data-category="file-set" data-action="file-set-view" data-name="<%= @presenter.id %>" >
@@ -21,7 +21,7 @@
21
21
  <!-- Page tabs -->
22
22
  <nav><%= render 'tabs' if @managed_collection_count > 0 %></nav>
23
23
 
24
- <% if can?(:create_any, Collection) && @collection_type_list_presenter.any? %>
24
+ <% if can?(:create_any, Hyrax.config.collection_class) && @collection_type_list_presenter.any? %>
25
25
  <% if @collection_type_list_presenter.many? %>
26
26
  <% # modal to select type %>
27
27
  <button type="button"
@@ -0,0 +1,18 @@
1
+ <script>
2
+ Morris.Bar({
3
+ element: 'downloads',
4
+ data: [
5
+ <% @downloads.list.take(30).reverse.each do |result| %>
6
+ { date: "<%= result[0] %>", metric: <%= result[1] %>},
7
+ <% end %>
8
+ ],
9
+ xkey: 'date',
10
+ ykeys: ['metric'],
11
+ labels: ["<%= t('.downloads') %>"],
12
+ gridTextSize: '12px',
13
+ gridLineColor: '#E5E5E5',
14
+ gridIntegers: true,
15
+ ymin: 0,
16
+ resize: true
17
+ });
18
+ </script>
@@ -0,0 +1,18 @@
1
+ <script>
2
+ Morris.Bar({
3
+ element: 'pageviews',
4
+ data: [
5
+ <% @pageviews.list.take(30).reverse.each do |result| %>
6
+ { date: "<%= result[0] %>", metric: <%= result[1] %>},
7
+ <% end %>
8
+ ],
9
+ xkey: 'date',
10
+ ykeys: ['metric'],
11
+ labels: ["<%= t('.pageviews') %>"],
12
+ gridTextSize: '12px',
13
+ gridLineColor: '#E5E5E5',
14
+ gridIntegers: true,
15
+ ymin: 0,
16
+ resize: true
17
+ });
18
+ </script>
@@ -1,26 +1,34 @@
1
1
  <!-- Adapted from jquery-flot examples https://github.com/flot/flot/blob/master/examples/visitors/index.html -->
2
2
  <script>
3
3
  //<![CDATA[
4
-
5
- var hyrax_item_stats = <%= raw json_escape @stats.to_flot.to_json %>;
6
-
4
+ var hyrax_item_stats = <%= raw json_escape @pageviews.to_flot.to_json %>;
7
5
  //]]>
8
6
  </script>
9
7
 
10
- <%= content_tag :h1, @stats, class: "lower" %>
8
+ <%= content_tag :h1, @document, class: "lower" %>
11
9
 
12
10
  <div class="row">
13
11
  <div class="col-sm-12">
14
- <%= content_tag :h2, "Work Analytics" %>
12
+ <%= content_tag :h2, "#{t('.header')}" %>
15
13
  <div class="alert alert-info">
16
14
  <span class="glyphicon glyphicon-signal large-icon"></span>
17
- <%= content_tag :strong, @stats.total_pageviews %> views since <%= @stats.created.strftime("%B %-d, %Y") %>
15
+ <%= t('total_view', count: @pageviews.range(Hyrax.config.analytics_start_date.to_date, Time.zone.today)) %>
16
+ <%= t('download', count: @downloads.range(Hyrax.config.analytics_start_date.to_date, Time.zone.today)) %>
18
17
  </div>
18
+
19
19
  <div class="stats-container">
20
- <div id="usage-stats" class="stats-placeholder"></div>
20
+ <h3 class="text-center"><%= t('.pageviews') %></h3>
21
+ <div id="pageviews">
22
+ <%= render 'pageviews' %>
23
+ </div>
21
24
  </div>
22
- <div class="stats-container" style="height:150px;">
23
- <div id="overview" class="stats-placeholder"></div>
25
+
26
+ <div class="stats-container">
27
+ <h3 class="text-center"><%= t('.downloads') %></h3>
28
+ <div id="downloads">
29
+ <%= render 'downloads' %>
30
+ </div>
24
31
  </div>
32
+
25
33
  </div>
26
34
  </div>
@@ -25,8 +25,13 @@ signed in %>
25
25
 
26
26
  <%= render 'shared/appearance_styles' %>
27
27
 
28
- <!-- Google Analytics -->
29
- <%= render partial: '/ga', formats: [:html] %>
28
+ <% if Hyrax.config.analytics? %>
29
+ <% if Hyrax.config.analytics_provider == 'google' %>
30
+ <%= render partial: 'shared/ga', formats: [:html] %>
31
+ <% elsif Hyrax.config.analytics_provider == 'matomo' %>
32
+ <%= render partial: 'shared/matomo', formats: [:html] %>
33
+ <% end %>
34
+ <% end %>
30
35
 
31
36
  <!-- for extras, e.g., a favicon -->
32
37
  <%= render partial: '/head_tag_extras', formats: [:html] %>
@@ -1,20 +1,16 @@
1
- <%
2
- if Hyrax.config.google_analytics_id?
3
- tracking_id = Hyrax.config.google_analytics_id
4
- %>
5
1
  <script type="text/javascript">
6
2
  var _gaq = _gaq || [];
7
- _gaq.push(['_setAccount', '<%= tracking_id %>']);
3
+ _gaq.push(['_setAccount', '<%= Hyrax::Analytics.config.analytics_id %>']);
8
4
  <% if Rails.env.development? %>
9
5
  // This allows us to look at GA data live from locahost
10
6
  _gaq.push(['_setDomainName', 'none']);
11
7
  <% end %>
12
- _gaq.push(['_trackPageview']);
13
8
 
14
9
  (function() {
15
10
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
16
11
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
17
12
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
18
13
  })();
14
+ window.analytics = _gaq;
19
15
  </script>
20
- <% end %>
16
+ <meta name="analytics-provider" content="google">
@@ -0,0 +1,15 @@
1
+ <script type="text/javascript">
2
+ var _paq = window._paq || [];
3
+ /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
4
+ // _paq.push(['trackPageView']);
5
+ _paq.push(['enableLinkTracking']);
6
+ (function() {
7
+ var u="<%= Hyrax::Analytics.config.base_url %>";
8
+ _paq.push(['setTrackerUrl', u+'matomo.php']);
9
+ _paq.push(['setSiteId', "<%= Hyrax::Analytics.config.site_id %>"]);
10
+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
11
+ g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
12
+ })();
13
+ window.analytics = _paq;
14
+ </script>
15
+ <meta name="analytics-provider" content="matomo">
@@ -2,7 +2,7 @@ apiVersion: v2
2
2
  name: hyrax
3
3
  description: An open-source, Samvera-powered digital repository system
4
4
  type: application
5
- version: 1.0.0
5
+ version: 1.0.2
6
6
  appVersion: 3.1.0
7
7
  dependencies:
8
8
  - name: fcrepo