Repository: ambari Updated Branches: refs/heads/branch-2.2 9a9cab5fb -> aa88cfc62
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/aa88cfc6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/aa88cfc6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/aa88cfc6 Branch: refs/heads/branch-2.2 Commit: aa88cfc62ce013db8adac1115520953450cec4e0 Parents: 9a9cab5 Author: ababiichuk <ababiic...@hortonworks.com> Authored: Mon Apr 4 19:52:56 2016 +0300 Committer: ababiichuk <ababiic...@hortonworks.com> Committed: Mon Apr 4 19:58:48 2016 +0300 ---------------------------------------------------------------------- .../app/controllers/wizard/step6_controller.js | 26 ++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/aa88cfc6/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 72e1071..7826c06 100644 --- a/ambari-web/app/controllers/wizard/step6_controller.js +++ b/ambari-web/app/controllers/wizard/step6_controller.js @@ -72,6 +72,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} */ @@ -563,15 +575,24 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { }, callValidation: function (successCallback) { - this.callServerSideValidation(successCallback); + var self = this; + clearTimeout(this.get('timer')); + if (this.get('validationInProgress')) { + this.set('timer', setTimeout(function () { + self.callValidation(successCallback); + }, 700)); + } else { + this.callServerSideValidation(successCallback); + } }, /** * 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'); @@ -631,6 +652,7 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { error: 'updateValidationsErrorCallback' }). then(function () { + self.set('validationInProgress', false); if (!self.get('submitDisabled') && successCallback) { successCallback(); }