2016-07-06 16:52:00 -04:00
|
|
|
module ServicesHelper
|
|
|
|
def service_event_description(event)
|
|
|
|
case event
|
2016-12-27 07:44:24 -05:00
|
|
|
when "push", "push_events"
|
2016-07-13 15:49:47 -04:00
|
|
|
"Event will be triggered by a push to the repository"
|
2016-12-27 07:44:24 -05:00
|
|
|
when "tag_push", "tag_push_events"
|
2016-07-13 15:49:47 -04:00
|
|
|
"Event will be triggered when a new tag is pushed to the repository"
|
2016-12-27 07:44:24 -05:00
|
|
|
when "note", "note_events"
|
2016-07-13 15:49:47 -04:00
|
|
|
"Event will be triggered when someone adds a comment"
|
2016-12-27 07:44:24 -05:00
|
|
|
when "issue", "issue_events"
|
2016-08-30 17:39:25 -04:00
|
|
|
"Event will be triggered when an issue is created/updated/closed"
|
2016-12-27 07:44:24 -05:00
|
|
|
when "confidential_issue", "confidential_issue_events"
|
2016-08-30 17:39:25 -04:00
|
|
|
"Event will be triggered when a confidential issue is created/updated/closed"
|
2016-12-27 07:44:24 -05:00
|
|
|
when "merge_request", "merge_request_events"
|
2016-07-13 15:49:47 -04:00
|
|
|
"Event will be triggered when a merge request is created/updated/merged"
|
2017-04-25 07:23:13 -04:00
|
|
|
when "pipeline", "pipeline_events"
|
|
|
|
"Event will be triggered when a pipeline status changes"
|
2016-12-27 07:44:24 -05:00
|
|
|
when "wiki_page", "wiki_page_events"
|
2016-07-13 15:49:47 -04:00
|
|
|
"Event will be triggered when a wiki page is created/updated"
|
2016-12-27 07:44:24 -05:00
|
|
|
when "commit", "commit_events"
|
2016-11-14 16:30:01 -05:00
|
|
|
"Event will be triggered when a commit is created/updated"
|
2016-07-06 16:52:00 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def service_event_field_name(event)
|
2016-08-30 17:39:25 -04:00
|
|
|
event = event.pluralize if %w[merge_request issue confidential_issue].include?(event)
|
2016-07-06 16:52:00 -04:00
|
|
|
"#{event}_events"
|
|
|
|
end
|
2017-01-12 17:33:04 -05:00
|
|
|
|
2018-01-04 04:33:51 -05:00
|
|
|
def service_save_button(service)
|
|
|
|
button_tag(class: 'btn btn-save', type: 'submit', disabled: service.deprecated?) do
|
|
|
|
icon('spinner spin', class: 'hidden js-btn-spinner') +
|
|
|
|
content_tag(:span, 'Save changes', class: 'js-btn-label')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def disable_fields_service?(service)
|
|
|
|
!current_controller?("admin/services") && service.deprecated?
|
|
|
|
end
|
|
|
|
|
2017-01-12 17:33:04 -05:00
|
|
|
extend self
|
2016-07-06 16:52:00 -04:00
|
|
|
end
|