AMBARI-14610 Sometimes Assign Slaves and Clients page works not properly. 
(ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7857a16b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7857a16b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7857a16b

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7857a16b4bcc0f5bb42142c1c5ec3cf72715f315
Parents: b2278d0
Author: ababiichuk <ababiic...@hortonworks.com>
Authored: Mon Jan 11 17:50:23 2016 +0200
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Thu Jan 14 11:43:24 2016 -0500

----------------------------------------------------------------------
 .../app/controllers/wizard/step6_controller.js  | 26 ++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7857a16b/ambari-web/app/controllers/wizard/step6_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step6_controller.js 
b/ambari-web/app/controllers/wizard/step6_controller.js
index 62eee59..ffa5cc9 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -74,6 +74,18 @@ App.WizardStep6Controller = 
Em.Controller.extend(App.BlueprintMixin, {
   submitDisabled: false,
 
   /**
+   * timer for validation request
+   */
+  timer: null,
+
+  /**
+   * true if request for validation is in progress
+   *
+   * @type {bool}
+   */
+  validationInProgress: false,
+
+  /**
    * Check if <code>addHostWizard</code> used
    * @type {bool}
    */
@@ -548,15 +560,24 @@ App.WizardStep6Controller = 
Em.Controller.extend(App.BlueprintMixin, {
   },
 
   callValidation: function (successCallback) {
-    this.callServerSideValidation(successCallback);
+    var self = this;
+    clearTimeout(this.get('timer'));
+    this.set('timer', setTimeout(function() {
+      if (self.get('validationInProgress')) {
+        self.callValidation(successCallback);
+      } else {
+        self.callServerSideValidation(successCallback);
+      }
+    }, 700));
   },
 
   /**
    * Update submit button status
-   * @metohd callServerSideValidation
+   * @method callServerSideValidation
    */
   callServerSideValidation: function (successCallback) {
     var self = this;
+    this.set('validationInProgress', true);
 
     var selectedServices = 
App.StackService.find().filterProperty('isSelected').mapProperty('serviceName');
     var installedServices = 
App.StackService.find().filterProperty('isInstalled').mapProperty('serviceName');
@@ -615,6 +636,7 @@ App.WizardStep6Controller = 
Em.Controller.extend(App.BlueprintMixin, {
       error: 'updateValidationsErrorCallback'
     }).
       then(function () {
+        self.set('validationInProgress', false);
         if (!self.get('submitDisabled') && successCallback) {
           successCallback();
         }

Reply via email to