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
f715c41d
Commit
f715c41d
authored
Mar 23, 2020
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add frontend "keep divergent refs" option
parent
4629e944
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
app/assets/javascripts/mirrors/mirror_repos.js
app/assets/javascripts/mirrors/mirror_repos.js
+13
-0
app/controllers/projects/mirrors_controller.rb
app/controllers/projects/mirrors_controller.rb
+1
-0
app/views/projects/mirrors/_mirror_repos_push.html.haml
app/views/projects/mirrors/_mirror_repos_push.html.haml
+7
-0
No files found.
app/assets/javascripts/mirrors/mirror_repos.js
View file @
f715c41d
...
...
@@ -22,15 +22,18 @@ export default class MirrorRepos {
}
initMirrorPush
()
{
this
.
$keepDivergentRefsInput
=
$
(
'
.js-mirror-keep-divergent-refs
'
,
this
.
$form
);
this
.
$passwordGroup
=
$
(
'
.js-password-group
'
,
this
.
$container
);
this
.
$password
=
$
(
'
.js-password
'
,
this
.
$passwordGroup
);
this
.
$authMethod
=
$
(
'
.js-auth-method
'
,
this
.
$form
);
this
.
$keepDivergentRefsInput
.
on
(
'
change
'
,
()
=>
this
.
updateKeepDivergentRefs
());
this
.
$authMethod
.
on
(
'
change
'
,
()
=>
this
.
togglePassword
());
this
.
$password
.
on
(
'
input.updateUrl
'
,
()
=>
this
.
debouncedUpdateUrl
());
this
.
initMirrorSSH
();
this
.
updateProtectedBranches
();
this
.
updateKeepDivergentRefs
();
}
initMirrorSSH
()
{
...
...
@@ -61,6 +64,16 @@ export default class MirrorRepos {
$
(
'
.js-mirror-protected-hidden
'
,
this
.
$form
).
val
(
val
);
}
updateKeepDivergentRefs
()
{
const
field
=
this
.
$keepDivergentRefsInput
.
get
(
0
);
// This field only exists after the form is switched to 'Push' mode
if
(
field
)
{
const
val
=
field
.
checked
?
this
.
$keepDivergentRefsInput
.
val
()
:
'
0
'
;
$
(
'
.js-mirror-keep-divergent-refs-hidden
'
,
this
.
$form
).
val
(
val
);
}
}
registerUpdateListeners
()
{
this
.
debouncedUpdateUrl
=
debounce
(()
=>
this
.
updateUrl
(),
200
);
this
.
$urlInput
.
on
(
'
input
'
,
()
=>
this
.
debouncedUpdateUrl
());
...
...
app/controllers/projects/mirrors_controller.rb
View file @
f715c41d
...
...
@@ -77,6 +77,7 @@ class Projects::MirrorsController < Projects::ApplicationController
id
enabled
only_protected_branches
keep_divergent_refs
auth_method
password
ssh_known_hosts
...
...
app/views/projects/mirrors/_mirror_repos_push.html.haml
View file @
f715c41d
-
protocols
=
Gitlab
::
UrlSanitizer
::
ALLOWED_SCHEMES
.
join
(
'|'
)
-
keep_divergent_refs
=
Feature
.
enabled?
(
:keep_divergent_refs
,
@project
)
=
f
.
fields_for
:remote_mirrors
,
@project
.
remote_mirrors
.
build
do
|
rm_f
|
=
rm_f
.
hidden_field
:enabled
,
value:
'1'
=
rm_f
.
hidden_field
:url
,
class:
'js-mirror-url-hidden'
,
required:
true
,
pattern:
"(
#{
protocols
}
):
\/\/
.+"
=
rm_f
.
hidden_field
:only_protected_branches
,
class:
'js-mirror-protected-hidden'
-
if
keep_divergent_refs
=
rm_f
.
hidden_field
:keep_divergent_refs
,
class:
'js-mirror-keep-divergent-refs-hidden'
=
render
partial:
'projects/mirrors/ssh_host_keys'
,
locals:
{
f:
rm_f
}
=
render
partial:
'projects/mirrors/authentication_method'
,
locals:
{
f:
rm_f
}
-
if
keep_divergent_refs
.form-check.append-bottom-10
=
check_box_tag
:keep_divergent_refs
,
'1'
,
false
,
class:
'js-mirror-keep-divergent-refs form-check-input'
=
label_tag
:keep_divergent_refs
,
'Keep divergent refs'
,
class:
'form-check-label'
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