summaryrefslogtreecommitdiff
path: root/app/views/import
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-15 06:53:42 +0000
committerDouwe Maan <douwe@gitlab.com>2015-04-15 06:53:42 +0000
commit63b21945d2a6d53c7baa65bffcac33ab5fa8bb91 (patch)
tree250754a33d53845d5f720d97a7648fd9ebe97eb9 /app/views/import
parent61c79418c46105ecedfca3701b7e4ac9ba6ba601 (diff)
parent9d00bb08962e26b0c284bcfc5e7ed52cf141d5c6 (diff)
downloadgitlab-ce-63b21945d2a6d53c7baa65bffcac33ab5fa8bb91.tar.gz
Merge branch 'google-code-import' into 'master'
Import projects from Google Code. Resolves #1257. Issue import logic almost entirely taken from https://gitlab.com/o9000/google-code-to-gitlab ( :hearts: @o9000). ### To do - [x] List projects from Google Takeout file - [x] Import Git repository - [x] Import issues - [x] Link to correct attachment URL (https://code.google.com/p/support-tools/issues/detail?id=50) - [x] Handle deleted attachments - [x] Handle blockedOn attribute - [x] Add directions on how to get data from Google Takeout ### Import instructions ![Screen_Shot_2015-04-03_at_16.02.21](https://gitlab.com/gitlab-org/gitlab-ce/uploads/4a87038035fbad9441cf613b8cdcc690/Screen_Shot_2015-04-03_at_16.02.21.png) ### Imported issue ![Screen_Shot_2015-04-03_at_16.25.49](https://gitlab.com/gitlab-org/gitlab-ce/uploads/b2c2eaf5ecfcf57b3c48511eb5d26db4/Screen_Shot_2015-04-03_at_16.25.49.png) See merge request !471
Diffstat (limited to 'app/views/import')
-rw-r--r--app/views/import/google_code/new.html.haml60
-rw-r--r--app/views/import/google_code/new_user_map.html.haml20
-rw-r--r--app/views/import/google_code/status.html.haml49
3 files changed, 129 insertions, 0 deletions
diff --git a/app/views/import/google_code/new.html.haml b/app/views/import/google_code/new.html.haml
new file mode 100644
index 00000000000..ce78fec205f
--- /dev/null
+++ b/app/views/import/google_code/new.html.haml
@@ -0,0 +1,60 @@
+%h3.page-title
+ %i.fa.fa-google
+ Import projects from Google Code
+%hr
+
+= form_tag callback_import_google_code_path, class: 'form-horizontal', multipart: true do
+ %p
+ Follow the steps below to export your Google Code project data.
+ In the next step, you'll be able to select the projects you want to import.
+ %ol
+ %li
+ %p
+ Go to
+ #{link_to "Google Takeout", "https://www.google.com/settings/takeout", target: "_blank"}.
+ %li
+ %p
+ Make sure you're logged into the account that owns the projects you'd like to import.
+ %li
+ %p
+ Click the <strong>Select none</strong> button on the right, since we only need "Google Code Project Hosting".
+ %li
+ %p
+ Scroll down to <strong>Google Code Project Hosting</strong> and enable the switch on the right.
+ %li
+ %p
+ Choose <strong>Next</strong> at the bottom of the page.
+ %li
+ %p
+ Leave the "File type" and "Delivery method" options on their default values.
+ %li
+ %p
+ Choose <strong>Create archive</strong> and wait for archiving to complete.
+ %li
+ %p
+ Click the <strong>Download</strong> button and wait for downloading to complete.
+ %li
+ %p
+ Find the downloaded ZIP file and decompress it.
+ %li
+ %p
+ Find the newly extracted <code>Takeout/Google Code Project Hosting/GoogleCodeProjectHosting.json</code> file.
+ %li
+ %p
+ Upload <code>GoogleCodeProjectHosting.json</code> here:
+ %p
+ %input{type: "file", name: "dump_file", id: "dump_file"}
+ %li
+ %p
+ Do you want to customize how Google Code email addresses and usernames are imported into GitLab?
+ %p
+ = label_tag :create_user_map_0 do
+ = radio_button_tag :create_user_map, 0, true
+ No, directly import the existing email addresses and usernames.
+ %p
+ = label_tag :create_user_map_1 do
+ = radio_button_tag :create_user_map, 1, false
+ Yes, let me map Google Code users to full names or GitLab users.
+ %li
+ %p
+ = submit_tag 'Continue to the next step', class: "btn btn-create"
diff --git a/app/views/import/google_code/new_user_map.html.haml b/app/views/import/google_code/new_user_map.html.haml
new file mode 100644
index 00000000000..d55fcfc97a8
--- /dev/null
+++ b/app/views/import/google_code/new_user_map.html.haml
@@ -0,0 +1,20 @@
+%h3.page-title
+ %i.fa.fa-google
+ Import projects from Google Code
+%hr
+
+= form_tag create_user_map_import_google_code_path, class: 'form-horizontal' do
+ %p
+ Customize how Google Code email addresses and usernames are imported into GitLab.
+ In the next step, you'll be able to select the projects you want to import.
+ %p
+ The user map is a JSON document mapping Google Code users (as keys) to the way they will be imported into GitLab (as values). By default the username is masked to ensure users' privacy.
+ %p
+ To map a Google Code user to a full name or GitLab user, simply replace the value, e.g. <code>"johnsmith@gmail.com": "John Smith"</code> or <code>"johnsmith@gmail.com": "@johnsmith"</code>. Be sure to preserve the surrounding double quotes and other punctuation.
+
+ .form-group
+ .col-sm-12
+ = text_area_tag :user_map, JSON.pretty_generate(@user_map), class: 'form-control', rows: 15
+
+ .form-actions
+ = submit_tag 'Continue to the next step', class: "btn btn-create"
diff --git a/app/views/import/google_code/status.html.haml b/app/views/import/google_code/status.html.haml
new file mode 100644
index 00000000000..2013b8c03c6
--- /dev/null
+++ b/app/views/import/google_code/status.html.haml
@@ -0,0 +1,49 @@
+%h3.page-title
+ %i.fa.fa-google
+ Import projects from Google Code
+
+%p.light
+ Select projects you want to import.
+%p.light
+ Optionally, you can
+ = link_to "customize", new_user_map_import_google_code_path
+ how Google Code email addresses and usernames are imported into GitLab.
+%hr
+%p
+ = button_tag 'Import all projects', class: "btn btn-success js-import-all"
+
+%table.table.import-jobs
+ %thead
+ %tr
+ %th From Google Code
+ %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.import_source, "https://code.google.com/p/#{project.import_source}", target: "_blank"
+ %td
+ %strong= link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project]
+ %td.job-status
+ - if project.import_status == 'finished'
+ %span
+ %i.fa.fa-check
+ done
+ - elsif project.import_status == 'started'
+ %i.fa.fa-spinner.fa-spin
+ started
+ - else
+ = project.human_import_status_name
+
+ - @repos.each do |repo|
+ %tr{id: "repo_#{repo.id}"}
+ %td
+ = link_to repo.name, "https://code.google.com/p/#{repo.name}", target: "_blank"
+ %td.import-target
+ = "#{current_user.username}/#{repo.name}"
+ %td.import-actions.job-status
+ = button_tag "Import", class: "btn js-add-to-import"
+
+:coffeescript
+ new ImporterStatus("#{jobs_import_google_code_path}", "#{import_google_code_path}")