浏览代码

AMBARI-6357. deleted host can not be added properly again. (akovalenko)

Aleksandr Kovalenko 11 年之前
父节点
当前提交
bb43d2b29b

+ 7 - 20
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);
   },

+ 0 - 1
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

+ 1 - 0
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');
     },
     /**