summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarka Kadlecová <jarka@gitlab.com>2018-02-09 11:18:53 +0100
committerJarka Kadlecová <jarka@gitlab.com>2018-02-09 13:02:29 +0100
commit7087e391aac9108822be08fbecc1fef9c62b6520 (patch)
tree9e0aa7b8a50bb6b4478f4634c87a387efc6b4bf6
parentfa0923ddfed657223d2e337693f4f2dc74cd7604 (diff)
downloadgitlab-ce-37050-ext-issue-tracker.tar.gz
Display a link to external issue tracker when enabled37050-ext-issue-tracker
-rw-r--r--app/helpers/projects_helper.rb4
-rw-r--r--app/models/project_services/jira_service.rb2
-rw-r--r--app/views/layouts/nav/sidebar/_project.html.haml13
-rw-r--r--changelogs/unreleased/37050-ext-issue-tracker.yml5
-rw-r--r--doc/user/project/integrations/bugzilla.md6
-rw-r--r--doc/user/project/integrations/jira.md2
-rw-r--r--doc/user/project/integrations/redmine.md2
-rw-r--r--spec/features/projects/services/user_activates_bugzilla_spec.rb86
-rw-r--r--spec/features/projects/services/user_activates_custom_tracker_spec.rb86
-rw-r--r--spec/features/projects/services/user_activates_jira_spec.rb31
-rw-r--r--spec/features/projects/services/user_activates_redmine_spec.rb86
11 files changed, 308 insertions, 15 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 6512617a02d..43c8b1b612b 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -296,6 +296,10 @@ module ProjectsHelper
nav_tabs << :pipelines
end
+ if project.external_issue_tracker
+ nav_tabs << :external_issue_tracker
+ end
+
tab_ability_map.each do |tab, ability|
if can?(current_user, ability, project)
nav_tabs << tab
diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb
index 30eafe31454..436a870b0c4 100644
--- a/app/models/project_services/jira_service.rb
+++ b/app/models/project_services/jira_service.rb
@@ -10,6 +10,8 @@ class JiraService < IssueTrackerService
before_update :reset_password
+ alias_method :project_url, :url
+
# This is confusing, but JiraService does not really support these events.
# The values here are required to display correct options in the service
# configuration screen.
diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml
index 2b98cb9de99..29e4df3c633 100644
--- a/app/views/layouts/nav/sidebar/_project.html.haml
+++ b/app/views/layouts/nav/sidebar/_project.html.haml
@@ -127,6 +127,19 @@
= link_to project_milestones_path(@project), title: 'Milestones' do
%span
Milestones
+ - if project_nav_tab? :external_issue_tracker
+ = nav_link do
+ - issue_tracker = @project.external_issue_tracker
+ = link_to issue_tracker.issue_tracker_path, class: 'shortcuts-external_tracker' do
+ .nav-icon-container
+ = sprite_icon('issue-external')
+ %span.nav-item-name
+ #{ issue_tracker.title }
+ %ul.sidebar-sub-level-items.is-fly-out-only
+ = nav_link(html_options: { class: "fly-out-top-item" } ) do
+ = link_to issue_tracker.issue_tracker_path do
+ %strong.fly-out-top-item-name
+ #{ issue_tracker.title }
- if project_nav_tab? :merge_requests
= nav_link(controller: @project.issues_enabled? ? :merge_requests : [:merge_requests, :labels, :milestones]) do
diff --git a/changelogs/unreleased/37050-ext-issue-tracker.yml b/changelogs/unreleased/37050-ext-issue-tracker.yml
new file mode 100644
index 00000000000..29bccdded02
--- /dev/null
+++ b/changelogs/unreleased/37050-ext-issue-tracker.yml
@@ -0,0 +1,5 @@
+---
+title: Display a link to external issue tracker when enabled
+merge_request:
+author:
+type: changed
diff --git a/doc/user/project/integrations/bugzilla.md b/doc/user/project/integrations/bugzilla.md
index ba2adc1afda..671804035cc 100644
--- a/doc/user/project/integrations/bugzilla.md
+++ b/doc/user/project/integrations/bugzilla.md
@@ -11,11 +11,7 @@ in the table below.
| `issues_url` | The URL to the issue in Bugzilla project that is linked to this GitLab project. Note that the `issues_url` requires `:id` in the URL. This ID is used by GitLab as a placeholder to replace the issue number. |
| `new_issue_url` | This is the URL to create a new issue in Bugzilla for the project linked to this GitLab project. Note that the `new_issue_url` requires PRODUCT_NAME to be updated with the product/project name in Bugzilla. |
-Once you have configured and enabled Bugzilla:
-
-- the **Issues** link on the GitLab project pages takes you to the appropriate
- Bugzilla product page
-- clicking **New issue** on the project dashboard takes you to Bugzilla for entering a new issue
+Once you have configured and enabled Bugzilla you'll see the Bugzilla link on the GitLab project pages that takes you to the appropriate Bugzilla project.
## Referencing issues in Bugzilla
diff --git a/doc/user/project/integrations/jira.md b/doc/user/project/integrations/jira.md
index f77569e4886..fc527663db0 100644
--- a/doc/user/project/integrations/jira.md
+++ b/doc/user/project/integrations/jira.md
@@ -116,7 +116,7 @@ in the table below.
| `Transition ID` | This is the ID of a transition that moves issues to a closed state. You can find this number under JIRA workflow administration ([see screenshot](img/jira_workflow_screenshot.png)). **Closing JIRA issues via commits or Merge Requests won't work if you don't set the ID correctly.** |
After saving the configuration, your GitLab project will be able to interact
-with all JIRA projects in your JIRA instance.
+with all JIRA projects in your JIRA instance and you'll see the JIRA link on the GitLab project pages that takes you to the appropriate JIRA project.
![JIRA service page](img/jira_service_page.png)
diff --git a/doc/user/project/integrations/redmine.md b/doc/user/project/integrations/redmine.md
index cc3218fbfd1..de2cf6d4647 100644
--- a/doc/user/project/integrations/redmine.md
+++ b/doc/user/project/integrations/redmine.md
@@ -12,6 +12,8 @@ in the table below.
| `issues_url` | The URL to the issue in Redmine project that is linked to this GitLab project. Note that the `issues_url` requires `:id` in the URL. This ID is used by GitLab as a placeholder to replace the issue number. |
| `new_issue_url` | This is the URL to create a new issue in Redmine for the project linked to this GitLab project. **This is currently not being used and will be removed in a future release.** |
+ Once you have configured and enabled Redmine you'll see the Redmine link on the GitLab project pages that takes you to the appropriate Redmine project.
+
As an example, below is a configuration for a project named gitlab-ci.
![Redmine configuration](img/redmine_configuration.png)
diff --git a/spec/features/projects/services/user_activates_bugzilla_spec.rb b/spec/features/projects/services/user_activates_bugzilla_spec.rb
new file mode 100644
index 00000000000..e49bd469aeb
--- /dev/null
+++ b/spec/features/projects/services/user_activates_bugzilla_spec.rb
@@ -0,0 +1,86 @@
+require 'spec_helper'
+
+describe 'User activates Bugzilla', :js do
+ let(:user) { create(:user) }
+ let(:project) { create(:project) }
+
+ let(:url) { 'http://bugzilla.example.com' }
+
+ def fill_form(active = true)
+ check 'Active' if active
+
+ fill_in 'service_project_url', with: url
+ fill_in 'service_issues_url', with: "#{url}/:id"
+ fill_in 'service_new_issue_url', with: url
+ end
+
+ before do
+ project.add_master(user)
+ sign_in(user)
+
+ visit project_settings_integrations_path(project)
+ end
+
+ describe 'user sets and activates Bugzilla Service' do
+ context 'when Bugzilla connection test succeeds' do
+ before do
+ stub_request(:head, url).to_return(headers: { 'Content-Type' => 'application/json' })
+
+ click_link('Bugzilla')
+ fill_form
+ click_button('Test settings and save changes')
+ wait_for_requests
+ end
+
+ it 'activates the Bugzilla service' do
+ expect(page).to have_content('Bugzilla activated.')
+ expect(current_path).to eq(project_settings_integrations_path(project))
+ end
+
+ it 'shows the Bugzilla link in the menu' do
+ page.within('.nav-sidebar') do
+ expect(page).to have_link('Bugzilla', href: url)
+ end
+ end
+ end
+
+ context 'when Bugzilla connection test fails' do
+ it 'activates the Bugzilla service' do
+ stub_request(:head, url).to_raise(HTTParty::Error)
+
+ click_link('Bugzilla')
+ fill_form
+ click_button('Test settings and save changes')
+ wait_for_requests
+
+ expect(find('.flash-container-page')).to have_content 'Test failed.'
+ expect(find('.flash-container-page')).to have_content 'Save anyway'
+
+ find('.flash-alert .flash-action').click
+ wait_for_requests
+
+ expect(page).to have_content('Bugzilla activated.')
+ expect(current_path).to eq(project_settings_integrations_path(project))
+ end
+ end
+ end
+
+ describe 'user sets Bugzilla Service but keeps it disabled' do
+ before do
+ click_link('Bugzilla')
+ fill_form(false)
+ click_button('Save changes')
+ end
+
+ it 'saves but does not activate the Bugzilla service' do
+ expect(page).to have_content('Bugzilla settings saved, but not activated.')
+ expect(current_path).to eq(project_settings_integrations_path(project))
+ end
+
+ it 'does not show the Bugzilla link in the menu' do
+ page.within('.nav-sidebar') do
+ expect(page).not_to have_link('Bugzilla', href: url)
+ end
+ end
+ end
+end
diff --git a/spec/features/projects/services/user_activates_custom_tracker_spec.rb b/spec/features/projects/services/user_activates_custom_tracker_spec.rb
new file mode 100644
index 00000000000..f085b6a1d15
--- /dev/null
+++ b/spec/features/projects/services/user_activates_custom_tracker_spec.rb
@@ -0,0 +1,86 @@
+require 'spec_helper'
+
+describe 'User activates Custom Issue Tracker', :js do
+ let(:user) { create(:user) }
+ let(:project) { create(:project) }
+
+ let(:url) { 'http://tracker.example.com' }
+
+ def fill_form(active = true)
+ check 'Active' if active
+
+ fill_in 'service_project_url', with: url
+ fill_in 'service_issues_url', with: "#{url}/:id"
+ fill_in 'service_new_issue_url', with: url
+ end
+
+ before do
+ project.add_master(user)
+ sign_in(user)
+
+ visit project_settings_integrations_path(project)
+ end
+
+ describe 'user sets and activates Custom Issue Tracker Service' do
+ context 'when Custom Issue Tracker connection test succeeds' do
+ before do
+ stub_request(:head, url).to_return(headers: { 'Content-Type' => 'application/json' })
+
+ click_link('Custom Issue Tracker')
+ fill_form
+ click_button('Test settings and save changes')
+ wait_for_requests
+ end
+
+ it 'activates the Custom Issue Tracker service' do
+ expect(page).to have_content('Custom Issue Tracker activated.')
+ expect(current_path).to eq(project_settings_integrations_path(project))
+ end
+
+ it 'shows the Custom Issue Tracker link in the menu' do
+ page.within('.nav-sidebar') do
+ expect(page).to have_link('Custom Issue Tracker', href: url)
+ end
+ end
+ end
+
+ context 'when Custom Issue Tracker connection test fails' do
+ it 'activates the Custom Issue Tracker service' do
+ stub_request(:head, url).to_raise(HTTParty::Error)
+
+ click_link('Custom Issue Tracker')
+ fill_form
+ click_button('Test settings and save changes')
+ wait_for_requests
+
+ expect(find('.flash-container-page')).to have_content 'Test failed.'
+ expect(find('.flash-container-page')).to have_content 'Save anyway'
+
+ find('.flash-alert .flash-action').click
+ wait_for_requests
+
+ expect(page).to have_content('Custom Issue Tracker activated.')
+ expect(current_path).to eq(project_settings_integrations_path(project))
+ end
+ end
+ end
+
+ describe 'user sets Custom Issue Tracker Service but keeps it disabled' do
+ before do
+ click_link('Custom Issue Tracker')
+ fill_form(false)
+ click_button('Save changes')
+ end
+
+ it 'saves but does not activate the Custom Issue Tracker service' do
+ expect(page).to have_content('Custom Issue Tracker settings saved, but not activated.')
+ expect(current_path).to eq(project_settings_integrations_path(project))
+ end
+
+ it 'does not show the Custom Issue Tracker link in the menu' do
+ page.within('.nav-sidebar') do
+ expect(page).not_to have_link('Custom Issue Tracker', href: url)
+ end
+ end
+ end
+end
diff --git a/spec/features/projects/services/user_activates_jira_spec.rb b/spec/features/projects/services/user_activates_jira_spec.rb
index 028669eeaf2..429128ec096 100644
--- a/spec/features/projects/services/user_activates_jira_spec.rb
+++ b/spec/features/projects/services/user_activates_jira_spec.rb
@@ -3,7 +3,6 @@ require 'spec_helper'
describe 'User activates Jira', :js do
let(:user) { create(:user) }
let(:project) { create(:project) }
- let(:service) { project.create_jira_service }
let(:url) { 'http://jira.example.com' }
let(:test_url) { 'http://jira.example.com/rest/api/2/serverInfo' }
@@ -26,7 +25,7 @@ describe 'User activates Jira', :js do
describe 'user sets and activates Jira Service' do
context 'when Jira connection test succeeds' do
- it 'activates the JIRA service' do
+ before do
server_info = { key: 'value' }.to_json
WebMock.stub_request(:get, test_url).with(basic_auth: %w(username password)).to_return(body: server_info)
@@ -34,10 +33,18 @@ describe 'User activates Jira', :js do
fill_form
click_button('Test settings and save changes')
wait_for_requests
+ end
+ it 'activates the JIRA service' do
expect(page).to have_content('JIRA activated.')
expect(current_path).to eq(project_settings_integrations_path(project))
end
+
+ it 'shows the JIRA link in the menu' do
+ page.within('.nav-sidebar') do
+ expect(page).to have_link('JIRA', href: url)
+ end
+ end
end
context 'when Jira connection test fails' do
@@ -75,14 +82,20 @@ describe 'User activates Jira', :js do
end
describe 'user sets Jira Service but keeps it disabled' do
- context 'when Jira connection test succeeds' do
- it 'activates the JIRA service' do
- click_link('JIRA')
- fill_form(false)
- click_button('Save changes')
+ before do
+ click_link('JIRA')
+ fill_form(false)
+ click_button('Save changes')
+ end
- expect(page).to have_content('JIRA settings saved, but not activated.')
- expect(current_path).to eq(project_settings_integrations_path(project))
+ it 'saves but does not activate the JIRA service' do
+ expect(page).to have_content('JIRA settings saved, but not activated.')
+ expect(current_path).to eq(project_settings_integrations_path(project))
+ end
+
+ it 'does not show the JIRA link in the menu' do
+ page.within('.nav-sidebar') do
+ expect(page).not_to have_link('JIRA', href: url)
end
end
end
diff --git a/spec/features/projects/services/user_activates_redmine_spec.rb b/spec/features/projects/services/user_activates_redmine_spec.rb
new file mode 100644
index 00000000000..92b4981f3db
--- /dev/null
+++ b/spec/features/projects/services/user_activates_redmine_spec.rb
@@ -0,0 +1,86 @@
+require 'spec_helper'
+
+describe 'User activates Redmine', :js do
+ let(:user) { create(:user) }
+ let(:project) { create(:project) }
+
+ let(:url) { 'http://redmine.example.com' }
+
+ def fill_form(active = true)
+ check 'Active' if active
+
+ fill_in 'service_project_url', with: url
+ fill_in 'service_issues_url', with: "#{url}/:id"
+ fill_in 'service_new_issue_url', with: url
+ end
+
+ before do
+ project.add_master(user)
+ sign_in(user)
+
+ visit project_settings_integrations_path(project)
+ end
+
+ describe 'user sets and activates Redmine Service' do
+ context 'when Redmine connection test succeeds' do
+ before do
+ stub_request(:head, url).to_return(headers: { 'Content-Type' => 'application/json' })
+
+ click_link('Redmine')
+ fill_form
+ click_button('Test settings and save changes')
+ wait_for_requests
+ end
+
+ it 'activates the Redmine service' do
+ expect(page).to have_content('Redmine activated.')
+ expect(current_path).to eq(project_settings_integrations_path(project))
+ end
+
+ it 'shows the Redmine link in the menu' do
+ page.within('.nav-sidebar') do
+ expect(page).to have_link('Redmine', href: url)
+ end
+ end
+ end
+
+ context 'when Redmine connection test fails' do
+ it 'activates the Redmine service' do
+ stub_request(:head, url).to_raise(HTTParty::Error)
+
+ click_link('Redmine')
+ fill_form
+ click_button('Test settings and save changes')
+ wait_for_requests
+
+ expect(find('.flash-container-page')).to have_content 'Test failed.'
+ expect(find('.flash-container-page')).to have_content 'Save anyway'
+
+ find('.flash-alert .flash-action').click
+ wait_for_requests
+
+ expect(page).to have_content('Redmine activated.')
+ expect(current_path).to eq(project_settings_integrations_path(project))
+ end
+ end
+ end
+
+ describe 'user sets Redmine Service but keeps it disabled' do
+ before do
+ click_link('Redmine')
+ fill_form(false)
+ click_button('Save changes')
+ end
+
+ it 'saves but does not activate the Redmine service' do
+ expect(page).to have_content('Redmine settings saved, but not activated.')
+ expect(current_path).to eq(project_settings_integrations_path(project))
+ end
+
+ it 'does not show the Redmine link in the menu' do
+ page.within('.nav-sidebar') do
+ expect(page).not_to have_link('Redmine', href: url)
+ end
+ end
+ end
+end