diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-30 15:07:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-30 15:07:51 +0000 |
commit | 4e9acbfba3682c552b3de707c535e6257ef41054 (patch) | |
tree | 8b1fd5f89ad3f1be68d8944815b13bb7d498e4a6 /app/assets/javascripts | |
parent | 506d6dcd7c787ba71a8a53102f3d4fdb6adcfa5e (diff) | |
download | gitlab-ce-4e9acbfba3682c552b3de707c535e6257ef41054.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/mirrors/mirror_repos.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/assets/javascripts/mirrors/mirror_repos.js b/app/assets/javascripts/mirrors/mirror_repos.js index e5acaaf9366..5401fb7b6ec 100644 --- a/app/assets/javascripts/mirrors/mirror_repos.js +++ b/app/assets/javascripts/mirrors/mirror_repos.js @@ -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()); |