Commit 22a24f32 authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'master' into 8-8-stable-ee

parents 8b0e73ec 6044679d
- page_title "Webhooks" - page_title "Webhooks"
- context_title = @project ? 'project' : 'group' - context_title = @project ? 'project' : 'group'
%h3.page-title .row.prepend-top-default
.col-lg-3
%h4.prepend-top-0
= page_title
%p
#{link_to "Webhooks ", help_page_path("web_hooks", "web_hooks"), class: "vlink"} can be
used for binding events when something is happening within the #{context_title}.
.col-lg-9.append-bottom-default
= form_for hook, as: :hook, url: polymorphic_path(url_components + [:hooks]) do |f|
= form_errors(hook)
Webhooks .form-group
= f.label :url, "URL", class: 'label-light'
%p.light = f.text_field :url, class: "form-control", placeholder: 'http://example.com/trigger-ci.json'
#{link_to "Webhooks ", help_page_path("web_hooks", "web_hooks"), class: "vlink"} can be .form-group
used for binding events when something is happening within the #{context_title}. = f.label :token, "Secret Token", class: 'label-light'
= f.text_field :token, class: "form-control", placeholder: ''
%hr.clearfix %p.help-block
Use this token to validate received payloads
= form_for hook, as: :hook, url: polymorphic_path(url_components + [:hooks]), html: { class: 'form-horizontal' } do |f| .form-group
= form_errors(hook) = f.label :url, "Trigger", class: 'label-light'
%ul.list-unstyled
.form-group %li
= f.label :url, "URL", class: 'control-label' = f.check_box :push_events, class: 'pull-left'
.col-sm-10 .prepend-left-20
= f.text_field :url, class: "form-control", placeholder: 'http://example.com/trigger-ci.json' = f.label :push_events, class: 'list-label' do
.form-group %strong Push events
= f.label :token, "Secret Token", class: 'label-light' %p.light
= f.text_field :token, class: "form-control", placeholder: '' This url will be triggered by a push to the repository
%p.help-block %li
Use this token to validate received payloads = f.check_box :tag_push_events, class: 'pull-left'
.form-group .prepend-left-20
= f.label :url, "Trigger", class: 'control-label' = f.label :tag_push_events, class: 'list-label' do
.col-sm-10.prepend-top-10 %strong Tag push events
%div %p.light
= f.check_box :push_events, class: 'pull-left' This url will be triggered when a new tag is pushed to the repository
.prepend-left-20 %li
= f.label :push_events, class: 'list-label' do = f.check_box :note_events, class: 'pull-left'
%strong Push events .prepend-left-20
%p.light = f.label :note_events, class: 'list-label' do
This url will be triggered by a push to the repository %strong Comments
%div %p.light
= f.check_box :tag_push_events, class: 'pull-left' This url will be triggered when someone adds a comment
.prepend-left-20 %li
= f.label :tag_push_events, class: 'list-label' do = f.check_box :issues_events, class: 'pull-left'
%strong Tag push events .prepend-left-20
%p.light = f.label :issues_events, class: 'list-label' do
This url will be triggered when a new tag is pushed to the repository %strong Issues events
%div %p.light
= f.check_box :note_events, class: 'pull-left' This url will be triggered when an issue is created/updated/merged
.prepend-left-20 %li
= f.label :note_events, class: 'list-label' do = f.check_box :merge_requests_events, class: 'pull-left'
%strong Comments .prepend-left-20
%p.light = f.label :merge_requests_events, class: 'list-label' do
This url will be triggered when someone adds a comment %strong Merge Request events
%div %p.light
= f.check_box :issues_events, class: 'pull-left' This url will be triggered when a merge request is created/updated/merged
.prepend-left-20 %li
= f.label :issues_events, class: 'list-label' do = f.check_box :build_events, class: 'pull-left'
%strong Issues events .prepend-left-20
%p.light = f.label :build_events, class: 'list-label' do
This url will be triggered when an issue is created/updated/merged %strong Build events
%div %p.light
= f.check_box :merge_requests_events, class: 'pull-left' This url will be triggered when the build status changes
.prepend-left-20 .form-group
= f.label :merge_requests_events, class: 'list-label' do = f.label :enable_ssl_verification, "SSL verification", class: 'label-light checkbox'
%strong Merge Request events .checkbox
%p.light = f.label :enable_ssl_verification do
This url will be triggered when a merge request is created/updated/merged = f.check_box :enable_ssl_verification
%div %strong Enable SSL verification
= f.check_box :build_events, class: 'pull-left' = f.submit "Add Webhook", class: "btn btn-create"
.prepend-left-20 %hr
= f.label :build_events, class: 'list-label' do %h5.prepend-top-default
%strong Build events
%p.light
This url will be triggered when the build status changes
.form-group
= f.label :enable_ssl_verification, "SSL verification", class: 'control-label checkbox'
.col-sm-10
.checkbox
= f.label :enable_ssl_verification do
= f.check_box :enable_ssl_verification
%strong Enable SSL verification
.form-actions
= f.submit "Add Webhook", class: "btn btn-create"
-if hooks.any?
.panel.panel-default
.panel-heading
Webhooks (#{hooks.count}) Webhooks (#{hooks.count})
%ul.content-list - if hooks.any?
- hooks.each do |hook| %ul.well-list
%li - hooks.each do |hook|
.controls %li
= link_to 'Test Hook', polymorphic_path(url_components + [hook], action: :test), class: "btn btn-sm btn-grouped" .row
= link_to 'Remove', polymorphic_path(url_components + [hook]), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove btn-sm btn-grouped" .col-md-8.col-lg-7
%p %strong.light-header= hook.url
.monospace= hook.url %div
%div - %w(push_events tag_push_events issues_events note_events merge_requests_events build_events).each do |trigger|
- %w(push_events tag_push_events issues_events note_events merge_requests_events build_events).each do |hook_type| - if hook.send(trigger)
- if hook.send(hook_type) %span.label.label-gray.deploy-project-label= trigger.titleize
%span.label.label-gray= hook_type.titleize .col-md-4.col-lg-5.text-right-lg.prepend-top-5
%span.label.label-gray SSL Verification: #{hook.enable_ssl_verification ? "enabled" : "disabled"} %span.append-right-10.inline
SSL Verification: #{hook.enable_ssl_verification ? "enabled" : "disabled"}
= link_to 'Test', polymorphic_path(url_components + [hook], action: :test), class: "btn btn-sm"
= link_to polymorphic_path(url_components + [hook]), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-transparent" do
%span.sr-only Remove
= icon('trash')
- else
%p.settings-message.text-center.append-bottom-0
No webhooks found, add one in the form above.
...@@ -44,12 +44,12 @@ class Spinach::Features::GroupHooks < Spinach::FeatureSteps ...@@ -44,12 +44,12 @@ class Spinach::Features::GroupHooks < Spinach::FeatureSteps
step 'I click test hook button' do step 'I click test hook button' do
stub_request(:post, @hook.url).to_return(status: 200) stub_request(:post, @hook.url).to_return(status: 200)
click_link 'Test Hook' click_link 'Test'
end end
step 'I click test hook button with invalid URL' do step 'I click test hook button with invalid URL' do
stub_request(:post, @hook.url).to_raise(SocketError) stub_request(:post, @hook.url).to_raise(SocketError)
click_link 'Test Hook' click_link 'Test'
end end
step 'hook should be triggered' do step 'hook should be triggered' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment