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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
90e14fc5
Commit
90e14fc5
authored
Mar 04, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add status page license and check
- Controller check - Attribute in helper - Specs to test
parent
e952301e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
3 deletions
+24
-3
ee/app/controllers/ee/projects/settings/operations_controller.rb
...controllers/ee/projects/settings/operations_controller.rb
+7
-1
ee/app/helpers/operations_helper.rb
ee/app/helpers/operations_helper.rb
+1
-0
ee/spec/controllers/projects/settings/operations_controller_spec.rb
...ntrollers/projects/settings/operations_controller_spec.rb
+11
-2
ee/spec/helpers/ee/operations_helper_spec.rb
ee/spec/helpers/ee/operations_helper_spec.rb
+5
-0
No files found.
ee/app/controllers/ee/projects/settings/operations_controller.rb
View file @
90e14fc5
...
...
@@ -41,6 +41,10 @@ module EE
project
.
feature_available?
(
:tracing
,
current_user
)
end
def
has_status_page_licence?
project
.
feature_available?
(
:status_page
,
current_user
)
end
def
track_tracing_external_url
external_url_previous_change
=
project
&
.
tracing_setting
&
.
external_url_previous_change
return
unless
external_url_previous_change
...
...
@@ -58,7 +62,9 @@ module EE
permitted_params
[
:tracing_setting_attributes
]
=
[
:external_url
]
end
permitted_params
.
merge!
(
status_page_setting_params
)
if
has_status_page_licence?
permitted_params
.
merge!
(
status_page_setting_params
)
end
permitted_params
end
...
...
ee/app/helpers/operations_helper.rb
View file @
90e14fc5
...
...
@@ -22,6 +22,7 @@ module OperationsHelper
def
status_page_settings_data
(
status_page_setting
)
{
'user-can-enable-status-page'
=>
can?
(
current_user
,
:admin_operations
,
project
).
to_s
,
'setting-enabled'
=>
status_page_setting
&
.
enabled?
,
'setting-aws-access-key'
=>
status_page_setting
&
.
aws_access_key
,
'setting-masked-aws-secret-key'
=>
status_page_setting
&
.
masked_aws_secret_key
,
...
...
ee/spec/controllers/projects/settings/operations_controller_spec.rb
View file @
90e14fc5
...
...
@@ -117,6 +117,15 @@ describe Projects::Settings::OperationsController do
expect
(
project
.
tracing_setting
).
to
be_nil
end
it
'does not create status_page_setting'
do
update_project
(
project
,
status_page_params:
attributes_for
(
:status_page_setting
)
)
expect
(
project
.
status_page_setting
).
to
be_nil
end
end
context
'format html'
do
...
...
@@ -158,7 +167,7 @@ describe Projects::Settings::OperationsController do
context
'with a license'
do
before
do
stub_licensed_features
(
tracing:
true
,
incident_management:
true
)
stub_licensed_features
(
tracing:
true
,
incident_management:
true
,
status_page:
true
)
end
shared_examples
'user with write access'
do
|
project_visibility
|
...
...
@@ -324,7 +333,7 @@ describe Projects::Settings::OperationsController do
context
'without a license'
do
before
do
stub_licensed_features
(
tracing:
false
,
incident_management:
false
)
stub_licensed_features
(
tracing:
false
,
incident_management:
false
,
status_page:
false
)
end
it_behaves_like
'user without write access'
,
:public
,
:maintainer
...
...
ee/spec/helpers/ee/operations_helper_spec.rb
View file @
90e14fc5
...
...
@@ -6,12 +6,17 @@ describe OperationsHelper do
describe
'#status_page_settings_data'
do
subject
{
helper
.
status_page_settings_data
(
status_page_setting
)
}
before
do
allow
(
helper
).
to
receive
(
:can?
)
{
true
}
end
context
'setting does not exist'
do
let
(
:status_page_setting
)
{
nil
}
it
'returns the correct values'
do
expect
(
subject
.
keys
)
.
to
contain_exactly
(
'user-can-enable-status-page'
,
'setting-enabled'
,
'setting-aws-access-key'
,
'setting-masked-aws-secret-key'
,
...
...
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