Read about our upcoming Code of Conduct on this issue

Commit 032f4219 authored by Travis Miller's avatar Travis Miller
Browse files

Add project export API entities

parent 662703e18002
......@@ -1567,6 +1567,21 @@ def export_project_path
Dir.glob("#{export_path}/*export.tar.gz").max_by { |f| File.ctime(f) }
end
def export_status
if export_in_progress?
:started
elsif export_project_path
:finished
else
:none
end
end
def export_in_progress?
shared = Gitlab::ImportExport::Shared.new(relative_path: File.join(disk_path, 'work'))
File.directory?(shared.export_path)
end
def remove_exports
return nil unless export_path.present?
......
......@@ -91,6 +91,21 @@ class ProjectIdentity < Grape::Entity
expose :created_at
end
class ProjectExportStatus < ProjectIdentity
include ::API::Helpers::RelatedResourcesHelpers
expose :export_status
expose :_links, if: lambda { |project, options| project.export_status == :finished } do
expose :api_url do |project|
expose_url(api_v4_projects_export_download_path(id: project.id))
end
expose :web_url do |project|
Gitlab::Routing.url_helpers.download_export_project_url(project)
end
end
end
class ProjectImportStatus < ProjectIdentity
expose :import_status
......
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