Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
a4308c53
Commit
a4308c53
authored
Feb 24, 2018
by
Travis Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add project export API entities
parent
b2040837
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
app/models/project.rb
app/models/project.rb
+15
-0
lib/api/entities.rb
lib/api/entities.rb
+15
-0
No files found.
app/models/project.rb
View file @
a4308c53
...
...
@@ -1567,6 +1567,21 @@ class Project < ActiveRecord::Base
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?
...
...
lib/api/entities.rb
View file @
a4308c53
...
...
@@ -91,6 +91,21 @@ module API
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment