diff options
Diffstat (limited to 'app/controllers/import/bulk_imports_controller.rb')
-rw-r--r-- | app/controllers/import/bulk_imports_controller.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/app/controllers/import/bulk_imports_controller.rb b/app/controllers/import/bulk_imports_controller.rb index 7394e8bf615..61eb9a27560 100644 --- a/app/controllers/import/bulk_imports_controller.rb +++ b/app/controllers/import/bulk_imports_controller.rb @@ -22,7 +22,13 @@ class Import::BulkImportsController < ApplicationController def status respond_to do |format| format.json do - render json: { importable_data: serialized_importable_data } + data = importable_data + + pagination_headers.each do |header| + response.set_header(header, data.headers[header]) + end + + render json: { importable_data: serialized_data(data.parsed_response) } end format.html do @source_url = session[url_key] @@ -44,8 +50,12 @@ class Import::BulkImportsController < ApplicationController private - def serialized_importable_data - serializer.represent(importable_data, {}, Import::BulkImportEntity) + def pagination_headers + %w[x-next-page x-page x-per-page x-prev-page x-total x-total-pages] + end + + def serialized_data(data) + serializer.represent(data, {}, Import::BulkImportEntity) end def serializer @@ -53,7 +63,7 @@ class Import::BulkImportsController < ApplicationController end def importable_data - client.get('groups', query_params).parsed_response + client.get('groups', query_params) end # Default query string params used to fetch groups from GitLab source instance @@ -74,7 +84,9 @@ class Import::BulkImportsController < ApplicationController def client @client ||= BulkImports::Clients::Http.new( uri: session[url_key], - token: session[access_token_key] + token: session[access_token_key], + per_page: params[:per_page], + page: params[:page] ) end |