You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2012/10/18 02:59:58 UTC

svn commit: r1399500 - in /incubator/ambari/branches/AMBARI-666: ./ ambari-web/app/controllers/installer/ ambari-web/app/data/ ambari-web/app/routes/ ambari-web/app/templates/installer/ ambari-web/app/views/installer/

Author: yusaku
Date: Thu Oct 18 00:59:57 2012
New Revision: 1399500

URL: http://svn.apache.org/viewvc?rev=1399500&view=rev
Log:
AMBARI-871. Integrate basic sets of rest APIs with ambari-web installer wizard. (Jaimin Jetly via yusaku)

Added:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/data/review_configs.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/data/statusCodes.js
Modified:
    incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step3_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step5_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step6_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step8_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step6.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step8.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step9.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step5_view.js

Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1399500&r1=1399499&r2=1399500&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Thu Oct 18 00:59:57 2012
@@ -12,6 +12,9 @@ AMBARI-666 branch (unreleased changes)
 
   NEW FEATURES
 
+  AMBARI-871. Integrate basic set of rest APIs with ambari-web
+  installer wizardi. (Jaimin Jetly via yusaku)
+
   AMBARI-884. Implement Dashboard/Service summary. (yusaku)
 
   AMBARI-882. Group-based DataNode/TaskTracker/RegionServer overrides.

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step3_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step3_controller.js?rev=1399500&r1=1399499&r2=1399500&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step3_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step3_controller.js Thu Oct 18 00:59:57 2012
@@ -187,9 +187,10 @@ App.InstallerStep3Controller = Em.ArrayC
 
   doBootstrap: function () {
     var self = this;
+	  var url = '/api/bootstrap';
     $.ajax({
       type: 'GET',
-      url: '/api/bootstrap',
+      url: url,
       timeout: 5000,
       success: function (data) {
         console.log("TRACE: In success function for the GET bootstrap call");
@@ -206,13 +207,7 @@ App.InstallerStep3Controller = Em.ArrayC
         self.stopBootstrap();
       },
 
-      statusCode: {
-        404: function () {
-          console.log("URI not found.");
-        }
-      },
-
-      dataType: 'application/json'
+      statusCode: require('data/statusCodes')
     });
 
   },

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step5_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step5_controller.js?rev=1399500&r1=1399499&r2=1399500&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step5_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step5_controller.js Thu Oct 18 00:59:57 2012
@@ -19,572 +19,577 @@
 var App = require('app');
 
 App.InstallerStep5Controller = Em.Controller.extend({
-  //properties
-  name: "installerStep5Controller",
-  hosts: [],
-  selectedServices: [],
-  selectedServicesMasters: [],
-  zId: 0,
-  components: require('data/service_components'),
-
-  /*
-   Below function retrieves host information from local storage
-   */
-
-  clearStep: function () {
-    this.set('hosts', []);
-    this.set('selectedServices', []);
-    this.set('selectedServicesMasters', []);
-    this.set('zId', 0);
-  },
-
-  loadStep: function () {
-    console.log("TRACE: Loading step5: Assign Masters");
-    this.clearStep();
-    this.renderHostInfo(this.loadHostInfo());
-    this.renderComponents(this.loadComponents(this.loadServices()));
-  },
-
-  loadHostInfo: function () {
-    var hostInfo = [];
-    hostInfo = App.db.getHosts();
-    var hosts = new Ember.Set();
-    for (var index in hostInfo) {
-      hosts.add(hostInfo[index]);
-      console.log("TRACE: host name is: " + hostInfo[index].name);
-    }
-    return hosts.filterProperty('bootStatus', 'success');
-  },
-
-
-  renderHostInfo: function (hostsInfo) {
-
-    //wrap the model data into
-
-    hostsInfo.forEach(function (_host) {
-      var hostObj = Ember.Object.create({
-        host_name: _host.name,
-        cpu: _host.cpu,
-        memory: _host.memory
-      });
-      console.log('pushing ' + hostObj.host_name);
-      hostObj.set("host_info", "" + hostObj.get("host_name") + " ( " + hostObj.get("memory") + "GB" + " " + hostObj.get("cpu") + "cores )");
-      this.get("hosts").pushObject(hostObj);
-    }, this);
-
-
-  },
-
-  loadServices: function () {
-    var serviceInfo = App.db.getService();
-    var services = serviceInfo.filterProperty('isSelected', true).mapProperty('serviceName');
-    services.forEach(function (item) {
-      console.log("TRACE: service name is: " + item);
-      this.get("selectedServices").pushObject(Ember.Object.create({service_name: item}));
-    }, this);
-
-    return services;
-
-  },
-
-  loadComponents: function (services) {
-    var components = new Ember.Set();
-    if (App.db.getMasterComponentHosts() === undefined) {
-      var masterComponents = this.components.filterProperty('isMaster', true);
-      for (var index in services) {
-        var componentInfo = masterComponents.filterProperty('service_name', services[index]);
-        componentInfo.forEach(function (_componentInfo) {
-          console.log("TRACE: master component name is: " + _componentInfo.display_name);
-          var componentObj = {};
-          componentObj.component_name = _componentInfo.display_name;
-          componentObj.selectedHost = this.selectHost(_componentInfo.component_name);   // call the method that plays selectNode algorithm or fetches from server
-          componentObj.availableHosts = [];
-          components.add(componentObj);
-        }, this);
-      }
-    } else {
-      var masterComponentHosts = App.db.getMasterComponentHosts();
-      masterComponentHosts.forEach(function (_masterComponentHost) {
-        var componentObj = {};
-        componentObj.component_name =_masterComponentHost.component;
-        componentObj.selectedHost = _masterComponentHost.hostName;   // call the method that plays selectNode algorithm or fetches from server
-        componentObj.availableHosts = [];
-        components.add(componentObj);
-      }, this);
-    }
-    return components;
-  },
-
-  getMasterComponents: function () {
-    return (this.get('selectedServicesMasters').slice(0));
-  },
-
-  renderComponents: function (masterComponents) {
-    var zookeeperComponent = null, componentObj = null;
-    var services = [];
-    services = this.getMasterComponents();
-    if (services.length) {
-      this.set('selectedServicesMasters', []);
-    }
-
-
-    masterComponents.forEach(function (item) {
-      //add the zookeeper component at the end if exists
-      if (item.component_name === "ZooKeeper") {
-        if (services.length) {
-          services.forEach(function (_service) {
-            this.get('selectedServicesMasters').pushObject(_service);
-          }, this);
-        }
-        this.set('zId', parseInt(this.get('zId')) + 1);
-        zookeeperComponent = Ember.Object.create(item);
-        zookeeperComponent.set('zId', this.get('zId'));
-        zookeeperComponent.set("showRemoveControl", true);
-        zookeeperComponent.set("availableHosts", this.get("hosts").slice(0));
-        this.get("selectedServicesMasters").pushObject(Ember.Object.create(zookeeperComponent));
-
-      } else {
-        componentObj = Ember.Object.create(item);
-        componentObj.set("availableHosts", this.get("hosts").slice(0));
-        this.get("selectedServicesMasters").pushObject(componentObj);
-      }
-    }, this);
-  },
-
-  getKerberosServer: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    if (noOfHosts === 1) {
-      return hosts[0];
-    } else if (noOfHosts < 3) {
-      return hosts[1];
-    } else if (noOfHosts <= 5) {
-      return hosts[1];
-    } else if (noOfHosts <= 30) {
-      return hosts[3];
-    } else {
-      return hosts[5];
-    }
-  },
-
-  getNameNode: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    return hosts[0];
-  },
-
-  getSNameNode: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    if (noOfHosts === 1) {
-      return hosts[0];
-    } else {
-      return hosts[1];
-    }
-  },
-
-  getJobTracker: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    if (noOfHosts === 1) {
-      return hosts[0];
-    } else if (noOfHosts < 3) {
-      return hosts[1];
-    } else if (noOfHosts <= 5) {
-      return hosts[1];
-    } else if (noOfHosts <= 30) {
-      return hosts[1];
-    } else {
-      return hosts[2];
-    }
-  },
-
-  getHBaseMaster: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    if (noOfHosts === 1) {
-      return hosts[0];
-    } else if (noOfHosts < 3) {
-      return hosts[0];
-    } else if (noOfHosts <= 5) {
-      return hosts[0];
-    } else if (noOfHosts <= 30) {
-      return hosts[2];
-    } else {
-      return hosts[3];
-    }
-  },
-
-  getOozieServer: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    if (noOfHosts === 1) {
-      return hosts[0];
-    } else if (noOfHosts < 3) {
-      return hosts[1];
-    } else if (noOfHosts <= 5) {
-      return hosts[1];
-    } else if (noOfHosts <= 30) {
-      return hosts[2];
-    } else {
-      return hosts[3];
-    }
-  },
-
-  getOozieServer: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    if (noOfHosts === 1) {
-      return hosts[0];
-    } else if (noOfHosts < 3) {
-      return hosts[1];
-    } else if (noOfHosts <= 5) {
-      return hosts[1];
-    } else if (noOfHosts <= 30) {
-      return hosts[2];
-    } else {
-      return hosts[3];
-    }
-  },
-
-  getHiveServer: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    if (noOfHosts === 1) {
-      return hosts[0];
-    } else if (noOfHosts < 3) {
-      return hosts[1];
-    } else if (noOfHosts <= 5) {
-      return hosts[1];
-    } else if (noOfHosts <= 30) {
-      return hosts[2];
-    } else {
-      return hosts[4];
-    }
-  },
-
-  getTempletonServer: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    if (noOfHosts === 1) {
-      return hosts[0];
-    } else if (noOfHosts < 3) {
-      return hosts[1];
-    } else if (noOfHosts <= 5) {
-      return hosts[1];
-    } else if (noOfHosts <= 30) {
-      return hosts[2];
-    } else {
-      return hosts[4];
-    }
-  },
-
-  getZooKeeperServer: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    if (noOfHosts < 3) {
-      return [hosts[0].host_name];
-    } else {
-      return [hosts[0].host_name, hosts[1].host_name, hosts[2].host_name];
-    }
-  },
-
-  getGangliaServer: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    var hostnames = [];
-    var inc = 0;
-    hosts.forEach(function (_hostname) {
-      hostnames[inc] = _hostname.host_name;
-      inc++;
-    });
-    var hostExcAmbari = hostnames.without(location.hostname);
-    if (hostExcAmbari !== null || hostExcAmbari !== undefined || hostExcAmbari.length !== 0) {
-      return hostExcAmbari[0];
-    } else {
-      return hostnames[0];
-    }
-  },
-
-  getNagiosServer: function (noOfHosts) {
-    var hosts = this.get('hosts');
-    var hostnames = [];
-    var inc = 0;
-    hosts.forEach(function (_hostname) {
-      hostnames[inc] = _hostname.host_name;
-      inc++;
-    });
-    var hostExcAmbari = hostnames.without(location.hostname);
-    if (hostExcAmbari !== null || hostExcAmbari !== undefined || hostExcAmbari.length !== 0) {
-      return hostExcAmbari[0];
-    } else {
-      return hostnames[0];
-    }
-  },
-
-
-  selectHost: function (componentName) {
-    var noOfHosts = this.get('hosts').length;
-    if (componentName === 'KERBEROS_SERVER') {
-      return this.getKerberosServer(noOfHosts).host_name;
-    } else if (componentName === 'NAMENODE') {
-      return this.getNameNode(noOfHosts).host_name;
-    } else if (componentName === 'SNAMENODE') {
-      return this.getSNameNode(noOfHosts).host_name;
-    } else if (componentName === 'JOBTRACKER') {
-      return this.getJobTracker(noOfHosts).host_name;
-    } else if (componentName === 'HBASE_MASTER') {
-      return this.getHBaseMaster(noOfHosts).host_name;
-    } else if (componentName === 'OOZIE_SERVER') {
-      return this.getOozieServer(noOfHosts).host_name;
-    } else if (componentName === 'HIVE_SERVER') {
-      return this.getHiveServer(noOfHosts).host_name;
-    } else if (componentName === 'TEMPLETON_SERVER') {
-      return this.getTempletonServer(noOfHosts).host_name;
-    } else if (componentName === 'ZOOKEEPER_SERVER') {
-      var zhosts = this.getZooKeeperServer(noOfHosts);
-      var extraHosts = zhosts.slice(0, zhosts.length - 1);
-      var zooKeeperHosts = new Ember.Set();
-      extraHosts.forEach(function (_host) {
-        var zooKeeperHost = {};
-        zooKeeperHost.component_name = 'ZooKeeper';
-        zooKeeperHost.selectedHost = _host;
-        zooKeeperHost.availableHosts = [];
-        zooKeeperHosts.add(zooKeeperHost);
-      });
-      this.renderComponents(zooKeeperHosts);
-      var lastHost = zhosts[zhosts.length - 1];
-      return lastHost;
-    } else if (componentName === 'GANGLIA_MONITOR_SERVER') {
-      return this.getGangliaServer(noOfHosts);
-    } else if (componentName === 'NAGIOS_SERVER') {
-      return this.getNagiosServer(noOfHosts);
-    }
-  },
-
-
-  masterHostMapping: function () {
-    var mapping = [], mappingObject, self = this, mappedHosts, hostObj, hostInfo;
-    //get the unique assigned hosts and find the master services assigned to them
-
-    mappedHosts = this.get("selectedServicesMasters").mapProperty("selectedHost").uniq();
-
-    mappedHosts.forEach(function (item) {
-      hostObj = self.get("hosts").findProperty("host_name", item);
-      console.log("Name of the host is: " + hostObj.host_name);
-      hostInfo = " ( " + hostObj.get("memory") + "GB" + " " + hostObj.get("cpu") + "cores )";
-
-      mappingObject = Ember.Object.create({
-        host_name: item,
-        hostInfo: hostInfo,
-        masterServices: self.get("selectedServicesMasters").filterProperty("selectedHost", item)
-      });
-
-      mapping.pushObject(mappingObject);
-    }, this);
-
-    mapping.sort(this.sortHostsByName);
-
-    return mapping;
-
-  }.property("selectedServicesMasters.@each.selectedHost"),
-
-  remainingHosts: function () {
-    return (this.get("hosts.length") - this.get("masterHostMapping.length"));
-  }.property("selectedServicesMasters.@each.selectedHost"),
-
-  hasZookeeper: function () {
-    return this.selectedServices.findProperty("service_name", "ZooKeeper");
-  }.property("selectedServices"),
-
-  //methods
-  getAvailableHosts: function (componentName) {
-    var assignableHosts = [],
-      zookeeperHosts = null;
-
-    if (componentName === "ZooKeeper") {
-      zookeeperHosts = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper").mapProperty("selectedHost").uniq();
-      this.get("hosts").forEach(function (item) {
-        if (!(zookeeperHosts.contains(item.get("host_name")))) {
-          assignableHosts.pushObject(item);
-        }
-      }, this);
-      return assignableHosts;
-
-    } else {
-      return this.get("hosts");
-    }
-  },
-
-   assignHostToMaster: function (masterService, selectedHost, zId) {
-     if (selectedHost && masterService) {
-       if ((masterService === "ZooKeeper") && zId) {
-         this.get('selectedServicesMasters').findProperty("zId", zId).set("selectedHost", selectedHost);
-         this.rebalanceZookeeperHosts();
-       }
-       else {
-         this.get('selectedServicesMasters').findProperty("component_name", masterService).set("selectedHost", selectedHost);
-       }
-
-     }
-   },
-
-  lastZooKeeper: function () {
-    var currentZooKeepers = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper");
-    var lastZooKeeper = currentZooKeepers.get("lastObject");
-    return lastZooKeeper;
-  },
-
-  addZookeepers: function () {
-    /*
-     *Logic: If ZooKeeper service is selected then there can be
-     * minimum 1 ZooKeeper master in total, and
-     * maximum 1 ZooKeeper on every host
-     */
-
-    var maxNumZooKeepers = this.get("hosts.length"),
-      currentZooKeepers = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper"),
-      newZookeeper = null,
-      zookeeperHosts = null,
-      suggestedHost = null,
-      i = 0,
-      lastZoo = null;
-    console.log('hosts legth is: ' + maxNumZooKeepers);
-    //work only if the Zookeeper service is selected in previous step
-    if (!this.get("selectedServices").mapProperty("service_name").contains("ZOOKEEPER")) {
-      console.log('ALERT: Zookeeper service was not selected');
-      return false;
-    }
-
-    if (currentZooKeepers.get("length") < maxNumZooKeepers) {
-      console.log('currentZookeeper length less than maximum. Its: ' + currentZooKeepers.get("length"))
-      currentZooKeepers.set("lastObject.showAddControl", false);
-      if (currentZooKeepers.get("length") >= 1) {
-        currentZooKeepers.set("lastObject.showRemoveControl", true);
-      }
-
-      //create a new zookeeper based on an existing one
-      newZookeeper = Ember.Object.create({});
-      lastZoo = currentZooKeepers.get("lastObject");
-      newZookeeper.set("component_name", lastZoo.get("component_name"));
-      newZookeeper.set("selectedHost", lastZoo.get("selectedHost"));
-      newZookeeper.set("availableHosts", this.getAvailableHosts("ZooKeeper"));
-
-      if (currentZooKeepers.get("length") === (maxNumZooKeepers - 1)) {
-        newZookeeper.set("showAddControl", false);
-      } else {
-        newZookeeper.set("showAddControl", true);
-      }
-      newZookeeper.set("showRemoveControl", true);
-
-      //get recommended host for the new Zookeeper server
-      zookeeperHosts = currentZooKeepers.mapProperty("selectedHost").uniq();
-
-      for (i = 0; i < this.get("hosts.length"); i++) {
-        if (!(zookeeperHosts.contains(this.get("hosts")[i].get("host_name")))) {
-          suggestedHost = this.get("hosts")[i].get("host_name");
-          break;
-        }
-      }
-
-      newZookeeper.set("selectedHost", suggestedHost);
-      newZookeeper.set("zId", (currentZooKeepers.get("lastObject.zId") + 1));
-      this.set('zId', parseInt(this.get('zId')) + 1);
-
-      this.get("selectedServicesMasters").pushObject(newZookeeper);
-
-      this.rebalanceZookeeperHosts();
-
-      return true;
-    }
-    return false;//if no more zookeepers can be added
-  },
-
-  removeZookeepers: function (zId) {
-    var currentZooKeepers;
-
-    //work only if the Zookeeper service is selected in previous step
-    if (!this.get("selectedServices").mapProperty("service_name").contains("ZOOKEEPER")) {
-      return false;
-    }
-
-    currentZooKeepers = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper");
-
-    if (currentZooKeepers.get("length") > 1) {
-      this.get("selectedServicesMasters").removeAt(this.get("selectedServicesMasters").indexOf(this.get("selectedServicesMasters").findProperty("zId", zId)));
-
-      currentZooKeepers = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper");
-      if (currentZooKeepers.get("length") < this.get("hosts.length")) {
-        currentZooKeepers.set("lastObject.showAddControl", true);
-      }
-
-      if (currentZooKeepers.get("length") === 1) {
-        currentZooKeepers.set("lastObject.showRemoveControl", false);
-      }
-      this.set('zId', parseInt(this.get('zId')) - 1);
-      this.rebalanceZookeeperHosts();
-
-      return true;
-    }
-
-    return false;
-
-  },
-
-  rebalanceZookeeperHosts: function () {
-    //for a zookeeper update the available hosts for the other zookeepers
-
-    var currentZooKeepers = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper"),
-      zooHosts = currentZooKeepers.mapProperty("selectedHost"),
-      availableZooHosts = [],
-      preparedAvailableHosts = null;
-
-    //get all hosts available for zookeepers
-    this.get("hosts").forEach(function (item) {
-      if (!zooHosts.contains(item.get("host_name"))) {
-        availableZooHosts.pushObject(item);
-      }
-    }, this);
-
-    currentZooKeepers.forEach(function (item) {
-      preparedAvailableHosts = availableZooHosts.slice(0);
-      preparedAvailableHosts.pushObject(this.get("hosts").findProperty("host_name", item.get("selectedHost")))
-      preparedAvailableHosts.sort(this.sortHostsByConfig, this);
-      item.set("availableHosts", preparedAvailableHosts);
-    }, this);
-
-  },
-
-  sortHostsByConfig: function (a, b) {
-    //currently handling only total memory on the host
-    if (a.memory < b.memory) {
-      return 1;
-    }
-    else {
-      return -1;
-    }
-  },
-
-  sortHostsByName: function (a, b) {
-    if (a.host_name > b.host_name) {
-      return 1;
-    }
-    else {
-      return -1;
-    }
-  },
-
-  saveComponentHostsToDb: function () {
-    var obj = this.get('selectedServicesMasters');
-    var masterComponentHosts = [];
-    var inc = 0;
-    var array = [];
-    obj.forEach(function (_component) {
-      var hostArr = [];
-      masterComponentHosts.push({
-        component: _component.component_name,
-        hostName: _component.selectedHost
-      });
-    });
-
-    App.db.setMasterComponentHosts(masterComponentHosts);
-
-  },
-
-  submit: function () {
-    this.saveComponentHostsToDb();
-    App.router.send('next');
-  }
-
+	//properties
+	name: "installerStep5Controller",
+	hosts: [],
+	selectedServices: [],
+	selectedServicesMasters: [],
+	zId: 0,
+	components: require('data/service_components'),
+
+	/*
+	 Below function retrieves host information from local storage
+	 */
+
+	clearStep: function () {
+		this.set('hosts', []);
+		this.set('selectedServices', []);
+		this.set('selectedServicesMasters', []);
+		this.set('zId', 0);
+	},
+
+	loadStep: function () {
+		console.log("TRACE: Loading step5: Assign Masters");
+		this.clearStep();
+		this.renderHostInfo(this.loadHostInfo());
+		this.renderComponents(this.loadComponents(this.loadServices()));
+	},
+
+	loadHostInfo: function () {
+		var hostInfo = [];
+		hostInfo = App.db.getHosts();
+		var hosts = new Ember.Set();
+		for (var index in hostInfo) {
+			hosts.add(hostInfo[index]);
+			console.log("TRACE: host name is: " + hostInfo[index].name);
+		}
+		return hosts.filterProperty('bootStatus', 'success');
+	},
+
+
+	renderHostInfo: function (hostsInfo) {
+
+		//wrap the model data into
+
+		hostsInfo.forEach(function (_host) {
+			var hostObj = Ember.Object.create({
+				host_name: _host.name,
+				cpu: _host.cpu,
+				memory: _host.memory
+			});
+			console.log('pushing ' + hostObj.host_name);
+			hostObj.set("host_info", "" + hostObj.get("host_name") + " ( " + hostObj.get("memory") + "GB" + " " + hostObj.get("cpu") + "cores )");
+			this.get("hosts").pushObject(hostObj);
+		}, this);
+
+
+	},
+
+	loadServices: function () {
+		var serviceInfo = App.db.getService();
+		var services = serviceInfo.filterProperty('isSelected', true).mapProperty('serviceName');
+		services.forEach(function (item) {
+			console.log("TRACE: service name is: " + item);
+			this.get("selectedServices").pushObject(Ember.Object.create({service_name: item}));
+		}, this);
+
+		return services;
+
+	},
+
+	loadComponents: function (services) {
+		var components = new Ember.Set();
+		if (App.db.getMasterComponentHosts() === undefined) {
+			var masterComponents = this.components.filterProperty('isMaster', true);
+			for (var index in services) {
+				var componentInfo = masterComponents.filterProperty('service_name', services[index]);
+				componentInfo.forEach(function (_componentInfo) {
+					console.log("TRACE: master component name is: " + _componentInfo.display_name);
+					var componentObj = {};
+					componentObj.component_name = _componentInfo.display_name;
+					componentObj.selectedHost = this.selectHost(_componentInfo.component_name);   // call the method that plays selectNode algorithm or fetches from server
+					componentObj.availableHosts = [];
+					components.add(componentObj);
+				}, this);
+			}
+		} else {
+			var masterComponentHosts = App.db.getMasterComponentHosts();
+			masterComponentHosts.forEach(function (_masterComponentHost) {
+				var componentObj = {};
+				componentObj.component_name = _masterComponentHost.component;
+				componentObj.selectedHost = _masterComponentHost.hostName;   // call the method that plays selectNode algorithm or fetches from server
+				componentObj.availableHosts = [];
+				components.add(componentObj);
+			}, this);
+		}
+		return components;
+	},
+
+	getMasterComponents: function () {
+		return (this.get('selectedServicesMasters').slice(0));
+	},
+
+	renderComponents: function (masterComponents) {
+		var zookeeperComponent = null, componentObj = null;
+		var services = [];
+		services = this.getMasterComponents();
+		if (services.length) {
+			this.set('selectedServicesMasters', []);
+		}
+
+
+		masterComponents.forEach(function (item) {
+			//add the zookeeper component at the end if exists
+			if (item.component_name === "ZooKeeper") {
+				if (services.length) {
+					services.forEach(function (_service) {
+						this.get('selectedServicesMasters').pushObject(_service);
+					}, this);
+				}
+				this.set('zId', parseInt(this.get('zId')) + 1);
+				zookeeperComponent = Ember.Object.create(item);
+				zookeeperComponent.set('zId', this.get('zId'));
+				zookeeperComponent.set("showRemoveControl", true);
+				zookeeperComponent.set("availableHosts", this.get("hosts").slice(0));
+				this.get("selectedServicesMasters").pushObject(Ember.Object.create(zookeeperComponent));
+
+			} else {
+				componentObj = Ember.Object.create(item);
+				componentObj.set("availableHosts", this.get("hosts").slice(0));
+				this.get("selectedServicesMasters").pushObject(componentObj);
+			}
+		}, this);
+	},
+
+	getKerberosServer: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		if (noOfHosts === 1) {
+			return hosts[0];
+		} else if (noOfHosts < 3) {
+			return hosts[1];
+		} else if (noOfHosts <= 5) {
+			return hosts[1];
+		} else if (noOfHosts <= 30) {
+			return hosts[3];
+		} else {
+			return hosts[5];
+		}
+	},
+
+	getNameNode: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		return hosts[0];
+	},
+
+	getSNameNode: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		if (noOfHosts === 1) {
+			return hosts[0];
+		} else {
+			return hosts[1];
+		}
+	},
+
+	getJobTracker: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		if (noOfHosts === 1) {
+			return hosts[0];
+		} else if (noOfHosts < 3) {
+			return hosts[1];
+		} else if (noOfHosts <= 5) {
+			return hosts[1];
+		} else if (noOfHosts <= 30) {
+			return hosts[1];
+		} else {
+			return hosts[2];
+		}
+	},
+
+	getHBaseMaster: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		if (noOfHosts === 1) {
+			return hosts[0];
+		} else if (noOfHosts < 3) {
+			return hosts[0];
+		} else if (noOfHosts <= 5) {
+			return hosts[0];
+		} else if (noOfHosts <= 30) {
+			return hosts[2];
+		} else {
+			return hosts[3];
+		}
+	},
+
+	getOozieServer: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		if (noOfHosts === 1) {
+			return hosts[0];
+		} else if (noOfHosts < 3) {
+			return hosts[1];
+		} else if (noOfHosts <= 5) {
+			return hosts[1];
+		} else if (noOfHosts <= 30) {
+			return hosts[2];
+		} else {
+			return hosts[3];
+		}
+	},
+
+	getOozieServer: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		if (noOfHosts === 1) {
+			return hosts[0];
+		} else if (noOfHosts < 3) {
+			return hosts[1];
+		} else if (noOfHosts <= 5) {
+			return hosts[1];
+		} else if (noOfHosts <= 30) {
+			return hosts[2];
+		} else {
+			return hosts[3];
+		}
+	},
+
+	getHiveServer: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		if (noOfHosts === 1) {
+			return hosts[0];
+		} else if (noOfHosts < 3) {
+			return hosts[1];
+		} else if (noOfHosts <= 5) {
+			return hosts[1];
+		} else if (noOfHosts <= 30) {
+			return hosts[2];
+		} else {
+			return hosts[4];
+		}
+	},
+
+	getTempletonServer: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		if (noOfHosts === 1) {
+			return hosts[0];
+		} else if (noOfHosts < 3) {
+			return hosts[1];
+		} else if (noOfHosts <= 5) {
+			return hosts[1];
+		} else if (noOfHosts <= 30) {
+			return hosts[2];
+		} else {
+			return hosts[4];
+		}
+	},
+
+	getZooKeeperServer: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		if (noOfHosts < 3) {
+			return [hosts[0].host_name];
+		} else {
+			return [hosts[0].host_name, hosts[1].host_name, hosts[2].host_name];
+		}
+	},
+
+	getGangliaServer: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		var hostnames = [];
+		var inc = 0;
+		hosts.forEach(function (_hostname) {
+			hostnames[inc] = _hostname.host_name;
+			inc++;
+		});
+		var hostExcAmbari = hostnames.without(location.hostname);
+		if (hostExcAmbari !== null || hostExcAmbari !== undefined || hostExcAmbari.length !== 0) {
+			return hostExcAmbari[0];
+		} else {
+			return hostnames[0];
+		}
+	},
+
+	getNagiosServer: function (noOfHosts) {
+		var hosts = this.get('hosts');
+		var hostnames = [];
+		var inc = 0;
+		hosts.forEach(function (_hostname) {
+			hostnames[inc] = _hostname.host_name;
+			inc++;
+		});
+		var hostExcAmbari = hostnames.without(location.hostname);
+		if (hostExcAmbari !== null || hostExcAmbari !== undefined || hostExcAmbari.length !== 0) {
+			return hostExcAmbari[0];
+		} else {
+			return hostnames[0];
+		}
+	},
+
+
+	selectHost: function (componentName) {
+		var noOfHosts = this.get('hosts').length;
+		if (componentName === 'KERBEROS_SERVER') {
+			return this.getKerberosServer(noOfHosts).host_name;
+		} else if (componentName === 'NAMENODE') {
+			return this.getNameNode(noOfHosts).host_name;
+		} else if (componentName === 'SNAMENODE') {
+			return this.getSNameNode(noOfHosts).host_name;
+		} else if (componentName === 'JOBTRACKER') {
+			return this.getJobTracker(noOfHosts).host_name;
+		} else if (componentName === 'HBASE_MASTER') {
+			return this.getHBaseMaster(noOfHosts).host_name;
+		} else if (componentName === 'OOZIE_SERVER') {
+			return this.getOozieServer(noOfHosts).host_name;
+		} else if (componentName === 'HIVE_SERVER') {
+			return this.getHiveServer(noOfHosts).host_name;
+		} else if (componentName === 'TEMPLETON_SERVER') {
+			return this.getTempletonServer(noOfHosts).host_name;
+		} else if (componentName === 'ZOOKEEPER_SERVER') {
+			var zhosts = this.getZooKeeperServer(noOfHosts);
+			var extraHosts = zhosts.slice(0, zhosts.length - 1);
+			var zooKeeperHosts = new Ember.Set();
+			extraHosts.forEach(function (_host) {
+				var zooKeeperHost = {};
+				zooKeeperHost.component_name = 'ZooKeeper';
+				zooKeeperHost.selectedHost = _host;
+				zooKeeperHost.availableHosts = [];
+				zooKeeperHosts.add(zooKeeperHost);
+			});
+			this.renderComponents(zooKeeperHosts);
+			var lastHost = zhosts[zhosts.length - 1];
+			return lastHost;
+		} else if (componentName === 'GANGLIA_MONITOR_SERVER') {
+			return this.getGangliaServer(noOfHosts);
+		} else if (componentName === 'NAGIOS_SERVER') {
+			return this.getNagiosServer(noOfHosts);
+		}
+	},
+
+
+	masterHostMapping: function () {
+		var mapping = [], mappingObject, self = this, mappedHosts, hostObj, hostInfo;
+		//get the unique assigned hosts and find the master services assigned to them
+
+		mappedHosts = this.get("selectedServicesMasters").mapProperty("selectedHost").uniq();
+
+		mappedHosts.forEach(function (item) {
+			hostObj = self.get("hosts").findProperty("host_name", item);
+			console.log("Name of the host is: " + hostObj.host_name);
+			hostInfo = " ( " + hostObj.get("memory") + "GB" + " " + hostObj.get("cpu") + "cores )";
+
+			mappingObject = Ember.Object.create({
+				host_name: item,
+				hostInfo: hostInfo,
+				masterServices: self.get("selectedServicesMasters").filterProperty("selectedHost", item)
+			});
+
+			mapping.pushObject(mappingObject);
+		}, this);
+
+		mapping.sort(this.sortHostsByName);
+
+		return mapping;
+
+	}.property("selectedServicesMasters.@each.selectedHost"),
+
+	remainingHosts: function () {
+		return (this.get("hosts.length") - this.get("masterHostMapping.length"));
+	}.property("selectedServicesMasters.@each.selectedHost"),
+
+	hasZookeeper: function () {
+		return this.selectedServices.findProperty("service_name", "ZooKeeper");
+	}.property("selectedServices"),
+
+	//methods
+	getAvailableHosts: function (componentName) {
+		var assignableHosts = [],
+			zookeeperHosts = null;
+
+		if (componentName === "ZooKeeper") {
+			zookeeperHosts = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper").mapProperty("selectedHost").uniq();
+			this.get("hosts").forEach(function (item) {
+				if (!(zookeeperHosts.contains(item.get("host_name")))) {
+					assignableHosts.pushObject(item);
+				}
+			}, this);
+			return assignableHosts;
+
+		} else {
+			return this.get("hosts");
+		}
+	},
+	/*
+
+	 assignHostToMaster: function (masterService, selectedHost, zId) {
+	 if (selectedHost && masterService) {
+	 if ((masterService === "ZooKeeper") && zId) {
+	 this.get('selectedServicesMasters').findProperty("zId", zId).set("selectedHost", selectedHost);
+	 this.rebalanceZookeeperHosts();
+	 }
+	 else {
+	 this.get('selectedServicesMasters').findProperty("component_name", masterService).set("selectedHost", selectedHost);
+	 }
+
+	 }
+	 },
+	 */
+
+	lastZooKeeper: function () {
+		var currentZooKeepers = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper");
+		if (currentZooKeepers) {
+			var lastZooKeeper = currentZooKeepers.get("lastObject");
+			return lastZooKeeper;
+		} else {
+			return null;
+		}
+	},
+
+	addZookeepers: function () {
+		/*
+		 *Logic: If ZooKeeper service is selected then there can be
+		 * minimum 1 ZooKeeper master in total, and
+		 * maximum 1 ZooKeeper on every host
+		 */
+
+		var maxNumZooKeepers = this.get("hosts.length"),
+			currentZooKeepers = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper"),
+			newZookeeper = null,
+			zookeeperHosts = null,
+			suggestedHost = null,
+			i = 0,
+			lastZoo = null;
+		console.log('hosts legth is: ' + maxNumZooKeepers);
+		//work only if the Zookeeper service is selected in previous step
+		if (!this.get("selectedServices").mapProperty("service_name").contains("ZOOKEEPER")) {
+			console.log('ALERT: Zookeeper service was not selected');
+			return false;
+		}
+
+		if (currentZooKeepers.get("length") < maxNumZooKeepers) {
+			console.log('currentZookeeper length less than maximum. Its: ' + currentZooKeepers.get("length"))
+			currentZooKeepers.set("lastObject.showAddControl", false);
+			if (currentZooKeepers.get("length") >= 1) {
+				currentZooKeepers.set("lastObject.showRemoveControl", true);
+			}
+
+			//create a new zookeeper based on an existing one
+			newZookeeper = Ember.Object.create({});
+			lastZoo = currentZooKeepers.get("lastObject");
+			newZookeeper.set("component_name", lastZoo.get("component_name"));
+			newZookeeper.set("selectedHost", lastZoo.get("selectedHost"));
+			newZookeeper.set("availableHosts", this.getAvailableHosts("ZooKeeper"));
+
+			if (currentZooKeepers.get("length") === (maxNumZooKeepers - 1)) {
+				newZookeeper.set("showAddControl", false);
+			} else {
+				newZookeeper.set("showAddControl", true);
+			}
+			newZookeeper.set("showRemoveControl", true);
+
+			//get recommended host for the new Zookeeper server
+			zookeeperHosts = currentZooKeepers.mapProperty("selectedHost").uniq();
+
+			for (i = 0; i < this.get("hosts.length"); i++) {
+				if (!(zookeeperHosts.contains(this.get("hosts")[i].get("host_name")))) {
+					suggestedHost = this.get("hosts")[i].get("host_name");
+					break;
+				}
+			}
+
+			newZookeeper.set("selectedHost", suggestedHost);
+			newZookeeper.set("zId", (currentZooKeepers.get("lastObject.zId") + 1));
+			this.set('zId', parseInt(this.get('zId')) + 1);
+
+			this.get("selectedServicesMasters").pushObject(newZookeeper);
+
+			this.rebalanceZookeeperHosts();
+
+			return true;
+		}
+		return false;//if no more zookeepers can be added
+	},
+
+	removeZookeepers: function (zId) {
+		var currentZooKeepers;
+
+		//work only if the Zookeeper service is selected in previous step
+		if (!this.get("selectedServices").mapProperty("service_name").contains("ZOOKEEPER")) {
+			return false;
+		}
+
+		currentZooKeepers = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper");
+
+		if (currentZooKeepers.get("length") > 1) {
+			this.get("selectedServicesMasters").removeAt(this.get("selectedServicesMasters").indexOf(this.get("selectedServicesMasters").findProperty("zId", zId)));
+
+			currentZooKeepers = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper");
+			if (currentZooKeepers.get("length") < this.get("hosts.length")) {
+				currentZooKeepers.set("lastObject.showAddControl", true);
+			}
+
+			if (currentZooKeepers.get("length") === 1) {
+				currentZooKeepers.set("lastObject.showRemoveControl", false);
+			}
+			this.set('zId', parseInt(this.get('zId')) - 1);
+			this.rebalanceZookeeperHosts();
+
+			return true;
+		}
+
+		return false;
+
+	},
+
+	rebalanceZookeeperHosts: function () {
+		//for a zookeeper update the available hosts for the other zookeepers
+
+		var currentZooKeepers = this.get("selectedServicesMasters").filterProperty("component_name", "ZooKeeper"),
+			zooHosts = currentZooKeepers.mapProperty("selectedHost"),
+			availableZooHosts = [],
+			preparedAvailableHosts = null;
+
+		//get all hosts available for zookeepers
+		this.get("hosts").forEach(function (item) {
+			if (!zooHosts.contains(item.get("host_name"))) {
+				availableZooHosts.pushObject(item);
+			}
+		}, this);
+
+		currentZooKeepers.forEach(function (item) {
+			preparedAvailableHosts = availableZooHosts.slice(0);
+			preparedAvailableHosts.pushObject(this.get("hosts").findProperty("host_name", item.get("selectedHost")))
+			preparedAvailableHosts.sort(this.sortHostsByConfig, this);
+			item.set("availableHosts", preparedAvailableHosts);
+		}, this);
+
+	},
+
+	sortHostsByConfig: function (a, b) {
+		//currently handling only total memory on the host
+		if (a.memory < b.memory) {
+			return 1;
+		}
+		else {
+			return -1;
+		}
+	},
+
+	sortHostsByName: function (a, b) {
+		if (a.host_name > b.host_name) {
+			return 1;
+		}
+		else {
+			return -1;
+		}
+	},
+
+	saveComponentHostsToDb: function () {
+		var obj = this.get('selectedServicesMasters');
+		var masterComponentHosts = [];
+		var inc = 0;
+		var array = [];
+		obj.forEach(function (_component) {
+			var hostArr = [];
+			masterComponentHosts.push({
+				component: _component.component_name,
+				hostName: _component.selectedHost
+			});
+		});
+
+		App.db.setMasterComponentHosts(masterComponentHosts);
+
+	},
+
+	submit: function () {
+		this.saveComponentHostsToDb();
+		App.router.send('next');
+	}
 
 });
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step6_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step6_controller.js?rev=1399500&r1=1399499&r2=1399500&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step6_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step6_controller.js Thu Oct 18 00:59:57 2012
@@ -34,223 +34,237 @@ var db = require('utils/db');
  */
 App.InstallerStep6Controller = Em.Controller.extend({
 
-  hosts: [],
-  // TODO: hook up with user host selection
-  rawHosts: [],
-  selectedServiceNames: null,
-  masterComponentHosts: require('data/mock/master_component_hosts'),
-  showHbase: false,
-
-  hasMasterComponents: function (hostname) {
-    var hasMaster = false;
-    var masterComponentHosts = db.getMasterComponentHosts();
-    return masterComponentHosts.someProperty('hostName', hostname);
-  },
-
-
-  isAllDataNodes: function () {
-    return this.get('hosts').everyProperty('isDataNode', true);
-  }.property('hosts.@each.isDataNode'),
-
-  isAllTaskTrackers: function () {
-    return this.get('hosts').everyProperty('isTaskTracker', true);
-  }.property('hosts.@each.isTaskTracker'),
-
-  isAllRegionServers: function () {
-    return this.get('hosts').everyProperty('isRegionServer', true);
-  }.property('hosts.@each.isRegionServer'),
-
-  isNoDataNodes: function () {
-    return this.get('hosts').everyProperty('isDataNode', false);
-  }.property('hosts.@each.isDataNode'),
-
-  isNoTaskTrackers: function () {
-    return this.get('hosts').everyProperty('isTaskTracker', false);
-  }.property('hosts.@each.isTaskTracker'),
-
-  isNoRegionServers: function () {
-    return this.get('hosts').everyProperty('isRegionServer', false);
-  }.property('hosts.@each.isRegionServer'),
-
-  isHbaseSelected: function () {
-    var services = db.getSelectedServiceNames();
-    console.log('isHbase selected is: ' + services.contains('HBASE'));
-    return services.contains('HBASE');
-  },
-
-
-  selectAllDataNodes: function () {
-    this.get('hosts').setEach('isDataNode', true);
-  },
-
-  selectAllTaskTrackers: function () {
-    this.get('hosts').setEach('isTaskTracker', true);
-  },
-
-  selectAllRegionServers: function () {
-    this.get('hosts').setEach('isRegionServer', true);
-  },
-
-  deselectAllDataNodes: function () {
-    this.get('hosts').setEach('isDataNode', false);
-  },
-
-  deselectAllTaskTrackers: function () {
-    this.get('hosts').setEach('isTaskTracker', false);
-  },
-
-  deselectAllRegionServers: function () {
-    this.get('hosts').setEach('isRegionServer', false);
-  },
-
-
-  clearStep: function () {
-    this.set('hosts', []);
-  },
-
-  loadStep: function () {
-    console.log("TRACE: Loading step6: Assign Slaves");
-    this.clearStep();
-    this.set('showHbase', this.isHbaseSelected());
-    this.setSlaveHost(this.getSlaveHosts());
-  },
-
-  navigateStep: function () {
-    this.loadStep();
-  },
-
-  getHostNames: function () {
-    var hostInfo = db.getHosts();
-    var hostNames = [];
-    for (var index in hostInfo) {
-      if (hostInfo[index].bootStatus === 'success')
-        hostNames.push(hostInfo[index].name);
-    }
-    return hostNames;
-  },
-
-  getSlaveHosts: function () {
-    var hostObjs = new Ember.Set();
-    var allHosts = this.getHostNames();
-    var slaveHosts = App.db.getSlaveComponentHosts();
-    if (slaveHosts === undefined || slaveHosts === null) {
-      allHosts.forEach(function (_hostname) {
-        var hostObj = {};
-        hostObj.hostname = _hostname;
-        hostObj.isDataNode = !this.hasMasterComponents(_hostname);
-        hostObj.isTaskTracker = !this.hasMasterComponents(_hostname);
-        hostObj.isRegionServer = !this.hasMasterComponents(_hostname);
-        hostObjs.add(hostObj);
-      }, this);
-      return hostObjs;
-    } else {
-      allHosts.forEach(function (_hostName) {
-        hostObjs.add({
-          hostname: _hostName
-        });
-      });
-      var datanodes = slaveHosts.findProperty('componentName', 'DataNode');
-      datanodes.hosts.forEach(function (_datanode) {
-        var datanode = hostObjs.findProperty('hostname', _datanode.hostname);
-        if (datanode !== null) {
-          datanode.isDataNode = true;
-        }
-      });
-      var taskTrackers = slaveHosts.findProperty('componentName', 'TaskTracker');
-      taskTrackers.hosts.forEach(function (_taskTracker) {
-        var taskTracker = hostObjs.findProperty('hostname', _taskTracker.hostname);
-        if (taskTracker !== null) {
-          taskTracker.isTaskTracker = true;
-        }
-      });
-      if (this.isHbaseSelected()) {
-        var regionServers = slaveHosts.findProperty('componentName', 'RegionServer');
-        regionServers.hosts.forEach(function (_regionServer) {
-          var regionServer = hostObjs.findProperty('hostname', _regionServer.hostname);
-          if (regionServer !== null) {
-            regionServer.isRegionServer = true;
-          }
-        });
-      }
-      return hostObjs;
-    }
-  },
-
-  setSlaveHost: function (hostObj) {
-    hostObj.forEach(function (_hostObj) {
-      this.get('hosts').pushObject(Ember.Object.create(_hostObj));
-    }, this);
-  },
-
-  loadSlaveHost: function (hostNames) {
-
-    hostNames.forEach(function (_hostName) {
-      this.get('hosts').pushObject(Ember.Object.create({
-        hostname: _hostName,
-        isDataNode: !this.hasMasterComponents(_hostName),
-        isTaskTracker: !this.hasMasterComponents(_hostName),
-        isRegionServer: !this.hasMasterComponents(_hostName)
-      }));
-    }, this);
-  },
-
-
-  validate: function () {
-    return !(this.get('isNoDataNodes') || this.get('isNoTaskTrackers') || this.get('isNoRegionServers'));
-  },
-
-  submit: function () {
-    if (!this.validate()) {
-      this.set('errorMessage', Ember.I18n.t('installer.step6.error.mustSelectOne'));
-      return;
-    }
-    App.db.setHostSlaveComponents(this.get('host'));
-
-    var dataNodeHosts = [];
-    var taskTrackerHosts = [];
-    var regionServerHosts = [];
-
-    this.get('hosts').forEach(function (host) {
-      if (host.get('isDataNode')) {
-        dataNodeHosts.push({
-          hostname: host.hostname,
-          group: 'Default'
-        });
-      }
-      if (host.get('isTaskTracker')) {
-        taskTrackerHosts.push({
-          hostname: host.hostname,
-          group: 'Default'
-        });
-      }
-      if (this.isHbaseSelected() && host.get('isRegionServer')) {
-        regionServerHosts.push({
-          hostname: host.hostname,
-          group: 'Default'
-        });
-      }
-    }, this);
-
-    var slaveComponentHosts = [];
-    slaveComponentHosts.push({
-      componentName: 'DataNode',
-      hosts: dataNodeHosts
-    });
-    slaveComponentHosts.push({
-      componentName: 'TaskTracker',
-      hosts: taskTrackerHosts
-    });
-    if (this.isHbaseSelected()) {
-      slaveComponentHosts.push({
-        componentName: 'RegionServer',
-        hosts: regionServerHosts
-      });
-    }
+	hosts: [],
+	// TODO: hook up with user host selection
+	rawHosts: [],
+	selectedServiceNames: [],
+	masterComponentHosts: require('data/mock/master_component_hosts'),
+	showHbase: false,
+	showTaskTracker: false,
+
+
+	hasMasterComponents: function (hostname) {
+		var hasMaster = false;
+		var masterComponentHosts = db.getMasterComponentHosts();
+		return masterComponentHosts.someProperty('hostName', hostname);
+	},
+
+
+	isAllDataNodes: function () {
+		return this.get('hosts').everyProperty('isDataNode', true);
+	}.property('hosts.@each.isDataNode'),
+
+	isAllTaskTrackers: function () {
+		return this.get('hosts').everyProperty('isTaskTracker', true);
+	}.property('hosts.@each.isTaskTracker'),
+
+	isAllRegionServers: function () {
+		return this.get('hosts').everyProperty('isRegionServer', true);
+	}.property('hosts.@each.isRegionServer'),
+
+	isNoDataNodes: function () {
+		return this.get('hosts').everyProperty('isDataNode', false);
+	}.property('hosts.@each.isDataNode'),
+
+	isNoTaskTrackers: function () {
+		return this.get('hosts').everyProperty('isTaskTracker', false);
+	}.property('hosts.@each.isTaskTracker'),
+
+	isNoRegionServers: function () {
+		return this.get('hosts').everyProperty('isRegionServer', false);
+	}.property('hosts.@each.isRegionServer'),
+
+	isHbaseSelected: function () {
+		var services = db.getSelectedServiceNames();
+		return this.get('selectedServiceNames').contains('HBASE');
+	},
+
+	isMrSelected: function () {
+		return this.get('selectedServiceNames').contains('MAPREDUCE');
+	}.property('selectedServiceNames'),
+
+	selectAllDataNodes: function () {
+		this.get('hosts').setEach('isDataNode', true);
+	},
+
+	selectAllTaskTrackers: function () {
+		this.get('hosts').setEach('isTaskTracker', true);
+	},
+
+	selectAllRegionServers: function () {
+		this.get('hosts').setEach('isRegionServer', true);
+	},
+
+	deselectAllDataNodes: function () {
+		this.get('hosts').setEach('isDataNode', false);
+	},
+
+	deselectAllTaskTrackers: function () {
+		this.get('hosts').setEach('isTaskTracker', false);
+	},
+
+	deselectAllRegionServers: function () {
+		this.get('hosts').setEach('isRegionServer', false);
+	},
+
+
+	clearStep: function () {
+		this.set('hosts', []);
+		this.set('selectedServiceNames', []);
+	},
+
+	loadStep: function () {
+		console.log("TRACE: Loading step6: Assign Slaves");
+		this.clearStep();
+		this.set('selectedServiceNames',db.getSelectedServiceNames());
+		this.set('showHbase', this.isHbaseSelected());
+		this.set('showTaskTracker', this.get('isMrSelected'));
+		this.setSlaveHost(this.getSlaveHosts());
+	},
+
+	navigateStep: function () {
+		this.loadStep();
+	},
+
+	getHostNames: function () {
+		var hostInfo = db.getHosts();
+		var hostNames = [];
+		for (var index in hostInfo) {
+			if (hostInfo[index].bootStatus === 'success')
+				hostNames.push(hostInfo[index].name);
+		}
+		return hostNames;
+	},
+
+	getSlaveHosts: function () {
+		var hostObjs = new Ember.Set();
+		var allHosts = this.getHostNames();
+		var slaveHosts = App.db.getSlaveComponentHosts();
+		if (slaveHosts === undefined || slaveHosts === null) {
+			allHosts.forEach(function (_hostname) {
+				var hostObj = {};
+				hostObj.hostname = _hostname;
+				hostObj.isDataNode = !this.hasMasterComponents(_hostname);
+				hostObj.isTaskTracker = !this.hasMasterComponents(_hostname);
+				hostObj.isRegionServer = !this.hasMasterComponents(_hostname);
+				hostObjs.add(hostObj);
+			}, this);
+			return hostObjs;
+		} else {
+			allHosts.forEach(function (_hostName) {
+				hostObjs.add({
+					hostname: _hostName
+				});
+			});
+			var datanodes = slaveHosts.findProperty('componentName', 'DATANODE');
+			datanodes.hosts.forEach(function (_datanode) {
+				var datanode = hostObjs.findProperty('hostname', _datanode.hostname);
+				if (datanode !== null) {
+					datanode.isDataNode = true;
+				}
+			});
+			if (this.get('isMrSelected')) {
+				var taskTrackers = slaveHosts.findProperty('componentName', 'TASKTRACKER');
+				taskTrackers.hosts.forEach(function (_taskTracker) {
+					var taskTracker = hostObjs.findProperty('hostname', _taskTracker.hostname);
+					if (taskTracker !== null) {
+						taskTracker.isTaskTracker = true;
+					}
+				});
+			}
+			if (this.isHbaseSelected()) {
+				var regionServers = slaveHosts.findProperty('componentName', 'HBASE_REGIONSERVER');
+				regionServers.hosts.forEach(function (_regionServer) {
+					var regionServer = hostObjs.findProperty('hostname', _regionServer.hostname);
+					if (regionServer !== null) {
+						regionServer.isRegionServer = true;
+					}
+				});
+			}
+			return hostObjs;
+		}
+	},
+
+	setSlaveHost: function (hostObj) {
+		hostObj.forEach(function (_hostObj) {
+			this.get('hosts').pushObject(Ember.Object.create(_hostObj));
+		}, this);
+	},
+
+	loadSlaveHost: function (hostNames) {
+
+		hostNames.forEach(function (_hostName) {
+			this.get('hosts').pushObject(Ember.Object.create({
+				hostname: _hostName,
+				isDataNode: !this.hasMasterComponents(_hostName),
+				isTaskTracker: !this.hasMasterComponents(_hostName),
+				isRegionServer: !this.hasMasterComponents(_hostName)
+			}));
+		}, this);
+	},
+
+
+	validate: function () {
+		return !(this.get('isNoDataNodes') || this.get('isNoTaskTrackers') || this.get('isNoRegionServers'));
+	},
+
+	submit: function () {
+		if (!this.validate()) {
+			this.set('errorMessage', Ember.I18n.t('installer.step6.error.mustSelectOne'));
+			return;
+		}
+		App.db.setHostSlaveComponents(this.get('host'));
+
+		var dataNodeHosts = [];
+		var taskTrackerHosts = [];
+		var regionServerHosts = [];
+
+		this.get('hosts').forEach(function (host) {
+			if (host.get('isDataNode')) {
+				dataNodeHosts.push({
+					hostname: host.hostname,
+					group: 'Default'
+				});
+			}
+			if (this.get('isMrSelected') && host.get('isRegionServer')) {
+				taskTrackerHosts.push({
+					hostname: host.hostname,
+					group: 'Default'
+				});
+			}
+			if (this.isHbaseSelected() && host.get('isRegionServer')) {
+				regionServerHosts.push({
+					hostname: host.hostname,
+					group: 'Default'
+				});
+			}
+		}, this);
+
+		var slaveComponentHosts = [];
+		slaveComponentHosts.push({
+			componentName: 'DATANODE',
+			displayName: 'DataNode',
+			hosts: dataNodeHosts
+		});
+		if (this.get('isMrSelected')) {
+			slaveComponentHosts.push({
+				componentName: 'TASKTRACKER',
+				displayName: 'TaskTracker',
+				hosts: taskTrackerHosts
+			});
+		}
+		if (this.isHbaseSelected()) {
+			slaveComponentHosts.push({
+				componentName: 'HBASE_REGIONSERVER',
+				displayName: 'RegionServer',
+				hosts: regionServerHosts
+			});
+		}
 
-    App.db.setSlaveComponentHosts(slaveComponentHosts);
+		App.db.setSlaveComponentHosts(slaveComponentHosts);
 
-    App.router.send('next');
+		App.router.send('next');
 
-  }
+	}
 })
 ;
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js?rev=1399500&r1=1399499&r2=1399500&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js Thu Oct 18 00:59:57 2012
@@ -190,11 +190,11 @@ App.SlaveComponentGroupsController = Emb
   selectedComponentName: function () {
     switch (App.router.get('installerStep7Controller.selectedService.serviceName')) {
       case 'HDFS':
-        return 'DataNode';
+        return 'DATANODE';
       case 'MAPREDUCE':
-        return 'TaskTracker';
+        return 'TASKTRACKER';
       case 'HBASE':
-        return 'RegionServer';
+        return 'HBASE_REGIONSERVER';
       default:
         return null;
     }

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step8_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step8_controller.js?rev=1399500&r1=1399499&r2=1399500&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step8_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step8_controller.js Thu Oct 18 00:59:57 2012
@@ -19,41 +19,224 @@
 var App = require('app');
 
 App.InstallerStep8Controller = Em.ArrayController.extend({
-  name: 'installerStep8Controller',
-  contentBinding: Ember.Binding.oneWay('App.router.installerStep7Controller.content'),
-
-
-  clearStep: function () {
-    this.clear();
-  },
-
-  loadStep: function () {
-    console.log("TRACE: Loading step8: Review Page")
-    App.router.get('installerStep7Controller').loadStep();
-    this.doConfigsUneditable();
-  },
-
-  doConfigsUneditable: function () {
-    this.content.forEach(function (_service) {
-      _service.get('configs').forEach(function (_serviceConfig) {
-        console.log('value of isEditable before for: '+ _serviceConfig.name);
-        console.log('value of isEditable before: '+ _serviceConfig.isEditable);
-        console.log('value of displayType before: '+ _serviceConfig.displayType);
-      _serviceConfig.set('isEditable',false);
-        _serviceConfig.set('displayType','string');
-        console.log('value of isEditable after for: '+ _serviceConfig.name);
-        console.log('value of isEditable after: '+ _serviceConfig.isEditable);
-        console.log('value of displayType after: '+ _serviceConfig.displayType);
-      }, this);
-    }, this);
-  },
-
-  navigateStep: function () {
-    if (App.router.get('isFwdNavigation') === true) {
-      this.loadStep();
-    }
-  }
-
-});
-
-
+	name: 'installerStep8Controller',
+	rawContent: require('data/review_configs'),
+	content: [],
+	services: [],
+
+	clearStep: function () {
+		this.clear();
+		this.services.clear();
+	},
+
+	loadStep: function () {
+		console.log("TRACE: Loading step8: Review Page");
+		this.clearStep();
+		var configObj = new Ember.Set();
+		this.loadClusterName();
+		this.loadHosts();
+		this.loadServices();
+		// this.doConfigsUneditable();
+	},
+
+	loadClusterName: function () {
+		var obj = {};
+		var cluster = this.rawContent.findProperty('config_name', 'cluster');
+		cluster.config_value = App.db.getClusterName();
+		this.pushObject(Ember.Object.create(cluster));
+	},
+
+	loadHosts: function () {
+		var masterHosts = App.db.getMasterComponentHosts().mapProperty('hostName').uniq();
+		var slaveHosts = App.db.getSlaveComponentHosts();
+		var hostObj = [];
+		slaveHosts.forEach(function (_hosts) {
+			hostObj = hostObj.concat(_hosts.hosts);
+		}, this);
+		slaveHosts = hostObj.mapProperty('hostname').uniq();
+		console.log('The value of slaveHosts is: ' + slaveHosts);
+		var totalHosts = masterHosts.concat(slaveHosts).uniq().length;
+		var totalHostsObj = this.rawContent.findProperty('config_name', 'hosts');
+		totalHostsObj.config_value = totalHosts;
+		this.pushObject(Ember.Object.create(totalHostsObj));
+	},
+
+	loadServices: function () {
+		this.set('services', App.db.getSelectedServiceNames());
+	},
+
+	submit: function () {
+		this.createCluster();
+		this.createSelectedServices();
+		this.createComponents();
+		this.createHostComponents();
+		App.router.send('next');
+
+	},
+
+	createCluster: function () {
+		var self = this;
+		var clusterName = this.findProperty('config_name', 'cluster').config_value;
+		var url = '/api/clusters/' + clusterName;
+		$.ajax({
+			type: 'PUT',
+			url: url,
+			async: false,
+			//accepts: 'text',
+			dataType: 'text',
+			timeout: 5000,
+			success: function (data) {
+				var jsonData = jQuery.parseJSON(data);
+				console.log("TRACE: STep8 -> In success function for createCluster call");
+				console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+
+			},
+
+			error: function (request, ajaxOptions, error) {
+				console.log('Step8: In Error ');
+				console.log('Step8: Error message is: ' + request.responseText);
+			},
+
+			statusCode: require('data/statusCodes')
+		});
+
+	},
+
+	createSelectedServices: function () {
+		var services = App.db.getSelectedServiceNames();
+		services.forEach(function (_service) {
+			this.createService(_service);
+		}, this);
+	},
+
+	createService: function (service) {
+		var self = this;
+		var clusterName = this.findProperty('config_name', 'cluster').config_value;
+		var url = '/api/clusters/' + clusterName + '/services/' + service;
+		$.ajax({
+			type: 'PUT',
+			url: url,
+			async: false,
+			dataType: 'text',
+			timeout: 5000,
+			success: function (data) {
+				var jsonData = jQuery.parseJSON(data);
+				console.log("TRACE: STep8 -> In success function for the createService call");
+				console.log("TRACE: STep8 -> value of the url is: " + url);
+				console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+
+			},
+
+			error: function (request, ajaxOptions, error) {
+				console.log('Step8: In Error ');
+				console.log('Step8: Error message is: ' + request.responseText);
+			},
+
+			statusCode: require('data/statusCodes')
+		});
+	},
+
+	createComponents: function () {
+		var serviceComponents = require('data/service_components');
+		var services = App.db.getSelectedServiceNames();
+		services.forEach(function (_service) {
+			var components = serviceComponents.filterProperty('service_name', _service);
+			components.forEach(function (_component) {
+				console.log("value of component is: " + _component.component_name);
+				this.createComponent(_service, _component.component_name);
+			}, this);
+		}, this);
+
+	},
+
+	createComponent: function (service, component) {
+		var self = this;
+		var clusterName = this.findProperty('config_name', 'cluster').config_value;
+		var url = '/api/clusters/' + clusterName + '/services/' + service + '/components/' + component;
+		$.ajax({
+			type: 'PUT',
+			url: url,
+			async: false,
+			dataType: 'text',
+			timeout: 5000,
+			success: function (data) {
+				var jsonData = jQuery.parseJSON(data);
+				console.log("TRACE: STep8 -> value of the url is: " + url);
+				console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+
+			},
+
+			error: function (request, ajaxOptions, error) {
+				console.log('Step8: In Error ');
+				console.log('Step8: Error message is: ' + request.responseText);
+			},
+
+			statusCode: require('data/statusCodes')
+		});
+	},
+
+	createHostComponents: function () {
+		var masterHosts = App.db.getMasterComponentHosts();
+		var slaveHosts = App.db.getSlaveComponentHosts();
+		masterHosts.forEach(function (_masterHost) {
+			this.createHostComponent(_masterHost);
+		}, this);
+		slaveHosts.forEach(function (_slaveHosts) {
+			var slaveObj = {};
+			slaveObj.component = _slaveHosts.componentName;
+			_slaveHosts.hosts.forEach(function (_slaveHost) {
+				slaveObj.hostName = _slaveHost.hostname;
+				this.createHostComponent(slaveObj);
+			}, this);
+		}, this);
+	},
+
+	createHostComponent: function (hostComponent) {
+		var self = this;
+		var clusterName = this.findProperty('config_name', 'cluster').config_value;
+		var url = '/api/clusters/' + clusterName + '/hosts/' + hostComponent.hostName + '/host_components/' + hostComponent.component;
+
+		$.ajax({
+			type: 'PUT',
+			url: url,
+			async: false,
+			dataType: 'text',
+			timeout: 5000,
+			success: function (data) {
+				var jsonData = jQuery.parseJSON(data);
+				console.log("TRACE: STep8 -> In success function for the createComponent with new host call");
+				console.log("TRACE: STep8 -> value of the url is: " + url);
+				console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+
+			},
+
+			error: function (request, ajaxOptions, error) {
+				console.log('Step8: In Error ');
+				console.log('Step8: Error message is: ' + request.responseText);
+			},
+
+			statusCode: require('data/statusCodes')
+		});
+	}
+})
+
+
+/*
+ doConfigsUneditable: function () {
+ this.content.forEach(function (_service) {
+ _service.get('configs').forEach(function (_serviceConfig) {
+ console.log('value of isEditable before for: ' + _serviceConfig.name);
+ console.log('value of isEditable before: ' + _serviceConfig.isEditable);
+ console.log('value of displayType before: ' + _serviceConfig.displayType);
+ _serviceConfig.set('isEditable', false);
+ _serviceConfig.set('displayType', 'string');
+ console.log('value of isEditable after for: ' + _serviceConfig.name);
+ console.log('value of isEditable after: ' + _serviceConfig.isEditable);
+ console.log('value of displayType after: ' + _serviceConfig.displayType);
+ }, this);
+ }, this);
+ }
+ + 
+ */
+  
+  

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/data/review_configs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/data/review_configs.js?rev=1399500&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/data/review_configs.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/data/review_configs.js Thu Oct 18 00:59:57 2012
@@ -0,0 +1,139 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+module.exports = new Ember.Set([
+
+  {
+    config_name: 'cluster',
+    display_name: 'Cluster Name',
+    config_value: ''
+  },
+  {
+    config_name: 'hosts',
+    display_name: 'Total Hosts',
+    config_value: ''
+  },
+  {
+    config_name: 'Repo',
+    display_name: 'Local Repository',
+    config_value: ''
+  },
+  {
+    config_name: 'services',
+    display_name: 'Services',
+    config_value: [
+      {
+        service_name: 'HDFS',
+        service_components:  [
+          {
+            display_name: 'NameNode',
+            component_value: ''
+          },
+          {
+            display_name: 'SecondaryNameNode',
+            component_value: ''
+          },
+          {
+            display_name: 'DataNodes',
+            component_value: ''
+          }
+        ]
+      },
+      {
+        service_name: 'MapReduce',
+        service_components:  [
+          {
+            display_name: 'JobTracker',
+            component_value: ''
+          },
+          {
+            display_name: 'TaskTrackers',
+            component_value: ''
+          }
+        ]
+      },
+      {
+        service_name: 'Hive + HCatalog',
+        service_components:  [
+          {
+            display_name: 'Hive Metastore Server',
+            component_value: ''
+          },
+          {
+            display_name: 'Database',
+            component_value: ''
+          }
+        ]
+      },
+      {
+        service_name: 'HBase',
+        service_components:  [
+          {
+            display_name: 'Master',
+            component_value: ''
+          },
+          {
+            display_name: 'Region Servers',
+            component_value: ''
+          }
+        ]
+      },
+      {
+        service_name: 'ZooKeeper',
+        service_components:  [
+          {
+            display_name: 'Servers',
+            component_value: ''
+          }
+        ]
+      },
+      {
+        service_name: 'Oozie',
+        service_components:  [
+          {
+            display_name: 'Server',
+            component_value: ''
+          }
+        ]
+      },
+      {
+        service_name: 'Nagios',
+        service_components:  [
+          {
+            display_name: 'Server',
+            component_value: ''
+          },
+          {
+            display_name: 'Administrator',
+            component_value: ''
+          }
+        ]
+      },
+      {
+        service_name: 'Ganglia',
+        service_components:  [
+          {
+            display_name: 'Server',
+            component_value: ''
+          }
+        ]
+      }
+
+    ]
+  }
+]);
\ No newline at end of file

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/data/statusCodes.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/data/statusCodes.js?rev=1399500&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/data/statusCodes.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/data/statusCodes.js Thu Oct 18 00:59:57 2012
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+module.exports = {
+	200: function () {
+		console.log("Status code 200: Success.");
+	},
+	400: function () {
+		console.log("Error code 400: Bad Request.");
+	},
+	401: function () {
+		console.log("Error code 401: Unauthorized.");
+	},
+	402: function () {
+		console.log("Error code 402: Payment Required.");
+	},
+	403: function () {
+		console.log("Error code 403: Forbidden.");
+	},
+	404: function () {
+		console.log("Error code 404: URI not found.");
+	},
+	500: function () {
+		console.log("Error code 500: Internal Error on server side.");
+	},
+	501: function () {
+		console.log("Error code 501: Not implementd yet.");
+	},
+	502: function () {
+		console.log("Error code 502: Services temporarily overloaded.");
+	},
+	503: function () {
+		console.log("Error code 503: Gateway timeout.");
+	}
+}

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js?rev=1399500&r1=1399499&r2=1399500&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js Thu Oct 18 00:59:57 2012
@@ -67,7 +67,12 @@ module.exports = Em.Route.extend({
       router.setInstallerCurrentStep('1', false);
       router.get('installerController').connectOutlet('installerStep1');
     },
-    next: Em.Router.transitionTo('step2')
+    next: function (router, context) {
+	   // App.db.setAllHostNames(undefined);
+	   // App.db.setInstallType(undefined);
+	   //App.db.setSoftRepo(undefined);
+	    router.transitionTo('step2');
+    }
   }),
 
   step2: Em.Route.extend({

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step6.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step6.hbs?rev=1399500&r1=1399499&r2=1399500&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step6.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step6.hbs Thu Oct 18 00:59:57 2012
@@ -30,9 +30,11 @@
       <th>
         <a href="#" {{bindAttr class="isAllDataNodes:selected:deselected"}} {{action selectAllDataNodes target="controller"}}>all</a> | <a href="#" {{bindAttr class="isNoDataNodes:selected:deselected"}} {{action deselectAllDataNodes target="controller"}}>none</a>
       </th>
+      {{#if controller.isMrSelected}}
       <th>
         <a href="#" {{bindAttr class="isAllTaskTrackers:selected:deselected"}} {{action selectAllTaskTrackers target="controller"}}>all</a> | <a href="#" {{bindAttr class="isNoTaskTrackers:selected:deselected"}} {{action deselectAllTaskTrackers target="controller"}}>none</a>
       </th>
+      {{/if}}
       {{#if showHbase}}
       <th>
         <a href="#" {{bindAttr class="isAllRegionServers:selected:deselected"}} {{action selectAllRegionServers target="controller"}}>all</a> | <a href="#" {{bindAttr class="isNoRegionServers:selected:deselected"}} {{action deselectAllRegionServers target="controller"}}>none</a>
@@ -46,7 +48,9 @@
     <tr>
       <td>{{hostname}}</td>
       <td><label class="checkbox">{{view Ember.Checkbox checkedBinding="isDataNode"}}DataNode</label></td>
+      {{#if controller.isMrSelected}}
       <td><label class="checkbox">{{view Ember.Checkbox checkedBinding="isTaskTracker"}}TaskTracker</label></td>
+      {{/if}}
       {{#if controller.showHbase}}
       <td><label class="checkbox">{{view Ember.Checkbox checkedBinding="isRegionServer"}}RegionServer</label></td>
       {{/if}}

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step8.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step8.hbs?rev=1399500&r1=1399499&r2=1399500&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step8.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step8.hbs Thu Oct 18 00:59:57 2012
@@ -18,10 +18,16 @@
 
 <h2>{{t installer.step8.header}}</h2>
 <div class="alert alert-info">
-  {{t installer.step8.body}}
+    {{t installer.step8.body}}
 </div>
 
+{{#each item in controller}}
+<p>
+    {{item.display_name}} : {{item.config_value}}
+</p>
+{{/each}}
+
 <div class="btn-area">
-  <a class="btn pull-left" {{action back}}>&larr; Back</a>
-  <a class="btn btn-success pull-right" {{action next}}>Next &rarr;</a>
+    <a class="btn pull-left" {{action back}}>&larr; Back</a>
+    <a class="btn btn-success pull-right" {{action submit target="controller"}}>Next &rarr;</a>
 </div>
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step9.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step9.hbs?rev=1399500&r1=1399499&r2=1399500&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step9.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step9.hbs Thu Oct 18 00:59:57 2012
@@ -106,7 +106,7 @@
 
 <div>
   {{#if view.resultMsg}}
-  <p {{bindAttr class="view.resultMsgColor :alert"}}>{{view.resultMsg}}</p>
+  <p {{bindAttr class="view.resultMsgColor"}}>{{view.resultMsg}}</p>
   {{/if}}
   <div class="btn-area">
     <a

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step5_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step5_view.js?rev=1399500&r1=1399499&r2=1399500&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step5_view.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step5_view.js Thu Oct 18 00:59:57 2012
@@ -21,51 +21,51 @@ var App = require('app');
 
 App.InstallerStep5View = Em.View.extend({
 
-  templateName: require('templates/installer/step5'),
+	templateName: require('templates/installer/step5'),
 
-  didInsertElement: function () {
-    var controller = this.get('controller');
-    controller.loadStep();
-    if(controller.lastZooKeeper()){
-      controller.lastZooKeeper().set('showAddControl',true);
-    }
-  }
+	didInsertElement: function () {
+		var controller = this.get('controller');
+		controller.loadStep();
+		if (controller.lastZooKeeper()) {
+			controller.lastZooKeeper().set('showAddControl',true);
+		}
+	}
 
 });
 
 App.SelectHostView = Em.Select.extend({
-  content: [],
-  zId: null,
-  selectedHost: null,
-  serviceName: null,
-
-  change: function () {
-    this.get('controller').assignHostToMaster(this.get("serviceName"), this.get("value"), this.get("zId"));
-  },
-
-  didInsertElement: function () {
-    this.set("value", this.get("selectedHost"));
-  }
+	content: [],
+	zId: null,
+	selectedHost: null,
+	serviceName: null,
+
+	change: function () {
+		this.get('controller').assignHostToMaster(this.get("serviceName"), this.get("value"), this.get("zId"));
+	},
+
+	didInsertElement: function () {
+		this.set("value", this.get("selectedHost"));
+	}
 });
 
 App.AddControlView = Em.View.extend({
-  componentName: null,
-  tagName: "span",
-  classNames: ["badge", "badge-important"],
-  template: Ember.Handlebars.compile('+'),
-
-  click: function (event) {
-    this.get('controller').addZookeepers();
-  }
+	componentName: null,
+	tagName: "span",
+	classNames: ["badge", "badge-important"],
+	template: Ember.Handlebars.compile('+'),
+
+	click: function (event) {
+		this.get('controller').addZookeepers();
+	}
 });
 
 App.RemoveControlView = Em.View.extend({
-  zId: null,
-  tagName: "span",
-  classNames: ["badge", "badge-important"],
-  template: Ember.Handlebars.compile('-'),
-
-  click: function (event) {
-    this.get('controller').removeZookeepers(this.get("zId"));
-  }
+	zId: null,
+	tagName: "span",
+	classNames: ["badge", "badge-important"],
+	template: Ember.Handlebars.compile('-'),
+
+	click: function (event) {
+		this.get('controller').removeZookeepers(this.get("zId"));
+	}
 });