2019-02-18 17:08:36 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class YoutrackService < IssueTrackerService
|
2019-02-21 10:39:44 +00:00
|
|
|
validates :project_url, :issues_url, presence: true, public_url: true, if: :activated?
|
2019-02-18 17:08:36 +00:00
|
|
|
|
2019-06-03 12:52:54 +00:00
|
|
|
# {PROJECT-KEY}-{NUMBER} Examples: YT-1, PRJ-1, gl-030
|
2019-02-18 17:08:36 +00:00
|
|
|
def self.reference_pattern(only_long: false)
|
|
|
|
if only_long
|
2020-02-14 12:09:03 +00:00
|
|
|
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+\b)/
|
2019-02-18 17:08:36 +00:00
|
|
|
else
|
2020-02-18 12:09:15 +00:00
|
|
|
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+\b)|(#{Issue.reference_prefix}#{Gitlab::Regex.issue})/
|
2019-02-18 17:08:36 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-06-22 12:08:47 +00:00
|
|
|
def title
|
2019-02-21 10:39:44 +00:00
|
|
|
'YouTrack'
|
2019-02-18 17:08:36 +00:00
|
|
|
end
|
|
|
|
|
2020-06-22 12:08:47 +00:00
|
|
|
def description
|
2019-06-26 14:03:57 +00:00
|
|
|
s_('IssueTracker|YouTrack issue tracker')
|
2019-02-18 17:08:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.to_param
|
|
|
|
'youtrack'
|
|
|
|
end
|
2019-02-21 10:39:44 +00:00
|
|
|
|
|
|
|
def fields
|
|
|
|
[
|
2020-05-07 00:11:11 +00:00
|
|
|
{ type: 'text', name: 'project_url', title: 'Project URL', placeholder: 'Project URL', required: true },
|
|
|
|
{ type: 'text', name: 'issues_url', title: 'Issue URL', placeholder: 'Issue URL', required: true }
|
2019-02-21 10:39:44 +00:00
|
|
|
]
|
|
|
|
end
|
2019-02-18 17:08:36 +00:00
|
|
|
end
|