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
Boxiang Sun
gitlab-ce
Commits
2a0d4e72
Commit
2a0d4e72
authored
Sep 29, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move CI triggers page to project settings area
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
e1b7fced
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
53 additions
and
60 deletions
+53
-60
CHANGELOG
CHANGELOG
+1
-0
app/controllers/ci/triggers_controller.rb
app/controllers/ci/triggers_controller.rb
+0
-43
app/controllers/projects/triggers_controller.rb
app/controllers/projects/triggers_controller.rb
+35
-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/triggers/_trigger.html.haml
app/views/projects/triggers/_trigger.html.haml
+1
-1
app/views/projects/triggers/index.html.haml
app/views/projects/triggers/index.html.haml
+5
-5
config/routes.rb
config/routes.rb
+1
-2
spec/features/triggers_spec.rb
spec/features/triggers_spec.rb
+5
-4
No files found.
CHANGELOG
View file @
2a0d4e72
...
...
@@ -15,6 +15,7 @@ v 8.1.0 (unreleased)
- Fix grammar in admin area "labels" .nothing-here-block when no labels exist.
- Move CI runners page to project settings area
- Move CI variables page to project settings area
- Move CI triggers page to project settings area
v 8.0.3
- Fix URL shown in Slack notifications
...
...
app/controllers/ci/triggers_controller.rb
deleted
100644 → 0
View file @
e1b7fced
module
Ci
class
TriggersController
<
Ci
::
ApplicationController
before_action
:authenticate_user!
before_action
:project
before_action
:authorize_access_project!
before_action
:authorize_manage_project!
layout
'ci/project'
def
index
@triggers
=
@project
.
triggers
@trigger
=
Ci
::
Trigger
.
new
end
def
create
@trigger
=
@project
.
triggers
.
new
@trigger
.
save
if
@trigger
.
valid?
redirect_to
ci_project_triggers_path
(
@project
)
else
@triggers
=
@project
.
triggers
.
select
(
&
:persisted?
)
render
:index
end
end
def
destroy
trigger
.
destroy
redirect_to
ci_project_triggers_path
(
@project
)
end
private
def
trigger
@trigger
||=
@project
.
triggers
.
find
(
params
[
:id
])
end
def
project
@project
=
Ci
::
Project
.
find
(
params
[
:project_id
])
end
end
end
app/controllers/projects/triggers_controller.rb
0 → 100644
View file @
2a0d4e72
class
Projects::TriggersController
<
Projects
::
ApplicationController
before_action
:ci_project
before_action
:authorize_admin_project!
layout
'project_settings'
def
index
@triggers
=
@ci_project
.
triggers
@trigger
=
Ci
::
Trigger
.
new
end
def
create
@trigger
=
@ci_project
.
triggers
.
new
@trigger
.
save
if
@trigger
.
valid?
redirect_to
namespace_project_triggers_path
(
@project
.
namespace
,
@project
)
else
@triggers
=
@ci_project
.
triggers
.
select
(
&
:persisted?
)
render
:index
end
end
def
destroy
trigger
.
destroy
redirect_to
namespace_project_triggers_path
(
@project
.
namespace
,
@project
)
end
private
def
trigger
@trigger
||=
@ci_project
.
triggers
.
find
(
params
[
:id
])
end
end
app/views/layouts/ci/_nav_project.html.haml
View file @
2a0d4e72
...
...
@@ -16,11 +16,6 @@
=
icon
(
'link fw'
)
%span
Web Hooks
=
nav_link
path:
'triggers#index'
do
=
link_to
ci_project_triggers_path
(
@project
)
do
=
icon
(
'retweet fw'
)
%span
Triggers
=
nav_link
path:
[
'services#index'
,
'services#edit'
]
do
=
link_to
ci_project_services_path
(
@project
)
do
=
icon
(
'share fw'
)
...
...
app/views/layouts/nav/_project_settings.html.haml
View file @
2a0d4e72
...
...
@@ -45,3 +45,8 @@
=
icon
(
'code fw'
)
%span
Variables
=
nav_link
path:
'triggers#index'
do
=
link_to
namespace_project_triggers_path
(
@project
.
namespace
,
@project
)
do
=
icon
(
'retweet fw'
)
%span
Triggers
app/views/
ci
/triggers/_trigger.html.haml
→
app/views/
projects
/triggers/_trigger.html.haml
View file @
2a0d4e72
...
...
@@ -11,4 +11,4 @@
%td
.pull-right
=
link_to
'Revoke'
,
ci_project_trigger_path
(
@project
,
trigger
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-danger btn-sm btn-grouped"
=
link_to
'Revoke'
,
namespace_project_trigger_path
(
@project
.
namespace
,
@project
,
trigger
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-danger btn-sm btn-grouped"
app/views/
ci
/triggers/index.html.haml
→
app/views/
projects
/triggers/index.html.haml
View file @
2a0d4e72
...
...
@@ -12,11 +12,11 @@
%th
Token
%th
Last used
%th
=
render
@triggers
=
render
partial:
'trigger'
,
collection:
@triggers
,
as: :trigger
-
else
%h4
No triggers
=
form_for
[
:ci
,
@project
,
@trigger
]
,
html:
{
class:
'form-horizontal'
}
do
|
f
|
=
form_for
@trigger
,
url:
url_for
(
controller:
'projects/triggers'
,
action:
'create'
)
,
html:
{
class:
'form-horizontal'
}
do
|
f
|
.clearfix
=
f
.
submit
"Add Trigger"
,
class:
'btn btn-success pull-right'
...
...
@@ -34,7 +34,7 @@
:plain
curl -X POST \
-F token=TOKEN \
#{
ci_build_trigger_url
(
@project
.
id
,
'REF_NAME'
)
}
#{
ci_build_trigger_url
(
@
ci_
project
.
id
,
'REF_NAME'
)
}
%h3
Use .gitlab-ci.yml
...
...
@@ -49,7 +49,7 @@
trigger:
type: deploy
script:
- "curl -X POST -F token=TOKEN
#{
ci_build_trigger_url
(
@project
.
id
,
'REF_NAME'
)
}
"
- "curl -X POST -F token=TOKEN
#{
ci_build_trigger_url
(
@
ci_
project
.
id
,
'REF_NAME'
)
}
"
%h3
Pass build variables
...
...
@@ -64,4 +64,4 @@
curl -X POST \
-F token=TOKEN \
-F "variables[RUN_NIGHTLY_BUILD]=true" \
#{
ci_build_trigger_url
(
@project
.
id
,
'REF_NAME'
)
}
#{
ci_build_trigger_url
(
@
ci_
project
.
id
,
'REF_NAME'
)
}
config/routes.rb
View file @
2a0d4e72
...
...
@@ -53,8 +53,6 @@ Gitlab::Application.routes.draw do
end
end
resources
:triggers
,
only:
[
:index
,
:create
,
:destroy
]
resources
:runner_projects
,
only:
[
:create
,
:destroy
]
resources
:events
,
only:
[
:index
]
...
...
@@ -591,6 +589,7 @@ Gitlab::Application.routes.draw do
resources
:tags
,
only:
[
:index
,
:new
,
:create
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
resources
:protected_branches
,
only:
[
:index
,
:create
,
:update
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
resource
:variables
,
only:
[
:show
,
:update
]
resources
:triggers
,
only:
[
:index
,
:create
,
:destroy
]
resources
:hooks
,
only:
[
:index
,
:create
,
:destroy
],
constraints:
{
id:
/\d+/
}
do
member
do
...
...
spec/features/
ci/
triggers_spec.rb
→
spec/features/triggers_spec.rb
View file @
2a0d4e72
require
'spec_helper'
describe
'Triggers'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
{
login_as
(
user
)
}
before
do
login_as
(
user
)
@project
=
FactoryGirl
.
create
:ci_project
@project
.
gl_project
.
team
<<
[
user
,
:master
]
visit
ci_project_triggers_path
(
@project
)
@gl_project
=
@project
.
gl_project
@gl_project
.
team
<<
[
user
,
:master
]
visit
namespace_project_triggers_path
(
@gl_project
.
namespace
,
@gl_project
)
end
context
'create a trigger'
do
...
...
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