2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
module ServicesHelper
|
|
|
|
def service_event_description(event)
|
|
|
|
case event
|
2017-08-17 22:00:37 +05:30
|
|
|
when "push", "push_events"
|
2016-08-24 12:49:21 +05:30
|
|
|
"Event will be triggered by a push to the repository"
|
2017-08-17 22:00:37 +05:30
|
|
|
when "tag_push", "tag_push_events"
|
2016-08-24 12:49:21 +05:30
|
|
|
"Event will be triggered when a new tag is pushed to the repository"
|
2017-08-17 22:00:37 +05:30
|
|
|
when "note", "note_events"
|
2016-08-24 12:49:21 +05:30
|
|
|
"Event will be triggered when someone adds a comment"
|
2018-04-05 14:03:07 +05:30
|
|
|
when "confidential_note", "confidential_note_events"
|
|
|
|
"Event will be triggered when someone adds a comment on a confidential issue"
|
2017-08-17 22:00:37 +05:30
|
|
|
when "issue", "issue_events"
|
2016-09-29 09:46:39 +05:30
|
|
|
"Event will be triggered when an issue is created/updated/closed"
|
2018-04-05 14:03:07 +05:30
|
|
|
when "confidential_issue", "confidential_issues_events"
|
2016-09-29 09:46:39 +05:30
|
|
|
"Event will be triggered when a confidential issue is created/updated/closed"
|
2017-08-17 22:00:37 +05:30
|
|
|
when "merge_request", "merge_request_events"
|
2016-08-24 12:49:21 +05:30
|
|
|
"Event will be triggered when a merge request is created/updated/merged"
|
2017-08-17 22:00:37 +05:30
|
|
|
when "pipeline", "pipeline_events"
|
|
|
|
"Event will be triggered when a pipeline status changes"
|
|
|
|
when "wiki_page", "wiki_page_events"
|
2016-08-24 12:49:21 +05:30
|
|
|
"Event will be triggered when a wiki page is created/updated"
|
2017-08-17 22:00:37 +05:30
|
|
|
when "commit", "commit_events"
|
|
|
|
"Event will be triggered when a commit is created/updated"
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def service_event_field_name(event)
|
2016-09-29 09:46:39 +05:30
|
|
|
event = event.pluralize if %w[merge_request issue confidential_issue].include?(event)
|
2016-08-24 12:49:21 +05:30
|
|
|
"#{event}_events"
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def service_save_button(service)
|
2018-12-05 23:21:45 +05:30
|
|
|
button_tag(class: 'btn btn-success', type: 'submit', disabled: service.deprecated?) do
|
2018-03-17 18:26:18 +05:30
|
|
|
icon('spinner spin', class: 'hidden js-btn-spinner') +
|
|
|
|
content_tag(:span, 'Save changes', class: 'js-btn-label')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def disable_fields_service?(service)
|
2019-10-12 21:52:04 +05:30
|
|
|
!current_controller?("admin/services") && service.deprecated?
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
extend self
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|