Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/bulk_imports/entity.rb')
-rw-r--r--app/models/bulk_imports/entity.rb30
1 files changed, 26 insertions, 4 deletions
diff --git a/app/models/bulk_imports/entity.rb b/app/models/bulk_imports/entity.rb
index 2368be6196c..38b7da76306 100644
--- a/app/models/bulk_imports/entity.rb
+++ b/app/models/bulk_imports/entity.rb
@@ -20,8 +20,6 @@
class BulkImports::Entity < ApplicationRecord
self.table_name = 'bulk_import_entities'
- EXPORT_RELATIONS_URL = '/%{resource}/%{full_path}/export_relations'
-
belongs_to :bulk_import, optional: false
belongs_to :parent, class_name: 'BulkImports::Entity', optional: true
@@ -104,18 +102,42 @@ class BulkImports::Entity < ApplicationRecord
end
end
+ def entity_type
+ source_type.gsub('_entity', '')
+ end
+
def pluralized_name
- source_type.gsub('_entity', '').pluralize
+ entity_type.pluralize
+ end
+
+ def base_resource_url_path
+ "/#{pluralized_name}/#{encoded_source_full_path}"
end
def export_relations_url_path
- @export_relations_url_path ||= EXPORT_RELATIONS_URL % { resource: pluralized_name, full_path: encoded_source_full_path }
+ "#{base_resource_url_path}/export_relations"
end
def relation_download_url_path(relation)
"#{export_relations_url_path}/download?relation=#{relation}"
end
+ def wikis_url_path
+ "#{base_resource_url_path}/wikis"
+ end
+
+ def project?
+ source_type == 'project_entity'
+ end
+
+ def group?
+ source_type == 'group_entity'
+ end
+
+ def update_service
+ "::#{pluralized_name.capitalize}::UpdateService".constantize
+ end
+
private
def validate_parent_is_a_group