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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
037defc7
Commit
037defc7
authored
Sep 28, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move CI variables page to project settings
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
b6564195
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
47 additions
and
57 deletions
+47
-57
CHANGELOG
CHANGELOG
+1
-0
app/controllers/ci/variables_controller.rb
app/controllers/ci/variables_controller.rb
+0
-33
app/controllers/projects/application_controller.rb
app/controllers/projects/application_controller.rb
+4
-0
app/controllers/projects/runners_controller.rb
app/controllers/projects/runners_controller.rb
+0
-4
app/controllers/projects/variables_controller.rb
app/controllers/projects/variables_controller.rb
+25
-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/variables/show.html.haml
app/views/projects/variables/show.html.haml
+5
-5
config/routes.rb
config/routes.rb
+1
-1
spec/features/variables_spec.rb
spec/features/variables_spec.rb
+6
-9
No files found.
CHANGELOG
View file @
037defc7
...
@@ -16,6 +16,7 @@ v 8.1.0 (unreleased)
...
@@ -16,6 +16,7 @@ v 8.1.0 (unreleased)
- Add notes and SSL verification entries to hook APIs (Ben Boeckel)
- Add notes and SSL verification entries to hook APIs (Ben Boeckel)
- Fix grammar in admin area "labels" .nothing-here-block when no labels exist.
- Fix grammar in admin area "labels" .nothing-here-block when no labels exist.
- Move CI runners page to project settings area
- Move CI runners page to project settings area
- Move CI variables page to project settings area
v 8.0.3 (unreleased)
v 8.0.3 (unreleased)
...
...
app/controllers/ci/variables_controller.rb
deleted
100644 → 0
View file @
b6564195
module
Ci
class
VariablesController
<
Ci
::
ApplicationController
before_action
:authenticate_user!
before_action
:project
before_action
:authorize_access_project!
before_action
:authorize_manage_project!
layout
'ci/project'
def
show
end
def
update
if
project
.
update_attributes
(
project_params
)
Ci
::
EventService
.
new
.
change_project_settings
(
current_user
,
project
)
redirect_to
ci_project_variables_path
(
project
),
notice:
'Variables were successfully updated.'
else
render
action:
'show'
end
end
private
def
project
@project
||=
Ci
::
Project
.
find
(
params
[
:project_id
])
end
def
project_params
params
.
require
(
:project
).
permit
({
variables_attributes:
[
:id
,
:key
,
:value
,
:_destroy
]
})
end
end
end
app/controllers/projects/application_controller.rb
View file @
037defc7
...
@@ -31,4 +31,8 @@ class Projects::ApplicationController < ApplicationController
...
@@ -31,4 +31,8 @@ class Projects::ApplicationController < ApplicationController
def
ci_enabled
def
ci_enabled
return
render_404
unless
@project
.
gitlab_ci?
return
render_404
unless
@project
.
gitlab_ci?
end
end
def
ci_project
@ci_project
||=
@project
.
gitlab_ci_project
end
end
end
app/controllers/projects/runners_controller.rb
View file @
037defc7
...
@@ -55,10 +55,6 @@ class Projects::RunnersController < Projects::ApplicationController
...
@@ -55,10 +55,6 @@ class Projects::RunnersController < Projects::ApplicationController
protected
protected
def
ci_project
@ci_project
=
@project
.
gitlab_ci_project
end
def
set_runner
def
set_runner
@runner
||=
@ci_project
.
runners
.
find
(
params
[
:id
])
@runner
||=
@ci_project
.
runners
.
find
(
params
[
:id
])
end
end
...
...
app/controllers/projects/variables_controller.rb
0 → 100644
View file @
037defc7
class
Projects::VariablesController
<
Projects
::
ApplicationController
before_action
:ci_project
before_action
:authorize_admin_project!
layout
'project_settings'
def
show
end
def
update
if
ci_project
.
update_attributes
(
project_params
)
Ci
::
EventService
.
new
.
change_project_settings
(
current_user
,
ci_project
)
redirect_to
namespace_project_variables_path
(
project
.
namespace
,
project
),
notice:
'Variables were successfully updated.'
else
render
action:
'show'
end
end
private
def
project_params
params
.
require
(
:project
).
permit
({
variables_attributes:
[
:id
,
:key
,
:value
,
:_destroy
]
})
end
end
app/views/layouts/ci/_nav_project.html.haml
View file @
037defc7
...
@@ -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:
'variables#show'
do
=
link_to
ci_project_variables_path
(
@project
)
do
=
icon
(
'code fw'
)
%span
Variables
=
nav_link
path:
'web_hooks#index'
do
=
nav_link
path:
'web_hooks#index'
do
=
link_to
ci_project_web_hooks_path
(
@project
)
do
=
link_to
ci_project_web_hooks_path
(
@project
)
do
=
icon
(
'link fw'
)
=
icon
(
'link fw'
)
...
...
app/views/layouts/nav/_project_settings.html.haml
View file @
037defc7
...
@@ -40,3 +40,8 @@
...
@@ -40,3 +40,8 @@
=
icon
(
'cog fw'
)
=
icon
(
'cog fw'
)
%span
%span
Runners
Runners
=
nav_link
(
controller: :variables
)
do
=
link_to
namespace_project_variables_path
(
@project
.
namespace
,
@project
)
do
=
icon
(
'code fw'
)
%span
Variables
app/views/
ci
/variables/show.html.haml
→
app/views/
projects
/variables/show.html.haml
View file @
037defc7
...
@@ -9,13 +9,13 @@
...
@@ -9,13 +9,13 @@
%hr
%hr
=
nested_form_for
@
project
,
url:
url_for
(
controller:
'ci
/variables'
,
action:
'update'
),
html:
{
class:
'form-horizontal'
}
do
|
f
|
=
nested_form_for
@
ci_project
,
url:
url_for
(
controller:
'projects
/variables'
,
action:
'update'
),
html:
{
class:
'form-horizontal'
}
do
|
f
|
-
if
@project
.
errors
.
any?
-
if
@project
.
errors
.
any?
#error_explanation
#error_explanation
%p
.lead
=
"
#{
pluralize
(
@project
.
errors
.
count
,
"error"
)
}
prohibited this project from being saved:"
%p
.lead
=
"
#{
pluralize
(
@
ci_
project
.
errors
.
count
,
"error"
)
}
prohibited this project from being saved:"
.alert.alert-error
.alert.alert-error
%ul
%ul
-
@project
.
errors
.
full_messages
.
each
do
|
msg
|
-
@
ci_
project
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
%li
=
msg
=
f
.
fields_for
:variables
do
|
variable_form
|
=
f
.
fields_for
:variables
do
|
variable_form
|
...
...
config/routes.rb
View file @
037defc7
...
@@ -58,7 +58,6 @@ Gitlab::Application.routes.draw do
...
@@ -58,7 +58,6 @@ Gitlab::Application.routes.draw do
resources
:runner_projects
,
only:
[
:create
,
:destroy
]
resources
:runner_projects
,
only:
[
:create
,
:destroy
]
resources
:events
,
only:
[
:index
]
resources
:events
,
only:
[
:index
]
resource
:variables
,
only:
[
:show
,
:update
]
end
end
resource
:user_sessions
do
resource
:user_sessions
do
...
@@ -591,6 +590,7 @@ Gitlab::Application.routes.draw do
...
@@ -591,6 +590,7 @@ Gitlab::Application.routes.draw do
resources
:branches
,
only:
[
:index
,
:new
,
:create
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
resources
:branches
,
only:
[
:index
,
:new
,
:create
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
resources
:tags
,
only:
[
:index
,
:new
,
:create
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
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
}
resources
:protected_branches
,
only:
[
:index
,
:create
,
:update
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
resource
:variables
,
only:
[
:show
,
:update
]
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/
variables_spec.rb
→
spec/features/variables_spec.rb
View file @
037defc7
...
@@ -2,19 +2,17 @@ require 'spec_helper'
...
@@ -2,19 +2,17 @@ require 'spec_helper'
describe
"Variables"
do
describe
"Variables"
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
{
login_as
(
user
)
}
before
do
login_as
(
user
)
end
describe
"specific runners"
do
describe
"specific runners"
do
before
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
@project
=
FactoryGirl
.
create
:ci_project
@project
.
gl_project
.
team
<<
[
user
,
:master
]
@gl_project
=
@project
.
gl_project
@gl_project
.
team
<<
[
user
,
:master
]
end
end
it
"creates variable"
,
js:
true
do
it
"creates variable"
,
js:
true
do
visit
ci_project_variables_path
(
@
project
)
visit
namespace_project_variables_path
(
@gl_project
.
namespace
,
@gl_
project
)
click_on
"Add a variable"
click_on
"Add a variable"
fill_in
"Key"
,
with:
"SECRET_KEY"
fill_in
"Key"
,
with:
"SECRET_KEY"
fill_in
"Value"
,
with:
"SECRET_VALUE"
fill_in
"Value"
,
with:
"SECRET_VALUE"
...
@@ -23,6 +21,5 @@ describe "Variables" do
...
@@ -23,6 +21,5 @@ describe "Variables" do
expect
(
page
).
to
have_content
(
"Variables were successfully updated."
)
expect
(
page
).
to
have_content
(
"Variables were successfully updated."
)
expect
(
@project
.
variables
.
count
).
to
eq
(
1
)
expect
(
@project
.
variables
.
count
).
to
eq
(
1
)
end
end
end
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