Updated Branches: refs/heads/trunk 2599fa997 -> 731618c40
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/731618c4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/731618c4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/731618c4 Branch: refs/heads/trunk Commit: 731618c407525f21ef51407697fce9d168f62f06 Parents: 2599fa9 Author: Yusaku Sako <[email protected]> Authored: Mon Nov 25 18:46:51 2013 -0800 Committer: Yusaku Sako <[email protected]> Committed: Mon Nov 25 18:46:51 2013 -0800 ---------------------------------------------------------------------- .../global/configuration_controller.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/731618c4/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); } });
