Commit db7921f2 authored by Douwe Maan's avatar Douwe Maan

Add "Import all projects" button to GitHub and GitLab import pages.

Closes #1963.
parent bc57ff0e
...@@ -4,7 +4,7 @@ class @ImporterStatus ...@@ -4,7 +4,7 @@ class @ImporterStatus
this.setAutoUpdate() this.setAutoUpdate()
initStatusPage: -> initStatusPage: ->
$(".btn-add-to-import").click (event) => $(".js-add-to-import").click (event) =>
new_namespace = null new_namespace = null
tr = $(event.currentTarget).closest("tr") tr = $(event.currentTarget).closest("tr")
id = tr.attr("id").replace("repo_", "") id = tr.attr("id").replace("repo_", "")
...@@ -12,6 +12,10 @@ class @ImporterStatus ...@@ -12,6 +12,10 @@ class @ImporterStatus
new_namespace = tr.find(".import-target input").prop("value") new_namespace = tr.find(".import-target input").prop("value")
tr.find(".import-target").empty().append(new_namespace + "/" + tr.find(".import-target").data("project_name")) tr.find(".import-target").empty().append(new_namespace + "/" + tr.find(".import-target").data("project_name"))
$.post @import_url, {repo_id: id, new_namespace: new_namespace}, dataType: 'script' $.post @import_url, {repo_id: id, new_namespace: new_namespace}, dataType: 'script'
$(".js-import-all").click (event) =>
$(".js-add-to-import").each ->
$(this).click()
setAutoUpdate: -> setAutoUpdate: ->
setInterval (=> setInterval (=>
......
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
Import repositories from GitHub.com Import repositories from GitHub.com
%p.light %p.light
Select projects you want to import. Select projects you want to import.
%hr %hr
%p
= button_tag 'Import all projects', class: "btn btn-success js-import-all"
%table.table.import-jobs %table.table.import-jobs
%thead %thead
%tr %tr
...@@ -32,7 +34,7 @@ ...@@ -32,7 +34,7 @@
%td.import-target %td.import-target
= repo.full_name = repo.full_name
%td.import-actions.job-status %td.import-actions.job-status
= button_tag "Add", class: "btn btn-add-to-import" = button_tag "Import", class: "btn js-add-to-import"
:coffeescript :coffeescript
$ -> $ ->
......
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
Import repositories from GitLab.com Import repositories from GitLab.com
%p.light %p.light
Select projects you want to import. Select projects you want to import.
%hr %hr
%p
= button_tag 'Import all projects', class: "btn btn-success js-import-all"
%table.table.import-jobs %table.table.import-jobs
%thead %thead
%tr %tr
...@@ -32,8 +34,8 @@ ...@@ -32,8 +34,8 @@
%td.import-target %td.import-target
= repo["path_with_namespace"] = repo["path_with_namespace"]
%td.import-actions.job-status %td.import-actions.job-status
= button_tag "Add", class: "btn btn-add-to-import" = button_tag "Import", class: "btn js-add-to-import"
:coffeescript :coffeescript
$ -> $ ->
new ImporterStatus("#{jobs_import_gitlab_path}", "#{import_gitlab_url}") new ImporterStatus("#{jobs_import_gitlab_path}", "#{import_gitlab_path}")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment