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 03:15:48 UTC

svn commit: r1399502 [1/2] - in /incubator/ambari/branches/AMBARI-666: ./ ambari-web/app/ ambari-web/app/controllers/installer/ ambari-web/app/routes/ ambari-web/app/styles/ ambari-web/app/templates/main/service/info/ ambari-web/app/utils/ ambari-web/a...

Author: yusaku
Date: Thu Oct 18 01:15:47 2012
New Revision: 1399502

URL: http://svn.apache.org/viewvc?rev=1399502&view=rev
Log:
AMBARI-885. Fix miscellaneous issues related to Ambari Web. (yusaku)

Added:
    incubator/ambari/branches/AMBARI-666/ambari-web/vendor/scripts/jquery-ui-1.9.0.custom.js
Modified:
    incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step5_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/data_adapter.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/menu.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.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=1399502&r1=1399501&r2=1399502&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Thu Oct 18 01:15:47 2012
@@ -310,6 +310,8 @@ AMBARI-666 branch (unreleased changes)
 
   BUG FIXES
 
+  AMBARI-885. Fix miscellaneous issues related to Ambari Web. (yusaku)
+
   AMBARI-879. Installer skips Confirm Hosts page of the wizard when testing
   locally without Ambari Server. (yusaku)
 

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=1399502&r1=1399501&r2=1399502&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 01:15:47 2012
@@ -19,577 +19,570 @@
 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");
