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
Webhooks %h4.prepend-top-0
= page_title
%p.light %p
#{link_to "Webhooks ", help_page_path("web_hooks", "web_hooks"), class: "vlink"} can be #{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}. used for binding events when something is happening within the #{context_title}.
.col-lg-9.append-bottom-default
%hr.clearfix = form_for hook, as: :hook, url: polymorphic_path(url_components + [:hooks]) do |f|
= form_for hook, as: :hook, url: polymorphic_path(url_components + [:hooks]), html: { class: 'form-horizontal' } do |f|
= form_errors(hook) = form_errors(hook)
.form-group .form-group
= f.label :url, "URL", class: 'control-label' = f.label :url, "URL", class: 'label-light'
.col-sm-10
= f.text_field :url, class: "form-control", placeholder: 'http://example.com/trigger-ci.json' = f.text_field :url, class: "form-control", placeholder: 'http://example.com/trigger-ci.json'
.form-group .form-group
= f.label :token, "Secret Token", class: 'label-light' = f.label :token, "Secret Token", class: 'label-light'
...@@ -24,44 +21,44 @@ ...@@ -24,44 +21,44 @@
%p.help-block %p.help-block
Use this token to validate received payloads Use this token to validate received payloads
.form-group .form-group
= f.label :url, "Trigger", class: 'control-label' = f.label :url, "Trigger", class: 'label-light'
.col-sm-10.prepend-top-10 %ul.list-unstyled
%div %li
= f.check_box :push_events, class: 'pull-left' = f.check_box :push_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :push_events, class: 'list-label' do = f.label :push_events, class: 'list-label' do
%strong Push events %strong Push events
%p.light %p.light
This url will be triggered by a push to the repository This url will be triggered by a push to the repository
%div %li
= f.check_box :tag_push_events, class: 'pull-left' = f.check_box :tag_push_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :tag_push_events, class: 'list-label' do = f.label :tag_push_events, class: 'list-label' do
%strong Tag push events %strong Tag push events
%p.light %p.light
This url will be triggered when a new tag is pushed to the repository This url will be triggered when a new tag is pushed to the repository
%div %li
= f.check_box :note_events, class: 'pull-left' = f.check_box :note_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :note_events, class: 'list-label' do = f.label :note_events, class: 'list-label' do
%strong Comments %strong Comments
%p.light %p.light
This url will be triggered when someone adds a comment This url will be triggered when someone adds a comment
%div %li
= f.check_box :issues_events, class: 'pull-left' = f.check_box :issues_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :issues_events, class: 'list-label' do = f.label :issues_events, class: 'list-label' do
%strong Issues events %strong Issues events
%p.light %p.light
This url will be triggered when an issue is created/updated/merged This url will be triggered when an issue is created/updated/merged
%div %li
= f.check_box :merge_requests_events, class: 'pull-left' = f.check_box :merge_requests_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :merge_requests_events, class: 'list-label' do = f.label :merge_requests_events, class: 'list-label' do
%strong Merge Request events %strong Merge Request events
%p.light %p.light
This url will be triggered when a merge request is created/updated/merged This url will be triggered when a merge request is created/updated/merged
%div %li
= f.check_box :build_events, class: 'pull-left' = f.check_box :build_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :build_events, class: 'list-label' do = f.label :build_events, class: 'list-label' do
...@@ -69,29 +66,33 @@ ...@@ -69,29 +66,33 @@
%p.light %p.light
This url will be triggered when the build status changes This url will be triggered when the build status changes
.form-group .form-group
= f.label :enable_ssl_verification, "SSL verification", class: 'control-label checkbox' = f.label :enable_ssl_verification, "SSL verification", class: 'label-light checkbox'
.col-sm-10
.checkbox .checkbox
= f.label :enable_ssl_verification do = f.label :enable_ssl_verification do
= f.check_box :enable_ssl_verification = f.check_box :enable_ssl_verification
%strong Enable SSL verification %strong Enable SSL verification
.form-actions
= f.submit "Add Webhook", class: "btn btn-create" = f.submit "Add Webhook", class: "btn btn-create"
%hr
-if hooks.any? %h5.prepend-top-default
.panel.panel-default
.panel-heading
Webhooks (#{hooks.count}) Webhooks (#{hooks.count})
%ul.content-list - if hooks.any?
%ul.well-list
- hooks.each do |hook| - hooks.each do |hook|
%li %li
.controls .row
= link_to 'Test Hook', polymorphic_path(url_components + [hook], action: :test), class: "btn btn-sm btn-grouped" .col-md-8.col-lg-7
= link_to 'Remove', polymorphic_path(url_components + [hook]), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove btn-sm btn-grouped" %strong.light-header= hook.url
%p
.monospace= hook.url
%div %div
- %w(push_events tag_push_events issues_events note_events merge_requests_events build_events).each do |hook_type| - %w(push_events tag_push_events issues_events note_events merge_requests_events build_events).each do |trigger|
- if hook.send(hook_type) - if hook.send(trigger)
%span.label.label-gray= hook_type.titleize %span.label.label-gray.deploy-project-label= trigger.titleize
%span.label.label-gray SSL Verification: #{hook.enable_ssl_verification ? "enabled" : "disabled"} .col-md-4.col-lg-5.text-right-lg.prepend-top-5
%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