Module: ImportHelper

Includes:
Gitlab::Utils::StrongMemoize
Included in:
Import::FogbugzProviderRepoEntity, Import::GithubController, Import::GithubishProviderRepoEntity, ProjectImportEntity
Defined in:
app/helpers/import_helper.rb

Instance Method Summary collapse

Instance Method Details

#has_ci_cd_only_params?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'app/helpers/import_helper.rb', line 6

def has_ci_cd_only_params?
  false
end

#import_configure_github_admin_messageObject



55
56
57
58
59
60
61
62
63
# File 'app/helpers/import_helper.rb', line 55

def import_configure_github_admin_message
  github_integration_link = link_to 'GitHub integration', help_page_path('integration/github.md')

  if current_user.can_admin_all_resources?
    safe_format(_('Note: As an administrator you may like to configure %{github_integration_link}, which will allow login via GitHub and allow importing repositories without generating a personal access token.'), github_integration_link: github_integration_link)
  else
    safe_format(_('Note: Consider asking your GitLab administrator to configure %{github_integration_link}, which will allow login via GitHub and allow importing repositories without generating a personal access token.'), github_integration_link: github_integration_link)
  end
end

#import_github_authorize_messageObject



51
52
53
# File 'app/helpers/import_helper.rb', line 51

def import_github_authorize_message
  s_('GithubImport|To import GitHub repositories, you must first authorize GitLab to access your GitHub repositories.')
end

#import_in_progress_titleObject



39
40
41
42
43
44
45
# File 'app/helpers/import_helper.rb', line 39

def import_in_progress_title
  if @project.forked?
    _('Forking in progress')
  else
    _('Import in progress')
  end
end

#import_project_target(owner, name) ⇒ Object



16
17
18
19
# File 'app/helpers/import_helper.rb', line 16

def import_project_target(owner, name)
  namespace = current_user.can_create_group? ? owner : current_user.namespace_path
  "#{namespace}/#{name}"
end

#import_svn_message(_ci_cd_only) ⇒ Object



34
35
36
37
# File 'app/helpers/import_helper.rb', line 34

def import_svn_message(_ci_cd_only)
  svn_link = link_to _('Learn more'), help_page_path('user/import/_index.md', anchor: 'migrate-from-subversion')
  safe_format(s_('Import|You can import a Subversion repository by using third-party tools. %{svn_link}.'), svn_link: svn_link)
end

#import_wait_and_refresh_messageObject



47
48
49
# File 'app/helpers/import_helper.rb', line 47

def import_wait_and_refresh_message
  _('Please wait while we import the repository for you. Refresh at will.')
end

#import_will_timeout_message(_ci_cd_only) ⇒ Object



29
30
31
32
# File 'app/helpers/import_helper.rb', line 29

def import_will_timeout_message(_ci_cd_only)
  timeout = time_interval_in_words(Gitlab.config.gitlab_shell.git_timeout)
  _('The import will time out after %{timeout}. For repositories that take longer, use a clone/push combination.') % { timeout: timeout }
end


21
22
23
24
25
26
27
# File 'app/helpers/import_helper.rb', line 21

def provider_project_link_url(provider_url, full_path)
  if Gitlab::Utils.parse_url(full_path)&.absolute?
    full_path
  else
    Gitlab::Utils.append_path(provider_url, full_path)
  end
end

#sanitize_project_name(name) ⇒ Object



10
11
12
13
14
# File 'app/helpers/import_helper.rb', line 10

def sanitize_project_name(name)
  # For personal projects in Bitbucket in the form ~username, we can
  # just drop that leading tilde.
  name.gsub(/\A~+/, '').gsub(/[^\w\-]/, '-')
end