Repository: ambari
Updated Branches:
  refs/heads/trunk 1472e1b09 -> 82589fc4d


AMBARI-12471. Unsaved Configs popup appears when switching config versions 
quickly (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c0a52967
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c0a52967
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c0a52967

Branch: refs/heads/trunk
Commit: c0a5296759ea5e79b54535cc6808a601a3e116ba
Parents: 1472e1b
Author: Alex Antonenko <hiv...@gmail.com>
Authored: Tue Jul 21 17:08:11 2015 +0300
Committer: Alex Antonenko <hiv...@gmail.com>
Committed: Tue Jul 21 17:08:11 2015 +0300

----------------------------------------------------------------------
 .../views/common/configs/config_history_flow.js | 25 ++++++++++++++++----
 1 file changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c0a52967/ambari-web/app/views/common/configs/config_history_flow.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_history_flow.js 
b/ambari-web/app/views/common/configs/config_history_flow.js
index 364d1c5..4f11bfd 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -118,6 +118,17 @@ App.ConfigHistoryFlowView = Em.View.extend({
   }.property('serviceName', 'controller.selectedConfigGroup.name'),
 
   /**
+   * disable versions visible to the user to prevent actions on them
+   */
+  disableVersions: function () {
+    var allServiceVersions = 
App.ServiceConfigVersion.find().filterProperty('serviceName', 
this.get('serviceName'));
+
+    allServiceVersions.forEach(function (version) {
+      version.set('isDisabled', true);
+    }, this);
+  },
+
+  /**
    * service versions which in viewport and visible to user
    */
   visibleServiceVersion: function () {
@@ -309,11 +320,15 @@ App.ConfigHistoryFlowView = Em.View.extend({
       self[type].call(self, event);
     }
 
-    if (controller.hasUnsavedChanges()) {
-      controller.showSavePopup(null, callback);
-      return;
-    }
-    callback();
+    Em.run.next(function() {
+      if (controller.hasUnsavedChanges()) {
+        controller.showSavePopup(null, callback);
+        return;
+      }
+
+      self.disableVersions();
+      callback();
+    });
   },
 
   /**

Reply via email to