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
4c045f21
Commit
4c045f21
authored
Aug 06, 2019
by
Luke Bennett
Committed by
Clement Ho
Aug 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add top navigation analytics link
Includes 'More' dropdown link.
parent
0f6d6679
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
1 deletion
+64
-1
app/views/layouts/nav/_dashboard.html.haml
app/views/layouts/nav/_dashboard.html.haml
+5
-0
ee/app/helpers/ee/dashboard_helper.rb
ee/app/helpers/ee/dashboard_helper.rb
+11
-0
ee/app/helpers/ee/tab_helper.rb
ee/app/helpers/ee/tab_helper.rb
+4
-0
ee/app/views/layouts/nav/sidebar/_analytics_link.html.haml
ee/app/views/layouts/nav/sidebar/_analytics_link.html.haml
+5
-0
ee/app/views/layouts/nav/sidebar/_analytics_more_link.html.haml
.../views/layouts/nav/sidebar/_analytics_more_link.html.haml
+4
-0
ee/changelogs/unreleased/analytics-top-nav.yml
ee/changelogs/unreleased/analytics-top-nav.yml
+5
-0
ee/spec/helpers/ee/dashboard_helper_spec.rb
ee/spec/helpers/ee/dashboard_helper_spec.rb
+29
-0
spec/helpers/dashboard_helper_spec.rb
spec/helpers/dashboard_helper_spec.rb
+1
-1
No files found.
app/views/layouts/nav/_dashboard.html.haml
View file @
4c045f21
...
@@ -32,6 +32,8 @@
...
@@ -32,6 +32,8 @@
=
link_to
dashboard_snippets_path
,
class:
'dashboard-shortcuts-snippets qa-snippets-link'
do
=
link_to
dashboard_snippets_path
,
class:
'dashboard-shortcuts-snippets qa-snippets-link'
do
=
_
(
'Snippets'
)
=
_
(
'Snippets'
)
=
render_if_exists
'layouts/nav/sidebar/analytics_link'
-
if
any_dashboard_nav_link?
([
:groups
,
:milestones
,
:activity
,
:snippets
])
-
if
any_dashboard_nav_link?
([
:groups
,
:milestones
,
:activity
,
:snippets
])
%li
.header-more.dropdown.d-xl-none
{
class:
(
'd-lg-none'
unless
has_extra_nav_icons?
)
}
%li
.header-more.dropdown.d-xl-none
{
class:
(
'd-lg-none'
unless
has_extra_nav_icons?
)
}
%a
{
href:
"#"
,
data:
{
toggle:
"dropdown"
}
}
%a
{
href:
"#"
,
data:
{
toggle:
"dropdown"
}
}
...
@@ -53,6 +55,9 @@
...
@@ -53,6 +55,9 @@
=
nav_link
(
controller:
'dashboard/snippets'
)
do
=
nav_link
(
controller:
'dashboard/snippets'
)
do
=
link_to
dashboard_snippets_path
,
class:
'dashboard-shortcuts-snippets'
do
=
link_to
dashboard_snippets_path
,
class:
'dashboard-shortcuts-snippets'
do
=
_
(
'Snippets'
)
=
_
(
'Snippets'
)
=
render_if_exists
'layouts/nav/sidebar/analytics_more_link'
%li
.dropdown.d-lg-none
%li
.dropdown.d-lg-none
=
render_if_exists
'dashboard/operations/nav_link_list'
=
render_if_exists
'dashboard/operations/nav_link_list'
-
if
can?
(
current_user
,
:read_instance_statistics
)
-
if
can?
(
current_user
,
:read_instance_statistics
)
...
...
ee/app/helpers/ee/dashboard_helper.rb
View file @
4c045f21
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
module
EE
module
EE
module
DashboardHelper
module
DashboardHelper
extend
::
Gitlab
::
Utils
::
Override
def
controller_action_to_child_dashboards
(
controller
=
controller_name
,
action
=
action_name
)
def
controller_action_to_child_dashboards
(
controller
=
controller_name
,
action
=
action_name
)
case
"
#{
controller
}
#
#{
action
}
"
case
"
#{
controller
}
#
#{
action
}
"
when
'projects#index'
,
'root#index'
,
'projects#starred'
,
'projects#trending'
when
'projects#index'
,
'root#index'
,
'projects#starred'
,
'projects#trending'
...
@@ -28,5 +30,14 @@ module EE
...
@@ -28,5 +30,14 @@ module EE
def
has_start_trial?
def
has_start_trial?
!
current_license
&&
current_user
.
admin?
!
current_license
&&
current_user
.
admin?
end
end
private
override
:get_dashboard_nav_links
def
get_dashboard_nav_links
super
.
tap
do
|
links
|
links
<<
:analytics
if
::
Feature
.
enabled?
(
:analytics
)
end
end
end
end
end
end
ee/app/helpers/ee/tab_helper.rb
View file @
4c045f21
...
@@ -12,5 +12,9 @@ module EE
...
@@ -12,5 +12,9 @@ module EE
super
super
end
end
end
end
def
analytics_controllers
[
'analytics/productivity_analytics'
,
'analytics/cycle_analytics'
]
end
end
end
end
end
ee/app/views/layouts/nav/sidebar/_analytics_link.html.haml
0 → 100644
View file @
4c045f21
-
if
dashboard_nav_link?
(
:analytics
)
=
nav_link
(
controller:
analytics_controllers
,
html_options:
{
class:
"d-none d-xl-block"
})
do
=
link_to
analytics_root_path
do
=
_
(
'Analytics'
)
ee/app/views/layouts/nav/sidebar/_analytics_more_link.html.haml
0 → 100644
View file @
4c045f21
-
if
dashboard_nav_link?
(
:analytics
)
=
nav_link
(
controller:
analytics_controllers
)
do
=
link_to
analytics_root_path
do
=
_
(
'Analytics'
)
ee/changelogs/unreleased/analytics-top-nav.yml
0 → 100644
View file @
4c045f21
---
title
:
Add analytics top navigation link
merge_request
:
14377
author
:
type
:
added
ee/spec/helpers/ee/dashboard_helper_spec.rb
View file @
4c045f21
...
@@ -3,6 +3,35 @@
...
@@ -3,6 +3,35 @@
require
'spec_helper'
require
'spec_helper'
describe
DashboardHelper
,
type: :helper
do
describe
DashboardHelper
,
type: :helper
do
let
(
:user
)
{
build
(
:user
)
}
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
helper
).
to
receive
(
:can?
)
{
true
}
end
describe
'#dashboard_nav_links'
do
context
'when analytics is enabled'
do
before
do
stub_feature_flags
(
analytics:
true
)
end
it
'includes analytics'
do
expect
(
helper
.
dashboard_nav_links
).
to
include
(
:analytics
)
end
end
context
'when analytics is disabled'
do
before
do
stub_feature_flags
(
analytics:
false
)
end
it
'does not include analytics'
do
expect
(
helper
.
dashboard_nav_links
).
not_to
include
(
:analytics
)
end
end
end
describe
'.has_start_trial?'
do
describe
'.has_start_trial?'
do
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
...
...
spec/helpers/dashboard_helper_spec.rb
View file @
4c045f21
...
@@ -12,7 +12,7 @@ describe DashboardHelper do
...
@@ -12,7 +12,7 @@ describe DashboardHelper do
it
'has all the expected links by default'
do
it
'has all the expected links by default'
do
menu_items
=
[
:projects
,
:groups
,
:activity
,
:milestones
,
:snippets
]
menu_items
=
[
:projects
,
:groups
,
:activity
,
:milestones
,
:snippets
]
expect
(
helper
.
dashboard_nav_links
).
to
contain_exactly
(
*
menu_items
)
expect
(
helper
.
dashboard_nav_links
).
to
include
(
*
menu_items
)
end
end
it
'does not contain cross project elements when the user cannot read cross project'
do
it
'does not contain cross project elements when the user cannot read cross project'
do
...
...
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