Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
c293cc91
Commit
c293cc91
authored
Oct 05, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move CI web hooks page to project settings area
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
0de7c83a
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
87 additions
and
68 deletions
+87
-68
CHANGELOG
CHANGELOG
+1
-0
app/controllers/ci/web_hooks_controller.rb
app/controllers/ci/web_hooks_controller.rb
+0
-53
app/controllers/projects/ci_web_hooks_controller.rb
app/controllers/projects/ci_web_hooks_controller.rb
+45
-0
app/views/layouts/ci/_nav_project.html.haml
app/views/layouts/ci/_nav_project.html.haml
+0
-5
app/views/layouts/nav/_project_settings.html.haml
app/views/layouts/nav/_project_settings.html.haml
+5
-0
app/views/projects/ci_web_hooks/index.html.haml
app/views/projects/ci_web_hooks/index.html.haml
+4
-4
config/routes.rb
config/routes.rb
+5
-6
spec/features/ci_web_hooks_spec.rb
spec/features/ci_web_hooks_spec.rb
+27
-0
No files found.
CHANGELOG
View file @
c293cc91
...
@@ -29,6 +29,7 @@ v 8.1.0 (unreleased)
...
@@ -29,6 +29,7 @@ v 8.1.0 (unreleased)
- Ensure code blocks are properly highlighted after a note is updated
- Ensure code blocks are properly highlighted after a note is updated
- Fix wrong access level badge on MR comments
- Fix wrong access level badge on MR comments
- Hide password in the service settings form
- Hide password in the service settings form
- Move CI web hooks page to project settings area
v 8.0.3
v 8.0.3
- Fix URL shown in Slack notifications
- Fix URL shown in Slack notifications
...
...
app/controllers/ci/web_hooks_controller.rb
deleted
100644 → 0
View file @
0de7c83a
module
Ci
class
WebHooksController
<
Ci
::
ApplicationController
before_action
:authenticate_user!
before_action
:project
before_action
:authorize_access_project!
before_action
:authorize_manage_project!
layout
'ci/project'
def
index
@web_hooks
=
@project
.
web_hooks
@web_hook
=
Ci
::
WebHook
.
new
end
def
create
@web_hook
=
@project
.
web_hooks
.
new
(
web_hook_params
)
@web_hook
.
save
if
@web_hook
.
valid?
redirect_to
ci_project_web_hooks_path
(
@project
)
else
@web_hooks
=
@project
.
web_hooks
.
select
(
&
:persisted?
)
render
:index
end
end
def
test
Ci
::
TestHookService
.
new
.
execute
(
hook
,
current_user
)
redirect_to
:back
end
def
destroy
hook
.
destroy
redirect_to
ci_project_web_hooks_path
(
@project
)
end
private
def
hook
@web_hook
||=
@project
.
web_hooks
.
find
(
params
[
:id
])
end
def
project
@project
=
Ci
::
Project
.
find
(
params
[
:project_id
])
end
def
web_hook_params
params
.
require
(
:web_hook
).
permit
(
:url
)
end
end
end
app/controllers/projects/ci_web_hooks_controller.rb
0 → 100644
View file @
c293cc91
class
Projects::CiWebHooksController
<
Projects
::
ApplicationController
before_action
:ci_project
before_action
:authorize_admin_project!
layout
"project_settings"
def
index
@web_hooks
=
@ci_project
.
web_hooks
@web_hook
=
Ci
::
WebHook
.
new
end
def
create
@web_hook
=
@ci_project
.
web_hooks
.
new
(
web_hook_params
)
@web_hook
.
save
if
@web_hook
.
valid?
redirect_to
namespace_project_ci_web_hooks_path
(
@project
.
namespace
,
@project
)
else
@web_hooks
=
@ci_project
.
web_hooks
.
select
(
&
:persisted?
)
render
:index
end
end
def
test
Ci
::
TestHookService
.
new
.
execute
(
hook
,
current_user
)
redirect_to
:back
end
def
destroy
hook
.
destroy
redirect_to
namespace_project_ci_web_hooks_path
(
@project
.
namespace
,
@project
)
end
private
def
hook
@web_hook
||=
@ci_project
.
web_hooks
.
find
(
params
[
:id
])
end
def
web_hook_params
params
.
require
(
:web_hook
).
permit
(
:url
)
end
end
app/views/layouts/ci/_nav_project.html.haml
View file @
c293cc91
...
@@ -11,11 +11,6 @@
...
@@ -11,11 +11,6 @@
%span
%span
Commits
Commits
%span
.count
=
@project
.
commits
.
count
%span
.count
=
@project
.
commits
.
count
=
nav_link
path:
'web_hooks#index'
do
=
link_to
ci_project_web_hooks_path
(
@project
)
do
=
icon
(
'link fw'
)
%span
Web Hooks
=
nav_link
path:
[
'services#index'
,
'services#edit'
]
do
=
nav_link
path:
[
'services#index'
,
'services#edit'
]
do
=
link_to
ci_project_services_path
(
@project
)
do
=
link_to
ci_project_services_path
(
@project
)
do
=
icon
(
'share fw'
)
=
icon
(
'share fw'
)
...
...
app/views/layouts/nav/_project_settings.html.haml
View file @
c293cc91
...
@@ -50,6 +50,11 @@
...
@@ -50,6 +50,11 @@
=
icon
(
'retweet fw'
)
=
icon
(
'retweet fw'
)
%span
%span
Triggers
Triggers
=
nav_link
path:
'web_hooks#index'
do
=
link_to
namespace_project_ci_web_hooks_path
(
@project
.
namespace
,
@project
)
do
=
icon
(
'link fw'
)
%span
CI Web Hooks
=
nav_link
path:
'ci_settings#edit'
do
=
nav_link
path:
'ci_settings#edit'
do
=
link_to
edit_namespace_project_ci_settings_path
(
@project
.
namespace
,
@project
)
do
=
link_to
edit_namespace_project_ci_settings_path
(
@project
.
namespace
,
@project
)
do
=
icon
(
'building fw'
)
=
icon
(
'building fw'
)
...
...
app/views/
ci/
web_hooks/index.html.haml
→
app/views/
projects/ci_
web_hooks/index.html.haml
View file @
c293cc91
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
%hr
.clearfix
%hr
.clearfix
=
form_for
[
:ci
,
@project
,
@web_hook
]
,
html:
{
class:
'form-horizontal'
}
do
|
f
|
=
form_for
@web_hook
,
url:
namespace_project_ci_web_hooks_path
(
@project
.
namespace
,
@project
)
,
html:
{
class:
'form-horizontal'
}
do
|
f
|
-
if
@web_hook
.
errors
.
any?
-
if
@web_hook
.
errors
.
any?
.alert.alert-danger
.alert.alert-danger
-
@web_hook
.
errors
.
full_messages
.
each
do
|
msg
|
-
@web_hook
.
errors
.
full_messages
.
each
do
|
msg
|
...
@@ -28,9 +28,9 @@
...
@@ -28,9 +28,9 @@
%span
.monospace
=
hook
.
url
%span
.monospace
=
hook
.
url
%td
%td
.pull-right
.pull-right
-
if
@project
.
commits
.
any?
-
if
@
ci_
project
.
commits
.
any?
=
link_to
'Test Hook'
,
test_
ci_project_web_hook_path
(
@project
,
hook
),
class:
"btn btn-sm btn-grouped"
=
link_to
'Test Hook'
,
test_
namespace_project_ci_web_hook_path
(
@project
.
namespace
,
@project
,
hook
),
class:
"btn btn-sm btn-grouped"
=
link_to
'Remove'
,
ci_project_web_hook_path
(
@project
,
hook
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-remove btn-sm btn-grouped"
=
link_to
'Remove'
,
namespace_project_ci_web_hook_path
(
@project
.
namespace
,
@project
,
hook
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-remove btn-sm btn-grouped"
%h4
Web Hook data example
%h4
Web Hook data example
...
...
config/routes.rb
View file @
c293cc91
...
@@ -47,12 +47,6 @@ Gitlab::Application.routes.draw do
...
@@ -47,12 +47,6 @@ Gitlab::Application.routes.draw do
end
end
end
end
resources
:web_hooks
,
only:
[
:index
,
:create
,
:destroy
]
do
member
do
get
:test
end
end
resources
:runner_projects
,
only:
[
:create
,
:destroy
]
resources
:runner_projects
,
only:
[
:create
,
:destroy
]
resources
:events
,
only:
[
:index
]
resources
:events
,
only:
[
:index
]
...
@@ -591,6 +585,11 @@ Gitlab::Application.routes.draw do
...
@@ -591,6 +585,11 @@ Gitlab::Application.routes.draw do
resource
:variables
,
only:
[
:show
,
:update
]
resource
:variables
,
only:
[
:show
,
:update
]
resources
:triggers
,
only:
[
:index
,
:create
,
:destroy
]
resources
:triggers
,
only:
[
:index
,
:create
,
:destroy
]
resource
:ci_settings
,
only:
[
:edit
,
:update
,
:destroy
]
resource
:ci_settings
,
only:
[
:edit
,
:update
,
:destroy
]
resources
:ci_web_hooks
,
only:
[
:index
,
:create
,
:destroy
]
do
member
do
get
:test
end
end
resources
:hooks
,
only:
[
:index
,
:create
,
:destroy
],
constraints:
{
id:
/\d+/
}
do
resources
:hooks
,
only:
[
:index
,
:create
,
:destroy
],
constraints:
{
id:
/\d+/
}
do
member
do
member
do
...
...
spec/features/ci_web_hooks_spec.rb
0 → 100644
View file @
c293cc91
require
'spec_helper'
describe
'CI web hooks'
do
let
(
:user
)
{
create
(
:user
)
}
before
{
login_as
(
user
)
}
before
do
@project
=
FactoryGirl
.
create
:ci_project
@gl_project
=
@project
.
gl_project
@gl_project
.
team
<<
[
user
,
:master
]
visit
namespace_project_ci_web_hooks_path
(
@gl_project
.
namespace
,
@gl_project
)
end
context
'create a trigger'
do
before
do
fill_in
'web_hook_url'
,
with:
'http://example.com'
click_on
'Add Web Hook'
end
it
{
expect
(
@project
.
web_hooks
.
count
).
to
eq
(
1
)
}
it
'revokes the trigger'
do
click_on
'Remove'
expect
(
@project
.
web_hooks
.
count
).
to
eq
(
0
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment