2021-01-29 00:20:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module BulkImports
|
|
|
|
module Pipeline
|
|
|
|
class Context
|
2021-03-11 19:13:27 +05:30
|
|
|
attr_accessor :extra
|
2021-01-29 00:20:46 +05:30
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
attr_reader :tracker
|
|
|
|
|
|
|
|
def initialize(tracker, extra = {})
|
|
|
|
@tracker = tracker
|
2021-03-11 19:13:27 +05:30
|
|
|
@extra = extra
|
2021-01-29 00:20:46 +05:30
|
|
|
end
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
def entity
|
|
|
|
@entity ||= tracker.entity
|
|
|
|
end
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
def portable
|
|
|
|
@portable ||= entity.group || entity.project
|
|
|
|
end
|
|
|
|
|
|
|
|
def import_export_config
|
|
|
|
@import_export_config ||= ::BulkImports::FileTransfer.config_for(portable)
|
|
|
|
end
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
def group
|
2021-04-29 21:17:54 +05:30
|
|
|
@group ||= entity.group
|
|
|
|
end
|
|
|
|
|
|
|
|
def bulk_import
|
|
|
|
@bulk_import ||= entity.bulk_import
|
2021-03-11 19:13:27 +05:30
|
|
|
end
|
2021-01-29 00:20:46 +05:30
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
def current_user
|
2021-04-29 21:17:54 +05:30
|
|
|
@current_user ||= bulk_import.user
|
2021-01-29 00:20:46 +05:30
|
|
|
end
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
def configuration
|
2021-04-29 21:17:54 +05:30
|
|
|
@configuration ||= bulk_import.configuration
|
2021-01-29 00:20:46 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|