-		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');
-	}
+  //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/data_adapter.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/data_adapter.js?rev=1399502&r1=1399501&r2=1399502&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/data_adapter.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/data_adapter.js Thu Oct 18 01:15:47 2012
@@ -84,6 +84,13 @@ module.exports = DS.Adapter.create({
     } else {
       return this.fixtureAdapter.createRecord(store, type, record);
     }
+  },
+  updateRecord: function (store, type, record) {
+    if (this.isRestType(type)) {
+      return this.restAdapter.updateRecord(store, type, record);
+    } else {
+      return this.fixtureAdapter.updateRecord(store, type, record);
+    }
   }
 });
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js?rev=1399502&r1=1399501&r2=1399502&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js Thu Oct 18 01:15:47 2012
@@ -192,7 +192,7 @@ Em.I18n.translations = {
   'services.service.start.popup.body': 'Are you sure?',
   'services.service.stop.popup.body': 'Are you sure?',
   'services.service.summary.version': 'Version',
-  'services.service.summary.nameNode': 'NameNode',
+  'services.service.summary.nameNode': 'NameNode Web UI',
   'services.service.summary.nameNodeUptime': 'NameNode Uptime',
   'services.service.summary.nameNodeHeap': 'NameNode Heap',
   'services.service.summary.pendingUpgradeStatus': 'HDFS Pending Upgrade Status',
@@ -202,7 +202,7 @@ Em.I18n.translations = {
   'services.service.summary.blocksTotal': 'Blocks (total)',
   'services.service.summary.blockErrors': 'Block Errors (corr./miss./underrep.)',
   'services.service.summary.totalFiles': 'Total Files + Directory Count',
-  'services.service.summary.jobTracker': 'Job Tracker',
+  'services.service.summary.jobTracker': 'Job Tracker Web UI',
   'services.service.summary.jobTrackerUptime': 'Job Tracker Uptime',
   'services.service.summary.trackersLiveTotal': 'Trackers (live/total)',
   'services.service.summary.trackersBlacklistGraylist': 'Trackers (blacklist/graylist/excl.)',
@@ -213,7 +213,7 @@ Em.I18n.translations = {
   'services.service.summary.currentSlotUtiliReduces': 'Current Slot Utilization: Reduces (occupied/reserved)',
   'services.service.summary.tasksMaps': 'Tasks: Maps (running/waiting)',
   'services.service.summary.tasksReduces': 'Tasks: Reduces (running/waiting)',
-  'services.service.summary.hbaseMaster': 'HBase Mastre',
+  'services.service.summary.hbaseMaster': 'HBase Master Web UI',
   'services.service.summary.regionServerCount': 'Region Server Count (live/dead)',
   'services.service.summary.regionInTransition': 'Region In Transition',
   'services.service.summary.masterStarted': 'Master Started',

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js?rev=1399502&r1=1399501&r2=1399502&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js Thu Oct 18 01:15:47 2012
@@ -143,18 +143,15 @@ module.exports = Em.Route.extend({
   admin:Em.Route.extend({
     route:'/admin',
 
-    enter:function (router) {
-      if (router.get('currentState.name') != 'main') { // is user comes from main -> navigate to users
-        Em.run.next(function () {
-          router.transitionTo('adminUser');
-        });
-      }
-    },
-
     connectOutlets:function (router, context) {
       router.get('mainController').connectOutlet('mainAdmin');
     },
 
+    index:Ember.Route.extend({
+      route:'/',
+      redirectsTo:'adminUser'
+    }),
+
     adminUser:Em.Route.extend({
       route:'/user',
       enter:function (router) {
@@ -191,7 +188,7 @@ module.exports = Em.Route.extend({
         connectOutlets:function (router, user) {
           router.get('mainAdminController').connectOutlet('mainAdminUserEdit', user);
         }
-      }),
+      })
     }),
 
     adminAuthentication:Em.Route.extend({

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less?rev=1399502&r1=1399501&r2=1399502&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less Thu Oct 18 01:15:47 2012
@@ -49,7 +49,7 @@ footer {
 }
 
 #content {
-  padding: 40px 0;
+  padding: 30px 0;
 }
 
 #top-nav {
@@ -139,7 +139,7 @@ footer {
     margin: 0;
   }
 
-  margin-bottom: 40px;
+  margin-bottom: 30px;
 }
 
 @green: #69BE28;
@@ -175,7 +175,7 @@ h1 {
 }
  
 
-#installer {
+#installer, #add-host {
   h2 {
     margin-top: 0;
   }
@@ -185,7 +185,7 @@ h1 {
   .btn-area {
     margin-top: 20px;
   }
-  #installer-content {
+  #installer-content, #add-host-content {
     padding: 25px;
     background-color: #fff;
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs?rev=1399502&r1=1399501&r2=1399502&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs Thu Oct 18 01:15:47 2012
@@ -29,182 +29,170 @@
     </ul>
 		<h4>{{controller.content.label}} Summary</h4>
 		<div class="service-content">
-			{{#each component in controller.content.components}}
-        {{#if component.type}}
-          <div class="service-links">{{component.componentName}}: <a {{action selectHost component.host}} href="javascript:void(null)">{{component.host.hostName}}</a></div>
-        {{else}}
-          <div class="service-links">{{component.componentName}}: <a {{action filterHosts component}} href="javascript:void(null)">{{component.componentName}}</a></div>
+      <table id="summary-info" class="table table-bordered table-striped table-condensed">
+        <tbody>
+        {{#each component in controller.content.components}}
+          <tr>
+          {{#if component.type}}
+            <td>{{component.componentName}}</td><td><a {{action selectHost component.host}} href="javascript:void(null)">{{component.host.hostName}}</a></td>
+          {{else}}
+            <td>{{component.componentName}}s</td><td><a {{action filterHosts component}} href="javascript:void(null)">{{component.componentName}}s</a></td>
+          {{/if}}
+          </tr>
+        {{/each}}
+        {{#if view.serviceStatus.hdfs}}
+          <tr>
+            <td>{{t services.service.summary.version}}</td>
+            <td>{{view.attributes.version}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.nameNode}}</td>
+            <td><a {{bindAttr href="view.attributes.namenode_addr"}}>{{view.attributes.namenode_addr}}</a></td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.nameNodeUptime}}</td>
+            <td>{{view.attributes.start_time.d}}day {{view.attributes.start_time.h}}hr {{view.attributes.start_time.m}}min</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.nameNodeHeap}}</td>
+            <td>{{view.attributes.memory_heap_used}} / {{view.attributes.memory_heap_max}} ({{view.attributes.memory_heap_percent_used}} used)</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.dataNodes}}</td>
+            <td>
+              <a href="javascript:void(null)">{{view.attributes.live_nodes}}</a> / <a href="javascript:void(null)">{{view.attributes.dead_nodes}}</a> / <a href="javascript:void(null)">{{view.attributes.decommissioning_nodes}}</a>
+            </td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.diskCapacity}}</td>
+            <td>{{view.attributes.used_bytes}} / {{view.attributes.dfs_total_bytes}} ({{view.attributes.dfs_percent_disk_used}} used)</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.blocksTotal}}</td>
+            <td>{{view.attributes.dfs_blocks_total}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.blockErrors}}</td>
+            <td>{{view.attributes.dfs_blocks_corrupt}} / {{view.attributes.dfs_blocks_missing}} / ({{view.attributes.dfs_blocks_underreplicated}})</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.totalFiles}}</td>
+            <td>{{view.attributes.dfs_dirfiles_count}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.pendingUpgradeStatus}}</td>
+            <td>
+              {{#if view.attributes.pending_upgrades}}
+              Pending upgrade
+              {{else}}
+              No pending upgrade
+              {{/if}}
+            </td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.safeModeStatus}}</td>
+            <td>
+              {{#if view.attributes.safemode}}
+              In safe mode
+              {{else}}
+              Not in safe mode
+              {{/if}}
+            </td>
+          </tr>
         {{/if}}
-			{{/each}}
-      {{#if view.serviceStatus.hdfs}}
-        <table id="summary-info" class="table table-bordered table-striped table-condensed">
-          <tbody>
-            <tr>
-              <td>{{t services.service.summary.version}}</td>
-              <td>{{view.attributes.version}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.nameNode}}</td>
-              <td><a {{bindAttr href="view.attributes.namenode_addr"}}>{{view.attributes.namenode_addr}}</a></td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.nameNodeUptime}}</td>
-              <td>{{view.attributes.start_time.d}}day {{view.attributes.start_time.h}}hr {{view.attributes.start_time.m}}min</td>
-            </tr>
-          </tbody>
-          <tbody {{bindAttr class="view.isHide:hide"}}>
-            <tr>
-              <td>{{t services.service.summary.nameNodeHeap}}</td>
-              <td>{{view.attributes.memory_heap_used}} MB / {{view.attributes.memory_heap_max}} MB ({{view.attributes.memory_heap_percent_used}}% used)</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.dataNodes}}</td>
-              <td>
-                <a href="javascript:void(null)">{{view.attributes.live_nodes}}</a> / <a href="javascript:void(null)">{{view.attributes.dead_nodes}}</a> / <a href="javascript:void(null)">{{view.attributes.decommissioning_nodes}}</a>
-              </td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.diskCapacity}}</td>
-              <td>{{view.attributes.used_bytes}} GB / {{view.attributes.dfs_total_bytes}} GB ({{view.attributes.dfs_percent_disk_used}}% used)</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.blocksTotal}}</td>
-              <td>{{view.attributes.dfs_blocks_total}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.blockErrors}}</td>
-              <td>{{view.attributes.dfs_blocks_corrupt}} / {{view.attributes.dfs_blocks_missing}} / ({{view.attributes.dfs_blocks_underreplicated}})</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.totalFiles}}</td>
-              <td>{{view.attributes.dfs_dirfiles_count}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.pendingUpgradeStatus}}</td>
-              <td>
-                {{#if view.attributes.pending_upgrades}}
-                Pending upgrade
-                {{else}}
-                No pending upgrade
-                {{/if}}
-              </td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.safeModeStatus}}</td>
-              <td>
-                {{#if view.attributes.safemode}}
-                In safe mode
-                {{else}}
-                Not in safe mode
-                {{/if}}
-              </td>
-            </tr>
-          </tbody>
-        </table>
-      {{/if}}
-      {{#if view.serviceStatus.mapreduce}}
-        <table id="summary-info" class="table table-bordered table-striped table-condensed">
-          <tbody>
-            <tr>
-              <td>{{t services.service.summary.version}}</td>
-              <td>{{view.attributes.version}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.jobTracker}}</td>
-              <td><a {{bindAttr href="view.attributes.jobtracker_addr"}}>{{view.attributes.jobtracker_addr}}</a></td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.jobTrackerUptime}}</td>
-              <td>{{view.attributes.start_time.d}}day {{view.attributes.start_time.h}}hr {{view.attributes.start_time.m}}min</td>
-            </tr>
-          </tbody>
-          <tbody {{bindAttr class="view.isHide:hide"}}>
-            <tr>
-              <td>{{t services.service.summary.trackersLiveTotal}}</td>
-              <td>
-                <a href="javascript:void(null)">{{view.attributes.trackers_live}}</a> / {{view.attributes.trackers_total}}
-              </td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.trackersBlacklistGraylist}}</td>
-              <td>
-                <a href="javascript:void(null)">{{view.attributes.trackers_blacklisted}}</a> / <a href="javascript:void(null)">{{view.attributes.trackers_graylisted}}</a> / <a href="javascript:void(null)">{{view.attributes.trackers_excluded}}</a>
-              </td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.jobTrackerHeap}}</td>
-              <td>{{view.attributes.memory_heap_used}} MB / {{view.attributes.memory_heap_max}} MB ({{view.attributes.memory_heap_percent_used}}% used)</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.totalSlotsCapacity}}</td>
-              <td>{{view.attributes.map_task_capacity}} / {{view.attributes.reduce_task_capacity}} / {{view.attributes.average_node_capacity}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.totalJobs}}</td>
-              <td>{{view.attributes.job_total_submissions}} / {{view.attributes.job_total_completions}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.currentSlotUtiliMaps}}</td>
-              <td>{{view.attributes.occupied_map_slots}} / {{view.attributes.reserved_map_slots}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.currentSlotUtiliReduces}}</td>
-              <td>{{view.attributes.occupied_reduce_slots}} / {{view.attributes.reserved_reduce_slots}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.tasksMaps}}</td>
-              <td>{{view.attributes.running_map_tasks}} / {{view.attributes.waiting_maps}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.tasksReduces}}</td>
-              <td>{{view.attributes.running_reduce_tasks}} / {{view.attributes.waiting_reduces}}</td>
-            </tr>
-          </tbody>
-        </table>
-      {{/if}}
-      {{#if view.serviceStatus.hbase}}
-        <table id="summary-info" class="table table-bordered table-striped table-condensed">
-          <tbody>
-            <tr>
-              <td>{{t services.service.summary.version}}</td>
-              <td>{{view.attributes.version}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.hbaseMaster}}</td>
-              <td><a {{bindAttr href="view.attributes.hbasemaster_addr"}}>{{view.attributes.hbasemaster_addr}}</a></td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.regionServerCount}}</td>
-              <td>
-                <a href="javascript:void(null)">{{view.attributes.live_regionservers}}</a> / <a href="javascript:void(null)">{{view.attributes.dead_regionservers}}</a>
-              </td>
-            </tr>
-          </tbody>
-          <tbody {{bindAttr class="view.isHide:hide"}}>
-            <tr>
-              <td>{{t services.service.summary.regionInTransition}}</td>
-              <td>{{view.attributes.regions_in_transition_count}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.masterStarted}}</td>
-              <td>{{view.attributes.start_time.d}}day {{view.attributes.start_time.h}}hr {{view.attributes.start_time.m}}min</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.masterActivated}}</td>
-              <td>{{view.attributes.active_time.d}}day {{view.attributes.active_time.h}}hr {{view.attributes.active_time.m}}min</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.averageLoad}}</td>
-              <td>{{view.attributes.average_load}}</td>
-            </tr>
-            <tr>
-              <td>{{t services.service.summary.masterHeap}}</td>
-              <td>{{view.attributes.memory_heap_used}} MB / {{view.attributes.memory_heap_max}} MB ({{view.attributes.memory_heap_percent_used}}% used)</td>
-            </tr>
-          </tbody>
-        </table>
-      {{/if}}
-      {{view view.moreStatsView}}
+        {{#if view.serviceStatus.mapreduce}}
+          <tr>
+            <td>{{t services.service.summary.version}}</td>
+            <td>{{view.attributes.version}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.jobTracker}}</td>
+            <td><a {{bindAttr href="view.attributes.jobtracker_addr"}}>{{view.attributes.jobtracker_addr}}</a></td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.jobTrackerUptime}}</td>
+            <td>{{view.attributes.start_time.d}}day {{view.attributes.start_time.h}}hr {{view.attributes.start_time.m}}min</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.trackersLiveTotal}}</td>
+            <td>
+              <a href="javascript:void(null)">{{view.attributes.trackers_live}}</a> / {{view.attributes.trackers_total}}
+            </td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.trackersBlacklistGraylist}}</td>
+            <td>
+              <a href="javascript:void(null)">{{view.attributes.trackers_blacklisted}}</a> / <a href="javascript:void(null)">{{view.attributes.trackers_graylisted}}</a> / <a href="javascript:void(null)">{{view.attributes.trackers_excluded}}</a>
+            </td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.jobTrackerHeap}}</td>
+            <td>{{view.attributes.memory_heap_used}} / {{view.attributes.memory_heap_max}} ({{view.attributes.memory_heap_percent_used}} used)</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.totalSlotsCapacity}}</td>
+            <td>{{view.attributes.map_task_capacity}} / {{view.attributes.reduce_task_capacity}} / {{view.attributes.average_node_capacity}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.totalJobs}}</td>
+            <td>{{view.attributes.job_total_submissions}} / {{view.attributes.job_total_completions}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.currentSlotUtiliMaps}}</td>
+            <td>{{view.attributes.occupied_map_slots}} / {{view.attributes.reserved_map_slots}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.currentSlotUtiliReduces}}</td>
+            <td>{{view.attributes.occupied_reduce_slots}} / {{view.attributes.reserved_reduce_slots}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.tasksMaps}}</td>
+            <td>{{view.attributes.running_map_tasks}} / {{view.attributes.waiting_maps}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.tasksReduces}}</td>
+            <td>{{view.attributes.running_reduce_tasks}} / {{view.attributes.waiting_reduces}}</td>
+          </tr>
+        {{/if}}
+        {{#if view.serviceStatus.hbase}}
+          <tr>
+            <td>{{t services.service.summary.version}}</td>
+            <td>{{view.attributes.version}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.hbaseMaster}}</td>
+            <td><a {{bindAttr href="view.attributes.hbasemaster_addr"}}>{{view.attributes.hbasemaster_addr}}</a></td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.regionServerCount}}</td>
+            <td>
+              <a href="javascript:void(null)">{{view.attributes.live_regionservers}}</a> / <a href="javascript:void(null)">{{view.attributes.dead_regionservers}}</a>
+            </td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.regionInTransition}}</td>
+            <td>{{view.attributes.regions_in_transition_count}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.masterStarted}}</td>
+            <td>{{view.attributes.start_time.d}}day {{view.attributes.start_time.h}}hr {{view.attributes.start_time.m}}min</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.masterActivated}}</td>
+            <td>{{view.attributes.active_time.d}}day {{view.attributes.active_time.h}}hr {{view.attributes.active_time.m}}min</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.averageLoad}}</td>
+            <td>{{view.attributes.average_load}}</td>
+          </tr>
+          <tr>
+            <td>{{t services.service.summary.masterHeap}}</td>
+            <td>{{view.attributes.memory_heap_used}} / {{view.attributes.memory_heap_max}} ({{view.attributes.memory_heap_percent_used}} used)</td>
+          </tr>
+        {{/if}}
+        </tbody>
+      </table>
+      {{!view view.moreStatsView}}
 		</div>
 	</div>
 	<div class="span6">

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js?rev=1399502&r1=1399501&r2=1399502&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js Thu Oct 18 01:15:47 2012
@@ -41,8 +41,17 @@ String.prototype.format = function() {
   });
 };
 
