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
6b572e35
Commit
6b572e35
authored
Aug 17, 2020
by
Doug Stull
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic navigation instrumentation
- for collecting data on what is clicked in navigation area.
parent
d795ab07
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
63 additions
and
12 deletions
+63
-12
app/assets/javascripts/search_autocomplete.js
app/assets/javascripts/search_autocomplete.js
+10
-0
app/views/layouts/_search.html.haml
app/views/layouts/_search.html.haml
+1
-1
app/views/layouts/header/_default.html.haml
app/views/layouts/header/_default.html.haml
+20
-5
app/views/layouts/nav/_dashboard.html.haml
app/views/layouts/nav/_dashboard.html.haml
+1
-1
app/views/layouts/nav/sidebar/_group.html.haml
app/views/layouts/nav/sidebar/_group.html.haml
+1
-1
app/views/layouts/nav/sidebar/_profile.html.haml
app/views/layouts/nav/sidebar/_profile.html.haml
+1
-1
app/views/layouts/nav/sidebar/_project.html.haml
app/views/layouts/nav/sidebar/_project.html.haml
+1
-2
changelogs/unreleased/223927-write-schema-to-instrument-the-navigation-on-gitlab-com.yml
...ite-schema-to-instrument-the-navigation-on-gitlab-com.yml
+5
-0
spec/frontend/search_autocomplete_spec.js
spec/frontend/search_autocomplete_spec.js
+23
-1
No files found.
app/assets/javascripts/search_autocomplete.js
View file @
6b572e35
...
...
@@ -12,6 +12,7 @@ import {
getProjectSlug
,
spriteIcon
,
}
from
'
./lib/utils/common_utils
'
;
import
Tracking
from
'
~/tracking
'
;
/**
* Search input in top navigation bar.
...
...
@@ -355,6 +356,15 @@ export class SearchAutocomplete {
if
(
!
this
.
dropdown
.
hasClass
(
'
show
'
))
{
this
.
loadingSuggestions
=
false
;
this
.
dropdownToggle
.
dropdown
(
'
toggle
'
);
const
trackEvent
=
'
click_search_bar
'
;
const
trackCategory
=
undefined
;
// will be default set in event method
Tracking
.
event
(
trackCategory
,
trackEvent
,
{
label
:
'
main_navigation
'
,
property
:
'
navigation
'
,
});
return
this
.
searchInput
.
removeClass
(
'
js-autocomplete-disabled
'
);
}
}
...
...
app/views/layouts/_search.html.haml
View file @
6b572e35
.search.search-form
{
data:
{
track_label:
"navbar_search"
,
track_event:
"activate_form_input"
,
track_value:
""
}
}
=
form_tag
search_path
,
method: :get
,
class:
'form-inline'
do
|
f
|
=
form_tag
search_path
,
method: :get
,
class:
'form-inline'
do
|
_
f
|
.search-input-container
.search-input-wrap
.dropdown
{
data:
{
url:
search_autocomplete_path
}
}
...
...
app/views/layouts/header/_default.html.haml
View file @
6b572e35
...
...
@@ -7,7 +7,7 @@
.title-container
%h1
.title
%span
.gl-sr-only
GitLab
=
link_to
root_path
,
title:
_
(
'Dashboard'
),
id:
'logo'
do
=
link_to
root_path
,
title:
_
(
'Dashboard'
),
id:
'logo'
,
**
tracking_attrs
(
'main_navigation'
,
'click_gitlab_logo_link'
,
'navigation'
)
do
=
brand_header_logo
-
logo_text
=
brand_header_logo_type
-
if
logo_text
.
present?
...
...
@@ -35,25 +35,40 @@
=
sprite_icon
(
'search'
)
-
if
header_link?
(
:issues
)
=
nav_link
(
path:
'dashboard#issues'
,
html_options:
{
class:
"user-counter"
})
do
=
link_to
assigned_issues_dashboard_path
,
title:
_
(
'Issues'
),
class:
'dashboard-shortcuts-issues'
,
aria:
{
label:
_
(
'Issues'
)
},
data:
{
qa_selector:
'issues_shortcut_button'
,
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
link_to
assigned_issues_dashboard_path
,
title:
_
(
'Issues'
),
class:
'dashboard-shortcuts-issues'
,
aria:
{
label:
_
(
'Issues'
)
},
data:
{
qa_selector:
'issues_shortcut_button'
,
toggle:
'tooltip'
,
placement:
'bottom'
,
track_label:
'main_navigation'
,
track_event:
'click_issues_link'
,
track_property:
'navigation'
,
container:
'body'
}
do
=
sprite_icon
(
'issues'
)
-
issues_count
=
assigned_issuables_count
(
:issues
)
%span
.badge.badge-pill.issues-count.green-badge
{
class:
(
'hidden'
if
issues_count
==
0
)
}
=
number_with_delimiter
(
issues_count
)
-
if
header_link?
(
:merge_requests
)
=
nav_link
(
path:
'dashboard#merge_requests'
,
html_options:
{
class:
"user-counter"
})
do
=
link_to
assigned_mrs_dashboard_path
,
title:
_
(
'Merge requests'
),
class:
'dashboard-shortcuts-merge_requests'
,
aria:
{
label:
_
(
'Merge requests'
)
},
data:
{
qa_selector:
'merge_requests_shortcut_button'
,
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
link_to
assigned_mrs_dashboard_path
,
title:
_
(
'Merge requests'
),
class:
'dashboard-shortcuts-merge_requests'
,
aria:
{
label:
_
(
'Merge requests'
)
},
data:
{
qa_selector:
'merge_requests_shortcut_button'
,
toggle:
'tooltip'
,
placement:
'bottom'
,
track_label:
'main_navigation'
,
track_event:
'click_merge_link'
,
track_property:
'navigation'
,
container:
'body'
}
do
=
sprite_icon
(
'git-merge'
)
-
merge_requests_count
=
assigned_issuables_count
(
:merge_requests
)
%span
.badge.badge-pill.merge-requests-count
{
class:
(
'hidden'
if
merge_requests_count
==
0
)
}
=
number_with_delimiter
(
merge_requests_count
)
-
if
header_link?
(
:todos
)
=
nav_link
(
controller:
'dashboard/todos'
,
html_options:
{
class:
"user-counter"
})
do
=
link_to
dashboard_todos_path
,
title:
_
(
'To-Do List'
),
aria:
{
label:
_
(
'To-Do List'
)
},
class:
'shortcuts-todos'
,
data:
{
qa_selector:
'todos_shortcut_button'
,
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
link_to
dashboard_todos_path
,
title:
_
(
'To-Do List'
),
aria:
{
label:
_
(
'To-Do List'
)
},
class:
'shortcuts-todos'
,
data:
{
qa_selector:
'todos_shortcut_button'
,
toggle:
'tooltip'
,
placement:
'bottom'
,
track_label:
'main_navigation'
,
track_event:
'click_to_do_link'
,
track_property:
'navigation'
,
container:
'body'
}
do
=
sprite_icon
(
'todo-done'
)
%span
.badge.badge-pill.todos-count
{
class:
(
'hidden'
if
todos_pending_count
==
0
)
}
=
todos_count_format
(
todos_pending_count
)
%li
.nav-item.header-help.dropdown.d-none.d-md-block
%li
.nav-item.header-help.dropdown.d-none.d-md-block
{
**
tracking_attrs
(
'main_navigation'
,
'click_question_mark_link'
,
'navigation'
)
}
=
link_to
help_path
,
class:
'header-help-dropdown-toggle'
,
data:
{
toggle:
"dropdown"
}
do
%span
.gl-sr-only
=
s_
(
'Nav|Help'
)
...
...
app/views/layouts/nav/_dashboard.html.haml
View file @
6b572e35
...
...
@@ -18,7 +18,7 @@
=
render
"layouts/nav/groups_dropdown/show"
-
if
any_dashboard_nav_link?
([
:groups
,
:milestones
,
:activity
,
:snippets
])
%li
.header-more.dropdown
%li
.header-more.dropdown
{
**
tracking_attrs
(
'main_navigation'
,
'click_more_link'
,
'navigation'
)
}
%a
{
href:
"#"
,
data:
{
toggle:
"dropdown"
,
qa_selector:
'more_dropdown'
}
}
=
_
(
'More'
)
=
sprite_icon
(
'angle-down'
,
css_class:
'caret-down'
)
...
...
app/views/layouts/nav/sidebar/_group.html.haml
View file @
6b572e35
-
issues_count
=
group_issues_count
(
state:
'opened'
)
-
merge_requests_count
=
group_merge_requests_count
(
state:
'opened'
)
.nav-sidebar
{
class:
(
"sidebar-collapsed-desktop"
if
collapsed_sidebar?
)
}
.nav-sidebar
{
class:
(
"sidebar-collapsed-desktop"
if
collapsed_sidebar?
)
,
**
tracking_attrs
(
'groups_side_navigation'
,
'render'
,
'groups_side_navigation'
)
}
.nav-sidebar-inner-scroll
.context-header
=
link_to
group_path
(
@group
),
title:
@group
.
name
do
...
...
app/views/layouts/nav/sidebar/_profile.html.haml
View file @
6b572e35
.nav-sidebar
{
class:
(
"sidebar-collapsed-desktop"
if
collapsed_sidebar?
)
}
.nav-sidebar
{
class:
(
"sidebar-collapsed-desktop"
if
collapsed_sidebar?
)
,
**
tracking_attrs
(
'user_side_navigation'
,
'render'
,
'user_side_navigation'
)
}
.nav-sidebar-inner-scroll
.context-header
=
link_to
profile_path
,
title:
_
(
'Profile Settings'
)
do
...
...
app/views/layouts/nav/sidebar/_project.html.haml
View file @
6b572e35
.nav-sidebar
{
class:
(
"sidebar-collapsed-desktop"
if
collapsed_sidebar?
)
}
.nav-sidebar
{
class:
(
"sidebar-collapsed-desktop"
if
collapsed_sidebar?
)
,
**
tracking_attrs
(
'projects_side_navigation'
,
'render'
,
'projects_side_navigation'
)
}
.nav-sidebar-inner-scroll
-
can_edit
=
can?
(
current_user
,
:admin_project
,
@project
)
.context-header
=
link_to
project_path
(
@project
),
title:
@project
.
name
do
.avatar-container.rect-avatar.s40.project-avatar
...
...
changelogs/unreleased/223927-write-schema-to-instrument-the-navigation-on-gitlab-com.yml
0 → 100644
View file @
6b572e35
---
title
:
Setup basic level telemetry for navigation
merge_request
:
39638
author
:
type
:
added
spec/frontend/search_autocomplete_spec.js
View file @
6b572e35
...
...
@@ -3,6 +3,7 @@
import
$
from
'
jquery
'
;
import
'
~/gl_dropdown
'
;
import
AxiosMockAdapter
from
'
axios-mock-adapter
'
;
import
{
mockTracking
,
unmockTracking
}
from
'
helpers/tracking_helper
'
;
import
initSearchAutocomplete
from
'
~/search_autocomplete
'
;
import
'
~/lib/utils/common_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
...
...
@@ -274,11 +275,32 @@ describe('Search autocomplete dropdown', () => {
});
describe
(
'
enableAutocomplete
'
,
()
=>
{
let
toggleSpy
;
let
trackingSpy
;
beforeEach
(()
=>
{
toggleSpy
=
jest
.
spyOn
(
widget
.
dropdownToggle
,
'
dropdown
'
);
trackingSpy
=
mockTracking
(
'
_category_
'
,
undefined
,
jest
.
spyOn
);
document
.
body
.
dataset
.
page
=
'
some:page
'
;
// default tracking for category
});
afterEach
(()
=>
{
unmockTracking
();
});
it
(
'
should open the Dropdown
'
,
()
=>
{
const
toggleSpy
=
jest
.
spyOn
(
widget
.
dropdownToggle
,
'
dropdown
'
);
widget
.
enableAutocomplete
();
expect
(
toggleSpy
).
toHaveBeenCalledWith
(
'
toggle
'
);
});
it
(
'
should track the opening
'
,
()
=>
{
widget
.
enableAutocomplete
();
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
undefined
,
'
click_search_bar
'
,
{
label
:
'
main_navigation
'
,
property
:
'
navigation
'
,
});
});
});
});
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