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
5f081b28
Commit
5f081b28
authored
Jul 27, 2020
by
Adam Hegyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Empty Merge Request analytics page
parent
1e4701d6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
116 additions
and
3 deletions
+116
-3
ee/app/controllers/groups/analytics/merge_request_analytics_controller.rb
...rs/groups/analytics/merge_request_analytics_controller.rb
+18
-0
ee/app/helpers/ee/analytics/navbar_helper.rb
ee/app/helpers/ee/analytics/navbar_helper.rb
+12
-1
ee/app/helpers/ee/groups_helper.rb
ee/app/helpers/ee/groups_helper.rb
+4
-0
ee/app/models/license.rb
ee/app/models/license.rb
+2
-1
ee/app/policies/ee/group_policy.rb
ee/app/policies/ee/group_policy.rb
+7
-0
ee/app/views/groups/analytics/merge_request_analytics/show.html.haml
...s/groups/analytics/merge_request_analytics/show.html.haml
+0
-0
ee/config/routes/group.rb
ee/config/routes/group.rb
+1
-1
ee/lib/gitlab/analytics.rb
ee/lib/gitlab/analytics.rb
+5
-0
ee/spec/controllers/groups/analytics/merge_request_analytics_controller_spec.rb
...oups/analytics/merge_request_analytics_controller_spec.rb
+51
-0
ee/spec/features/groups/navbar_spec.rb
ee/spec/features/groups/navbar_spec.rb
+16
-0
No files found.
ee/app/controllers/groups/analytics/merge_request_analytics_controller.rb
0 → 100644
View file @
5f081b28
# frozen_string_literal: true
class
Groups::Analytics::MergeRequestAnalyticsController
<
Groups
::
Analytics
::
ApplicationController
check_feature_flag
Gitlab
::
Analytics
::
GROUP_MERGE_REQUEST_ANALYTICS_FEATURE_FLAG
layout
'group'
before_action
:load_group
before_action
->
{
check_feature_availability!
(
:group_merge_request_analytics
)
}
before_action
->
{
authorize_view_by_action!
(
:read_group_merge_request_analytics
)
}
def
show
end
end
ee/app/helpers/ee/analytics/navbar_helper.rb
View file @
5f081b28
...
@@ -21,7 +21,8 @@ module EE
...
@@ -21,7 +21,8 @@ module EE
group_insights_navbar_link
(
group
,
current_user
),
group_insights_navbar_link
(
group
,
current_user
),
issues_analytics_navbar_link
(
group
,
current_user
),
issues_analytics_navbar_link
(
group
,
current_user
),
productivity_analytics_navbar_link
(
group
,
current_user
),
productivity_analytics_navbar_link
(
group
,
current_user
),
group_cycle_analytics_navbar_link
(
group
,
current_user
)
group_cycle_analytics_navbar_link
(
group
,
current_user
),
group_merge_request_analytics_navbar_link
(
group
,
current_user
)
].
compact
].
compact
end
end
...
@@ -38,6 +39,16 @@ module EE
...
@@ -38,6 +39,16 @@ module EE
)
)
end
end
def
group_merge_request_analytics_navbar_link
(
group
,
current_user
)
return
unless
group_sidebar_link?
(
:merge_request_analytics
)
navbar_sub_item
(
title:
_
(
'Merge Requests'
),
path:
'groups/analytics/merge_requests_analytics#show'
,
link:
group_analytics_merge_request_analytics_path
(
group
)
)
end
def
group_cycle_analytics_navbar_link
(
group
,
current_user
)
def
group_cycle_analytics_navbar_link
(
group
,
current_user
)
return
unless
group_sidebar_link?
(
:cycle_analytics
)
return
unless
group_sidebar_link?
(
:cycle_analytics
)
...
...
ee/app/helpers/ee/groups_helper.rb
View file @
5f081b28
...
@@ -125,6 +125,10 @@ module EE
...
@@ -125,6 +125,10 @@ module EE
links
<<
:cycle_analytics
links
<<
:cycle_analytics
end
end
if
can?
(
current_user
,
:read_group_merge_request_analytics
,
@group
)
links
<<
:merge_request_analytics
end
if
can?
(
current_user
,
:read_group_contribution_analytics
,
@group
)
||
show_promotions?
if
can?
(
current_user
,
:read_group_contribution_analytics
,
@group
)
||
show_promotions?
links
<<
:contribution_analytics
links
<<
:contribution_analytics
end
end
...
...
ee/app/models/license.rb
View file @
5f081b28
...
@@ -74,11 +74,12 @@ class License < ApplicationRecord
...
@@ -74,11 +74,12 @@ class License < ApplicationRecord
feature_flags
feature_flags
file_locks
file_locks
geo
geo
github_project_service_integration
generic_alert_fingerprinting
generic_alert_fingerprinting
github_project_service_integration
group_allowed_email_domains
group_allowed_email_domains
group_coverage_reports
group_coverage_reports
group_ip_restriction
group_ip_restriction
group_merge_request_analytics
group_project_templates
group_project_templates
group_saml
group_saml
issues_analytics
issues_analytics
...
...
ee/app/policies/ee/group_policy.rb
View file @
5f081b28
...
@@ -21,6 +21,10 @@ module EE
...
@@ -21,6 +21,10 @@ module EE
@subject
.
feature_available?
(
:cycle_analytics_for_groups
)
@subject
.
feature_available?
(
:cycle_analytics_for_groups
)
end
end
condition
(
:group_merge_request_analytics_available
)
do
@subject
.
feature_available?
(
:group_merge_request_analytics
)
end
condition
(
:group_activity_analytics_available
)
do
condition
(
:group_activity_analytics_available
)
do
@subject
.
beta_feature_available?
(
:group_activity_analytics
)
@subject
.
beta_feature_available?
(
:group_activity_analytics
)
end
end
...
@@ -124,6 +128,9 @@ module EE
...
@@ -124,6 +128,9 @@ module EE
rule
{
has_access
&
group_activity_analytics_available
}
rule
{
has_access
&
group_activity_analytics_available
}
.
enable
:read_group_activity_analytics
.
enable
:read_group_activity_analytics
rule
{
reporter
&
group_merge_request_analytics_available
}
.
enable
:read_group_merge_request_analytics
rule
{
reporter
&
cycle_analytics_available
}.
policy
do
rule
{
reporter
&
cycle_analytics_available
}.
policy
do
enable
:read_group_cycle_analytics
,
:create_group_stage
,
:read_group_stage
,
:update_group_stage
,
:delete_group_stage
enable
:read_group_cycle_analytics
,
:create_group_stage
,
:read_group_stage
,
:update_group_stage
,
:delete_group_stage
end
end
...
...
ee/app/views/groups/analytics/merge_request_analytics/show.html.haml
0 → 100644
View file @
5f081b28
ee/config/routes/group.rb
View file @
5f081b28
...
@@ -24,8 +24,8 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
...
@@ -24,8 +24,8 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
namespace
:analytics
do
namespace
:analytics
do
resource
:productivity_analytics
,
only: :show
,
constraints:
->
(
req
)
{
Gitlab
::
Analytics
.
productivity_analytics_enabled?
}
resource
:productivity_analytics
,
only: :show
,
constraints:
->
(
req
)
{
Gitlab
::
Analytics
.
productivity_analytics_enabled?
}
resources
:coverage_reports
,
only: :index
,
constraints:
->
(
req
)
{
Gitlab
::
Analytics
.
group_coverage_reports_enabled?
}
resources
:coverage_reports
,
only: :index
,
constraints:
->
(
req
)
{
Gitlab
::
Analytics
.
group_coverage_reports_enabled?
}
resource
:merge_request_analytics
,
only: :show
,
constraints:
->
(
req
)
{
Gitlab
::
Analytics
.
group_merge_request_analytics_enabled?
}
feature_default_enabled
=
Gitlab
::
Analytics
.
feature_enabled_by_default?
(
Gitlab
::
Analytics
::
CYCLE_ANALYTICS_FEATURE_FLAG
)
feature_default_enabled
=
Gitlab
::
Analytics
.
feature_enabled_by_default?
(
Gitlab
::
Analytics
::
CYCLE_ANALYTICS_FEATURE_FLAG
)
constrainer
=
::
Constraints
::
FeatureConstrainer
.
new
(
Gitlab
::
Analytics
::
CYCLE_ANALYTICS_FEATURE_FLAG
,
default_enabled:
feature_default_enabled
)
constrainer
=
::
Constraints
::
FeatureConstrainer
.
new
(
Gitlab
::
Analytics
::
CYCLE_ANALYTICS_FEATURE_FLAG
,
default_enabled:
feature_default_enabled
)
...
...
ee/lib/gitlab/analytics.rb
View file @
5f081b28
...
@@ -6,6 +6,7 @@ module Gitlab
...
@@ -6,6 +6,7 @@ module Gitlab
CYCLE_ANALYTICS_FEATURE_FLAG
=
:cycle_analytics
CYCLE_ANALYTICS_FEATURE_FLAG
=
:cycle_analytics
PRODUCTIVITY_ANALYTICS_FEATURE_FLAG
=
:productivity_analytics
PRODUCTIVITY_ANALYTICS_FEATURE_FLAG
=
:productivity_analytics
GROUP_COVERAGE_REPORTS_FEATURE_FLAG
=
:group_coverage_reports
GROUP_COVERAGE_REPORTS_FEATURE_FLAG
=
:group_coverage_reports
GROUP_MERGE_REQUEST_ANALYTICS_FEATURE_FLAG
=
:group_merge_request_analytics
FEATURE_FLAGS
=
[
FEATURE_FLAGS
=
[
CYCLE_ANALYTICS_FEATURE_FLAG
,
CYCLE_ANALYTICS_FEATURE_FLAG
,
...
@@ -35,6 +36,10 @@ module Gitlab
...
@@ -35,6 +36,10 @@ module Gitlab
feature_enabled?
(
GROUP_COVERAGE_REPORTS_FEATURE_FLAG
)
feature_enabled?
(
GROUP_COVERAGE_REPORTS_FEATURE_FLAG
)
end
end
def
self
.
group_merge_request_analytics_enabled?
feature_enabled?
(
GROUP_MERGE_REQUEST_ANALYTICS_FEATURE_FLAG
)
end
def
self
.
feature_enabled_by_default?
(
flag
)
def
self
.
feature_enabled_by_default?
(
flag
)
!!
FEATURE_FLAG_DEFAULTS
[
flag
]
!!
FEATURE_FLAG_DEFAULTS
[
flag
]
end
end
...
...
ee/spec/controllers/groups/analytics/merge_request_analytics_controller_spec.rb
0 → 100644
View file @
5f081b28
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Groups
::
Analytics
::
MergeRequestAnalyticsController
do
let_it_be
(
:current_user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
:group
}
let_it_be
(
:feature_flag_name
)
{
Gitlab
::
Analytics
::
GROUP_MERGE_REQUEST_ANALYTICS_FEATURE_FLAG
}
let_it_be
(
:feature_name
)
{
:group_merge_request_analytics
}
before
do
sign_in
(
current_user
)
stub_feature_flags
(
feature_flag_name
=>
true
)
stub_licensed_features
(
feature_name
=>
true
)
end
describe
'GET show'
do
subject
{
get
:show
,
params:
{
group_id:
group
}
}
before
do
group
.
add_maintainer
(
current_user
)
end
it
{
is_expected
.
to
be_successful
}
context
'when license is missing'
do
before
do
stub_licensed_features
(
feature_name
=>
false
)
end
it
{
is_expected
.
to
have_gitlab_http_status
(
:forbidden
)
}
end
context
'when feature flag is off'
do
before
do
stub_feature_flags
(
feature_flag_name
=>
false
)
end
it
{
is_expected
.
to
have_gitlab_http_status
(
:not_found
)
}
end
context
'when the user has no access to the group'
do
before
do
current_user
.
group_members
.
delete_all
end
it
{
is_expected
.
to
have_gitlab_http_status
(
:forbidden
)
}
end
end
end
ee/spec/features/groups/navbar_spec.rb
View file @
5f081b28
...
@@ -37,6 +37,22 @@ RSpec.describe 'Group navbar' do
...
@@ -37,6 +37,22 @@ RSpec.describe 'Group navbar' do
it_behaves_like
'verified navigation bar'
it_behaves_like
'verified navigation bar'
end
end
context
'when merge request analytics is available'
do
before
do
stub_licensed_features
(
group_merge_request_analytics:
true
)
insert_after_sub_nav_item
(
_
(
'Contribution'
),
within:
_
(
'Analytics'
),
new_sub_nav_item_name:
_
(
'Merge Requests'
)
)
visit
group_path
(
group
)
end
it_behaves_like
'verified navigation bar'
end
context
'when value stream analytics is available'
do
context
'when value stream analytics is available'
do
before
do
before
do
stub_licensed_features
(
cycle_analytics_for_groups:
true
)
stub_licensed_features
(
cycle_analytics_for_groups:
true
)
...
...
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