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
85d0e28d
Commit
85d0e28d
authored
Mar 16, 2021
by
Dallas Reedy
Committed by
Phil Hughes
Mar 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic click-tracking to widget & buttons
- Make use of the data-track-… attributes
parent
1e7ea614
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
1 deletion
+60
-1
ee/app/assets/javascripts/contextual_sidebar/components/trial_status_popover.vue
...ts/contextual_sidebar/components/trial_status_popover.vue
+13
-0
ee/app/assets/javascripts/contextual_sidebar/components/trial_status_widget.vue
...pts/contextual_sidebar/components/trial_status_widget.vue
+13
-1
ee/spec/frontend/contextual_sidebar/__snapshots__/group_trial_status_popover_spec.js.snap
...bar/__snapshots__/group_trial_status_popover_spec.js.snap
+8
-0
ee/spec/frontend/contextual_sidebar/__snapshots__/group_trial_status_widget_spec.js.snap
...ebar/__snapshots__/group_trial_status_widget_spec.js.snap
+3
-0
ee/spec/frontend/contextual_sidebar/group_trial_status_popover_spec.js
...end/contextual_sidebar/group_trial_status_popover_spec.js
+16
-0
ee/spec/frontend/contextual_sidebar/group_trial_status_widget_spec.js
...tend/contextual_sidebar/group_trial_status_widget_spec.js
+7
-0
No files found.
ee/app/assets/javascripts/contextual_sidebar/components/trial_status_popover.vue
View file @
85d0e28d
...
@@ -9,6 +9,11 @@ import Tracking from '~/tracking';
...
@@ -9,6 +9,11 @@ import Tracking from '~/tracking';
const
RESIZE_EVENT_DEBOUNCE_MS
=
150
;
const
RESIZE_EVENT_DEBOUNCE_MS
=
150
;
export
default
{
export
default
{
tracking
:
{
event
:
'
click_button
'
,
labels
:
{
upgrade
:
'
upgrade_to_ultimate
'
,
compare
:
'
compare_all_plans
'
},
property
:
'
experiment:show_trial_status_in_sidebar
'
,
},
components
:
{
components
:
{
GlButton
,
GlButton
,
GlPopover
,
GlPopover
,
...
@@ -123,6 +128,10 @@ export default {
...
@@ -123,6 +128,10 @@ export default {
size
=
"
small
"
size
=
"
small
"
class
=
"
gl-mb-0
"
class
=
"
gl-mb-0
"
block
block
data
-
testid
=
"
upgradeBtn
"
:
data
-
track
-
event
=
"
$options.tracking.event
"
:
data
-
track
-
label
=
"
$options.tracking.labels.upgrade
"
:
data
-
track
-
property
=
"
$options.tracking.property
"
>
>
<
span
class
=
"
gl-font-sm
"
>
<
span
class
=
"
gl-font-sm
"
>
<
gl
-
sprintf
:
message
=
"
$options.i18n.upgradeButtonTitle
"
>
<
gl
-
sprintf
:
message
=
"
$options.i18n.upgradeButtonTitle
"
>
...
@@ -138,7 +147,11 @@ export default {
...
@@ -138,7 +147,11 @@ export default {
size
=
"
small
"
size
=
"
small
"
class
=
"
gl-mb-0
"
class
=
"
gl-mb-0
"
block
block
data
-
testid
=
"
compareBtn
"
:
title
=
"
$options.i18n.compareAllButtonTitle
"
:
title
=
"
$options.i18n.compareAllButtonTitle
"
:
data
-
track
-
event
=
"
$options.tracking.event
"
:
data
-
track
-
label
=
"
$options.tracking.labels.compare
"
:
data
-
track
-
property
=
"
$options.tracking.property
"
>
>
<
span
class
=
"
gl-font-sm
"
>
{{
$options
.
i18n
.
compareAllButtonTitle
}}
<
/span
>
<
span
class
=
"
gl-font-sm
"
>
{{
$options
.
i18n
.
compareAllButtonTitle
}}
<
/span
>
<
/gl-button
>
<
/gl-button
>
...
...
ee/app/assets/javascripts/contextual_sidebar/components/trial_status_widget.vue
View file @
85d0e28d
...
@@ -3,6 +3,11 @@ import { GlLink, GlProgressBar } from '@gitlab/ui';
...
@@ -3,6 +3,11 @@ import { GlLink, GlProgressBar } from '@gitlab/ui';
import
{
n__
,
sprintf
}
from
'
~/locale
'
;
import
{
n__
,
sprintf
}
from
'
~/locale
'
;
export
default
{
export
default
{
tracking
:
{
event
:
'
click_link
'
,
label
:
'
trial_status_widget
'
,
property
:
'
experiment:show_trial_status_in_sidebar
'
,
},
components
:
{
components
:
{
GlLink
,
GlLink
,
GlProgressBar
,
GlProgressBar
,
...
@@ -53,7 +58,14 @@ export default {
...
@@ -53,7 +58,14 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<gl-link
:id=
"containerId"
:title=
"widgetTitle"
:href=
"plansHref"
>
<gl-link
:id=
"containerId"
:title=
"widgetTitle"
:href=
"plansHref"
:data-track-event=
"$options.tracking.event"
:data-track-label=
"$options.tracking.label"
:data-track-property=
"$options.tracking.property"
>
<div
class=
"gl-display-flex gl-flex-direction-column gl-align-items-stretch gl-w-full"
>
<div
class=
"gl-display-flex gl-flex-direction-column gl-align-items-stretch gl-w-full"
>
<span
class=
"gl-display-flex gl-align-items-center"
>
<span
class=
"gl-display-flex gl-align-items-center"
>
<span
class=
"nav-icon-container svg-container"
>
<span
class=
"nav-icon-container svg-container"
>
...
...
ee/spec/frontend/contextual_sidebar/__snapshots__/group_trial_status_popover_spec.js.snap
View file @
85d0e28d
...
@@ -22,6 +22,10 @@ exports[`TrialStatusPopover component matches the snapshot 1`] = `
...
@@ -22,6 +22,10 @@ exports[`TrialStatusPopover component matches the snapshot 1`] = `
buttontextclasses=""
buttontextclasses=""
category="primary"
category="primary"
class="gl-mb-0"
class="gl-mb-0"
data-testid="upgradeBtn"
data-track-event="click_button"
data-track-label="upgrade_to_ultimate"
data-track-property="experiment:show_trial_status_in_sidebar"
href="transactions/new"
href="transactions/new"
icon=""
icon=""
size="small"
size="small"
...
@@ -41,6 +45,10 @@ exports[`TrialStatusPopover component matches the snapshot 1`] = `
...
@@ -41,6 +45,10 @@ exports[`TrialStatusPopover component matches the snapshot 1`] = `
buttontextclasses=""
buttontextclasses=""
category="secondary"
category="secondary"
class="gl-mb-0"
class="gl-mb-0"
data-testid="compareBtn"
data-track-event="click_button"
data-track-label="compare_all_plans"
data-track-property="experiment:show_trial_status_in_sidebar"
href="billing/path-for/group"
href="billing/path-for/group"
icon=""
icon=""
size="small"
size="small"
...
...
ee/spec/frontend/contextual_sidebar/__snapshots__/group_trial_status_widget_spec.js.snap
View file @
85d0e28d
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
exports[`TrialStatusWidget component without the optional containerId prop matches the snapshot 1`] = `
exports[`TrialStatusWidget component without the optional containerId prop matches the snapshot 1`] = `
<gl-link-stub
<gl-link-stub
data-track-event="click_link"
data-track-label="trial_status_widget"
data-track-property="experiment:show_trial_status_in_sidebar"
href="billing/path-for/group"
href="billing/path-for/group"
title="Ultimate Trial – 20 days left"
title="Ultimate Trial – 20 days left"
>
>
...
...
ee/spec/frontend/contextual_sidebar/group_trial_status_popover_spec.js
View file @
85d0e28d
...
@@ -7,6 +7,8 @@ import TrialStatusPopover from 'ee/contextual_sidebar/components/trial_status_po
...
@@ -7,6 +7,8 @@ import TrialStatusPopover from 'ee/contextual_sidebar/components/trial_status_po
describe
(
'
TrialStatusPopover component
'
,
()
=>
{
describe
(
'
TrialStatusPopover component
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
getGlButton
=
(
testId
)
=>
wrapper
.
find
(
`[data-testid="
${
testId
}
"]`
);
const
createComponent
=
()
=>
{
const
createComponent
=
()
=>
{
return
shallowMount
(
TrialStatusPopover
,
{
return
shallowMount
(
TrialStatusPopover
,
{
propsData
:
{
propsData
:
{
...
@@ -33,6 +35,20 @@ describe('TrialStatusPopover component', () => {
...
@@ -33,6 +35,20 @@ describe('TrialStatusPopover component', () => {
expect
(
wrapper
.
element
).
toMatchSnapshot
();
expect
(
wrapper
.
element
).
toMatchSnapshot
();
});
});
it
(
'
renders the upgrade button with correct tracking data attrs
'
,
()
=>
{
const
attrs
=
getGlButton
(
'
upgradeBtn
'
).
attributes
();
expect
(
attrs
[
'
data-track-event
'
]).
toBe
(
'
click_button
'
);
expect
(
attrs
[
'
data-track-label
'
]).
toBe
(
'
upgrade_to_ultimate
'
);
expect
(
attrs
[
'
data-track-property
'
]).
toBe
(
'
experiment:show_trial_status_in_sidebar
'
);
});
it
(
'
renders the compare plans button with correct tracking data attrs
'
,
()
=>
{
const
attrs
=
getGlButton
(
'
compareBtn
'
).
attributes
();
expect
(
attrs
[
'
data-track-event
'
]).
toBe
(
'
click_button
'
);
expect
(
attrs
[
'
data-track-label
'
]).
toBe
(
'
compare_all_plans
'
);
expect
(
attrs
[
'
data-track-property
'
]).
toBe
(
'
experiment:show_trial_status_in_sidebar
'
);
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
describe
(
'
onResize
'
,
()
=>
{
describe
(
'
onResize
'
,
()
=>
{
const
getGlPopover
=
()
=>
wrapper
.
findComponent
(
GlPopover
);
const
getGlPopover
=
()
=>
wrapper
.
findComponent
(
GlPopover
);
...
...
ee/spec/frontend/contextual_sidebar/group_trial_status_widget_spec.js
View file @
85d0e28d
...
@@ -38,6 +38,13 @@ describe('TrialStatusWidget component', () => {
...
@@ -38,6 +38,13 @@ describe('TrialStatusWidget component', () => {
it
(
'
renders without an id
'
,
()
=>
{
it
(
'
renders without an id
'
,
()
=>
{
expect
(
getGlLink
().
attributes
(
'
id
'
)).
toBe
(
undefined
);
expect
(
getGlLink
().
attributes
(
'
id
'
)).
toBe
(
undefined
);
});
});
it
(
'
renders with the correct tracking data attributes
'
,
()
=>
{
const
attrs
=
getGlLink
().
attributes
();
expect
(
attrs
[
'
data-track-event
'
]).
toBe
(
'
click_link
'
);
expect
(
attrs
[
'
data-track-label
'
]).
toBe
(
'
trial_status_widget
'
);
expect
(
attrs
[
'
data-track-property
'
]).
toBe
(
'
experiment:show_trial_status_in_sidebar
'
);
});
});
});
describe
(
'
with the optional containerId prop
'
,
()
=>
{
describe
(
'
with the optional containerId prop
'
,
()
=>
{
...
...
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