Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/jira_connect')
-rw-r--r--app/controllers/jira_connect/app_descriptor_controller.rb40
-rw-r--r--app/controllers/jira_connect/branches_controller.rb29
-rw-r--r--app/controllers/jira_connect/subscriptions_controller.rb7
3 files changed, 58 insertions, 18 deletions
diff --git a/app/controllers/jira_connect/app_descriptor_controller.rb b/app/controllers/jira_connect/app_descriptor_controller.rb
index 0de42ad2452..a0f387631dd 100644
--- a/app/controllers/jira_connect/app_descriptor_controller.rb
+++ b/app/controllers/jira_connect/app_descriptor_controller.rb
@@ -44,27 +44,14 @@ class JiraConnect::AppDescriptorController < JiraConnect::ApplicationController
def modules
modules = {
- jiraDevelopmentTool: {
- key: 'gitlab-development-tool',
- application: {
- value: 'GitLab'
- },
- name: {
- value: 'GitLab'
- },
- url: HOME_URL,
- logoUrl: logo_url,
- capabilities: %w(branch commit pull_request)
- },
postInstallPage: {
key: 'gitlab-configuration',
- name: {
- value: 'GitLab Configuration'
- },
+ name: { value: 'GitLab Configuration' },
url: relative_to_base_path(jira_connect_subscriptions_path)
}
}
+ modules.merge!(development_tool_module)
modules.merge!(build_information_module)
modules.merge!(deployment_information_module)
modules.merge!(feature_flag_module)
@@ -76,6 +63,25 @@ class JiraConnect::AppDescriptorController < JiraConnect::ApplicationController
view_context.image_url('gitlab_logo.png')
end
+ # See https://developer.atlassian.com/cloud/jira/software/modules/development-tool/
+ def development_tool_module
+ {
+ jiraDevelopmentTool: {
+ actions: {
+ createBranch: {
+ templateUrl: new_jira_connect_branch_url + '?issue_key={issue.key}&issue_summary={issue.summary}'
+ }
+ },
+ key: 'gitlab-development-tool',
+ application: { value: 'GitLab' },
+ name: { value: 'GitLab' },
+ url: HOME_URL,
+ logoUrl: logo_url,
+ capabilities: %w(branch commit pull_request)
+ }
+ }
+ end
+
# See: https://developer.atlassian.com/cloud/jira/software/modules/deployment/
def deployment_information_module
{
@@ -92,9 +98,7 @@ class JiraConnect::AppDescriptorController < JiraConnect::ApplicationController
{
jiraFeatureFlagInfoProvider: common_module_properties.merge(
actions: {}, # TODO: create, link and list feature flags https://gitlab.com/gitlab-org/gitlab/-/issues/297386
- name: {
- value: 'GitLab Feature Flags'
- },
+ name: { value: 'GitLab Feature Flags' },
key: 'gitlab-feature-flags'
)
}
diff --git a/app/controllers/jira_connect/branches_controller.rb b/app/controllers/jira_connect/branches_controller.rb
new file mode 100644
index 00000000000..12ea6560e3a
--- /dev/null
+++ b/app/controllers/jira_connect/branches_controller.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+# NOTE: This controller does not inherit from JiraConnect::ApplicationController
+# because we don't receive a JWT for this action, so we rely on standard GitLab authentication.
+class JiraConnect::BranchesController < ApplicationController
+ feature_category :integrations
+
+ def new
+ @new_branch_data = new_branch_data
+ end
+
+ private
+
+ def initial_branch_name
+ return unless params[:issue_key].present?
+
+ Issue.to_branch_name(
+ params[:issue_key],
+ params[:issue_summary]
+ )
+ end
+
+ def new_branch_data
+ {
+ initial_branch_name: initial_branch_name,
+ success_state_svg_path: ActionController::Base.helpers.image_path('illustrations/merge_requests.svg')
+ }
+ end
+end
diff --git a/app/controllers/jira_connect/subscriptions_controller.rb b/app/controllers/jira_connect/subscriptions_controller.rb
index 3ff12f29f10..a9c4dbf2b17 100644
--- a/app/controllers/jira_connect/subscriptions_controller.rb
+++ b/app/controllers/jira_connect/subscriptions_controller.rb
@@ -22,6 +22,13 @@ class JiraConnect::SubscriptionsController < JiraConnect::ApplicationController
def index
@subscriptions = current_jira_installation.subscriptions.preload_namespace_route
+
+ respond_to do |format|
+ format.html
+ format.json do
+ render json: JiraConnect::AppDataSerializer.new(@subscriptions, !!current_user).as_json
+ end
+ end
end
def create