Commit 531fc3a1 authored by Illya Klymov's avatar Illya Klymov

Add support for proper redirects and filtering

parent e3bd1af7
......@@ -43,6 +43,10 @@ class Import::BaseController < ApplicationController
private
def filter_attribute
:name
end
def sanitized_filter_param
@filter ||= sanitize(params[:filter])
end
......
......@@ -193,13 +193,19 @@ class Import::BitbucketServerController < Import::BaseController
end
def bitbucket_connection_error(error)
flash[:alert] = _("Unable to connect to server: %{error}") % { error: error }
clear_session_data
respond_to do |format|
format.json do
render json: { error: _("Unable to connect to server: %{error}") % { error: error } }, status: :unprocessable_entity
render json: {
error: {
message: _("Unable to connect to server: %{error}") % { error: error },
redirect: new_import_bitbucket_server_path
}
}, status: :unprocessable_entity
end
format.html do
flash[:alert] = _("Unable to connect to server: %{error}") % { error: error }
clear_session_data
redirect_to new_import_bitbucket_server_path
end
end
......
......@@ -25,6 +25,7 @@ namespace :import do
get :status
get :callback
get :jobs
get :realtime_changes
end
resource :bitbucket, only: [:create], controller: :bitbucket do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment