2015-04-26 12:48:37 +05:30
|
|
|
class Import::BaseController < ApplicationController
|
|
|
|
private
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
def find_already_added_projects(import_type)
|
|
|
|
current_user.created_projects.where(import_type: import_type).includes(:import_state)
|
|
|
|
end
|
|
|
|
|
|
|
|
def find_jobs(import_type)
|
|
|
|
current_user.created_projects
|
|
|
|
.includes(:import_state)
|
|
|
|
.where(import_type: import_type)
|
|
|
|
.to_json(only: [:id], methods: [:import_status])
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
def find_or_create_namespace(names, owner)
|
|
|
|
names = params[:target_namespace].presence || names
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
return current_user.namespace if names == owner
|
|
|
|
|
|
|
|
group = Groups::NestedCreateService.new(current_user, group_path: names).execute
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
group.errors.any? ? current_user.namespace : group
|
|
|
|
rescue => e
|
|
|
|
Gitlab::AppLogger.error(e)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
current_user.namespace
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|