Quellcode durchsuchen

AMBARI-6309 Service Config page: Upon clicking Save, the button is still enabled and the user can click it again and again. (ababiichuk)

aBabiichuk vor 11 Jahren
Ursprung
Commit
3bb817acf1

+ 9 - 1
ambari-web/app/controllers/main/service/info/configs.js

@@ -114,6 +114,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
    * clear and set properties to default value
    */
   clearStep: function () {
+    this.set("isApplyingChanges", false)
     this.set('isInit', true);
     this.set('hash', null);
     this.set('forceTransition', false);
@@ -768,6 +769,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     if (this.get("isSubmitDisabled")) {
       return;
     }
+    this.set("isApplyingChanges", true);
     var self = this;
     var header, message, messageClass, status;
     var serviceName = this.get('content.serviceName'),
@@ -781,7 +783,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
       if (this.isDirChanged()) {
         App.showConfirmationPopup(function () {
           self.saveConfigs();
-        }, Em.I18n.t('services.service.config.confirmDirectoryChange').format(displayName));
+        }, Em.I18n.t('services.service.config.confirmDirectoryChange').format(displayName), function() { self.set('isApplyingChanges', false)});
       } else {
         this.saveConfigs();
       }
@@ -932,8 +934,14 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         this.hide();
         if (flag) {
           self.loadStep();
+        } else {
+          self.set('isApplyingChanges', false)
         }
       },
+      onClose: function() {
+        this.hide();
+        self.set('isApplyingChanges', false)
+      },
       bodyClass: Ember.View.extend({
         flag: flag,
         message: message,

+ 7 - 1
ambari-web/app/views/common/modal_popup.js

@@ -141,6 +141,12 @@ App.showConfirmationPopup = function (primary, body, secondary) {
       if (secondary) {
         secondary();
       }
+    },
+    onClose:  function () {
+      this.hide();
+      if (secondary) {
+        secondary();
+      }
     }
   });
 };
@@ -265,4 +271,4 @@ App.showPromptPopup = function (text, primary, defaultValue, secondary) {
       }
     }
   });
-};
+};