gitlab-org--gitlab-foss/app/views/importers/githubs/status.html.haml

64 lines
2 KiB
Text
Raw Normal View History

2014-12-31 08:07:48 -05:00
%h3.page-title
2015-01-13 14:44:17 -05:00
%i.fa.fa-github
Import repositories from GitHub.com
2014-12-31 08:07:48 -05:00
2015-01-13 14:44:17 -05:00
%p.light
2015-01-20 14:52:55 -05:00
Select projects you want to import.
2015-01-13 14:44:17 -05:00
%hr
%table.table.import-jobs
2014-12-31 08:07:48 -05:00
%thead
%tr
%th From GitHub
%th To GitLab
%th Status
%tbody
2015-01-13 14:44:17 -05:00
- @already_added_projects.each do |project|
2015-01-20 14:52:55 -05:00
%tr{id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}"}
2015-01-13 14:44:17 -05:00
%td= project.import_source
%td
%strong= link_to project.name_with_namespace, project
2015-01-20 14:52:55 -05:00
%td.job-status
2015-01-13 14:44:17 -05:00
- if project.import_status == 'finished'
%span.cgreen
%i.fa.fa-check
done
- else
= project.human_import_status_name
2014-12-31 08:07:48 -05:00
- @repos.each do |repo|
%tr{id: "repo_#{repo.id}"}
%td= repo.full_name
2015-01-13 14:44:17 -05:00
%td.import-target
2014-12-31 08:07:48 -05:00
= repo.full_name
2015-01-20 14:52:55 -05:00
%td.import-actions.job-status
2014-12-31 08:07:48 -05:00
= button_tag "Add", class: "btn btn-add-to-import"
2015-01-13 14:44:17 -05:00
2014-12-31 08:07:48 -05:00
:coffeescript
$(".btn-add-to-import").click () ->
new_namespace = null
tr = $(this).closest("tr")
id = tr.attr("id").replace("repo_", "")
if tr.find(".import-target input").length > 0
new_namespace = tr.find(".import-target input").prop("value")
tr.find(".import-target").empty().append(new_namespace + "/" + tr.find(".import-target").data("project_name"))
2015-01-27 18:37:19 -05:00
$.post "#{importers_github_url}", {repo_id: id, new_namespace: new_namespace}, dataType: 'script'
2015-01-20 14:52:55 -05:00
setInterval (->
2015-01-27 18:37:19 -05:00
$.get "#{jobs_importers_github_path}", (data)->
2015-01-20 14:52:55 -05:00
$.each data, (i, job) ->
job_item = $("#project_" + job.id)
status_field = job_item.find(".job-status")
if job.import_status == 'finished'
job_item.removeClass("active").addClass("success")
status_field.html('<span class="cgreen"><i class="fa fa-check"></i> done</span>')
else if job.import_status == 'started'
status_field.html("<i class='fa fa-spinner fa-spin'></i> started")
else
status_field.html(job.import_status)
), 4000