Repository: ambari
Updated Branches:
  refs/heads/trunk 40341c29a -> 9f18d409d


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/9f18d409
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9f18d409
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9f18d409

Branch: refs/heads/trunk
Commit: 9f18d409d28464499b3ebe637c2bc5d6d8ff1e3a
Parents: 40341c2
Author: ababiichuk <ababiic...@hortonworks.com>
Authored: Mon Jan 11 17:50:23 2016 +0200
Committer: ababiichuk <ababiic...@hortonworks.com>
Committed: Tue Jan 12 09:13:44 2016 +0200

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/9f18d409/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