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/2da898b8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2da898b8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2da898b8 Branch: refs/heads/branch-2.1 Commit: 2da898b8c078f965e606e35d54245c23063493fb Parents: a30f449 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:30:08 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/2da898b8/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(); + }); }, /**