提交 2e87923d 编写于 作者: R Robert Speicher

Merge branch 'ce-3839-ci-cd-only-projects-fe' into 'master'

Create CI/CD-only projects by URL -- CE backport

See merge request gitlab-org/gitlab-ce!17342
......@@ -12,7 +12,7 @@ $(() => {
const $container = $(container);
$container
.find('.js-toggle-button .fa')
.find('.js-toggle-button .fa-chevron-up, .js-toggle-button .fa-chevron-down')
.toggleClass('fa-chevron-up', toggleState)
.toggleClass('fa-chevron-down', toggleState !== undefined ? !toggleState : undefined);
......@@ -22,7 +22,7 @@ $(() => {
}
$('body').on('click', '.js-toggle-button', function toggleButton(e) {
e.target.classList.toggle('open');
e.currentTarget.classList.toggle(e.currentTarget.dataset.toggleOpenClass || 'open');
toggleContainer($(this).closest('.js-toggle-container'));
const targetTag = e.currentTarget.tagName.toLowerCase();
......
......@@ -41,11 +41,11 @@ class ProjectsController < Projects::ApplicationController
cookies[:issue_board_welcome_hidden] = { path: project_path(@project), value: nil, expires: Time.at(0) }
redirect_to(
project_path(@project),
project_path(@project, custom_import_params),
notice: _("Project '%{project_name}' was successfully created.") % { project_name: @project.name }
)
else
render 'new', locals: { active_tab: ('import' if project_params[:import_url].present?) }
render 'new', locals: { active_tab: active_new_project_tab }
end
end
......@@ -103,7 +103,7 @@ class ProjectsController < Projects::ApplicationController
def show
if @project.import_in_progress?
redirect_to project_import_path(@project)
redirect_to project_import_path(@project, custom_import_params)
return
end
......@@ -359,6 +359,14 @@ class ProjectsController < Projects::ApplicationController
]
end
def custom_import_params
{}
end
def active_new_project_tab
project_params[:import_url].present? ? 'import' : 'blank'
end
def repo_exists?
project.repository_exists? && !project.empty_repo?
......
module ImportHelper
def has_ci_cd_only_params?
false
end
def import_project_target(owner, name)
namespace = current_user.can_create_group? ? owner : current_user.namespace_path
"#{namespace}/#{name}"
......@@ -10,6 +14,28 @@ module ImportHelper
link_to full_path, url, target: '_blank', rel: 'noopener noreferrer'
end
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
def import_svn_message(_ci_cd_only)
svn_link = link_to _('this document'), help_page_path('user/project/import/svn')
_('To import an SVN repository, check out %{svn_link}.').html_safe % { svn_link: svn_link }
end
def import_in_progress_title
if @project.forked?
_('Forking in progress')
else
_('Import in progress')
end
end
def import_wait_and_refresh_message
_('Please wait while we import the repository for you. Refresh at will.')
end
private
def github_project_url(full_path)
......
- visibility_level = params.dig(:project, :visibility_level) || default_project_visibility
- ci_cd_only = local_assigns.fetch(:ci_cd_only, false)
.row{ id: project_name_id }
= f.hidden_field :ci_cd_only, value: ci_cd_only
.form-group.project-path.col-sm-6
= f.label :namespace_id, class: 'label-light' do
%span
......
- page_title @project.forked? ? "Forking in progress" : "Import in progress"
- page_title import_in_progress_title
.save-project-loader
.center
%h2
%i.fa.fa-spinner.fa-spin
- if @project.forked?
Forking in progress.
- else
Import in progress.
- if @project.external_import?
= import_in_progress_title
- if !has_ci_cd_only_params? && @project.external_import?
%p.monospace git clone --bare #{@project.safe_import_url}
%p Please wait while we import the repository for you. Refresh at will.
%p
= import_wait_and_refresh_message
......@@ -12,11 +12,14 @@
.row.prepend-top-default
.col-lg-3.profile-settings-sidebar
%h4.prepend-top-0
New project
= _('New project')
%p
A project is where you house your files (repository), plan your work (issues), and publish your documentation (wiki), #{link_to 'among other things', help_page_path("user/project/index.md", anchor: "projects-features"), target: '_blank'}.
- among_other_things_link = link_to _('among other things'), help_page_path("user/project/index.md", anchor: "projects-features"), target: '_blank'
= _('A project is where you house your files (repository), plan your work (issues), and publish your documentation (wiki), %{among_other_things_link}.').html_safe % { among_other_things_link: among_other_things_link }
%p
All features are enabled when you create a project, but you can disable the ones you don’t need in the project settings.
= _('All features are enabled for blank projects, from templates, or when importing, but you can disable them afterward in the project settings.')
-# EE-specific start
-# EE-specific end
.md
= brand_new_project_guidelines
%p
......@@ -28,36 +31,38 @@
.col-lg-9.js-toggle-container
%ul.nav-links.gitlab-tabs{ role: 'tablist' }
%li{ class: ('active' if active_tab == 'blank'), role: 'presentation' }
%li{ class: active_when(active_tab == 'blank'), role: 'presentation' }
%a{ href: '#blank-project-pane', id: 'blank-project-tab', data: { toggle: 'tab' }, role: 'tab' }
%span.hidden-xs Blank project
%span.visible-xs Blank
%li{ class: ('active' if active_tab == 'template'), role: 'presentation' }
%li{ class: active_when(active_tab == 'template'), role: 'presentation' }
%a{ href: '#create-from-template-pane', id: 'create-from-template-tab', data: { toggle: 'tab' }, role: 'tab' }
%span.hidden-xs Create from template
%span.visible-xs Template
%li{ class: ('active' if active_tab == 'import'), role: 'presentation' }
%li{ class: active_when(active_tab == 'import'), role: 'presentation' }
%a{ href: '#import-project-pane', id: 'import-project-tab', data: { toggle: 'tab' }, role: 'tab' }
%span.hidden-xs Import project
%span.visible-xs Import
-# EE-specific start
-# EE-specific end
.tab-content.gitlab-tab-content
.tab-pane{ id: 'blank-project-pane', class: ('active' if active_tab == 'blank'), role: 'tabpanel' }
.tab-pane{ id: 'blank-project-pane', class: active_when(active_tab == 'blank'), role: 'tabpanel' }
= form_for @project, html: { class: 'new_project' } do |f|
= render 'new_project_fields', f: f, project_name_id: "blank-project-name"
.tab-pane.no-padding{ id: 'create-from-template-pane', class: ('active' if active_tab == 'template'), role: 'tabpanel' }
.tab-pane.no-padding{ id: 'create-from-template-pane', class: active_when(active_tab == 'template'), role: 'tabpanel' }
= form_for @project, html: { class: 'new_project' } do |f|
.project-template
.form-group
%div
= render 'project_templates', f: f
.tab-pane.import-project-pane{ id: 'import-project-pane', class: ('active' if active_tab == 'import'), role: 'tabpanel' }
.tab-pane.import-project-pane.js-toggle-container{ id: 'import-project-pane', class: active_when(active_tab == 'import'), role: 'tabpanel' }
= form_for @project, html: { class: 'new_project' } do |f|
- if import_sources_enabled?
.project-import.row
.col-sm-12
.col-lg-12
.form-group.import-btn-container.clearfix
= f.label :visibility_level, class: 'label-light' do #the label here seems wrong
Import project from
......@@ -97,7 +102,7 @@
Gitea
%div
- if git_import_enabled?
%button.btn.js-toggle-button.import_git{ type: "button" }
%button.btn.js-toggle-button.js-import-git-toggle-button{ type: "button", data: { toggle_open_class: 'active' } }
= icon('git', text: 'Repo by URL')
.col-lg-12
.js-toggle-content.toggle-import-form{ class: ('hide' if active_tab != 'import') }
......@@ -105,6 +110,10 @@
= render "shared/import_form", f: f
= render 'new_project_fields', f: f, project_name_id: "import-url-name"
-# EE-specific start
-# EE-specific end
.save-project-loader.hide
.center
%h2
......
- ci_cd_only = local_assigns.fetch(:ci_cd_only, false)
.form-group.import-url-data
= f.label :import_url, class: 'label-light' do
%span Git repository URL
%span
= _('Git repository URL')
= f.text_field :import_url, autocomplete: 'off', class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git'
= f.text_field :import_url, autocomplete: 'off', class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git', required: true
.well.prepend-top-20
%ul
%li
The repository must be accessible over <code>http://</code>, <code>https://</code> or <code>git://</code>.
= _('The repository must be accessible over <code>http://</code>, <code>https://</code> or <code>git://</code>.').html_safe
%li
If your HTTP repository is not publicly accessible, add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>.
= _('If your HTTP repository is not publicly accessible, add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>.').html_safe
%li
The import will time out after #{time_interval_in_words(Gitlab.config.gitlab_shell.git_timeout)}.
For repositories that take longer, use a clone/push combination.
= import_will_timeout_message(ci_cd_only)
%li
To migrate an SVN repository, check out #{link_to "this document", help_page_path('user/project/import/svn')}.
= import_svn_message(ci_cd_only)
-# EE-specific start
-# EE-specific end
......@@ -10,6 +10,7 @@
1. [From Perforce](perforce.md)
1. [From SVN](svn.md)
1. [From TFS](tfs.md)
1. [From repo by URL](repo_by_url.md)
In addition to the specific migration documentation above, you can import any
Git repository via HTTP from the New Project page. Be aware that if the
......
# Import project from repo by URL
You can import your existing repositories by providing the Git URL:
1. From your GitLab dashboard click **New project**
1. Switch to the **Import project** tab
1. Click on the **Repo by URL** button
1. Fill in the "Git repository URL" and the remaining project fields
1. Click **Create project** to being the import process
1. Once complete, you will be redirected to your newly created project
![Import project by repo URL](img/import_projects_from_repo_url.png)
......@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-01 18:03+0100\n"
"PO-Revision-Date: 2018-03-01 18:03+0100\n"
"POT-Creation-Date: 2018-03-05 13:02-0600\n"
"PO-Revision-Date: 2018-03-05 13:02-0600\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
......@@ -102,6 +102,9 @@ msgstr ""
msgid "A collection of graphs regarding Continuous Integration"
msgstr ""
msgid "A project is where you house your files (repository), plan your work (issues), and publish your documentation (wiki), %{among_other_things_link}."
msgstr ""
msgid "About auto deploy"
msgstr ""
......@@ -201,6 +204,9 @@ msgstr ""
msgid "All"
msgstr ""
msgid "All features are enabled for blank projects, from templates, or when importing, but you can disable them afterward in the project settings."
msgstr ""
msgid "Allows you to add and manage Kubernetes clusters."
msgstr ""
......@@ -698,6 +704,9 @@ msgstr ""
msgid "ClusterIntegration|Copy CA Certificate"
msgstr ""
msgid "ClusterIntegration|Copy Ingress IP Address to clipboard"
msgstr ""
msgid "ClusterIntegration|Copy Kubernetes cluster name"
msgstr ""
......@@ -746,6 +755,9 @@ msgstr ""
msgid "ClusterIntegration|Ingress"
msgstr ""
msgid "ClusterIntegration|Ingress IP Address"
msgstr ""
msgid "ClusterIntegration|Install"
msgstr ""
......@@ -1444,6 +1456,9 @@ msgstr ""
msgid "ForkedFromProjectPath|Forked from %{project_name} (deleted)"
msgstr ""
msgid "Forking in progress"
msgstr ""
msgid "Format"
msgstr ""
......@@ -1462,6 +1477,9 @@ msgstr ""
msgid "Generate a default set of labels"
msgstr ""
msgid "Git repository URL"
msgstr ""
msgid "Git revision"
msgstr ""
......@@ -1587,6 +1605,12 @@ msgstr ""
msgid "If you already have files you can push them using the %{link_to_cli} below."
msgstr ""
msgid "If your HTTP repository is not publicly accessible, add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>."
msgstr ""
msgid "Import in progress"
msgstr ""
msgid "Import repository"
msgstr ""
......@@ -1823,6 +1847,9 @@ msgstr ""
msgid "Monitoring"
msgstr ""
msgid "More information"
msgstr ""
msgid "More information is available|here"
msgstr ""
......@@ -2164,6 +2191,9 @@ msgstr ""
msgid "Please solve the reCAPTCHA"
msgstr ""
msgid "Please wait while we import the repository for you. Refresh at will."
msgstr ""
msgid "Preferences"
msgstr ""
......@@ -2520,6 +2550,9 @@ msgstr ""
msgid "Select target branch"
msgstr ""
msgid "Send email"
msgstr ""
msgid "Sep"
msgstr ""
......@@ -2833,6 +2866,9 @@ msgstr ""
msgid "The fork relationship has been removed."
msgstr ""
msgid "The import will time out after %{timeout}. For repositories that take longer, use a clone/push combination."
msgstr ""
msgid "The issue stage shows the time it takes from creating an issue to assigning the issue to a milestone, or add the issue to a list on your Issue Board. Begin creating issues to see data for this stage."
msgstr ""
......@@ -2866,6 +2902,9 @@ msgstr ""
msgid "The repository for this project is empty"
msgstr ""
msgid "The repository must be accessible over <code>http://</code>, <code>https://</code> or <code>git://</code>."
msgstr ""
msgid "The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request."
msgstr ""
......@@ -3131,6 +3170,9 @@ msgstr ""
msgid "Tip:"
msgstr ""
msgid "To import an SVN repository, check out %{svn_link}."
msgstr ""
msgid "Todo"
msgstr ""
......@@ -3437,6 +3479,9 @@ msgstr ""
msgid "Your projects"
msgstr ""
msgid "among other things"
msgstr ""
msgid "assign yourself"
msgstr ""
......@@ -3632,6 +3677,9 @@ msgstr ""
msgid "spendCommand|%{slash_command} will update the sum of the time spent."
msgstr ""
msgid "this document"
msgstr ""
msgid "username"
msgstr ""
......
......@@ -142,7 +142,7 @@ feature 'New project' do
context 'from git repository url, "Repo by URL"' do
before do
first('.import_git').click
first('.js-import-git-toggle-button').click
end
it 'does not autocomplete sensitive git repo URL' do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册