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
b34b8007
Commit
b34b8007
authored
Apr 08, 2022
by
Serena Fang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show banner on group pages
Also fix namespace helper and add specs
parent
3acc9f22
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
60 additions
and
21 deletions
+60
-21
app/helpers/namespaces_helper.rb
app/helpers/namespaces_helper.rb
+3
-2
app/views/groups/edit.html.haml
app/views/groups/edit.html.haml
+1
-0
app/views/groups/settings/ci_cd/show.html.haml
app/views/groups/settings/ci_cd/show.html.haml
+1
-0
app/views/groups/show.html.haml
app/views/groups/show.html.haml
+1
-0
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+1
-1
app/views/projects/jobs/index.html.haml
app/views/projects/jobs/index.html.haml
+1
-1
app/views/projects/pipeline_schedules/index.html.haml
app/views/projects/pipeline_schedules/index.html.haml
+1
-1
app/views/projects/pipelines/index.html.haml
app/views/projects/pipelines/index.html.haml
+1
-1
app/views/projects/settings/ci_cd/show.html.haml
app/views/projects/settings/ci_cd/show.html.haml
+1
-1
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+1
-1
app/views/shared/_minute_limit_banner.html.haml
app/views/shared/_minute_limit_banner.html.haml
+1
-1
spec/helpers/namespaces_helper_spec.rb
spec/helpers/namespaces_helper_spec.rb
+47
-12
No files found.
app/helpers/namespaces_helper.rb
View file @
b34b8007
...
...
@@ -88,8 +88,9 @@ module NamespacesHelper
}.
to_json
end
def
show_minute_limit_banner?
(
project
)
return
true
if
project
.
project_namespace
.
free_plan?
def
show_minute_limit_banner?
(
namespace
)
return
false
unless
::
Feature
.
enabled?
(
:show_minute_limit_banner
)
return
true
if
namespace
.
root_ancestor
.
free_plan?
&&
!
minute_limit_banner_dismissed?
false
end
...
...
app/views/groups/edit.html.haml
View file @
b34b8007
...
...
@@ -4,6 +4,7 @@
-
expanded
=
expanded_by_default?
=
render
'shared/namespaces/cascading_settings/lock_popovers'
=
render_if_exists
'shared/minute_limit_banner'
,
namespace:
@group
%section
.settings.gs-general.no-animate.expanded
#js-general-settings
.settings-header
...
...
app/views/groups/settings/ci_cd/show.html.haml
View file @
b34b8007
...
...
@@ -3,6 +3,7 @@
-
expanded
=
expanded_by_default?
-
general_expanded
=
@group
.
errors
.
empty?
?
expanded
:
true
=
render_if_exists
'shared/minute_limit_banner'
,
namespace:
@group
-# Given we only have one field in this form which is also admin-only,
-# we don't want to show an empty section to non-admin users,
...
...
app/views/groups/show.html.haml
View file @
b34b8007
...
...
@@ -8,6 +8,7 @@
=
render_if_exists
'shared/qrtly_reconciliation_alert'
,
group:
@group
=
render_if_exists
'shared/user_over_limit_free_plan_alert'
,
source:
@group
=
render_if_exists
'shared/minute_limit_banner'
,
namespace:
@group
-
if
show_invite_banner?
(
@group
)
=
content_for
:group_invite_members_banner
do
...
...
app/views/projects/edit.html.haml
View file @
b34b8007
...
...
@@ -5,7 +5,7 @@
-
expanded
=
expanded_by_default?
-
reduce_visibility_form_id
=
'reduce-visibility-form'
=
render_if_exists
'shared/minute_limit_banner'
,
project
:
@project
=
render_if_exists
'shared/minute_limit_banner'
,
namespace
:
@project
%section
.settings.general-settings.no-animate.expanded
#js-general-settings
.settings-header
...
...
app/views/projects/jobs/index.html.haml
View file @
b34b8007
=
render_if_exists
'shared/minute_limit_banner'
,
project
:
@project
=
render_if_exists
'shared/minute_limit_banner'
,
namespace
:
@project
-
page_title
_
(
"Jobs"
)
-
add_page_specific_style
'page_bundles/ci_status'
...
...
app/views/projects/pipeline_schedules/index.html.haml
View file @
b34b8007
=
render_if_exists
'shared/minute_limit_banner'
,
project
:
@project
=
render_if_exists
'shared/minute_limit_banner'
,
namespace
:
@project
-
breadcrumb_title
_
(
"Schedules"
)
-
page_title
_
(
"Pipeline Schedules"
)
...
...
app/views/projects/pipelines/index.html.haml
View file @
b34b8007
=
render_if_exists
'shared/minute_limit_banner'
,
project
:
@project
=
render_if_exists
'shared/minute_limit_banner'
,
namespace
:
@project
-
page_title
_
(
'Pipelines'
)
-
add_page_specific_style
'page_bundles/pipelines'
...
...
app/views/projects/settings/ci_cd/show.html.haml
View file @
b34b8007
=
render_if_exists
'shared/minute_limit_banner'
,
project
:
@project
=
render_if_exists
'shared/minute_limit_banner'
,
namespace
:
@project
-
@content_class
=
"limit-container-width"
unless
fluid_layout
-
page_title
_
(
"CI/CD Settings"
)
...
...
app/views/projects/show.html.haml
View file @
b34b8007
...
...
@@ -7,7 +7,7 @@
=
auto_discovery_link_tag
(
:atom
,
project_path
(
@project
,
rss_url_options
),
title:
"
#{
@project
.
name
}
activity"
)
=
render_if_exists
'shared/user_over_limit_free_plan_alert'
,
source:
@project
=
render_if_exists
'shared/minute_limit_banner'
,
project
:
@project
=
render_if_exists
'shared/minute_limit_banner'
,
namespace
:
@project
=
render
partial:
'flash_messages'
,
locals:
{
project:
@project
}
=
render
"projects/last_push"
...
...
app/views/shared/_minute_limit_banner.html.haml
View file @
b34b8007
-
if
show_minute_limit_banner?
(
project
)
-
if
show_minute_limit_banner?
(
namespace
)
.container-fluid.container-limited.pt-3
=
render
Pajamas
::
AlertComponent
.
new
(
title:
s_
(
"Free tier projects CI minutes quota"
),
alert_class:
'gl-mt-5 js-minute-limit-banner'
,
...
...
spec/helpers/namespaces_helper_spec.rb
View file @
b34b8007
...
...
@@ -272,28 +272,63 @@ RSpec.describe NamespacesHelper do
describe
'#show_minute_limit_banner?'
do
let
(
:project
)
{
create
(
:project
)
}
context
'when show_minute_limit_banner feature flag enabled'
do
before
do
stub_feature_flags
(
show_minute_limit_banner:
true
)
end
context
'for a free project'
do
before
do
allow
(
project
.
project_namespace
).
to
receive
(
:free_plan?
).
and_return
(
true
)
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
true
)
end
it
'returns true'
do
context
'when user has not dismissed banner'
do
before
do
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
Users
::
CalloutsHelper
::
MINUTE_LIMIT_BANNER
).
and_return
(
false
)
end
it
'shows the banner'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
true
)
end
end
context
'when user has dismissed banner'
do
before
do
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
Users
::
CalloutsHelper
::
MINUTE_LIMIT_BANNER
).
and_return
(
true
)
end
it
'does not show the banner'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
false
)
end
end
end
context
'for a non-free project'
do
before
do
allow
(
project
.
project_namespace
).
to
receive
(
:free_plan?
).
and_return
(
false
)
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
false
)
end
it
'returns false
'
do
it
'does not show the banner
'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
false
)
end
end
end
context
'when show_minute_limit_banner feature flag is not enabled'
do
before
do
stub_feature_flags
(
show_minute_limit_banner:
false
)
end
context
'for a free project and user has not dismissed callout'
do
before
do
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
Users
::
CalloutsHelper
::
MINUTE_LIMIT_BANNER
).
and_return
(
false
)
end
it
'does not show banner'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
false
)
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