summaryrefslogtreecommitdiff
path: root/app/views/import
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-07-02 12:16:24 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-07-11 12:22:57 +0300
commit88e640374a82c3058b2a8cb54407fdc1784484d9 (patch)
treec6d0451ca3947e92a56c4d39e00cbf5b0272d257 /app/views/import
parente68a547bc790d44a1df3c9ae8b07b004ab8dd47e (diff)
downloadgitlab-ce-88e640374a82c3058b2a8cb54407fdc1784484d9.tar.gz
Add manifest import feature
It allows user to automatically import multiple repositories with nested structure by uploading a manifest xml file. AOSP project was used as an example during development of this feature. Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/views/import')
-rw-r--r--app/views/import/manifest/_form.html.haml22
-rw-r--r--app/views/import/manifest/new.html.haml13
-rw-r--r--app/views/import/manifest/status.html.haml57
3 files changed, 92 insertions, 0 deletions
diff --git a/app/views/import/manifest/_form.html.haml b/app/views/import/manifest/_form.html.haml
new file mode 100644
index 00000000000..57980cfd58a
--- /dev/null
+++ b/app/views/import/manifest/_form.html.haml
@@ -0,0 +1,22 @@
+= form_tag upload_import_manifest_path, multipart: true do
+ .form-group
+ = label_tag :manifest, class: 'label-light' do
+ Manifest
+ = file_field_tag :manifest, class: 'form-control-file', required: true
+ .form-text.text-muted
+ Import multiple repositories by uploading a manifest file.
+
+ .form-group
+ = label_tag :group_id, nil, class: 'label-light' do
+ Namespace
+ .input-group
+ .input-group-prepend.has-tooltip{ title: root_url }
+ .input-group-text
+ = root_url
+ = select_tag :group_id, namespaces_options(nil, display_path: true), { class: 'select2 js-select-namespace' }
+ .form-text.text-muted
+ Choose the top-level namespace for your repository imports.
+
+ .append-bottom-10
+ = submit_tag 'Import projects', class: 'btn btn-success'
+ = link_to 'Cancel', new_project_path, class: 'btn btn-cancel'
diff --git a/app/views/import/manifest/new.html.haml b/app/views/import/manifest/new.html.haml
new file mode 100644
index 00000000000..1f27dec1b2b
--- /dev/null
+++ b/app/views/import/manifest/new.html.haml
@@ -0,0 +1,13 @@
+- page_title "Manifest Import"
+- header_title "Projects", root_path
+
+%h3.page-title
+ = icon('git')
+ Import multiple repositories
+
+- if @errors.present?
+ .alert.alert-danger
+ - @errors.each do |error|
+ = error
+
+= render 'form'
diff --git a/app/views/import/manifest/status.html.haml b/app/views/import/manifest/status.html.haml
new file mode 100644
index 00000000000..3355bed056b
--- /dev/null
+++ b/app/views/import/manifest/status.html.haml
@@ -0,0 +1,57 @@
+- page_title "Manifest import"
+- header_title "Projects", root_path
+- provider = 'manifest'
+
+%h3.page-title
+ = icon('git')
+ = _('Import multiple repositories')
+
+%p
+ = button_tag class: "btn btn-import btn-success js-import-all" do
+ = import_all_githubish_repositories_button_label
+ = icon("spinner spin", class: "loading-icon")
+
+.table-responsive
+ %table.table.import-jobs
+ %colgroup.import-jobs-from-col
+ %colgroup.import-jobs-to-col
+ %colgroup.import-jobs-status-col
+ %thead
+ %tr
+ %th= _('Repository URL')
+ %th= _('To GitLab')
+ %th= _('Status')
+ %tbody
+ - @already_added_projects.each do |project|
+ %tr{ id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}" }
+ %td
+ = link_to_project project
+ %td
+ = project.import_url
+ %td.job-status
+ - if project.import_status == 'finished'
+ %span
+ = icon('check')
+ = _('Done')
+ - elsif project.import_status == 'started'
+ = icon("spinner spin")
+ = _('Started')
+ - elsif project.import_status == 'failed'
+ = _('Failed')
+ - else
+ = project.human_import_status_name
+
+ - @repos.each do |repo|
+ %tr{ id: "repo_#{repo[:id]}" }
+ %td
+ = repo[:url]
+ %td.import-target
+ = import_project_target(@group.path, repo[:path])
+ %td.import-actions.job-status
+ = button_tag class: "btn btn-import js-add-to-import" do
+ Import
+ = icon("spinner spin", class: "loading-icon")
+
+.js-importer-status{ data: { jobs_import_path: "#{url_for([:jobs, :import, provider])}",
+ import_path: "#{url_for([:import, provider])}",
+ ci_cd_only: "#{has_ci_cd_only_params?}" } }