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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
48fcf540
Commit
48fcf540
authored
May 04, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add gitlab project controller - still WIP
parent
7a531bb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
app/controllers/import/gitlab_project_controller.rb
app/controllers/import/gitlab_project_controller.rb
+45
-0
No files found.
app/controllers/import/gitlab_project_controller.rb
0 → 100644
View file @
48fcf540
class
Import::GitlabProjectController
<
Import
::
BaseController
before_action
:verify_gitlab_project_import_enabled
before_action
:gitlab_project_auth
,
except: :callback
rescue_from
OAuth
::
Error
,
with: :gitlab_project_unauthorized
#TODO permissions stuff
def
callback
redirect_to
status_import_gitlab_project_url
end
def
status
@repos
=
client
.
projects
@incompatible_repos
=
client
.
incompatible_projects
@already_added_projects
=
current_user
.
created_projects
.
where
(
import_type:
"gitlab_project"
)
already_added_projects_names
=
@already_added_projects
.
pluck
(
:import_source
)
@repos
.
to_a
.
reject!
{
|
repo
|
already_added_projects_names
.
include?
"
#{
repo
[
"owner"
]
}
/
#{
repo
[
"slug"
]
}
"
}
end
def
jobs
jobs
=
current_user
.
created_projects
.
where
(
import_type:
"gitlab_project"
).
to_json
(
only:
[
:id
,
:import_status
])
render
json:
jobs
end
def
create
@file
=
params
[
:file
]
repo_owner
=
current_user
.
username
@target_namespace
=
params
[
:new_namespace
].
presence
||
repo_owner
# namespace = get_or_create_namespace || (render and return)
@project
=
Gitlab
::
ImportExport
::
ImportService
.
execute
(
archive_file:
file
,
owner:
repo_owner
)
end
private
def
verify_gitlab_project_import_enabled
render_404
unless
gitlab_project_import_enabled?
end
end
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