Updated Branches: refs/heads/branch-1.4.2 022eddee9 -> 173c56482
AMBARI-3881. UI incorrect behavior during upgrade. (jaimin via yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/173c5648 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/173c5648 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/173c5648 Branch: refs/heads/branch-1.4.2 Commit: 173c564825a1ed2cd19b91eb80e8dc4b5d2dd043 Parents: 022edde Author: Yusaku Sako <[email protected]> Authored: Mon Nov 25 18:46:51 2013 -0800 Committer: Yusaku Sako <[email protected]> Committed: Mon Nov 25 18:47:30 2013 -0800 ---------------------------------------------------------------------- .../global/configuration_controller.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/173c5648/ambari-web/app/controllers/global/configuration_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/global/configuration_controller.js b/ambari-web/app/controllers/global/configuration_controller.js index 401224d..a3ec061 100644 --- a/ambari-web/app/controllers/global/configuration_controller.js +++ b/ambari-web/app/controllers/global/configuration_controller.js @@ -23,12 +23,13 @@ App.ConfigurationController = Em.Controller.extend({ getConfigsByTags: function (tags) { var storedTags = []; - App.db.getConfigs().forEach(function(site){ - storedTags.push({ - siteName: site.type, - tagName: site.tag - }) - }); + // Access the Local storage App.db.data.app.configs object only if its defined + !!App.db.getConfigs() && App.db.getConfigs().forEach(function(site){ + storedTags.push({ + siteName: site.type, + tagName: site.tag + }) + }); if (this.checkTagsChanges(tags, storedTags)) { return this.loadFromServer(tags); } else { @@ -69,11 +70,16 @@ App.ConfigurationController = Em.Controller.extend({ var loadedConfigs = App.config.loadConfigsByTags(tags); var storedConfigs = App.db.getConfigs(); loadedConfigs.forEach(function (loadedSite) { - var storedSite = storedConfigs.findProperty('type', loadedSite.type); + // Access the Local storage App.db.data.app.configs object only if its defined + var storedSite = !!storedConfigs && storedConfigs.findProperty('type', loadedSite.type); if (storedSite) { storedConfigs.tag = loadedSite.tag; storedConfigs.properties = loadedSite.properties; } else { + // Initialize storedConfigs object if it's undefined + if (storedConfigs === undefined) { + storedConfigs = []; + } storedConfigs.push(loadedSite); } });
