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
Kazuhiko Shiozaki
gitlab-ce
Commits
37db76a3
Commit
37db76a3
authored
Mar 12, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Project import and retry import scaffold
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
1436433c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
55 deletions
+89
-55
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+25
-12
app/views/projects/create.js.haml
app/views/projects/create.js.haml
+6
-2
app/views/projects/empty.html.haml
app/views/projects/empty.html.haml
+29
-41
app/views/projects/import.html.haml
app/views/projects/import.html.haml
+29
-0
No files found.
app/controllers/projects_controller.rb
View file @
37db76a3
...
...
@@ -5,7 +5,7 @@ class ProjectsController < ApplicationController
# Authorize
before_filter
:authorize_read_project!
,
except:
[
:index
,
:new
,
:create
]
before_filter
:authorize_admin_project!
,
only:
[
:edit
,
:update
,
:destroy
,
:transfer
,
:archive
,
:unarchive
]
before_filter
:authorize_admin_project!
,
only:
[
:edit
,
:update
,
:destroy
,
:transfer
,
:archive
,
:unarchive
,
:retry_import
]
before_filter
:require_non_empty_project
,
only:
[
:blob
,
:tree
,
:graph
]
layout
'navless'
,
only:
[
:new
,
:create
,
:fork
]
...
...
@@ -21,16 +21,9 @@ class ProjectsController < ApplicationController
def
create
@project
=
::
Projects
::
CreateService
.
new
(
current_user
,
params
[
:project
]).
execute
flash
[
:notice
]
=
'Project was successfully created.'
if
@project
.
saved?
respond_to
do
|
format
|
flash
[
:notice
]
=
'Project was successfully created.'
if
@project
.
saved?
format
.
html
do
if
@project
.
saved?
redirect_to
@project
else
render
"new"
end
end
format
.
js
end
end
...
...
@@ -67,9 +60,7 @@ class ProjectsController < ApplicationController
if
@project
.
empty_repo?
render
"projects/empty"
,
layout:
user_layout
else
if
current_user
@last_push
=
current_user
.
recent_push
(
@project
.
id
)
end
@last_push
=
current_user
.
recent_push
(
@project
.
id
)
if
current_user
render
:show
,
layout:
user_layout
end
end
...
...
@@ -77,6 +68,28 @@ class ProjectsController < ApplicationController
end
end
def
import
if
project
.
import_finished?
redirect_to
@project
return
end
end
def
retry_import
unless
@project
.
import_failed?
redirect_to
import_project_path
(
@project
)
end
@project
.
import_url
=
params
[
:project
][
:import_url
]
if
@project
.
save
@project
.
reload
@project
.
import_retry
end
redirect_to
import_project_path
(
@project
)
end
def
destroy
return
access_denied!
unless
can?
(
current_user
,
:remove_project
,
project
)
...
...
app/views/projects/create.js.haml
View file @
37db76a3
-
if
@project
.
saved?
:plain
location.href = "
#{
project_path
(
@project
)
}
";
-
if
@project
.
import?
:plain
location.href = "
#{
import_project_path
(
@project
)
}
";
-
else
:plain
location.href = "
#{
project_path
(
@project
)
}
";
-
else
:plain
$(".project-edit-errors").html("
#{
escape_javascript
(
render
(
'errors'
))
}
");
...
...
app/views/projects/empty.html.haml
View file @
37db76a3
=
render
"home_panel"
-
if
@project
.
import?
&&
!
@project
.
imported
.save-project-loader
%center
%h2
%i
.icon-spinner.icon-spin
Importing repository.
%p
.monospace
git clone --bare
#{
@project
.
import_url
}
%p
Please wait while we import the repository for you. Refresh at will.
:javascript
new
ProjectImport
();
%div
.git-empty
%fieldset
%legend
Git global setup:
%pre
.dark
:preserve
git config --global user.name "
#{
git_user_name
}
"
git config --global user.email "
#{
git_user_email
}
"
-
else
%div
.git-empty
%fieldset
%legend
Git global setup:
%pre
.dark
:preserve
git config --global user.name "
#{
git_user_name
}
"
git config --global user.email "
#{
git_user_email
}
"
%fieldset
%legend
Create Repository
%pre
.dark
:preserve
mkdir
#{
@project
.
path
}
cd
#{
@project
.
path
}
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin
#{
content_tag
(
:span
,
default_url_to_repo
,
class:
'clone'
)
}
git push -u origin master
%fieldset
%legend
Create Repository
%pre
.dark
:preserve
mkdir
#{
@project
.
path
}
cd
#{
@project
.
path
}
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin
#{
content_tag
(
:span
,
default_url_to_repo
,
class:
'clone'
)
}
git push -u origin master
%fieldset
%legend
Existing Git Repo?
%pre
.dark
:preserve
cd existing_git_repo
git remote add origin
#{
content_tag
(
:span
,
default_url_to_repo
,
class:
'clone'
)
}
git push -u origin master
%fieldset
%legend
Existing Git Repo?
%pre
.dark
:preserve
cd existing_git_repo
git remote add origin
#{
content_tag
(
:span
,
default_url_to_repo
,
class:
'clone'
)
}
git push -u origin master
-
if
can?
current_user
,
:remove_project
,
@project
.prepend-top-20
=
link_to
'Remove project'
,
@project
,
data:
{
confirm:
remove_project_message
(
@project
)},
method: :delete
,
class:
"btn btn-remove pull-right"
-
if
can?
current_user
,
:remove_project
,
@project
.prepend-top-20
=
link_to
'Remove project'
,
@project
,
data:
{
confirm:
remove_project_message
(
@project
)},
method: :delete
,
class:
"btn btn-remove pull-right"
app/views/projects/import.html.haml
0 → 100644
View file @
37db76a3
-
if
@project
.
import_in_progress?
.save-project-loader
%center
%h2
%i
.icon-spinner.icon-spin
Import in progress.
%p
.monospace
git clone --bare
#{
@project
.
import_url
}
%p
Please wait while we import the repository for you. Refresh at will.
:javascript
new
ProjectImport
();
-
elsif
@project
.
import_failed?
.save-project-loader
%center
%h2
Import failed. Retry?
%hr
=
form_for
@project
,
url:
retry_import_project_path
(
@project
),
method: :put
,
html:
{
class:
'form-horizontal'
}
do
|
f
|
.form-group.import-url-data
=
f
.
label
:import_url
,
class:
'control-label'
do
%span
Import existing repo
.col-sm-10
=
f
.
text_field
:import_url
,
class:
'form-control'
,
placeholder:
'https://github.com/randx/six.git'
.bs-callout.bs-callout-info
This url must be publicly accessible or you can add a username and password like this: https://username:password@gitlab.com/company/project.git.
%br
The import will time out after 2 minutes. For big repositories, use a clone/push combination.
.form-actions
=
f
.
submit
'Retry import'
,
class:
"btn btn-create"
,
tabindex:
4
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