Commit d1a89b27 authored by Stan Hu's avatar Stan Hu

Backport EE JavaScript changes for SSH pull mirrors

This backports the JavaScript code in
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10272.
parent 909161dd
...@@ -20,6 +20,7 @@ export default class SSHMirror { ...@@ -20,6 +20,7 @@ export default class SSHMirror {
this.$btnDetectHostKeys = this.$form.find('.js-detect-host-keys'); this.$btnDetectHostKeys = this.$form.find('.js-detect-host-keys');
this.$btnSSHHostsShowAdvanced = this.$form.find('.btn-show-advanced'); this.$btnSSHHostsShowAdvanced = this.$form.find('.btn-show-advanced');
this.$dropdownAuthType = this.$form.find('.js-mirror-auth-type'); this.$dropdownAuthType = this.$form.find('.js-mirror-auth-type');
this.$hiddenAuthType = this.$form.find('.js-hidden-mirror-auth-type');
this.$wellAuthTypeChanging = this.$form.find('.js-well-changing-auth'); this.$wellAuthTypeChanging = this.$form.find('.js-well-changing-auth');
this.$wellPasswordAuth = this.$form.find('.js-well-password-auth'); this.$wellPasswordAuth = this.$form.find('.js-well-password-auth');
...@@ -167,6 +168,7 @@ export default class SSHMirror { ...@@ -167,6 +168,7 @@ export default class SSHMirror {
this.$wellPasswordAuth.collapse('hide'); this.$wellPasswordAuth.collapse('hide');
this.$wellSSHAuth.collapse('hide'); this.$wellSSHAuth.collapse('hide');
this.updateHiddenAuthType(selectedAuthType);
// This request should happen only if selected Auth type was SSH // This request should happen only if selected Auth type was SSH
// and SSH Public key was not present on page load // and SSH Public key was not present on page load
...@@ -234,6 +236,12 @@ export default class SSHMirror { ...@@ -234,6 +236,12 @@ export default class SSHMirror {
toggleAuthWell(authType) { toggleAuthWell(authType) {
this.$wellPasswordAuth.collapse(authType === AUTH_METHOD.PASSWORD ? 'show' : 'hide'); this.$wellPasswordAuth.collapse(authType === AUTH_METHOD.PASSWORD ? 'show' : 'hide');
this.$wellSSHAuth.collapse(authType === AUTH_METHOD.SSH ? 'show' : 'hide'); this.$wellSSHAuth.collapse(authType === AUTH_METHOD.SSH ? 'show' : 'hide');
this.updateHiddenAuthType(authType);
}
updateHiddenAuthType(authType) {
this.$hiddenAuthType.val(authType);
this.$hiddenAuthType.prop('disabled', authType === AUTH_METHOD.SSH);
} }
/** /**
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
= f.select :auth_method, = f.select :auth_method,
options_for_select(auth_options, mirror.auth_method), options_for_select(auth_options, mirror.auth_method),
{}, { class: "form-control js-mirror-auth-type qa-authentication-method" } {}, { class: "form-control js-mirror-auth-type qa-authentication-method" }
= f.hidden_field :auth_method, value: "password", class: "js-hidden-mirror-auth-type"
.form-group .form-group
.collapse.js-well-changing-auth .collapse.js-well-changing-auth
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment