AMBARI-7315.Wizards: Wrong behavior on fast clicking Next button. (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/66048a05 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/66048a05 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/66048a05 Branch: refs/heads/branch-alerts-dev Commit: 66048a0539b2239bf2aafdaf897f5afb45f71e5d Parents: 002a190 Author: Aleksandr Kovalenko <akovale...@hortonworks.com> Authored: Mon Sep 15 20:30:35 2014 +0300 Committer: Aleksandr Kovalenko <akovale...@hortonworks.com> Committed: Mon Sep 15 20:31:53 2014 +0300 ---------------------------------------------------------------------- .../app/controllers/wizard/step5_controller.js | 38 ++++++++++++-------- 1 file changed, 24 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/66048a05/ambari-web/app/controllers/wizard/step5_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step5_controller.js b/ambari-web/app/controllers/wizard/step5_controller.js index 258e856..68342c7 100644 --- a/ambari-web/app/controllers/wizard/step5_controller.js +++ b/ambari-web/app/controllers/wizard/step5_controller.js @@ -92,6 +92,12 @@ App.WizardStep5Controller = Em.Controller.extend(App.BlueprintMixin, { submitDisabled: false, /** + * Is Submit-click processing now + * @type {bool} + */ + submitButtonClicked: false, + + /** * Trigger for executing host names check for components * Should de "triggered" when host changed for some component and when new multiple component is added/removed * @type {bool} @@ -1075,30 +1081,34 @@ App.WizardStep5Controller = Em.Controller.extend(App.BlueprintMixin, { /** * Submit button click handler - * @metohd submit + * @method submit */ submit: function () { var self = this; + if (!this.get('submitButtonClicked')) { + this.set('submitButtonClicked', true); - var goNextStepIfValid = function() { - if (!self.get('submitDisabled')) { - App.router.send('next'); - } - }; + var goNextStepIfValid = function () { + if (!self.get('submitDisabled')) { + App.router.send('next'); + } + self.set('submitButtonClicked', false); + }; - if (App.get('supports.serverRecommendValidate')) { - self.recommendAndValidate(function() { - self.showValidationIssuesAcceptBox(goNextStepIfValid); - }); - } else { - self.updateIsSubmitDisabled(); - goNextStepIfValid(); + if (App.get('supports.serverRecommendValidate')) { + self.recommendAndValidate(function () { + self.showValidationIssuesAcceptBox(goNextStepIfValid); + }); + } else { + self.updateIsSubmitDisabled(); + goNextStepIfValid(); + } } }, /** * In case of any validation issues shows accept dialog box for user which allow cancel and fix issues or continue anyway - * @metohd submit + * @method showValidationIssuesAcceptBox */ showValidationIssuesAcceptBox: function(callback) { var self = this;