diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-06-17 14:28:58 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-06-17 14:28:58 +0000 |
commit | 402b651a552030c90af421ddd2a74f6cbf298413 (patch) | |
tree | c7aa3e6ff87eff5dccdb0b91dbd64675d5b6d211 /app/controllers/projects_controller.rb | |
parent | 2a747d386dbdc05453fce6b8be3f483e8cd9e796 (diff) | |
parent | 2d4556c5d208e9ae805b0467c1c7281ae6a36ebe (diff) | |
download | gitlab-ce-feature/project-import.tar.gz |
Merge branch 'feature/project-export-ui-experimental' into 'feature/project-import'
feature/project-import
Experimental UI for exporting and importing a project
Part of https://gitlab.com/gitlab-org/gitlab-ce/issues/3050
Screenshots of both the export and import processes:
## Export
1 - Project settings

2 - Flash after clicking on export

3 - Email received with download link

4 - The project settings export screen changes so we can either delete the file or download it again (it won't generate a new export, unless we delete it first)

5 - After delete flash

## Import
1 - New project page with new gitlab export option

2 - Next step importing - choosing a file

3 - Import in progress

4 - Import successful

See merge request !4012
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r-- | app/controllers/projects_controller.rb | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a6479c42d94..673adca6ade 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -7,7 +7,7 @@ class ProjectsController < Projects::ApplicationController before_action :assign_ref_vars, :tree, only: [:show], if: :repo_exists? # Authorize - before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping] + before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export, :generate_new_export] before_action :event_filter, only: [:show, :activity] layout :determine_layout @@ -185,6 +185,48 @@ class ProjectsController < Projects::ApplicationController ) end + def export + @project.add_export_job(current_user: current_user) + + redirect_to( + edit_project_path(@project), + notice: "Project export started. A download link will be sent by email." + ) + end + + def download_export + export_project_path = @project.export_project_path + + if export_project_path + send_file export_project_path, disposition: 'attachment' + else + redirect_to( + edit_project_path(@project), + alert: "Project export link has expired. Please generate a new export from your project settings." + ) + end + end + + def remove_export + if @project.remove_exports + flash[:notice] = "Project export has been deleted." + else + flash[:alert] = "Project export could not be deleted." + end + redirect_to(edit_project_path(@project)) + end + + def generate_new_export + if @project.remove_exports + export + else + redirect_to( + edit_project_path(@project), + alert: "Project export could not be deleted." + ) + end + end + def toggle_star current_user.toggle_star(@project) @project.reload |