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 ...@@ -43,6 +43,10 @@ class Import::BaseController < ApplicationController
private private
def filter_attribute
:name
end
def sanitized_filter_param def sanitized_filter_param
@filter ||= sanitize(params[:filter]) @filter ||= sanitize(params[:filter])
end end
......
...@@ -193,13 +193,19 @@ class Import::BitbucketServerController < Import::BaseController ...@@ -193,13 +193,19 @@ class Import::BitbucketServerController < Import::BaseController
end end
def bitbucket_connection_error(error) def bitbucket_connection_error(error)
flash[:alert] = _("Unable to connect to server: %{error}") % { error: error }
clear_session_data
respond_to do |format| respond_to do |format|
format.json do 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 end
format.html do format.html do
flash[:alert] = _("Unable to connect to server: %{error}") % { error: error }
clear_session_data
redirect_to new_import_bitbucket_server_path redirect_to new_import_bitbucket_server_path
end end
end end
......
...@@ -25,6 +25,7 @@ namespace :import do ...@@ -25,6 +25,7 @@ namespace :import do
get :status get :status
get :callback get :callback
get :jobs get :jobs
get :realtime_changes
end end
resource :bitbucket, only: [:create], controller: :bitbucket do 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