diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-12-05 12:00:02 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-12-05 12:00:02 +0000 |
commit | 4b66bdfa1af8fbef5d2af94a62e2522806cc7250 (patch) | |
tree | b63b843eca0e92ac2938ad8a49a979c2b8ab52e9 /app/assets/javascripts | |
parent | 04a882d8d3bd68bee71f5b7073cb7a8ce0149852 (diff) | |
download | gitlab-ce-4b66bdfa1af8fbef5d2af94a62e2522806cc7250.tar.gz |
Second iteration of Move Kubernetes from service to Cluster page
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/clusters/clusters_bundle.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index dc443475952..cdb5c430aa9 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -48,6 +48,7 @@ export default class Clusters { this.toggle = this.toggle.bind(this); this.installApplication = this.installApplication.bind(this); + this.showToken = this.showToken.bind(this); this.toggleButton = document.querySelector('.js-toggle-cluster'); this.toggleInput = document.querySelector('.js-toggle-input'); @@ -56,6 +57,8 @@ export default class Clusters { this.creatingContainer = document.querySelector('.js-cluster-creating'); this.errorReasonContainer = this.errorContainer.querySelector('.js-error-reason'); this.successApplicationContainer = document.querySelector('.js-cluster-application-notice'); + this.showTokenButton = document.querySelector('.js-show-cluster-token'); + this.tokenField = document.querySelector('.js-cluster-token'); initSettingsPanels(); this.initApplications(); @@ -97,11 +100,13 @@ export default class Clusters { addListeners() { this.toggleButton.addEventListener('click', this.toggle); + if (this.showTokenButton) this.showTokenButton.addEventListener('click', this.showToken); eventHub.$on('installApplication', this.installApplication); } removeListeners() { this.toggleButton.removeEventListener('click', this.toggle); + if (this.showTokenButton) this.showTokenButton.removeEventListener('click', this.showToken); eventHub.$off('installApplication', this.installApplication); } @@ -149,6 +154,16 @@ export default class Clusters { this.toggleInput.setAttribute('value', this.toggleButton.classList.contains('checked').toString()); } + showToken() { + const type = this.tokenField.getAttribute('type'); + + if (type === 'password') { + this.tokenField.setAttribute('type', 'text'); + } else { + this.tokenField.setAttribute('type', 'password'); + } + } + hideAll() { this.errorContainer.classList.add('hidden'); this.successContainer.classList.add('hidden'); |