Commit 24ab2c4a authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'buy-ci-minutes-link-v-a' into 'master'

Add buy ci minutes notification on dropdown

Closes gitlab-org/growth/product#1489

See merge request gitlab-org/gitlab!27920
parents f2dd6a1c fe959906
...@@ -553,6 +553,7 @@ ...@@ -553,6 +553,7 @@
vertical-align: text-top; vertical-align: text-top;
} }
a.ci-minutes-emoji gl-emoji,
a.trial-link gl-emoji { a.trial-link gl-emoji {
font-size: $gl-font-size; font-size: $gl-font-size;
vertical-align: baseline; vertical-align: baseline;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
- if current_user_menu?(:settings) - if current_user_menu?(:settings)
%li %li
= link_to s_("CurrentUser|Settings"), profile_path, data: { qa_selector: 'settings_link' } = link_to s_("CurrentUser|Settings"), profile_path, data: { qa_selector: 'settings_link' }
= render_if_exists 'layouts/header/buy_ci_minutes'
- if current_user_menu?(:help) - if current_user_menu?(:help)
%li.divider.d-md-none %li.divider.d-md-none
......
...@@ -15,6 +15,10 @@ module EE ...@@ -15,6 +15,10 @@ module EE
message.join(' ').html_safe message.join(' ').html_safe
end end
def show_buy_ci_minutes?
experiment_enabled?(:buy_ci_minutes_version_a)
end
private private
def purchase_shared_runner_minutes_link def purchase_shared_runner_minutes_link
......
- return unless show_buy_ci_minutes?
%li
= link_to profile_pipeline_quota_path, class: 'ci-minutes-emoji' do
= s_("CurrentUser|Buy CI minutes")
= emoji_icon('clock9')
...@@ -138,4 +138,24 @@ describe EE::RunnersHelper do ...@@ -138,4 +138,24 @@ describe EE::RunnersHelper do
end end
end end
end end
describe '.show_buy_ci_minutes?' do
subject { helper.show_buy_ci_minutes? }
context 'when experiment is disabled' do
before do
allow(helper).to receive(:experiment_enabled?).with(:buy_ci_minutes_version_a).and_return(false)
end
it { is_expected.to be_falsey }
end
context 'when experiment is enabled' do
before do
allow(helper).to receive(:experiment_enabled?).with(:buy_ci_minutes_version_a).and_return(true)
end
it { is_expected.to be_truthy }
end
end
end end
# frozen_string_literal: true
require 'spec_helper'
describe 'layouts/header/_current_user_dropdown' do
let_it_be(:user) { create(:user) }
let(:need_minutes) { true }
before do
allow(view).to receive(:current_user).and_return(user)
allow(view).to receive(:show_buy_ci_minutes?).and_return(need_minutes)
render
end
subject { rendered }
context 'when ci minutes need bought' do
it 'has "Buy CI minutes" link' do
expect(subject).to have_link('Buy CI 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')
end
end
end
...@@ -34,6 +34,12 @@ module Gitlab ...@@ -34,6 +34,12 @@ module Gitlab
environment: ::Gitlab.dev_env_or_com?, environment: ::Gitlab.dev_env_or_com?,
enabled_ratio: 0.1, enabled_ratio: 0.1,
tracking_category: 'Growth::Expansion::Experiment::CiNotificationDot' tracking_category: 'Growth::Expansion::Experiment::CiNotificationDot'
},
buy_ci_minutes_version_a: {
feature_toggle: :buy_ci_minutes_version_a,
environment: ::Gitlab.dev_env_or_com?,
enabled_ratio: 0.2,
tracking_category: 'Growth::Expansion::Experiment::BuyCiMinutesVersionA'
} }
}.freeze }.freeze
......
...@@ -5992,6 +5992,9 @@ msgstr "" ...@@ -5992,6 +5992,9 @@ msgstr ""
msgid "Current vulnerabilities count" msgid "Current vulnerabilities count"
msgstr "" msgstr ""
msgid "CurrentUser|Buy CI minutes"
msgstr ""
msgid "CurrentUser|Profile" msgid "CurrentUser|Profile"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment