Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ gem 'blacklight_range_limit', '~> 8.5'
gem 'bolognese', '>= 1.9.10'
gem 'bootstrap', '~> 4.6'
gem 'bootstrap-datepicker-rails'
gem 'bulkrax', github: 'samvera-labs/bulkrax', branch: 'main'
gem 'bulkrax', github: 'samvera-labs/bulkrax', branch: 'guided-import-metrics'
gem 'byebug', group: %i[development test]
gem 'capybara', group: %i[test]
gem 'capybara-screenshot', '~> 1.0', group: %i[test]
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ GIT

GIT
remote: https://github.com/samvera-labs/bulkrax.git
revision: 370cf9cd324b11a8afcdd10912db2baf59456928
branch: main
revision: de1c3fd043c660317532a68f2dc98ae49548ee43
branch: guided-import-metrics
specs:
bulkrax (9.3.5)
bagit (~> 0.6.0)
Expand Down
4 changes: 4 additions & 0 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ def can_export_works?
can_create_any_work?
end

def can_read_bulkrax_metrics?
admin? || superadmin?
end

##
# @api public
#
Expand Down
11 changes: 11 additions & 0 deletions app/models/concerns/account_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def reload_library_config
def configure_bulkrax
Bulkrax.config do |config|
config.guided_import_enabled = guided_import_enabled?
config.guided_import_metrics_enabled = guided_import_metrics_enabled?
end
end

Expand All @@ -290,6 +291,16 @@ def guided_import_enabled?
false
end

def guided_import_metrics_enabled?
return false unless guided_import_enabled?

ActiveRecord::Base.connection.transaction(requires_new: true) do
Flipflop.include_guided_import_metrics?
end
rescue ActiveRecord::StatementInvalid
false
end

def configure_hyrax
Hyrax.config do |config|
# A short-circuit of showing download links
Expand Down
4 changes: 4 additions & 0 deletions config/features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,9 @@
feature :include_guided_import,
default: false,
description: "Enable the guided import workflow."

feature :include_guided_import_metrics,
default: false,
description: "Enable product metrics for the guided import workflow."
end
end
20 changes: 19 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.2].define(version: 2026_02_02_120000) do
ActiveRecord::Schema[7.2].define(version: 2026_04_03_000000) do
# These are extensions that must be enabled in order to support this database
enable_extension "hstore"
enable_extension "pgcrypto"
Expand Down Expand Up @@ -116,6 +116,23 @@
t.index ["user_id"], name: "index_bulkrax_exporters_on_user_id"
end

create_table "bulkrax_import_metrics", force: :cascade do |t|
t.string "metric_type", null: false
t.string "event", null: false
t.bigint "importer_id"
t.bigint "user_id"
t.string "session_id"
t.jsonb "payload", default: {}
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["created_at"], name: "index_bulkrax_import_metrics_on_created_at"
t.index ["event"], name: "index_bulkrax_import_metrics_on_event"
t.index ["importer_id"], name: "index_bulkrax_import_metrics_on_importer_id"
t.index ["metric_type", "created_at"], name: "index_bulkrax_import_metrics_on_metric_type_and_created_at"
t.index ["metric_type"], name: "index_bulkrax_import_metrics_on_metric_type"
t.index ["user_id"], name: "index_bulkrax_import_metrics_on_user_id"
end

create_table "bulkrax_importer_runs", force: :cascade do |t|
t.bigint "importer_id"
t.integer "total_work_entries", default: 0
Expand Down Expand Up @@ -1054,6 +1071,7 @@
add_foreign_key "accounts", "endpoints", column: "redis_endpoint_id", on_delete: :nullify
add_foreign_key "accounts", "endpoints", column: "solr_endpoint_id", on_delete: :nullify
add_foreign_key "bulkrax_exporter_runs", "bulkrax_exporters", column: "exporter_id"
add_foreign_key "bulkrax_import_metrics", "bulkrax_importers", column: "importer_id"
add_foreign_key "bulkrax_importer_runs", "bulkrax_importers", column: "importer_id"
add_foreign_key "bulkrax_pending_relationships", "bulkrax_importer_runs", column: "importer_run_id"
add_foreign_key "collection_type_participants", "hyrax_collection_types"
Expand Down
Loading