summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2016-11-04 19:34:24 +0000
committerSean McGivern <sean@mcgivern.me.uk>2016-11-04 19:34:24 +0000
commitd0b28cd0616e84861bc6f3ed7e0b6becb371a3f5 (patch)
tree06b27a513f8c3cc0c1171c7cabc8e2f1e7cbabc9 /app
parent8d0d8b91e46573e8fe46dc712e84c65708a00b97 (diff)
parent8c2143a0a7330768211b8a03a6693ac823679339 (diff)
downloadgitlab-ce-d0b28cd0616e84861bc6f3ed7e0b6becb371a3f5.tar.gz
Merge branch 'issue_23032' into 'master'
Allow to test JIRA service when project does not have repository closes #23032 See merge request !7162
Diffstat (limited to 'app')
-rw-r--r--app/models/project_services/jira_service.rb15
-rw-r--r--app/views/projects/services/_form.html.haml7
2 files changed, 20 insertions, 2 deletions
diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb
index 0a493b7a12b..2dbe0075465 100644
--- a/app/models/project_services/jira_service.rb
+++ b/app/models/project_services/jira_service.rb
@@ -163,6 +163,21 @@ class JiraService < IssueTrackerService
add_comment(data, issue_key)
end
+ # reason why service cannot be tested
+ def disabled_title
+ "Please fill in Password and Username."
+ end
+
+ def can_test?
+ username.present? && password.present?
+ end
+
+ # JIRA does not need test data.
+ # We are requesting the project that belongs to the project key.
+ def test_data(user = nil, project = nil)
+ nil
+ end
+
def test_settings
return unless url.present?
# Test settings by getting the project
diff --git a/app/views/projects/services/_form.html.haml b/app/views/projects/services/_form.html.haml
index 752fbc21a11..b41edeb2c7e 100644
--- a/app/views/projects/services/_form.html.haml
+++ b/app/views/projects/services/_form.html.haml
@@ -12,6 +12,9 @@
= form.submit 'Save changes', class: 'btn btn-save'
&nbsp;
- if @service.valid? && @service.activated?
- - disabled = @service.can_test? ? '':'disabled'
- = link_to 'Test settings', test_namespace_project_service_path(@project.namespace, @project, @service), class: "btn #{disabled}", title: @service.disabled_title
+ - unless @service.can_test?
+ - disabled_class = 'disabled'
+ - disabled_title = @service.disabled_title
+
+ = link_to 'Test settings', test_namespace_project_service_path(@project.namespace, @project, @service), class: "btn #{disabled_class}", title: disabled_title
= link_to "Cancel", namespace_project_services_path(@project.namespace, @project), class: "btn btn-cancel"