Commit fe370b1c authored by James Lopez's avatar James Lopez

new export stuff and view

parent 3f7ed550
...@@ -348,4 +348,10 @@ module ProjectsHelper ...@@ -348,4 +348,10 @@ module ProjectsHelper
message.strip.gsub(Gitlab.config.gitlab_shell.repos_path.chomp('/'), "[REPOS PATH]") message.strip.gsub(Gitlab.config.gitlab_shell.repos_path.chomp('/'), "[REPOS PATH]")
end 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 end
...@@ -348,16 +348,6 @@ class Project < ActiveRecord::Base ...@@ -348,16 +348,6 @@ class Project < ActiveRecord::Base
joins(join_body).reorder('join_note_counts.amount DESC') joins(join_body).reorder('join_note_counts.amount DESC')
end 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 end
def team def team
......
...@@ -129,9 +129,27 @@ ...@@ -129,9 +129,27 @@
Generates a compressed export file of the project and sends a link to download the export. Generates a compressed export file of the project and sends a link to download the export.
.col-lg-9 .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" 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 %hr
- if can? current_user, :archive_project, @project - if can? current_user, :archive_project, @project
.row.prepend-top-default .row.prepend-top-default
......
...@@ -2,7 +2,7 @@ module Gitlab ...@@ -2,7 +2,7 @@ module Gitlab
module ImportExport module ImportExport
class ProjectCreator class ProjectCreator
def initialize(namespace_id, current_user, ) def initialize(namespace_id, current_user)
@repo = repo @repo = repo
@namespace = Namespace.find_by_id(namespace_id) @namespace = Namespace.find_by_id(namespace_id)
@current_user = current_user @current_user = current_user
......
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