Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-11-16 15:22:19 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2017-12-03 15:36:10 +0300
commitd81ffeac4996a30a1f6b262eaeec1bcb4e26cf87 (patch)
tree7e450624f45981426da0eb618aa802ae66cbff4a /app/assets/javascripts/clusters
parent6957f939d2a35a99700b79cc791d3a6c501bf21d (diff)
Changes after review - improve UX
Diffstat (limited to 'app/assets/javascripts/clusters')
-rw-r--r--app/assets/javascripts/clusters/clusters_bundle.js20
1 files changed, 2 insertions, 18 deletions
diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js
index 6a8c5bbdc1f..cdb5c430aa9 100644
--- a/app/assets/javascripts/clusters/clusters_bundle.js
+++ b/app/assets/javascripts/clusters/clusters_bundle.js
@@ -60,8 +60,6 @@ export default class Clusters {
this.showTokenButton = document.querySelector('.js-show-cluster-token');
this.tokenField = document.querySelector('.js-cluster-token');
- this.showTokenButtonHasEventListener = false;
-
initSettingsPanels();
this.initApplications();
@@ -102,26 +100,13 @@ export default class Clusters {
addListeners() {
this.toggleButton.addEventListener('click', this.toggle);
- this.addEventListenerToken();
+ if (this.showTokenButton) this.showTokenButton.addEventListener('click', this.showToken);
eventHub.$on('installApplication', this.installApplication);
}
- /**
- * This button only exists when the cluster is 'created'.
- * Because we are polling cluster status we need to make sure we only set one event listener
- */
- addEventListenerToken() {
- if (this.showTokenButton && !this.showTokenButtonHasEventListener) {
- this.showTokenButtonHasEventListener = true;
- this.showTokenButton.addEventListener('click', this.showToken);
- }
- }
removeListeners() {
this.toggleButton.removeEventListener('click', this.toggle);
- if (this.showTokenButton) {
- this.showTokenButton.removeEventListener('click', this.showToken);
- this.showTokenButtonHasEventListener = false;
- }
+ if (this.showTokenButton) this.showTokenButton.removeEventListener('click', this.showToken);
eventHub.$off('installApplication', this.installApplication);
}
@@ -208,7 +193,6 @@ export default class Clusters {
switch (status) {
case 'created':
this.successContainer.classList.remove('hidden');
- this.addEventListenerToken();
break;
case 'errored':
this.errorContainer.classList.remove('hidden');