Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
7ee47fdeef72
Commit
83f38b00
authored
Jan 06, 2019
by
Peter Leitzen
Browse files
Move settings operations controller from EE to CE
This commit prepares the structure for the upcoming feature error tracking.
parent
e0fd0da3484f
Changes
9
Hide whitespace changes
Inline
Side-by-side
app/controllers/projects/settings/operations_controller.rb
0 → 100644
View file @
7ee47fde
# frozen_string_literal: true
module
Projects
module
Settings
class
OperationsController
<
Projects
::
ApplicationController
before_action
:check_license
before_action
:authorize_update_environment!
def
show
end
def
update
result
=
::
Projects
::
Operations
::
UpdateService
.
new
(
project
,
current_user
,
update_params
).
execute
if
result
[
:status
]
==
:success
flash
[
:notice
]
=
_
(
'Your changes have been saved'
)
redirect_to
project_settings_operations_path
(
@project
)
else
render
'show'
end
end
private
def
update_params
params
.
require
(
:project
).
permit
(
permitted_project_params
)
end
# overridden in EE
def
permitted_project_params
{}
end
def
check_license
render_404
unless
helpers
.
settings_operations_available?
end
end
end
end
app/helpers/projects_helper.rb
View file @
7ee47fde
...
...
@@ -283,6 +283,11 @@ def show_issue_count?(disabled: false, compact_mode: false)
!
disabled
&&
!
compact_mode
&&
Feature
.
enabled?
(
:project_list_show_issue_count
,
default_enabled:
true
)
end
# overridden in EE
def
settings_operations_available?
false
end
private
def
get_project_nav_tabs
(
project
,
current_user
)
...
...
app/services/projects/operations/update_service.rb
0 → 100644
View file @
7ee47fde
# frozen_string_literal: true
module
Projects
module
Operations
class
UpdateService
<
BaseService
def
execute
Projects
::
UpdateService
.
new
(
project
,
current_user
,
project_update_params
)
.
execute
end
private
def
project_update_params
{}
end
end
end
end
app/views/layouts/nav/sidebar/_project.html.haml
View file @
7ee47fde
...
...
@@ -339,7 +339,10 @@
=
link_to
project_settings_ci_cd_path
(
@project
),
title:
_
(
'CI / CD'
)
do
%span
=
_
(
'CI / CD'
)
=
render_if_exists
'projects/sidebar/settings_operations'
-
if
settings_operations_available?
=
nav_link
(
controller:
[
:operations
])
do
=
link_to
project_settings_operations_path
(
@project
),
title:
_
(
'Operations'
)
do
=
_
(
'Operations'
)
-
if
@project
.
pages_available?
=
nav_link
(
controller: :pages
)
do
=
link_to
project_pages_path
(
@project
),
title:
_
(
'Pages'
)
do
...
...
app/views/projects/settings/operations/show.html.haml
0 → 100644
View file @
7ee47fde
-
@content_class
=
'limit-container-width'
unless
fluid_layout
-
page_title
_
(
'Operations'
)
=
render_if_exists
'projects/settings/operations/tracing'
config/routes/project.rb
View file @
7ee47fde
...
...
@@ -445,6 +445,10 @@
# its preferable to keep it below all other project routes
draw
:wiki
draw
:repository
namespace
:settings
do
resource
:operations
,
only:
[
:show
,
:update
]
end
end
resources
(
:projects
,
...
...
locale/gitlab.pot
View file @
7ee47fde
...
...
@@ -7818,6 +7818,9 @@ msgstr ""
msgid "Your changes have been committed. Commit %{commitId} %{commitStats}"
msgstr ""
msgid "Your changes have been saved"
msgstr ""
msgid "Your comment will not be visible to the public."
msgstr ""
...
...
spec/controllers/projects/settings/operations_controller_spec.rb
0 → 100644
View file @
7ee47fde
# frozen_string_literal: true
require
'spec_helper'
describe
Projects
::
Settings
::
OperationsController
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
)
}
before
do
sign_in
(
user
)
project
.
add_maintainer
(
user
)
end
describe
'GET #show'
do
it
'returns 404'
do
get
:show
,
params:
project_params
(
project
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
describe
'PATCH #update'
do
it
'returns 404'
do
patch
:update
,
params:
project_params
(
project
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
private
def
project_params
(
project
)
{
namespace_id:
project
.
namespace
,
project_id:
project
}
end
end
spec/services/projects/operations/update_service_spec.rb
0 → 100644
View file @
7ee47fde
# frozen_string_literal: true
require
'spec_helper'
describe
Projects
::
Operations
::
UpdateService
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
)
}
let
(
:result
)
{
subject
.
execute
}
subject
{
described_class
.
new
(
project
,
user
,
params
)
}
describe
'#execute'
do
context
'with inappropriate params'
do
let
(
:params
)
{
{
name:
''
}
}
let!
(
:original_name
)
{
project
.
name
}
it
'ignores params'
do
expect
(
result
[
:status
]).
to
eq
(
:success
)
expect
(
project
.
reload
.
name
).
to
eq
(
original_name
)
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