BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e2688fee
Commit
e2688fee
authored
Nov 11, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address initial review comments
parent
478730be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
bitbucket_controller.rb
app/controllers/import/bitbucket_controller.rb
+6
-7
status.html.haml
app/views/import/bitbucket/status.html.haml
+3
-3
No files found.
app/controllers/import/bitbucket_controller.rb
View file @
e2688fee
...
@@ -17,11 +17,10 @@ class Import::BitbucketController < Import::BaseController
...
@@ -17,11 +17,10 @@ class Import::BitbucketController < Import::BaseController
end
end
def
status
def
status
client
=
Bitbucket
::
Client
.
new
(
credentials
)
bitbucket_
client
=
Bitbucket
::
Client
.
new
(
credentials
)
repos
=
client
.
repos
repos
=
bitbucket_
client
.
repos
@repos
=
repos
.
select
(
&
:valid?
)
@repos
,
@incompatible_repos
=
repos
.
partition
{
|
repo
|
repo
.
valid?
}
@incompatible_repos
=
repos
.
reject
(
&
:valid?
)
@already_added_projects
=
current_user
.
created_projects
.
where
(
import_type:
'bitbucket'
)
@already_added_projects
=
current_user
.
created_projects
.
where
(
import_type:
'bitbucket'
)
already_added_projects_names
=
@already_added_projects
.
pluck
(
:import_source
)
already_added_projects_names
=
@already_added_projects
.
pluck
(
:import_source
)
...
@@ -36,15 +35,15 @@ class Import::BitbucketController < Import::BaseController
...
@@ -36,15 +35,15 @@ class Import::BitbucketController < Import::BaseController
end
end
def
create
def
create
client
=
Bitbucket
::
Client
.
new
(
credentials
)
bitbucket_
client
=
Bitbucket
::
Client
.
new
(
credentials
)
@repo_id
=
params
[
:repo_id
].
to_s
@repo_id
=
params
[
:repo_id
].
to_s
name
=
@repo_id
.
gsub
(
'___'
,
'/'
)
name
=
@repo_id
.
gsub
(
'___'
,
'/'
)
repo
=
client
.
repo
(
name
)
repo
=
bitbucket_
client
.
repo
(
name
)
@project_name
=
params
[
:new_name
].
presence
||
repo
.
name
@project_name
=
params
[
:new_name
].
presence
||
repo
.
name
repo_owner
=
repo
.
owner
repo_owner
=
repo
.
owner
repo_owner
=
current_user
.
username
if
repo_owner
==
client
.
user
.
username
repo_owner
=
current_user
.
username
if
repo_owner
==
bitbucket_
client
.
user
.
username
@target_namespace
=
params
[
:new_namespace
].
presence
||
repo_owner
@target_namespace
=
params
[
:new_namespace
].
presence
||
repo_owner
namespace
=
find_or_create_namespace
(
@target_namespace
,
repo_owner
)
namespace
=
find_or_create_namespace
(
@target_namespace
,
repo_owner
)
...
...
app/views/import/bitbucket/status.html.haml
View file @
e2688fee
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
-
@already_added_projects
.
each
do
|
project
|
-
@already_added_projects
.
each
do
|
project
|
%tr
{
id:
"project_#{project.id}"
,
class:
"#{project_status_css_class(project.import_status)}"
}
%tr
{
id:
"project_#{project.id}"
,
class:
"#{project_status_css_class(project.import_status)}"
}
%td
%td
=
link_to
project
.
import_source
,
'https://bitbucket.org/#{project.import_source}'
,
target:
'_blank'
=
link_to
project
.
import_source
,
"https://bitbucket.org/
#{
project
.
import_source
}
"
,
target:
'_blank'
%td
%td
=
link_to
project
.
path_with_namespace
,
[
project
.
namespace
.
becomes
(
Namespace
),
project
]
=
link_to
project
.
path_with_namespace
,
[
project
.
namespace
.
becomes
(
Namespace
),
project
]
%td
.job-status
%td
.job-status
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
-
@repos
.
each
do
|
repo
|
-
@repos
.
each
do
|
repo
|
%tr
{
id:
"repo_#{repo.owner}___#{repo.slug}"
}
%tr
{
id:
"repo_#{repo.owner}___#{repo.slug}"
}
%td
%td
=
link_to
"
#{
repo
.
full_name
}
"
,
"https://bitbucket.org/
#{
repo
.
full_name
}
"
,
target:
"_blank"
=
link_to
repo
.
full_name
,
"https://bitbucket.org/
#{
repo
.
full_name
}
"
,
target:
"_blank"
%td
.import-target
%td
.import-target
%fieldset
.row
%fieldset
.row
.input-group
.input-group
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
-
@incompatible_repos
.
each
do
|
repo
|
-
@incompatible_repos
.
each
do
|
repo
|
%tr
{
id:
"repo_#{repo.owner}___#{repo.slug}"
}
%tr
{
id:
"repo_#{repo.owner}___#{repo.slug}"
}
%td
%td
=
link_to
"
#{
repo
.
full_name
}
"
,
"https://bitbucket.org/
#{
repo
.
full_name
}
"
,
target:
'_blank'
=
link_to
repo
.
full_name
,
"https://bitbucket.org/
#{
repo
.
full_name
}
"
,
target:
'_blank'
%td
.import-target
%td
.import-target
%td
.import-actions-job-status
%td
.import-actions-job-status
=
label_tag
'Incompatible Project'
,
nil
,
class:
'label label-danger'
=
label_tag
'Incompatible Project'
,
nil
,
class:
'label label-danger'
...
...
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