Commit 14c2c573 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'project-webhooks-ui' into 'master'

Project webhooks updated UI

Closes #13993 

![Screen_Shot_2016-04-26_at_10.55.52](/uploads/684f79be18f8a69e9b5cbcca2c9b20e8/Screen_Shot_2016-04-26_at_10.55.52.png)

![Screen_Shot_2016-04-26_at_10.55.37](/uploads/9b9f3a8a243dec955f23967e20ec514f/Screen_Shot_2016-04-26_at_10.55.37.png)

See merge request !3922
parents bdcba438 b651303e
...@@ -205,6 +205,10 @@ h1, h2, h3, h4, h5, h6 { ...@@ -205,6 +205,10 @@ h1, h2, h3, h4, h5, h6 {
font-weight: 600; font-weight: 600;
} }
.light-header {
font-weight: 600;
}
/** CODE **/ /** CODE **/
pre { pre {
font-family: $monospace_font; font-family: $monospace_font;
...@@ -259,3 +263,9 @@ h1, h2, h3, h4 { ...@@ -259,3 +263,9 @@ h1, h2, h3, h4 {
color: $gl-gray; color: $gl-gray;
} }
} }
.text-right-lg {
@media (min-width: $screen-lg-min) {
text-align: right;
}
}
%li
.row
.col-md-8.col-lg-7
%strong.light-header= hook.url
%div
- %w(push_events tag_push_events issues_events note_events merge_requests_events build_events).each do |trigger|
- if hook.send(trigger)
%span.label.label-gray.deploy-project-label= trigger.titleize
.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", test_namespace_project_hook_path(@project.namespace, @project, hook), class: "btn btn-sm"
= link_to namespace_project_hook_path(@project.namespace, @project, hook), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-transparent" do
%span.sr-only Remove
= icon('trash')
- page_title "Webhooks" - page_title "Webhooks"
%h3.page-title .row.prepend-top-default
Webhooks .col-lg-3.profile-settings-sidebar
%h4.prepend-top-0
= page_title
%p
#{link_to "Webhooks", help_page_path("web_hooks", "web_hooks")} can be
used for binding events when something is happening within the project.
.col-lg-9.append-bottom-default
%h5.prepend-top-0
Add new webhook
= form_for [@project.namespace.becomes(Namespace), @project, @hook], as: :hook, url: namespace_project_hooks_path(@project.namespace, @project) do |f|
= form_errors(@hook)
%p.light .form-group
#{link_to "Webhooks ", help_page_path("web_hooks", "web_hooks"), class: "vlink"} can be = f.label :url, "URL", class: "label-light"
used for binding events when something is happening within the project. = f.text_field :url, class: "form-control", placeholder: "http://example.com/trigger-ci.json"
.form-group
%hr.clearfix = f.label :url, "Trigger", class: "label-light"
%div
= form_for [@project.namespace.becomes(Namespace), @project, @hook], as: :hook, url: namespace_project_hooks_path(@project.namespace, @project), html: { class: 'form-horizontal' } do |f| = f.check_box :push_events, class: "pull-left"
= form_errors(@hook) .prepend-left-20
= f.label :push_events, class: "label-light append-bottom-0" do
.form-group Push events
= f.label :url, "URL", class: 'control-label' %p.light
.col-sm-10 This url will be triggered by a push to the repository
= f.text_field :url, class: "form-control", placeholder: 'http://example.com/trigger-ci.json' %div
.form-group = f.check_box :tag_push_events, class: "pull-left"
= f.label :url, "Trigger", class: 'control-label' .prepend-left-20
.col-sm-10.prepend-top-10 = f.label :tag_push_events, class: "label-light append-bottom-0" do
%div Tag push events
= f.check_box :push_events, class: 'pull-left' %p.light
.prepend-left-20 This url will be triggered when a new tag is pushed to the repository
= f.label :push_events, class: 'list-label' do %div
%strong Push events = f.check_box :note_events, class: "pull-left"
%p.light .prepend-left-20
This url will be triggered by a push to the repository = f.label :note_events, class: "label-light append-bottom-0" do
%div Comments
= f.check_box :tag_push_events, class: 'pull-left' %p.light
.prepend-left-20 This url will be triggered when someone adds a comment
= f.label :tag_push_events, class: 'list-label' do %div
%strong Tag push events = f.check_box :issues_events, class: "pull-left"
%p.light .prepend-left-20
This url will be triggered when a new tag is pushed to the repository = f.label :issues_events, class: "label-light append-bottom-0" do
%div Issues events
= f.check_box :note_events, class: 'pull-left' %p.light
.prepend-left-20 This url will be triggered when an issue is created/updated/merged
= f.label :note_events, class: 'list-label' do %div
%strong Comments = f.check_box :merge_requests_events, class: "pull-left"
%p.light .prepend-left-20
This url will be triggered when someone adds a comment = f.label :merge_requests_events, class: "label-light append-bottom-0" do
%div Merge Request events
= f.check_box :issues_events, class: 'pull-left' %p.light
.prepend-left-20 This url will be triggered when a merge request is created/updated/merged
= f.label :issues_events, class: 'list-label' do %div
%strong Issues events = f.check_box :build_events, class: "pull-left"
%p.light .prepend-left-20
This url will be triggered when an issue is created/updated/merged = f.label :build_events, class: "label-light append-bottom-0" do
%div Build events
= f.check_box :merge_requests_events, class: 'pull-left' %p.light
.prepend-left-20 This url will be triggered when the build status changes
= f.label :merge_requests_events, class: 'list-label' do .form-group
%strong Merge Request events = f.label :enable_ssl_verification, "SSL verification", class: "label-light"
%p.light %div
This url will be triggered when a merge request is created/updated/merged = f.check_box :enable_ssl_verification, class: "pull-left"
%div .prepend-left-20
= f.check_box :build_events, class: 'pull-left' = f.label :enable_ssl_verification, class: "label-light append-bottom-0" do
.prepend-left-20 Enable SSL verification
= f.label :build_events, class: 'list-label' do = f.submit "Add Webhook", class: "btn btn-create"
%strong Build events %hr
%p.light %h5.prepend-top-default
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 = render "project_hook", hook: hook
= link_to 'Test Hook', test_namespace_project_hook_path(@project.namespace, @project, hook), class: "btn btn-sm btn-grouped" - else
= link_to 'Remove', namespace_project_hook_path(@project.namespace, @project, hook), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove btn-sm btn-grouped" %p.profile-settings-message.text-center.append-bottom-0
.monospace= hook.url No webhooks found, add one in the form above.
%div
- %w(push_events tag_push_events issues_events note_events merge_requests_events build_events).each do |trigger|
- if hook.send(trigger)
%span.label.label-gray= trigger.titleize
%span.label.label-gray SSL Verification: #{hook.enable_ssl_verification ? "enabled" : "disabled"}
...@@ -48,12 +48,12 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps ...@@ -48,12 +48,12 @@ class Spinach::Features::ProjectHooks < 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