AMBARI-12554. FE: Switching between different service's configs does not reduce DOM node and listeners count (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/892ef847 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/892ef847 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/892ef847 Branch: refs/heads/trunk Commit: 892ef84772c3b096ec24da94050a79966e0d6c33 Parents: b18f486 Author: Aleksandr Kovalenko <[email protected]> Authored: Mon Jul 27 19:28:28 2015 +0300 Committer: Aleksandr Kovalenko <[email protected]> Committed: Mon Jul 27 19:28:28 2015 +0300 ---------------------------------------------------------------------- ambari-web/app/controllers/main/service/info/configs.js | 12 ++++++++++-- ambari-web/app/utils/helper.js | 2 ++ .../app/views/common/configs/service_config_view.js | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/892ef847/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index 5ce4545..2c51a88 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -150,6 +150,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A * @type {boolean} */ isSubmitDisabled: function () { + if (!this.get('selectedService')) return true; return this.get('selectedService').get('errorCount') !== 0 || this.get('saveInProgress'); }.property('selectedService.errorCount', 'saveInProgress'), @@ -274,8 +275,15 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A serviceConfigVersionNote: '' }); this.get('filterColumns').setEach('selected', false); - this.get('stepConfigs').clear(); - this.get('allConfigs').clear(); + this.clearConfigs(); + }, + + clearConfigs: function() { + this.get('allConfigs').invoke('destroy'); + this.get('stepConfigs').invoke('destroy'); + this.set('stepConfigs', []); + this.set('allConfigs', []); + this.set('selectedService', null); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/892ef847/ambari-web/app/utils/helper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js index 0e454d6..04f767d 100644 --- a/ambari-web/app/utils/helper.js +++ b/ambari-web/app/utils/helper.js @@ -580,6 +580,7 @@ App.popover = function (self, options) { self.popover(options); self.on("remove", function () { $(this).trigger('mouseleave'); + $(this).off(); }); }; @@ -597,6 +598,7 @@ App.tooltip = function (self, options) { /* istanbul ignore next */ self.on("remove", function () { $(this).trigger('mouseleave'); + $(this).off(); }); }; http://git-wip-us.apache.org/repos/asf/ambari/blob/892ef847/ambari-web/app/views/common/configs/service_config_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/service_config_view.js b/ambari-web/app/views/common/configs/service_config_view.js index c9da165..47349c6 100644 --- a/ambari-web/app/views/common/configs/service_config_view.js +++ b/ambari-web/app/views/common/configs/service_config_view.js @@ -250,6 +250,7 @@ App.ServiceConfigView = Em.View.extend({ * @method filterEnhancedConfigs */ filterEnhancedConfigs: function () { + if (!this.get('controller.selectedService')) return true; var self = this; var serviceConfigs = this.get('controller.selectedService.configs').filterProperty('isVisible', true);