-
-Number.prototype.bytesToSize = function(precision) {
+/**
+ * Convert byte size to other metrics.
+ * @param {Number} precision  Number to adjust precision of return value. Default is 0.
+ * @param {String} parseType  JS method name for parse string to number. Default is "parseInt".
+ * @remarks The parseType argument can be "parseInt" or "parseFloat".
+ * @return {String) Returns converted value with abbreviation.
+ */
+Number.prototype.bytesToSize = function(precision, parseType/* = 'parseInt' */) {
+  if (arguments[1] === undefined) {
+    parseType = 'parseInt';
+  }
   var value = this;
   var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
   var posttxt = 0;
@@ -51,7 +60,15 @@ Number.prototype.bytesToSize = function(
     posttxt++;
     value = value / 1024;
   }
-  return parseInt(value).toFixed(precision) + " " + sizes[posttxt];
+  if (parseType == 'parseInt') {
+    var parsedValue = parseInt(value);
+  } else if (parseType == 'parseFloat') {
+    var parsedValue = parseFloat(value);
+  } else {
+    console.warn('Parameter parseType incorrect');
+  }
+
+  return parsedValue.toFixed(precision) + " " + sizes[posttxt];
 }
 
 Number.prototype.toDaysHoursMinutes = function() {
@@ -70,4 +87,9 @@ Number.prototype.toDaysHoursMinutes = fu
   dateDiff -= formatted.m * minK;
 
   return formatted;
+}
+
+Number.prototype.countPercentageRatio = function(maxValue) {
+  var usedValue = this;
+  return Math.round((usedValue/maxValue) * 100) + "%";
 }
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/menu.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/menu.js?rev=1399502&r1=1399501&r2=1399502&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/menu.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/menu.js Thu Oct 18 01:15:47 2012
@@ -45,7 +45,10 @@ App.MainMenuView = Em.CollectionView.ext
    *    Syncs navigation menu with requested URL
    */
   renderOnRoute:function () {
-    var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/);
+    var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/,'');
+    if(last_url.substr(1,4) !== 'main' || !this._childViews){
+      return;
+    }
     var reg = /^\/main\/([a-z]+)/g;
     var sub_url = reg.exec(last_url);
     var chunk = (null != sub_url) ? sub_url[1] : 'dashboard';

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js?rev=1399502&r1=1399501&r2=1399502&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js Thu Oct 18 01:15:47 2012
@@ -27,18 +27,13 @@ App.MainServiceInfoSummaryView = Em.View
     hbase: false
   },
   isHide: true,
