ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject git commit: AMBARI-6357. deleted host can not be added properly again. (akovalenko)
Date Wed, 02 Jul 2014 16:34:35 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 14ad9558e -> 95a4817c6


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/95a4817c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/95a4817c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/95a4817c

Branch: refs/heads/branch-1.6.1
Commit: 95a4817c61d54604fea512eb203702aaa13ed3e3
Parents: 14ad955
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Wed Jul 2 19:32:55 2014 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Wed Jul 2 19:32:55 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/95a4817c/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 c44ab74..4ec6920 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/95a4817c/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/95a4817c/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 32d6c57..ebc7a48 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');
     },
     /**


Mime
View raw message