Commit d857bc88 authored by Axel García's avatar Axel García

Registration features info for setting repo size

Changelog: added
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73222
EE: true
parent bb224023
- 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')
= sprintf(s_('Want to use this feature for free? The %{linkStart}Registration Features Program%{linkEnd} does just that.') , { linkStart: "<a href=\"#{registration_features_docs_path}\" target=\"_blank\">", linkEnd: "</a>", }).html_safe
- if @license.present?
= sprintf(s_('Simply %{linkStart}enable Service Ping and select Registration Features%{linkEnd} in your admin settings.') , { linkStart: "<a href=\"#{service_ping_settings_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: '0', class: 'form-control gl-form-input', disabled: true
%span.form-text.text-muted
= render 'shared/registration_features_discovery_message'
- 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: '0', class: 'form-control', disabled: true
%span.form-text.text-muted
= render 'shared/registration_features_discovery_message'
......@@ -38,4 +38,19 @@ 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') do
expect(rendered).to render_template('shared/_registration_features_discovery_message')
expect(rendered).to have_field('application_setting_disabled_repository_size_limit', disabled: true)
end
end
end
end
......@@ -40,4 +40,19 @@ 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') do
expect(rendered).to render_template('shared/_registration_features_discovery_message')
expect(rendered).to have_field('project_disabled_repository_size_limit', disabled: true)
end
end
end
end
......@@ -32674,6 +32674,9 @@ msgstr ""
msgid "Similar issues"
msgstr ""
msgid "Simply %{linkStart}enable Service Ping and select Registration Features%{linkEnd} in your admin settings."
msgstr ""
msgid "Simulate a pipeline created for the default branch"
msgstr ""
......@@ -39220,6 +39223,9 @@ msgstr ""
msgid "Want to see the data? Please ask an administrator for access."
msgstr ""
msgid "Want to use this feature for free? The %{linkStart}Registration Features Program%{linkEnd} does just that."
msgstr ""
msgid "Warning"
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