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
7034ea6f
Commit
7034ea6f
authored
Oct 20, 2021
by
Angelo Gulina
Committed by
Vitali Tatarintev
Oct 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Open Buy Minutes in new window if targeting CDot
parent
07e89047
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
9 deletions
+66
-9
ee/app/helpers/ee/namespaces_helper.rb
ee/app/helpers/ee/namespaces_helper.rb
+12
-3
ee/app/views/namespaces/pipelines_quota/_list.haml
ee/app/views/namespaces/pipelines_quota/_list.haml
+2
-1
ee/spec/helpers/ee/namespaces_helper_spec.rb
ee/spec/helpers/ee/namespaces_helper_spec.rb
+52
-5
No files found.
ee/app/helpers/ee/namespaces_helper.rb
View file @
7034ea6f
...
@@ -39,11 +39,20 @@ module EE
...
@@ -39,11 +39,20 @@ module EE
current_user
.
can?
(
:admin_namespace
,
namespace
.
root_ancestor
)
current_user
.
can?
(
:admin_namespace
,
namespace
.
root_ancestor
)
end
end
def
link_to_buy_additional_minutes_path
(
namespace
)
def
buy_additional_minutes_path
(
namespace
)
use_customer_dot_path
=
namespace
.
user_namespace?
||
::
Feature
.
disabled?
(
:new_route_ci_minutes_purchase
,
namespace
,
default_enabled: :yaml
)
return
EE
::
SUBSCRIPTIONS_MORE_MINUTES_URL
if
use_customers_dot_path?
(
namespace
)
return
EE
::
SUBSCRIPTIONS_MORE_MINUTES_URL
if
use_customer_dot_path
buy_minutes_subscriptions_path
(
selected_group:
namespace
.
id
)
buy_minutes_subscriptions_path
(
selected_group:
namespace
.
id
)
end
end
def
buy_additional_minutes_target
(
namespace
)
use_customers_dot_path?
(
namespace
)
?
'_blank'
:
'_self'
end
private
def
use_customers_dot_path?
(
namespace
)
namespace
.
user_namespace?
||
::
Feature
.
disabled?
(
:new_route_ci_minutes_purchase
,
namespace
,
default_enabled: :yaml
)
end
end
end
end
end
ee/app/views/namespaces/pipelines_quota/_list.haml
View file @
7034ea6f
...
@@ -9,7 +9,8 @@
...
@@ -9,7 +9,8 @@
.col-sm-6.offset-sm-6
.col-sm-6.offset-sm-6
-
if
::
Gitlab
.
com?
-
if
::
Gitlab
.
com?
=
link_to
s_
(
'UsageQuota|Buy additional minutes'
),
=
link_to
s_
(
'UsageQuota|Buy additional minutes'
),
link_to_buy_additional_minutes_path
(
namespace
),
buy_additional_minutes_path
(
namespace
),
target:
buy_additional_minutes_target
(
namespace
),
class:
'gl-button btn btn-confirm float-right'
,
class:
'gl-button btn btn-confirm float-right'
,
data:
{
track_action:
'click_buy_ci_minutes'
,
track_label:
namespace
.
actual_plan_name
,
track_property:
'pipeline_quota_page'
}
data:
{
track_action:
'click_buy_ci_minutes'
,
track_label:
namespace
.
actual_plan_name
,
track_property:
'pipeline_quota_page'
}
...
...
ee/spec/helpers/ee/namespaces_helper_spec.rb
View file @
7034ea6f
...
@@ -172,8 +172,8 @@ RSpec.describe EE::NamespacesHelper do
...
@@ -172,8 +172,8 @@ RSpec.describe EE::NamespacesHelper do
end
end
end
end
describe
'#
link_to_
buy_additional_minutes_path'
do
describe
'#buy_additional_minutes_path'
do
subject
{
helper
.
link_to_
buy_additional_minutes_path
(
namespace
)
}
subject
{
helper
.
buy_additional_minutes_path
(
namespace
)
}
let_it_be
(
:namespace
)
{
create
(
:group
)
}
let_it_be
(
:namespace
)
{
create
(
:group
)
}
...
@@ -200,11 +200,11 @@ RSpec.describe EE::NamespacesHelper do
...
@@ -200,11 +200,11 @@ RSpec.describe EE::NamespacesHelper do
end
end
it
'returns the default purchase path for the disabled namespace'
do
it
'returns the default purchase path for the disabled namespace'
do
expect
(
helper
.
link_to_
buy_additional_minutes_path
(
disabled_namespace
)).
to
be
EE
::
SUBSCRIPTIONS_MORE_MINUTES_URL
expect
(
helper
.
buy_additional_minutes_path
(
disabled_namespace
)).
to
be
EE
::
SUBSCRIPTIONS_MORE_MINUTES_URL
end
end
it
'returns GitLab purchase path for the disabled namespace'
do
it
'returns GitLab purchase path for the disabled namespace'
do
expect
(
helper
.
link_to_
buy_additional_minutes_path
(
enabled_namespace
)).
to
eq
buy_minutes_subscriptions_path
(
selected_group:
enabled_namespace
.
id
)
expect
(
helper
.
buy_additional_minutes_path
(
enabled_namespace
)).
to
eq
buy_minutes_subscriptions_path
(
selected_group:
enabled_namespace
.
id
)
end
end
end
end
...
@@ -213,7 +213,54 @@ RSpec.describe EE::NamespacesHelper do
...
@@ -213,7 +213,54 @@ RSpec.describe EE::NamespacesHelper do
let_it_be
(
:personal_namespace
)
{
user
.
namespace
}
let_it_be
(
:personal_namespace
)
{
user
.
namespace
}
it
'returns the default purchase'
do
it
'returns the default purchase'
do
expect
(
helper
.
link_to_buy_additional_minutes_path
(
personal_namespace
)).
to
be
EE
::
SUBSCRIPTIONS_MORE_MINUTES_URL
expect
(
helper
.
buy_additional_minutes_path
(
personal_namespace
)).
to
be
EE
::
SUBSCRIPTIONS_MORE_MINUTES_URL
end
end
end
end
describe
'#buy_additional_minutes_target'
do
subject
{
helper
.
buy_additional_minutes_target
(
namespace
)
}
let_it_be
(
:namespace
)
{
create
(
:group
)
}
context
'new_route_ci_minutes_purchase'
do
context
'when is disabled'
do
before
do
stub_feature_flags
(
new_route_ci_minutes_purchase:
false
)
end
it
{
is_expected
.
to
be
'_blank'
}
end
context
'when is enabled'
do
it
{
is_expected
.
to
eq
'_self'
}
end
context
'when is enabled only for a specific namespace'
do
let_it_be
(
:enabled_namespace
)
{
create
(
:group
)
}
let_it_be
(
:disabled_namespace
)
{
create
(
:group
)
}
before
do
stub_feature_flags
(
new_route_ci_minutes_purchase:
false
)
stub_feature_flags
(
new_route_ci_minutes_purchase:
enabled_namespace
)
end
it
'returns _blank for the disabled namespace'
do
expect
(
helper
.
buy_additional_minutes_target
(
disabled_namespace
)).
to
be
'_blank'
end
it
'returns _self for the disabled namespace'
do
expect
(
helper
.
buy_additional_minutes_target
(
enabled_namespace
)).
to
eq
'_self'
end
end
context
'when called for a personal namespace'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:personal_namespace
)
{
user
.
namespace
}
it
'returns _blank'
do
expect
(
helper
.
buy_additional_minutes_target
(
personal_namespace
)).
to
be
'_blank'
end
end
end
end
end
end
...
...
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