Repository: ambari Updated Branches: refs/heads/trunk faaf79946 -> 17990ba26
AMBARI-6169. Installer wizard: ambari web-client issues invalid requests after switching stacks. (jaimin) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/17990ba2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/17990ba2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/17990ba2 Branch: refs/heads/trunk Commit: 17990ba2642c086b3c4294f84c48274d5f0796c1 Parents: faaf799 Author: Jaimin Jetly <jai...@hortonworks.com> Authored: Tue Jun 17 14:15:16 2014 -0700 Committer: Jaimin Jetly <jai...@hortonworks.com> Committed: Tue Jun 17 14:15:40 2014 -0700 ---------------------------------------------------------------------- ambari-web/app/utils/component.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/17990ba2/ambari-web/app/utils/component.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/component.js b/ambari-web/app/utils/component.js index b374fe2..7e61a49 100644 --- a/ambari-web/app/utils/component.js +++ b/ambari-web/app/utils/component.js @@ -23,6 +23,18 @@ var App = require('app'); module.exports = { + + /** + * This needs to be done because mapper functions like App.stackServiceComponentMapper.map(data) does not override + * but unions the instances. So on re-navigation if the stack is switched and this function is not called then union of + * StackServiceComponent of both the stacks will be mapped to the model. + */ + clearStackModel: function() { + if (App.StackServiceComponent.find().get('content').length) { + App.StackServiceComponent.find().set('content', []); + } + }, + /** * Format and load info about components to StackServiceComponent model. * @@ -31,6 +43,7 @@ module.exports = { * @return {object} formatted info about components */ loadStackServiceComponentModel: function(data) { + this.clearStackModel(); var serviceComponents = {items: []}; data.items.forEach(function(item){ item.serviceComponents.forEach(function(_serviceComponent){ @@ -45,8 +58,8 @@ module.exports = { stack_version: stackServiceComponents.stack_version }; serviceComponents.items.pushObject(serviceComponent); - },this); - },this); + }, this); + }, this); App.stackServiceComponentMapper.map(serviceComponents); App.handleStackDependedComponents(); return serviceComponents;