- payload_class = 'js-service-ping-payload' - link_start = ''.html_safe - link_end = ''.html_safe = gitlab_ui_form_for @application_setting, url: metrics_and_profiling_admin_application_settings_path(anchor: 'js-usage-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) %fieldset .form-group - help_link_start = link_start % { url: help_page_path('administration/settings/usage_statistics.md', anchor: 'version-check') } = f.gitlab_ui_checkbox_component :version_check_enabled, _('Enable version check'), help_text: _("GitLab informs you if a new version is available. %{link_start}What information does GitLab Inc. collect?%{link_end}").html_safe % { link_start: help_link_start, link_end: link_end } .form-group - can_be_configured = @application_setting.usage_ping_can_be_configured? - service_ping_link_start = link_start % { url: help_page_path('development/internal_analytics/service_ping/index.md') } - deactivating_service_ping_link_start = link_start % { url: help_page_path('administration/settings/usage_statistics.md', anchor: 'through-the-configuration-file') } - usage_ping_help_text = s_('AdminSettings|To help improve GitLab and its user experience, GitLab periodically collects usage information. %{link_start}What information is shared with GitLab Inc.?%{link_end}').html_safe % { link_start: service_ping_link_start, link_end: link_end } - disabled_help_text = s_('AdminSettings|Service ping is disabled in your configuration file, and cannot be enabled through this form. For more information, see the documentation on %{link_start}deactivating service ping%{link_end}.').html_safe % { link_start: deactivating_service_ping_link_start, link_end: link_end } = f.gitlab_ui_checkbox_component :usage_ping_enabled, s_('AdminSettings|Enable Service Ping'), help_text: can_be_configured ? usage_ping_help_text : disabled_help_text, checkbox_options: { disabled: !can_be_configured || ServicePing::ServicePingSettings.license_operational_metric_enabled?, data: { testid: 'enable-usage-data-checkbox' } } - if Gitlab.ee? = render_if_exists 'admin/application_settings/include_optional_metric_in_service_ping_checkbox', form: f .form-text.gl-pl-6.gl-mb-6 - if @service_ping_data.present? = render Pajamas::ButtonComponent.new(button_options: { class: 'js-payload-preview-trigger gl-mr-2', data: { payload_selector: ".#{payload_class}" } }) do = gl_loading_icon(css_class: 'js-spinner gl-hidden', inline: true) %span.js-text.gl-inline= s_('AdminSettings|Preview payload') = render Pajamas::ButtonComponent.new(button_options: { class: 'js-payload-download-trigger gl-mr-2', data: { endpoint: usage_data_admin_application_settings_path(format: :json) } }) do = gl_loading_icon(css_class: 'js-spinner gl-hidden', inline: true) %span.js-text.gl-inline= s_('AdminSettings|Download payload') %pre.js-syntax-highlight.code.highlight.gl-mt-2.gl-hidden{ class: payload_class, data: { endpoint: usage_data_admin_application_settings_path(format: :html) } } - else = render Pajamas::AlertComponent.new(variant: :warning, dismissible: false, title: s_('AdminSettings|Service Ping payload not found in the application cache')) do |c| - c.with_body do - generate_manually_link = link_to('', help_page_path('development/internal_analytics/service_ping/troubleshooting.md', anchor: 'generate-service-ping'), target: '_blank', rel: 'noopener noreferrer') = safe_format(s_('AdminSettings|%{generate_manually_link_start}Generate%{generate_manually_link_end} Service Ping to preview and download service usage data payload.'), tag_pair(generate_manually_link, :generate_manually_link_start, :generate_manually_link_end)) .form-group - usage_ping_enabled = @application_setting.usage_ping_enabled? - include_optional_metrics_in_service_ping = @application_setting.include_optional_metrics_in_service_ping - label = s_('AdminSettings|Enable Registration Features') - label_link = link_to sprite_icon('question-o'), help_page_path('administration/settings/usage_statistics.md', anchor: 'registration-features-program') - service_ping_help_text = usage_ping_enabled ? s_('AdminSettings|You can enable Registration Features because Service Ping is enabled.') : s_('AdminSettings|To enable Registration Features, first enable Service Ping.') - optional_metrics_help_text = include_optional_metrics_in_service_ping ? s_('AdminSettings|You can enable Registration Features because optional data in Service Ping is enabled.') : s_('AdminSettings|To enable Registration Features, first enable optional data in Service Ping.') = f.gitlab_ui_checkbox_component :usage_ping_features_enabled?, '%{label} %{label_link}'.html_safe % { label: label, label_link: label_link }, help_text: tag.span(Gitlab.ee? ? optional_metrics_help_text : service_ping_help_text, id: 'service_ping_features_helper_text'), checkbox_options: { id: 'application_setting_usage_ping_features_enabled' }, label_options: { id: 'service_ping_features_label' } .form-text.gl-text-gray-500.gl-pl-6 %p.gl-mb-3 - registration_features_gitlab_path = help_page_path('administration/settings/usage_statistics.md', anchor: 'registration-features-program') - registration_features_gitlab_link = link_to('', registration_features_gitlab_path, target: '_blank', rel: 'noopener noreferrer') = safe_format(s_('AdminSettings|For a list of included Registration Features, see %{link_start}the documentation%{link_end}.'), tag_pair(registration_features_gitlab_link, :link_start, :link_end)) = f.submit _('Save changes'), pajamas_button: true