new export stuff and view

This commit is contained in:
James Lopez 2016-06-14 14:28:30 +02:00
parent 3f7ed55011
commit fe370b1c39
4 changed files with 26 additions and 12 deletions

View file

@ -348,4 +348,10 @@ module ProjectsHelper
message.strip.gsub(Gitlab.config.gitlab_shell.repos_path.chomp('/'), "[REPOS PATH]")
end
def db_export_list
YAML.load_file(Gitlab::ImportExport.config_file)['project_tree'].map do |relation|
relation.is_a?(Hash) ? relation.keys.first.to_s : relation.to_s
end + ['notes', 'merge_request_diffs']
end
end

View file

@ -348,16 +348,6 @@ class Project < ActiveRecord::Base
joins(join_body).reorder('join_note_counts.amount DESC')
end
def create_from_import_job(current_user_id:, tmp_file:, namespace_id:, project_path:)
job_id = ProjectImportWorker.perform_async(current_user_id, tmp_file, namespace_id, project_path)
if job_id
Rails.logger.info "Import job started for export #{tmp_file} with job ID #{job_id}"
else
Rails.logger.error "Import job failed to start for #{tmp_file}"
end
end
end
def team

View file

@ -129,9 +129,27 @@
Generates a compressed export file of the project and sends a link to download the export.
.col-lg-9
= link_to 'Generate new export', export_namespace_project_path(@project.namespace, @project),
= link_to 'Export project', export_namespace_project_path(@project.namespace, @project),
method: :post, class: "btn btn-default"
%p.append-bottom-0
%p
.row.prepend-top-default
Clicking on Export project, will produce a compressed file that will be sent as a link to your registered e-mail address.
.bs-callout.bs-callout-info
%p.append-bottom-0
%p
The following items will be exported:
%ul
%li Project and wiki repository
%li Project uploads
%li DB items, including configuration
%ul
- db_export_list.each do |export_relation|
%li
%code #{export_relation}
%hr
- if can? current_user, :archive_project, @project
.row.prepend-top-default

View file

@ -2,7 +2,7 @@ module Gitlab
module ImportExport
class ProjectCreator
def initialize(namespace_id, current_user, )
def initialize(namespace_id, current_user)
@repo = repo
@namespace = Namespace.find_by_id(namespace_id)
@current_user = current_user