Открыть боковую панель
Захаров Дмитрий Сергеевич
Gitlab
Коммиты
0b5a18fc
Коммит
0b5a18fc
создал
Мар 30, 2016
по автору
Rubén Dávila
Просмотр файлов
Add link to show/hide credentials from URL.
владелец
ed355728
Изменения
4
Скрыть пробелы
Построчно
Рядом
app/assets/javascripts/dispatcher.js.coffee
Просмотр файла @
0b5a18fc
...
...
@@ -109,6 +109,7 @@ class Dispatcher
new
GroupsSelect
()
when
'projects:mirrors:show'
,
'projects:mirrors:update'
new
UsersSelect
()
new
MirrorUrlProtector
()
when
'admin:emails:show'
new
AdminEmailSelect
()
...
...
app/assets/javascripts/mirror_url_protector.js.coffee
0 → 100644
Просмотр файла @
0b5a18fc
class
@
MirrorUrlProtector
constructor
:
->
$
(
'.toggle-remote-credentials'
).
on
'click'
,
(
e
)
=>
e
.
preventDefault
()
anchor
=
$
(
e
.
target
)
inputUrl
=
anchor
.
prev
()
switch
anchor
.
text
()
when
'Show credentials'
anchor
.
text
(
'Hide credentials'
)
inputUrl
.
val
(
inputUrl
.
data
(
'full-url'
))
when
'Hide credentials'
anchor
.
text
(
'Show credentials'
)
inputUrl
.
val
(
inputUrl
.
data
(
'safe-url'
))
app/models/remote_mirror.rb
Просмотр файла @
0b5a18fc
...
...
@@ -95,16 +95,22 @@ def mark_as_failed(error_message)
def
url
=
(
value
)
mirror_url
=
Gitlab
::
ImportUrl
.
new
(
value
)
self
.
credentials
=
mirror_url
.
credentials
if
mirror_url
.
credentials
.
values
.
any?
# Update credentials only if passed URL is different than the previous one.
self
.
credentials
=
mirror_url
.
credentials
if
url
!=
value
super
(
mirror_url
.
sanitized_url
)
end
def
full_url
mirror_url
=
Gitlab
::
ImportUrl
.
new
(
super
,
credentials:
credentials
)
mirror_url
=
Gitlab
::
ImportUrl
.
new
(
url
,
credentials:
credentials
)
mirror_url
.
full_url
end
def
has_credentials?
credentials
.
values
.
any?
end
private
def
url_availability
...
...
app/views/projects/mirrors/show.html.haml
Просмотр файла @
0b5a18fc
...
...
@@ -113,7 +113,9 @@
=
rm_form
.
label
:url
,
class:
'control-label'
do
%span
Git repository URL
.col-sm-10
=
rm_form
.
text_field
:url
,
class:
'form-control'
,
placeholder:
'https://username:password@gitlab.company.com/group/project.git'
=
rm_form
.
text_field
:url
,
class:
'form-control'
,
placeholder:
'https://username:password@gitlab.company.com/group/project.git'
,
data:
{
'safe-url'
=>
@remote_mirror
.
url
,
'full-url'
=>
@remote_mirror
.
full_url
}
-
if
@remote_mirror
.
has_credentials?
=
link_to
'Show credentials'
,
'#'
,
class:
'toggle-remote-credentials'
.well.prepend-top-20
The requirements for the URL format are the same mentioned in the
<strong>
Pull from a remote repository
</strong>
section.
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать