Repository: ambari Updated Branches: refs/heads/trunk 8cc5cabcb -> bb43d2b29
AMBARI-6357. deleted host can not be added properly again. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bb43d2b2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bb43d2b2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bb43d2b2 Branch: refs/heads/trunk Commit: bb43d2b29b1bad22ddf78e53f2c993e245a172ad Parents: 8cc5cab Author: Aleksandr Kovalenko <[email protected]> Authored: Wed Jul 2 19:35:07 2014 +0300 Committer: Aleksandr Kovalenko <[email protected]> Committed: Wed Jul 2 19:35:07 2014 +0300 ---------------------------------------------------------------------- .../app/controllers/main/host/add_controller.js | 27 +++++--------------- .../app/mappers/component_config_mapper.js | 1 - ambari-web/app/routes/add_host_routes.js | 1 + 3 files changed, 8 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/bb43d2b2/ambari-web/app/controllers/main/host/add_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/add_controller.js b/ambari-web/app/controllers/main/host/add_controller.js index c982e2d..6baa579 100644 --- a/ambari-web/app/controllers/main/host/add_controller.js +++ b/ambari-web/app/controllers/main/host/add_controller.js @@ -129,26 +129,16 @@ App.AddHostController = App.WizardController.extend({ }, /** - * return slaveComponents bound to hosts - * @return {Array} - */ - getSlaveComponentHosts: function () { - return this._super().filter(function (component) { - return component.isInstalled; - }); - }, - - /** - * Load master component hosts data for using in required step controllers + * Load slave component hosts data for using in required step controllers * TODO move to mixin */ loadSlaveComponentHosts: function () { - var slaveComponentHosts = this.getDBProperty('slaveComponentHosts'), - hosts = this.getDBProperty('hosts'), - host_names = Em.keys(hosts); - if (!Em.isNone(slaveComponentHosts)) { - slaveComponentHosts.forEach(function(component) { - component.hosts.forEach(function(host) { + var slaveComponentHosts = this.getDBProperty('slaveComponentHosts') || []; + if (slaveComponentHosts.length) { + var hosts = this.getDBProperty('hosts'), + host_names = Em.keys(hosts); + slaveComponentHosts.forEach(function (component) { + component.hosts.forEach(function (host) { //Em.set(host, 'hostName', hosts[host.host_id].name); for (var i = 0; i < host_names.length; i++) { if (hosts[host_names[i]].id === host.host_id) { @@ -159,9 +149,6 @@ App.AddHostController = App.WizardController.extend({ }); }); } - if (!slaveComponentHosts) { - slaveComponentHosts = this.getSlaveComponentHosts(); - } this.set("content.slaveComponentHosts", slaveComponentHosts); console.log("AddHostController.loadSlaveComponentHosts: loaded hosts ", slaveComponentHosts); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/bb43d2b2/ambari-web/app/mappers/component_config_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/component_config_mapper.js b/ambari-web/app/mappers/component_config_mapper.js index 79540e2..83a6d68 100644 --- a/ambari-web/app/mappers/component_config_mapper.js +++ b/ambari-web/app/mappers/component_config_mapper.js @@ -36,7 +36,6 @@ App.componentConfigMapper = App.QuickDataMapper.create({ var hostComponents = []; var serviceToHostComponentIdMap = {}; var cacheServices = App.cache['services']; - var componentsWithStaleConfigs = {}; var loadedServiceComponentsMap = this.buildServiceComponentMap(cacheServices); var mapConfig = this.get('config'); // We do not want to parse JSON if there is no need to http://git-wip-us.apache.org/repos/asf/ambari/blob/bb43d2b2/ambari-web/app/routes/add_host_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/add_host_routes.js b/ambari-web/app/routes/add_host_routes.js index a33d095..3cf338f 100644 --- a/ambari-web/app/routes/add_host_routes.js +++ b/ambari-web/app/routes/add_host_routes.js @@ -163,6 +163,7 @@ module.exports = App.WizardRoute.extend({ addHostController.saveClients(); addHostController.setDBProperty('bootStatus', true); + addHostController.setDBProperty('slaveComponentHosts', undefined); router.transitionTo('step3'); }, /**
