Explorar el Código

AMBARI-7315.Wizards: Wrong behavior on fast clicking Next button. (akovalenko)

Aleksandr Kovalenko hace 10 años
padre
commit
66048a0539
Se han modificado 1 ficheros con 24 adiciones y 14 borrados
  1. 24 14
      ambari-web/app/controllers/wizard/step5_controller.js

+ 24 - 14
ambari-web/app/controllers/wizard/step5_controller.js

@@ -91,6 +91,12 @@ App.WizardStep5Controller = Em.Controller.extend(App.BlueprintMixin, {
    */
    */
   submitDisabled: false,
   submitDisabled: false,
 
 
+  /**
+   * Is Submit-click processing now
+   * @type {bool}
+   */
+  submitButtonClicked: false,
+
   /**
   /**
    * Trigger for executing host names check for components
    * 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
    * Should de "triggered" when host changed for some component and when new multiple component is added/removed
@@ -1075,30 +1081,34 @@ App.WizardStep5Controller = Em.Controller.extend(App.BlueprintMixin, {
 
 
   /**
   /**
    * Submit button click handler
    * Submit button click handler
-   * @metohd submit
+   * @method submit
    */
    */
   submit: function () {
   submit: function () {
     var self = this;
     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
    * 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) {
   showValidationIssuesAcceptBox: function(callback) {
     var self = this;
     var self = this;