diff options
Diffstat (limited to 'app/controllers/import/bulk_imports_controller.rb')
-rw-r--r-- | app/controllers/import/bulk_imports_controller.rb | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/app/controllers/import/bulk_imports_controller.rb b/app/controllers/import/bulk_imports_controller.rb index da936215ad4..bec26cb547d 100644 --- a/app/controllers/import/bulk_imports_controller.rb +++ b/app/controllers/import/bulk_imports_controller.rb @@ -22,13 +22,16 @@ class Import::BulkImportsController < ApplicationController def status respond_to do |format| format.json do - data = importable_data + data = ::BulkImports::GetImportableDataService.new(params, query_params, credentials).execute pagination_headers.each do |header| - response.set_header(header, data.headers[header]) + response.set_header(header, data[:response].headers[header]) end - render json: { importable_data: serialized_data(data.parsed_response) } + json_response = { importable_data: serialized_data(data[:response].parsed_response) } + json_response[:version_validation] = data[:version_validation] + + render json: json_response end format.html do @source_url = session[url_key] @@ -37,7 +40,7 @@ class Import::BulkImportsController < ApplicationController end def create - response = BulkImportService.new(current_user, create_params, credentials).execute + response = ::BulkImports::CreateService.new(current_user, create_params, credentials).execute if response.success? render json: response.payload.to_json(only: [:id]) @@ -66,10 +69,6 @@ class Import::BulkImportsController < ApplicationController @serializer ||= BaseSerializer.new(current_user: current_user) end - def importable_data - client.get('groups', query_params) - end - # Default query string params used to fetch groups from GitLab source instance # # top_level_only: fetch only top level groups (subgroups are fetched during import itself) @@ -85,15 +84,6 @@ class Import::BulkImportsController < ApplicationController query_params end - def client - @client ||= BulkImports::Clients::HTTP.new( - url: session[url_key], - token: session[access_token_key], - per_page: params[:per_page], - page: params[:page] - ) - end - def configure_params params.permit(access_token_key, url_key) end |