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
cca00b11
Commit
cca00b11
authored
Jun 10, 2020
by
Doug Stull
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the buy ci minutes link name
- UX improvement to align with naming in other areas.
parent
7d1b05db
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
32 additions
and
32 deletions
+32
-32
app/assets/javascripts/header.js
app/assets/javascripts/header.js
+1
-1
app/views/layouts/header/_current_user_dropdown.html.haml
app/views/layouts/header/_current_user_dropdown.html.haml
+1
-1
ee/app/helpers/ee/runners_helper.rb
ee/app/helpers/ee/runners_helper.rb
+6
-6
ee/app/views/layouts/header/_buy_pipeline_minutes.html.haml
ee/app/views/layouts/header/_buy_pipeline_minutes.html.haml
+3
-3
ee/app/views/layouts/header/_user_notification_dot.html.haml
ee/app/views/layouts/header/_user_notification_dot.html.haml
+1
-1
ee/spec/helpers/ee/runners_helper_spec.rb
ee/spec/helpers/ee/runners_helper_spec.rb
+8
-8
ee/spec/views/layouts/application.html.haml_spec.rb
ee/spec/views/layouts/application.html.haml_spec.rb
+1
-1
ee/spec/views/layouts/header/_current_user_dropdown.html.haml_spec.rb
...s/layouts/header/_current_user_dropdown.html.haml_spec.rb
+8
-8
locale/gitlab.pot
locale/gitlab.pot
+1
-1
spec/frontend/header_spec.js
spec/frontend/header_spec.js
+2
-2
No files found.
app/assets/javascripts/header.js
View file @
cca00b11
...
...
@@ -86,7 +86,7 @@ function trackShowUserDropdownLink(trackEvent, elToTrack, el) {
}
export
function
initNavUserDropdownTracking
()
{
const
el
=
document
.
querySelector
(
'
.js-nav-user-dropdown
'
);
const
buyEl
=
document
.
querySelector
(
'
.js-buy-
ci
-minutes-link
'
);
const
buyEl
=
document
.
querySelector
(
'
.js-buy-
pipeline
-minutes-link
'
);
const
upgradeEl
=
document
.
querySelector
(
'
.js-upgrade-plan-link
'
);
if
(
el
&&
buyEl
)
{
...
...
app/views/layouts/header/_current_user_dropdown.html.haml
View file @
cca00b11
...
...
@@ -26,7 +26,7 @@
-
if
current_user_menu?
(
:settings
)
%li
=
link_to
s_
(
"CurrentUser|Settings"
),
profile_path
,
data:
{
qa_selector:
'settings_link'
}
=
render_if_exists
'layouts/header/buy_
ci
_minutes'
,
project:
@project
,
namespace:
@group
=
render_if_exists
'layouts/header/buy_
pipeline
_minutes'
,
project:
@project
,
namespace:
@group
=
render_if_exists
'layouts/header/upgrade'
-
if
current_user_menu?
(
:help
)
...
...
ee/app/helpers/ee/runners_helper.rb
View file @
cca00b11
...
...
@@ -3,22 +3,22 @@ module EE
module
RunnersHelper
include
::
Gitlab
::
Utils
::
StrongMemoize
def
show_buy_
ci
_minutes?
(
project
,
namespace
)
def
show_buy_
pipeline
_minutes?
(
project
,
namespace
)
return
false
unless
experiment_enabled?
(
:ci_notification_dot
)
||
experiment_enabled?
(
:buy_ci_minutes_version_a
)
show_out_of_
ci
_minutes_notification?
(
project
,
namespace
)
show_out_of_
pipeline
_minutes_notification?
(
project
,
namespace
)
end
def
show_
ci
_minutes_notification_dot?
(
project
,
namespace
)
def
show_
pipeline
_minutes_notification_dot?
(
project
,
namespace
)
return
false
unless
experiment_enabled?
(
:ci_notification_dot
)
show_out_of_
ci
_minutes_notification?
(
project
,
namespace
)
show_out_of_
pipeline
_minutes_notification?
(
project
,
namespace
)
end
private
def
show_out_of_
ci
_minutes_notification?
(
project
,
namespace
)
strong_memoize
(
:show_out_of_
ci
_minutes_notification
)
do
def
show_out_of_
pipeline
_minutes_notification?
(
project
,
namespace
)
strong_memoize
(
:show_out_of_
pipeline
_minutes_notification
)
do
next
unless
project
&
.
persisted?
||
namespace
&
.
persisted?
::
Ci
::
Minutes
::
Notification
.
new
(
project
,
namespace
).
show?
(
current_user
)
...
...
ee/app/views/layouts/header/_buy_
ci
_minutes.html.haml
→
ee/app/views/layouts/header/_buy_
pipeline
_minutes.html.haml
View file @
cca00b11
-
return
unless
show_buy_
ci
_minutes?
(
project
,
namespace
)
-
return
unless
show_buy_
pipeline
_minutes?
(
project
,
namespace
)
%li
=
link_to
profile_usage_quotas_path
,
class:
'ci-minutes-emoji js-buy-
ci
-minutes-link'
,
class:
'ci-minutes-emoji js-buy-
pipeline
-minutes-link'
,
data:
{
'track-event'
:
'click_buy_ci_minutes'
,
'track-label'
:
current_user
.
namespace
.
actual_plan_name
,
'track-property'
:
'user_dropdown'
}
do
=
s_
(
"CurrentUser|Buy
CI
minutes"
)
=
s_
(
"CurrentUser|Buy
Pipeline
minutes"
)
=
emoji_icon
(
'clock9'
,
'aria-hidden'
:
true
)
ee/app/views/layouts/header/_user_notification_dot.html.haml
View file @
cca00b11
-
return
unless
show_
ci
_minutes_notification_dot?
(
project
,
namespace
)
-
return
unless
show_
pipeline
_minutes_notification_dot?
(
project
,
namespace
)
%span
.header-user-notification-dot.rounded-circle.position-relative
{
data:
{
track_label:
"show_buy_ci_minutes_notification"
,
track_property:
current_user
.
namespace
.
actual_plan_name
,
track_event:
'render'
}
}
ee/spec/helpers/ee/runners_helper_spec.rb
View file @
cca00b11
...
...
@@ -49,12 +49,12 @@ RSpec.describe EE::RunnersHelper do
it
{
is_expected
.
to
be_falsey
}
context
'when show_
ci
_minutes_notification_dot? has been called before'
do
context
'when show_
pipeline
_minutes_notification_dot? has been called before'
do
it
'does not do all the notification and query work again'
do
expect
(
threshold
).
not_to
receive
(
:show?
)
expect
(
project
).
to
receive
(
:persisted?
).
once
helper
.
show_
ci
_minutes_notification_dot?
(
project
,
namespace
)
helper
.
show_
pipeline
_minutes_notification_dot?
(
project
,
namespace
)
expect
(
subject
).
to
be_falsey
end
...
...
@@ -67,12 +67,12 @@ RSpec.describe EE::RunnersHelper do
it
{
is_expected
.
to
be_falsey
}
end
context
'when show_
ci
_minutes_notification_dot? has been called before'
do
context
'when show_
pipeline
_minutes_notification_dot? has been called before'
do
it
'does not do all the notification and query work again'
do
expect
(
threshold
).
to
receive
(
:show?
).
once
expect
(
project
).
to
receive
(
:persisted?
).
once
helper
.
show_
ci
_minutes_notification_dot?
(
project
,
namespace
)
helper
.
show_
pipeline
_minutes_notification_dot?
(
project
,
namespace
)
expect
(
subject
).
to
be_truthy
end
...
...
@@ -84,8 +84,8 @@ RSpec.describe EE::RunnersHelper do
context
'with notifications'
do
let
(
:experiment_status
)
{
true
}
describe
'.show_buy_
ci
_minutes?'
do
subject
{
helper
.
show_buy_
ci
_minutes?
(
project
,
namespace
)
}
describe
'.show_buy_
pipeline
_minutes?'
do
subject
{
helper
.
show_buy_
pipeline
_minutes?
(
project
,
namespace
)
}
context
'when experiment is "ci_notification_dot"'
do
it_behaves_like
'minutes notification'
do
...
...
@@ -106,8 +106,8 @@ RSpec.describe EE::RunnersHelper do
end
end
describe
'.show_
ci
_minutes_notification_dot?'
do
subject
{
helper
.
show_
ci
_minutes_notification_dot?
(
project
,
namespace
)
}
describe
'.show_
pipeline
_minutes_notification_dot?'
do
subject
{
helper
.
show_
pipeline
_minutes_notification_dot?
(
project
,
namespace
)
}
it_behaves_like
'minutes notification'
do
before
do
...
...
ee/spec/views/layouts/application.html.haml_spec.rb
View file @
cca00b11
...
...
@@ -18,7 +18,7 @@ RSpec.describe 'layouts/application' do
let
(
:show_notification_dot
)
{
false
}
before
do
allow
(
view
).
to
receive
(
:show_
ci
_minutes_notification_dot?
).
and_return
(
show_notification_dot
)
allow
(
view
).
to
receive
(
:show_
pipeline
_minutes_notification_dot?
).
and_return
(
show_notification_dot
)
end
context
'when we show the notification dot'
do
...
...
ee/spec/views/layouts/header/_current_user_dropdown.html.haml_spec.rb
View file @
cca00b11
...
...
@@ -5,33 +5,33 @@ require 'spec_helper'
RSpec
.
describe
'layouts/header/_current_user_dropdown'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
describe
'Buy
CI
Minutes link in user dropdown'
do
describe
'Buy
Pipeline
Minutes link in user dropdown'
do
let
(
:need_minutes
)
{
true
}
before
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
view
).
to
receive
(
:show_upgrade_link?
).
and_return
(
false
)
allow
(
view
).
to
receive
(
:show_buy_
ci
_minutes?
).
and_return
(
need_minutes
)
allow
(
view
).
to
receive
(
:show_buy_
pipeline
_minutes?
).
and_return
(
need_minutes
)
render
end
subject
{
rendered
}
context
'when
ci
minutes need bought'
do
it
'has "Buy
CI
minutes" link with correct data properties'
,
:aggregate_failures
do
context
'when
pipeline
minutes need bought'
do
it
'has "Buy
Pipeline
minutes" link with correct data properties'
,
:aggregate_failures
do
expect
(
subject
).
to
have_selector
(
'[data-track-event="click_buy_ci_minutes"]'
)
expect
(
subject
).
to
have_selector
(
"[data-track-label='
#{
user
.
namespace
.
actual_plan_name
}
']"
)
expect
(
subject
).
to
have_selector
(
'[data-track-property="user_dropdown"]'
)
expect
(
subject
).
to
have_link
(
'Buy
CI
minutes'
)
expect
(
subject
).
to
have_link
(
'Buy
Pipeline
minutes'
)
end
end
context
'when ci minutes do not need bought'
do
let
(
:need_minutes
)
{
false
}
it
'has no "Buy
CI
minutes" link'
do
expect
(
subject
).
not_to
have_link
(
'Buy
CI
minutes'
)
it
'has no "Buy
Pipeline
minutes" link'
do
expect
(
subject
).
not_to
have_link
(
'Buy
Pipeline
minutes'
)
end
end
end
...
...
@@ -41,7 +41,7 @@ RSpec.describe 'layouts/header/_current_user_dropdown' do
before
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
view
).
to
receive
(
:show_buy_
ci
_minutes?
).
and_return
(
false
)
allow
(
view
).
to
receive
(
:show_buy_
pipeline
_minutes?
).
and_return
(
false
)
allow
(
view
).
to
receive
(
:show_upgrade_link?
).
and_return
(
on_upgradeable_plan
)
render
...
...
locale/gitlab.pot
View file @
cca00b11
...
...
@@ -6702,7 +6702,7 @@ msgstr ""
msgid "Current vulnerabilities count"
msgstr ""
msgid "CurrentUser|Buy
CI
minutes"
msgid "CurrentUser|Buy
Pipeline
minutes"
msgstr ""
msgid "CurrentUser|Profile"
...
...
spec/frontend/header_spec.js
View file @
cca00b11
...
...
@@ -60,7 +60,7 @@ describe('Header', () => {
beforeEach
(()
=>
{
setFixtures
(
`
<li class="js-nav-user-dropdown">
<a class="js-buy-
ci-minutes-link" data-track-event="click_buy_ci_minutes" data-track-label="free" data-track-property="user_dropdown">Buy CI
minutes</a>
<a class="js-buy-
pipeline-minutes-link" data-track-event="click_buy_ci_minutes" data-track-label="free" data-track-property="user_dropdown">Buy Pipeline
minutes</a>
<a class="js-upgrade-plan-link" data-track-event="click_upgrade_link" data-track-label="free" data-track-property="user_dropdown">Upgrade</a>
</li>`
);
...
...
@@ -74,7 +74,7 @@ describe('Header', () => {
unmockTracking
();
});
it
(
'
sends a tracking event when the dropdown is opened and contains Buy
CI
minutes link
'
,
()
=>
{
it
(
'
sends a tracking event when the dropdown is opened and contains Buy
Pipeline
minutes link
'
,
()
=>
{
$
(
'
.js-nav-user-dropdown
'
).
trigger
(
'
shown.bs.dropdown
'
);
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
'
some:page
'
,
'
show_buy_ci_minutes
'
,
{
...
...
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