2020-04-08 14:13:33 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Projects
|
|
|
|
module Import
|
|
|
|
class JiraController < Projects::ApplicationController
|
2020-04-22 19:07:51 +05:30
|
|
|
before_action :authenticate_user!
|
|
|
|
before_action :authorize_read_project!
|
2020-06-23 00:09:42 +05:30
|
|
|
before_action :validate_jira_import_settings!
|
2020-04-08 14:13:33 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
feature_category :integrations
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
def validate_jira_import_settings!
|
|
|
|
Gitlab::JiraImport.validate_project_settings!(@project, user: current_user, configuration_check: false)
|
2020-04-08 14:13:33 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
true
|
|
|
|
rescue Projects::ImportService::Error => e
|
|
|
|
flash[:notice] = e.message
|
2020-04-08 14:13:33 +05:30
|
|
|
redirect_to project_issues_path(@project)
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
false
|
|
|
|
end
|
2020-04-08 14:13:33 +05:30
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
def jira_integration
|
|
|
|
strong_memoize(:jira_integration) do
|
|
|
|
@project.jira_integration
|
2020-06-23 00:09:42 +05:30
|
|
|
end
|
2020-04-08 14:13:33 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def jira_import_params
|
|
|
|
params.permit(:jira_project_key)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|