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
88bc2340
Commit
88bc2340
authored
Apr 01, 2020
by
Adam Hegyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminate group_level_cycle_analytics FF
This commit removes the `group_level_cycle_analytics` feature flag.
parent
d4083f52
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
35 additions
and
148 deletions
+35
-148
ee/app/controllers/analytics/analytics_controller.rb
ee/app/controllers/analytics/analytics_controller.rb
+1
-3
ee/app/helpers/ee/analytics_navbar_helper.rb
ee/app/helpers/ee/analytics_navbar_helper.rb
+0
-1
ee/app/helpers/ee/dashboard_helper.rb
ee/app/helpers/ee/dashboard_helper.rb
+3
-9
ee/app/views/layouts/nav/sidebar/_analytics.html.haml
ee/app/views/layouts/nav/sidebar/_analytics.html.haml
+0
-13
ee/config/routes/group.rb
ee/config/routes/group.rb
+1
-1
ee/spec/controllers/analytics/analytics_controller_spec.rb
ee/spec/controllers/analytics/analytics_controller_spec.rb
+0
-15
ee/spec/features/analytics/analytics_workspace_spec.rb
ee/spec/features/analytics/analytics_workspace_spec.rb
+0
-1
ee/spec/features/dashboards/analytics_spec.rb
ee/spec/features/dashboards/analytics_spec.rb
+0
-3
ee/spec/helpers/ee/dashboard_helper_spec.rb
ee/spec/helpers/ee/dashboard_helper_spec.rb
+7
-41
ee/spec/support/helpers/analytics_helpers.rb
ee/spec/support/helpers/analytics_helpers.rb
+0
-16
ee/spec/views/layouts/nav/sidebar/_analytics.html.haml_spec.rb
...ec/views/layouts/nav/sidebar/_analytics.html.haml_spec.rb
+23
-45
No files found.
ee/app/controllers/analytics/analytics_controller.rb
View file @
88bc2340
...
...
@@ -2,9 +2,7 @@
class
Analytics::AnalyticsController
<
Analytics
::
ApplicationController
def
index
if
Feature
.
disabled?
(
:group_level_cycle_analytics
,
default_enabled:
true
)
&&
Gitlab
::
Analytics
.
cycle_analytics_enabled?
redirect_to
analytics_cycle_analytics_path
elsif
can?
(
current_user
,
:read_instance_statistics
)
if
can?
(
current_user
,
:read_instance_statistics
)
redirect_to
instance_statistics_dev_ops_score_index_path
else
render_404
...
...
ee/app/helpers/ee/analytics_navbar_helper.rb
View file @
88bc2340
...
...
@@ -38,7 +38,6 @@ module EE
end
def
group_cycle_analytics_navbar_link
(
group
,
current_user
)
return
unless
::
Feature
.
enabled?
(
:group_level_cycle_analytics
,
default_enabled:
true
)
return
unless
group_sidebar_link?
(
:cycle_analytics
)
navbar_sub_item
(
...
...
ee/app/helpers/ee/dashboard_helper.rb
View file @
88bc2340
...
...
@@ -32,15 +32,11 @@ module EE
end
def
analytics_nav_url
if
::
Feature
.
disabled?
(
:group_level_cycle_analytics
,
default_enabled:
true
)
&&
::
Gitlab
::
Analytics
.
any_features_enabled?
return
analytics_root_path
end
if
can?
(
current_user
,
:read_instance_statistics
)
return
instance_statistics_root_path
instance_statistics_root_path
else
'errors/not_found'
end
'errors/not_found'
end
private
...
...
@@ -48,8 +44,6 @@ module EE
override
:get_dashboard_nav_links
def
get_dashboard_nav_links
super
.
tap
do
|
links
|
links
<<
:analytics
if
::
Feature
.
disabled?
(
:group_level_cycle_analytics
,
default_enabled:
true
)
&&
::
Gitlab
::
Analytics
.
any_features_enabled?
if
can?
(
current_user
,
:read_operations_dashboard
)
links
<<
:environments
if
::
Feature
.
enabled?
(
:environments_dashboard
,
current_user
,
default_enabled:
true
)
links
<<
:operations
...
...
ee/app/views/layouts/nav/sidebar/_analytics.html.haml
View file @
88bc2340
...
...
@@ -6,19 +6,6 @@
=
sprite_icon
(
'chart'
,
size:
24
)
.sidebar-context-title
=
_
(
'Analytics'
)
%ul
.sidebar-top-level-items
-
if
Feature
.
disabled?
(
:group_level_cycle_analytics
,
default_enabled:
true
)
&&
Gitlab
::
Analytics
.
cycle_analytics_enabled?
=
nav_link
(
controller: :cycle_analytics
)
do
=
link_to
analytics_cycle_analytics_path
,
class:
'qa-sidebar-cycle-analytics'
do
.nav-icon-container
=
sprite_icon
(
'repeat'
)
%span
.nav-item-name
=
_
(
'Value Stream Analytics'
)
%ul
.sidebar-sub-level-items.is-fly-out-only
=
nav_link
(
controller: :cycle_analytics
,
html_options:
{
class:
"fly-out-top-item qa-sidebar-cycle-analytics-fly-out"
}
)
do
=
link_to
analytics_cycle_analytics_path
do
%strong
.fly-out-top-item-name
=
_
(
'Value Stream Analytics'
)
=
render_ce
'layouts/nav/sidebar/instance_statistics_links'
=
render
'shared/sidebar_toggle_button'
ee/config/routes/group.rb
View file @
88bc2340
...
...
@@ -33,7 +33,7 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
end
namespace
:analytics
do
resource
:productivity_analytics
,
only: :show
,
constraints:
->
(
req
)
{
Gitlab
::
Analytics
.
productivity_analytics_enabled?
}
resource
:cycle_analytics
,
path:
'value_stream_analytics'
,
only: :show
,
constraints:
->
(
req
)
{
Feature
.
enabled?
(
:group_level_cycle_analytics
,
default_enabled:
true
)
&&
Gitlab
::
Analytics
.
cycle_analytics_enabled?
}
resource
:cycle_analytics
,
path:
'value_stream_analytics'
,
only: :show
,
constraints:
->
(
req
)
{
Gitlab
::
Analytics
.
cycle_analytics_enabled?
}
end
resource
:ldap
,
only:
[]
do
...
...
ee/spec/controllers/analytics/analytics_controller_spec.rb
View file @
88bc2340
...
...
@@ -3,28 +3,13 @@
require
'spec_helper'
describe
Analytics
::
AnalyticsController
do
include
AnalyticsHelpers
let
(
:user
)
{
create
(
:user
)
}
before
do
stub_feature_flags
(
group_level_cycle_analytics:
false
)
sign_in
(
user
)
disable_all_analytics_feature_flags
end
describe
'GET index'
do
describe
'redirects to the first enabled analytics page'
do
it
'redirects to value stream analytics'
do
stub_feature_flags
(
Gitlab
::
Analytics
::
CYCLE_ANALYTICS_FEATURE_FLAG
=>
true
)
get
:index
expect
(
response
).
to
redirect_to
(
analytics_cycle_analytics_path
)
end
end
it
'renders devops score page when all the analytics feature flags are disabled'
do
get
:index
...
...
ee/spec/features/analytics/analytics_workspace_spec.rb
View file @
88bc2340
...
...
@@ -3,7 +3,6 @@
require
'spec_helper'
describe
'accessing the analytics workspace'
do
include
AnalyticsHelpers
let
(
:user
)
{
create
(
:user
)
}
before
do
...
...
ee/spec/features/dashboards/analytics_spec.rb
View file @
88bc2340
...
...
@@ -3,8 +3,6 @@
require
'spec_helper'
describe
'Showing analytics'
do
include
AnalyticsHelpers
before
do
sign_in
user
if
user
end
...
...
@@ -25,7 +23,6 @@ describe 'Showing analytics' do
context
'without access to instance statistics and analytics features'
do
before
do
disable_all_analytics_feature_flags
stub_application_setting
(
instance_statistics_visibility_private:
true
)
end
...
...
ee/spec/helpers/ee/dashboard_helper_spec.rb
View file @
88bc2340
...
...
@@ -3,53 +3,31 @@
require
'spec_helper'
describe
DashboardHelper
,
type: :helper
do
include
AnalyticsHelpers
let
(
:user
)
{
build
(
:user
)
}
describe
'#dashboard_nav_links'
do
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
stub_feature_flags
(
group_level_cycle_analytics:
false
)
end
describe
'analytics'
do
context
'
when at least one analytics feature is enabled
'
do
context
'
and the user has no access to instance statistics features
'
do
before
do
enable_only_one_analytics_feature_flag
stub_user_permissions_for
(
:analytics
,
false
)
end
it
'
includes
analytics'
do
expect
(
helper
.
dashboard_nav_links
).
to
include
(
:analytics
)
it
'
does not include
analytics'
do
expect
(
helper
.
dashboard_nav_links
).
not_
to
include
(
:analytics
)
end
end
context
'
when all analytics features are disabled
'
do
context
'
and the user has access to instance statistics features
'
do
before
do
disable_all_analytics_feature_flags
stub_user_permissions_for
(
:analytics
,
true
)
end
context
'and the user has no access to instance statistics features'
do
before
do
stub_user_permissions_for
(
:analytics
,
false
)
end
it
'does not include analytics'
do
expect
(
helper
.
dashboard_nav_links
).
not_to
include
(
:analytics
)
end
end
context
'and the user has access to instance statistics features'
do
before
do
stub_user_permissions_for
(
:analytics
,
true
)
end
it
'does include analytics'
do
expect
(
helper
.
dashboard_nav_links
).
to
include
(
:analytics
)
end
it
'does include analytics'
do
expect
(
helper
.
dashboard_nav_links
).
to
include
(
:analytics
)
end
end
end
...
...
@@ -239,22 +217,10 @@ describe DashboardHelper, type: :helper do
describe
'analytics_nav_url'
do
before
do
stub_feature_flags
(
group_level_cycle_analytics:
false
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
end
context
'when any analytics features are enabled'
do
it
'returns the analytics root path'
do
expect
(
helper
.
analytics_nav_url
).
to
match
(
analytics_root_path
)
end
end
context
'when analytics features are disabled'
do
before
do
disable_all_analytics_feature_flags
end
context
'and user has access to instance statistics features'
do
before
do
allow
(
helper
).
to
receive
(
:can?
)
{
true
}
...
...
ee/spec/support/helpers/analytics_helpers.rb
deleted
100644 → 0
View file @
d4083f52
# frozen_string_literal: true
# Helper for analytics related features
module
AnalyticsHelpers
def
disable_all_analytics_feature_flags
Gitlab
::
Analytics
::
FEATURE_FLAGS
.
each
do
|
flag
|
stub_feature_flags
(
flag
=>
false
)
end
end
def
enable_only_one_analytics_feature_flag
Gitlab
::
Analytics
::
FEATURE_FLAGS
.
each_with_index
do
|
flag
,
i
|
stub_feature_flags
(
flag
=>
i
==
0
)
end
end
end
ee/spec/views/layouts/nav/sidebar/_analytics.html.haml_spec.rb
View file @
88bc2340
...
...
@@ -3,14 +3,8 @@
require
'spec_helper'
describe
'layouts/nav/sidebar/_analytics'
do
include
AnalyticsHelpers
it_behaves_like
'has nav sidebar'
before
do
stub_feature_flags
(
group_level_cycle_analytics:
false
)
end
context
'top-level items'
do
context
'when feature flags are enabled'
do
it
'has `Analytics` link'
do
...
...
@@ -21,14 +15,6 @@ describe 'layouts/nav/sidebar/_analytics' do
expect
(
rendered
).
to
match
(
/<use xlink:href=".+?icons-.+?#chart">/
)
end
it
'has `Value Stream` link'
do
render
expect
(
rendered
).
to
have_content
(
'Value Stream'
)
expect
(
rendered
).
to
include
(
analytics_cycle_analytics_path
)
expect
(
rendered
).
to
match
(
/<use xlink:href=".+?icons-.+?#repeat">/
)
end
context
'and user has access to instance statistics features'
do
before
do
allow
(
view
).
to
receive
(
:can?
)
{
true
}
...
...
@@ -65,46 +51,38 @@ describe 'layouts/nav/sidebar/_analytics' do
end
end
context
'when feature flags are disabled'
do
it
'no analytics links are rendered'
do
disable_all_analytics_feature_flags
expect
(
rendered
).
not_to
have_content
(
'Value Stream'
)
context
'when user has access to instance statistics features'
do
before
do
allow
(
view
).
to
receive
(
:can?
)
{
true
}
end
context
'and user has access to instance statistics features'
do
before
do
allow
(
view
).
to
receive
(
:can?
)
{
true
}
end
it
'has `DevOps Score` link'
do
render
it
'has `DevOps Score` link'
do
render
expect
(
rendered
).
to
have_content
(
'DevOps Score'
)
expect
(
rendered
).
to
include
(
instance_statistics_dev_ops_score_index_path
)
expect
(
rendered
).
to
match
(
/<use xlink:href=".+?icons-.+?#comment">/
)
end
expect
(
rendered
).
to
have_content
(
'DevOps Score'
)
expect
(
rendered
).
to
include
(
instance_statistics_dev_ops_score_index_path
)
expect
(
rendered
).
to
match
(
/<use xlink:href=".+?icons-.+?#comment">/
)
end
it
'has `Cohorts` link'
do
render
it
'has `Cohorts` link'
do
render
expect
(
rendered
).
to
have_content
(
'Cohorts'
)
expect
(
rendered
).
to
include
(
instance_statistics_cohorts_path
)
expect
(
rendered
).
to
match
(
/<use xlink:href=".+?icons-.+?#users">/
)
end
expect
(
rendered
).
to
have_content
(
'Cohorts'
)
expect
(
rendered
).
to
include
(
instance_statistics_cohorts_path
)
expect
(
rendered
).
to
match
(
/<use xlink:href=".+?icons-.+?#users">/
)
end
end
context
'and user does not have access to instance statistics features'
do
before
do
allow
(
view
).
to
receive
(
:can?
)
{
false
}
end
context
'and user does not have access to instance statistics features'
do
before
do
allow
(
view
).
to
receive
(
:can?
)
{
false
}
end
it
'no instance statistics links are rendered'
do
render
it
'no instance statistics links are rendered'
do
render
expect
(
rendered
).
not_to
have_content
(
'DevOps Score'
)
expect
(
rendered
).
not_to
have_content
(
'Cohorts'
)
end
expect
(
rendered
).
not_to
have_content
(
'DevOps Score'
)
expect
(
rendered
).
not_to
have_content
(
'Cohorts'
)
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