1- parent = @group.parent
2- group_path = root_url
3- group_path << parent.full_path + '/' if parent
4
5= form_with url: import_gitlab_group_path, class: 'group-form gl-show-field-errors', multipart: true do |f|
6  .gl-border-l-solid.gl-border-r-solid.gl-border-gray-100.gl-border-1.gl-p-5
7    %h4
8      = _('Import group from file')
9    .gl-alert.gl-alert-warning{ role: 'alert' }
10      = sprite_icon('warning', css_class: 'gl-icon s16 gl-alert-icon gl-alert-icon-no-title')
11      .gl-alert-body
12        - docs_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/group/import/index.md') }
13        - link_end = '</a>'.html_safe
14        = s_('GroupsNew|This feature is deprecated and replaced by %{docs_link_start}Group Migration%{docs_link_end}.').html_safe % { docs_link_start: docs_link_start, docs_link_end: link_end }
15        - if Feature.enabled?(:bulk_import, default_enabled: :yaml)
16          - enable_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/group/import/index.md', anchor: 'enable-or-disable-gitlab-group-migration') }
17          = s_('GroupsNew|Ask your administrator to %{enable_link_start}enable%{enable_link_end} Group Migration.').html_safe % { enable_link_start: enable_link_start, enable_link_end: link_end }
18
19    .form-group.gl-display-flex.gl-flex-direction-column.gl-mt-5
20      = f.label :name, _('New group name'), for: 'import_group_name'
21      = f.text_field :name, placeholder: s_('GroupsNew|My Awesome Group'), class: 'js-autofill-group-name gl-form-input col-xs-12 col-sm-8',
22        required: true,
23        title: _('Please fill in a descriptive name for your group.'),
24        autofocus: true,
25        id: 'import_group_name'
26
27    .form-group.gl-display-flex.gl-flex-direction-column
28      = f.label :import_group_path, _('New group URL'), for: 'import_group_path'
29      .input-group.gl-field-error-anchor.col-xs-12.col-sm-8.gl-p-0
30        .group-root-path.input-group-prepend.has-tooltip{ title: group_path, :'data-placement' => 'bottom' }
31          .input-group-text
32            %span
33              = root_url
34            - if parent
35              %strong= parent.full_path + '/'
36        = f.hidden_field :parent_id, value: parent&.id
37        = f.text_field :path, placeholder: 'my-awesome-group', class: 'form-control js-validate-group-path js-autofill-group-path',
38          id: 'import_group_path',
39          required: true,
40          pattern: Gitlab::PathRegex::NAMESPACE_FORMAT_REGEX_JS,
41          title: group_url_error_message,
42          maxlength: ::Namespace::URL_MAX_LENGTH,
43          "data-bind-in" => "#{'create_chat_team' if Gitlab.config.mattermost.enabled}"
44      %p.validation-error.gl-field-error.field-validation.hide
45        = _("Group path is already taken. We've suggested one that is available.")
46      %p.validation-success.gl-field-success.field-validation.hide= _('Group path is available.')
47      %p.validation-pending.gl-field-error-ignore.field-validation.hide= _('Checking group path availability...')
48    .form-group
49      = f.label :file, s_('GroupsNew|Upload file')
50      .gl-font-weight-normal
51        - import_export_link_start = '<a href="%{url}" target="_blank">'.html_safe % { url: help_page_path('user/group/settings/import_export') }
52        = s_('GroupsNew|To import a group, navigate to the group settings for the GitLab source instance, %{link_start}generate an export file%{link_end}, and upload it here.').html_safe % { link_start: import_export_link_start, link_end: '</a>'.html_safe }
53      .gl-mt-3
54        = render 'shared/file_picker_button', f: f, field: :file, help_text: nil, classes: 'gl-button btn-confirm-secondary gl-mr-2'
55  .gl-border-gray-100.gl-border-solid.gl-border-1.gl-bg-gray-10.gl-p-5
56    = f.submit _('Import'), class: 'btn gl-button btn-confirm'
57