2019-11-15 18:06:24 +00:00
- return unless Gitlab::Sourcegraph.feature_available?
- expanded = integration_expanded?('sourcegraph_')
%section.settings.as-sourcegraph.no-animate#js-sourcegraph-settings{ class: ('expanded' if expanded) }
.settings-header
2022-07-06 18:08:29 +00:00
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only
2019-11-15 18:06:24 +00:00
= _('Sourcegraph')
2022-06-13 18:09:22 +00:00
= render Pajamas::ButtonComponent.new(button_options: { class: 'js-settings-toggle' }) do
2019-11-15 18:06:24 +00:00
= expanded ? _('Collapse') : _('Expand')
%p
- link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: 'https://sourcegraph.com/' }
- link_end = "#{sprite_icon('external-link', size: 12, css_class: 'ml-1 vertical-align-center')}</a>".html_safe
= s_('SourcegraphAdmin|Enable code intelligence powered by %{link_start}Sourcegraph%{link_end} on your GitLab instance\'s code views and merge requests.').html_safe % { link_start: link_start, link_end: link_end }
%span
2022-03-01 15:22:06 +00:00
= link_to s_('SourcegraphAdmin|Learn more.'), help_page_path('integration/sourcegraph.md'), target: '_blank', rel: 'noopener noreferrer'
2019-11-15 18:06:24 +00:00
.settings-content
2022-04-09 00:09:46 +00:00
= gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-sourcegraph-settings'), html: { class: 'fieldset-form', id: 'sourcegraph-settings' } do |f|
2022-06-14 12:08:53 +00:00
= form_errors(@application_setting, pajamas_alert: true)
2019-11-15 18:06:24 +00:00
%fieldset
.form-group
2022-04-09 00:09:46 +00:00
= f.gitlab_ui_checkbox_component :sourcegraph_enabled, s_('SourcegraphAdmin|Enable Sourcegraph')
2019-11-15 18:06:24 +00:00
.form-group
2022-04-09 00:09:46 +00:00
= f.gitlab_ui_checkbox_component :sourcegraph_public_only, s_('SourcegraphAdmin|Block on private and internal projects'), help_text: s_('SourcegraphAdmin|Only public projects have code intelligence enabled and communicate with Sourcegraph.')
2019-11-15 18:06:24 +00:00
.form-group
= f.label :sourcegraph_url, s_('SourcegraphAdmin|Sourcegraph URL'), class: 'label-bold'
2022-03-01 15:22:06 +00:00
= f.text_field :sourcegraph_url, class: 'form-control gl-form-input', placeholder: s_('SourcegraphAdmin|https://sourcegraph.example.com')
2019-11-15 18:06:24 +00:00
.form-text.text-muted
= s_('SourcegraphAdmin|Configure the URL to a Sourcegraph instance which can read your GitLab projects.')
2021-03-09 15:08:59 +00:00
= f.submit s_('SourcegraphAdmin|Save changes'), class: 'gl-button btn btn-confirm'