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
2422bf10
Commit
2422bf10
authored
Apr 28, 2020
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove FF environments_dashboard
This commit removes the FF
parent
d58353db
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
106 deletions
+10
-106
ee/app/controllers/operations_controller.rb
ee/app/controllers/operations_controller.rb
+0
-5
ee/app/helpers/ee/dashboard_helper.rb
ee/app/helpers/ee/dashboard_helper.rb
+1
-1
ee/spec/controllers/operations_controller_spec.rb
ee/spec/controllers/operations_controller_spec.rb
+1
-74
ee/spec/features/operations_nav_link_spec.rb
ee/spec/features/operations_nav_link_spec.rb
+0
-1
ee/spec/helpers/ee/dashboard_helper_spec.rb
ee/spec/helpers/ee/dashboard_helper_spec.rb
+8
-25
No files found.
ee/app/controllers/operations_controller.rb
View file @
2422bf10
...
...
@@ -2,7 +2,6 @@
class
OperationsController
<
ApplicationController
before_action
:authorize_read_operations_dashboard!
before_action
:environments_dashboard_feature_flag
,
only:
%i[environments environments_list]
respond_to
:json
,
only:
[
:list
]
...
...
@@ -56,10 +55,6 @@ class OperationsController < ApplicationController
render_404
unless
can?
(
current_user
,
:read_operations_dashboard
)
end
def
environments_dashboard_feature_flag
render_404
unless
Feature
.
enabled?
(
:environments_dashboard
,
current_user
,
default_enabled:
true
)
end
def
load_projects
Dashboard
::
Operations
::
ListService
.
new
(
current_user
).
execute
end
...
...
ee/app/helpers/ee/dashboard_helper.rb
View file @
2422bf10
...
...
@@ -45,7 +45,7 @@ module EE
def
get_dashboard_nav_links
super
.
tap
do
|
links
|
if
can?
(
current_user
,
:read_operations_dashboard
)
links
<<
:environments
if
::
Feature
.
enabled?
(
:environments_dashboard
,
current_user
,
default_enabled:
true
)
links
<<
:environments
links
<<
:operations
end
...
...
ee/spec/controllers/operations_controller_spec.rb
View file @
2422bf10
...
...
@@ -36,15 +36,6 @@ describe OperationsController do
expect
(
response
).
to
render_template
(
:index
)
end
it
'renders regardless of the environments_dashboard feature flag'
do
stub_feature_flags
(
environments_dashboard:
{
enabled:
false
,
thing:
user
})
get
:index
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:index
)
end
context
'with an anonymous user'
do
before
do
sign_out
(
user
)
...
...
@@ -68,24 +59,6 @@ describe OperationsController do
expect
(
response
).
to
render_template
(
:environments
)
end
it
'returns a 404 when the feature is disabled'
do
stub_feature_flags
(
environments_dashboard:
{
enabled:
false
,
thing:
user
})
get
:environments
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
it
'renders the view when the feature is disabled for a different user'
do
other_user
=
create
(
:user
)
stub_feature_flags
(
environments_dashboard:
{
enabled:
false
,
thing:
other_user
})
get
:environments
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:environments
)
end
context
'with an anonymous user'
do
before
do
sign_out
(
user
)
...
...
@@ -183,9 +156,7 @@ describe OperationsController do
expect
(
json_response
[
'projects'
].
size
).
to
eq
(
8
)
end
it
'returns a list of added projects regardless of the environments_dashboard feature flag'
do
stub_feature_flags
(
environments_dashboard:
{
enabled:
false
,
thing:
user
})
it
'returns a list of added projects'
do
get
:list
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
...
@@ -282,30 +253,6 @@ describe OperationsController do
user
.
update!
(
ops_dashboard_projects:
[
project
])
end
it
'returns a 404 when the feature is disabled'
do
stub_feature_flags
(
environments_dashboard:
{
enabled:
false
,
thing:
user
})
environment
=
create
(
:environment
,
project:
project
)
ci_build
=
create
(
:ci_build
,
project:
project
)
create
(
:deployment
,
:success
,
project:
project
,
environment:
environment
,
deployable:
ci_build
)
get
:environments_list
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
it
'returns a project when the feature is disabled for another user'
do
other_user
=
create
(
:user
)
stub_feature_flags
(
environments_dashboard:
{
enabled:
false
,
thing:
other_user
})
environment
=
create
(
:environment
,
project:
project
)
ci_build
=
create
(
:ci_build
,
project:
project
)
create
(
:deployment
,
:success
,
project:
project
,
environment:
environment
,
deployable:
ci_build
)
get
:environments_list
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'dashboard/operations/environments_list'
,
dir:
'ee'
)
end
it
'returns a project without an environment'
do
get
:environments_list
...
...
@@ -692,16 +639,6 @@ describe OperationsController do
expect
(
user
.
ops_dashboard_projects
).
to
contain_exactly
(
project_a
,
project_b
)
end
it
'adds projects to the dashboard regardless of the environments_dashboard feature flag'
do
stub_feature_flags
(
environments_dashboard:
{
enabled:
false
,
thing:
user
})
post
:create
,
params:
{
project_ids:
[
project_a
.
id
,
project_b
.
id
.
to_s
]
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
match_schema
(
'dashboard/operations/add'
,
dir:
'ee'
)
expect
(
json_response
[
'added'
]).
to
contain_exactly
(
project_a
.
id
,
project_b
.
id
)
end
it
'cannot add a project twice'
do
post
:create
,
params:
{
project_ids:
[
project_a
.
id
,
project_a
.
id
]
}
...
...
@@ -782,16 +719,6 @@ describe OperationsController do
user
.
reload
expect
(
user
.
ops_dashboard_projects
).
to
eq
([])
end
it
'removes a project regardless of the environments_dashboard feature flag'
do
stub_feature_flags
(
environments_dashboard:
{
enabled:
false
,
thing:
user
})
delete
:destroy
,
params:
{
project_id:
project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
user
.
reload
expect
(
user
.
ops_dashboard_projects
).
to
eq
([])
end
end
context
'without projects'
do
...
...
ee/spec/features/operations_nav_link_spec.rb
View file @
2422bf10
...
...
@@ -11,7 +11,6 @@ describe 'Operations dropdown navbar EE' do
sign_in
(
user
)
stub_licensed_features
(
operations_dashboard:
true
)
stub_feature_flags
(
environments_dashboard:
true
)
visit
project_issues_path
(
project
)
end
...
...
ee/spec/helpers/ee/dashboard_helper_spec.rb
View file @
2422bf10
...
...
@@ -67,34 +67,18 @@ describe DashboardHelper, type: :helper do
end
describe
'environments dashboard link'
do
context
'when the feature is enabled'
do
before
do
stub_feature_flags
(
environments_dashboard:
true
)
end
context
'and the feature is available on the license'
do
context
'and the user is authenticated'
do
before
do
stub_user_permissions_for
(
:operations
,
true
)
end
it
'is included in the nav'
do
expect
(
helper
.
dashboard_nav_links
).
to
include
(
:environments
)
end
context
'and the feature is available on the license'
do
context
'and the user is authenticated'
do
before
do
stub_user_permissions_for
(
:operations
,
true
)
end
context
'and the user is not authenticated'
do
before
do
stub_user_permissions_for
(
:operations
,
false
)
end
it
'is not included in the nav'
do
expect
(
helper
.
dashboard_nav_links
).
not_to
include
(
:environments
)
end
it
'is included in the nav'
do
expect
(
helper
.
dashboard_nav_links
).
to
include
(
:environments
)
end
end
context
'and the
feature is not available on the license
'
do
context
'and the
user is not authenticated
'
do
before
do
stub_user_permissions_for
(
:operations
,
false
)
end
...
...
@@ -105,9 +89,8 @@ describe DashboardHelper, type: :helper do
end
end
context
'
when the feature is not enabled
'
do
context
'
and the feature is not available on the license
'
do
before
do
stub_feature_flags
(
environments_dashboard:
false
)
stub_user_permissions_for
(
:operations
,
false
)
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