Commit caaab1ca authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '341949-in-app-awareness-of-registration-features-feature-based-cta' into 'master'

In-app awareness of Registration Features - Repository size limit [RUN-AS-IF-FOSS]

See merge request gitlab-org/gitlab!73222
parents c388c0d3 b45ee013
- license = local_assigns.fetch(:license)
- registration_features_docs_path = help_page_path('development/service_ping/index.md', anchor: 'registration-features-program')
- service_ping_settings_path = metrics_and_profiling_admin_application_settings_path(anchor: 'js-usage-settings')
%div
%span= s_('RegistrationFeatures|Want to use this feature for free?')
- if license.present?
= link_to s_('RegistrationFeatures|Enable Service Ping and register for this feature.'), service_ping_settings_path
= sprintf(s_('RegistrationFeatures|Read more about the %{linkStart}Registration Features Program%{linkEnd}.') , { linkStart: "<a href=\"#{registration_features_docs_path}\" target=\"_blank\">", linkEnd: "</a>", }).html_safe
- return unless repo_size_limit_feature_available?
- form = local_assigns.fetch(:form)
.form-group
= form.label :repository_size_limit, class: 'label-bold' do
= _('Size limit per repository (MB)')
= form.number_field :repository_size_limit, value: form.object.repository_size_limit.try(:to_mb), class: 'form-control gl-form-input', min: 0, title: _('Maximum size limit for each repository.'), data: { toggle: 'tooltip', container: 'body' }
%span.form-text.text-muted#repository_size_limit_help_block
= _('Includes LFS objects. It can be overridden per group, or per project. 0 for unlimited.')
= link_to _('Learn more.'), help_page_path('user/admin_area/settings/account_and_limit_settings'), target: '_blank', rel: 'noopener noreferrer'
- if repo_size_limit_feature_available?
= form.number_field :repository_size_limit, value: form.object.repository_size_limit.try(:to_mb), class: 'form-control gl-form-input', min: 0, title: _('Maximum size limit for each repository.'), data: { toggle: 'tooltip', container: 'body' }
%span.form-text.text-muted#repository_size_limit_help_block
= _('Includes LFS objects. It can be overridden per group, or per project. 0 for unlimited.')
= link_to _('Learn more.'), help_page_path('user/admin_area/settings/account_and_limit_settings'), target: '_blank', rel: 'noopener noreferrer'
- else
= form.number_field :disabled_repository_size_limit, value: '', class: 'form-control gl-form-input', disabled: true
%span.form-text.text-muted
= render 'shared/registration_features_discovery_message', license: @license
- return unless current_user.admin? && repo_size_limit_feature_available?
- return unless current_user.admin?
- form = local_assigns.fetch(:form)
- is_project = local_assigns.fetch(:type) == :project
......@@ -7,6 +7,11 @@
.form-group.col-md-9
= form.label :repository_size_limit, class: 'label-bold' do
Repository size limit (MB)
= form.number_field :repository_size_limit, value: form.object.repository_size_limit.try(:to_mb), class: 'form-control', min: 0, data: { qa_selector: 'repository_size_limit_field' }
%span.form-text.text-muted#repository_size_limit_help_block
= is_project ? size_limit_message(@project) : size_limit_message_for_group(@group)
- if repo_size_limit_feature_available?
= form.number_field :repository_size_limit, value: form.object.repository_size_limit.try(:to_mb), class: 'form-control', min: 0, data: { qa_selector: 'repository_size_limit_field' }
%span.form-text.text-muted#repository_size_limit_help_block
= is_project ? size_limit_message(@project) : size_limit_message_for_group(@group)
- else
= form.number_field :disabled_repository_size_limit, value: '', class: 'form-control', disabled: true
%span.form-text.text-muted
= render 'shared/registration_features_discovery_message', license: @license
......@@ -38,4 +38,32 @@ RSpec.describe 'admin/application_settings/general.html.haml' do
end
end
end
context 'repository size limit' do
context 'feature is disabled' do
before do
stub_licensed_features(repository_size_limit: false)
render
end
it('renders registration features prompt without activation link') do
expect(rendered).to have_field('application_setting_disabled_repository_size_limit', disabled: true)
expect(rendered).to have_link 'Registration Features Program'
expect(rendered).not_to have_link 'Enable Service Ping and register for this feature.'
end
context 'user has an active license' do
before do
assign(:license, create(:license))
render
end
it('renders registration features prompt with activation link') do
expect(rendered).to have_link 'Enable Service Ping and register for this feature.', href: metrics_and_profiling_admin_application_settings_path(anchor: 'js-usage-settings')
end
end
end
end
end
......@@ -40,4 +40,32 @@ RSpec.describe 'projects/edit' do
end
end
end
context 'repository size limit' do
context 'feature is disabled' do
before do
stub_licensed_features(repository_size_limit: false)
render
end
it('renders registration features prompt without activation link') do
expect(rendered).to have_field('project_disabled_repository_size_limit', disabled: true)
expect(rendered).to have_link 'Registration Features Program'
expect(rendered).not_to have_link 'Enable Service Ping and register for this feature.'
end
context 'user has an active license' do
before do
assign(:license, create(:license))
render
end
it('renders registration features prompt with activation link') do
expect(rendered).to have_link 'Enable Service Ping and register for this feature.', href: metrics_and_profiling_admin_application_settings_path(anchor: 'js-usage-settings')
end
end
end
end
end
......@@ -29040,6 +29040,15 @@ msgstr ""
msgid "Registration Features include:"
msgstr ""
msgid "RegistrationFeatures|Enable Service Ping and register for this feature."
msgstr ""
msgid "RegistrationFeatures|Read more about the %{linkStart}Registration Features Program%{linkEnd}."
msgstr ""
msgid "RegistrationFeatures|Want to use this feature for free?"
msgstr ""
msgid "Registration|Checkout"
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