-  showMoreStats: function() {
-    this.set('isHide', false);
-  },
   moreStatsView: Em.View.extend({
     tagName: "a",
     template: Ember.Handlebars.compile('{{t services.service.summary.moreStats}}'),
     attributeBindings: ['href'],
-    classNameBindings: ['hide'],
     classNames: ['more-stats'],
-    hide: false,
     click: function(event) {
-      this._parentView.set('isHide', false);
+      this._parentView._parentView.set('isHide', false);
       this.remove();
     },
     href: 'javascript:void(null)'
@@ -67,42 +62,28 @@ App.MainServiceInfoSummaryView = Em.View
           var summary = data[serviceName];
           if(serviceName == 'hdfs') {
             summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
-            summary['memory_heap_used'] = summaryView.convertByteToMbyte(summary['memory_heap_used']);
-            summary['memory_heap_max'] = summaryView.convertByteToMbyte(summary['memory_heap_max']);
-            summary['memory_heap_percent_used'] = summaryView.countPercentageRatio(summary['memory_heap_used'], summary['memory_heap_max']);
-            summary['used_bytes'] = summaryView.convertByteToGbyte(summary['dfs_used_bytes'] + summary['nondfs_used_bytes']);
-            summary['dfs_total_bytes'] = summaryView.convertByteToGbyte(summary['dfs_total_bytes']);
-            summary['dfs_percent_disk_used'] = parseFloat((100 - summary['dfs_percent_remaining']).toFixed(2));
+            summary['memory_heap_percent_used'] = summary['memory_heap_used'].countPercentageRatio(summary['memory_heap_max']);
+            summary['memory_heap_used'] = summary['memory_heap_used'].bytesToSize(2, 'parseFloat');
+            summary['memory_heap_max'] = summary['memory_heap_max'].bytesToSize(2, 'parseFloat');
+            summary['dfs_percent_disk_used'] = parseFloat((100 - summary['dfs_percent_remaining']).toFixed(2)) + "%";
+            summary['used_bytes'] = (summary['dfs_used_bytes'] + summary['nondfs_used_bytes']).bytesToSize(2, 'parseFloat');
+            summary['dfs_total_bytes'] = summary['dfs_total_bytes'].bytesToSize(2, 'parseFloat');
           } else if (serviceName == 'mapreduce') {
             summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
-            summary['memory_heap_used'] = summaryView.convertByteToMbyte(summary['memory_heap_used']);
-            summary['memory_heap_max'] = summaryView.convertByteToMbyte(summary['memory_heap_max']);
-            summary['memory_heap_percent_used'] = summaryView.countPercentageRatio(summary['memory_heap_used'], summary['memory_heap_max']);
+            summary['memory_heap_percent_used'] = summary['memory_heap_used'].countPercentageRatio(summary['memory_heap_max']);
+            summary['memory_heap_used'] = summary['memory_heap_used'].bytesToSize(2, 'parseFloat');
+            summary['memory_heap_max'] = summary['memory_heap_max'].bytesToSize(2, 'parseFloat');
+
           } else if (serviceName == 'hbase') {
-            summary['memory_heap_used'] = summaryView.convertByteToMbyte(summary['memory_heap_used']);
-            summary['memory_heap_max'] = summaryView.convertByteToMbyte(summary['memory_heap_max']);
-            summary['memory_heap_percent_used'] = summaryView.countPercentageRatio(summary['memory_heap_used'], summary['memory_heap_max']);
+            summary['memory_heap_percent_used'] = summary['memory_heap_used'].countPercentageRatio(summary['memory_heap_max']);
+            summary['memory_heap_used'] = summary['memory_heap_used'].bytesToSize(2, 'parseFloat');
+            summary['memory_heap_max'] = summary['memory_heap_max'].bytesToSize(2, 'parseFloat');
             summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
             summary['active_time'] = summary['active_time'].toDaysHoursMinutes();
-          } else {
-
           }
           summaryView.set('attributes', summary);
         }
       }
     )
-  },
-  convertByteToMbyte: function(value) {
-    var bytesInMbyte = 1048576;
-    var newValue = value/bytesInMbyte;
-    return parseFloat(newValue.toFixed(2));
-  },
-  convertByteToGbyte: function(value) {
-    var bytesInGbyte = 1073741824;
-    var newValue = value/bytesInGbyte;
-    return parseFloat(newValue.toFixed(2));
-  },
-  countPercentageRatio: function(usedValue, maxValue) {
-    return Math.round((usedValue/maxValue) * 100);
   }
 });
\ No newline at end of file