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/11 00:57:54 UTC

svn commit: r1396847 - in /incubator/ambari/branches/AMBARI-666: AMBARI-666-CHANGES.txt ambari-web/app/controllers/installer/step5_controller.js ambari-web/app/routes/installer.js ambari-web/app/views/installer/step5_view.js

Author: yusaku
Date: Wed Oct 10 22:57:53 2012
New Revision: 1396847

URL: http://svn.apache.org/viewvc?rev=1396847&view=rev
Log:
AMBARI-846. Select Masters Page: make ZooKeeper addition/removal UI more organized. (Jaimin Jetly via yusaku)

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/routes/installer.js
    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=1396847&r1=1396846&r2=1396847&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Wed Oct 10 22:57:53 2012
@@ -241,6 +241,9 @@ AMBARI-666 branch (unreleased changes)
 
   BUG FIXES
 
+  AMBARI-846. Select Masters Page: make ZooKeeper addition/removal UI more
+  organized. (Jaimin Jetly via yusaku)
+
   AMBARI-840. Hitting browser refresh should not clear present step data that 
   had already been persisted to local DB. (Jaimin Jetly via 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=1396847&r1=1396846&r2=1396847&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 Wed Oct 10 22:57:53 2012
@@ -53,7 +53,7 @@ App.InstallerStep5Controller = Em.Contro
       hosts.add(hostInfo[index]);
       console.log("TRACE: host name is: " + hostInfo[index].name);
     }
-    return hosts.filterProperty('bootStatus','success');
+    return hosts.filterProperty('bootStatus', 'success');
   },
 
 
@@ -77,7 +77,7 @@ App.InstallerStep5Controller = Em.Contro
 
   loadServices: function () {
     var serviceInfo = App.db.getService();
-    var services = serviceInfo.filterProperty('isSelected',true).mapProperty('serviceName');
+    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}));
@@ -88,22 +88,30 @@ App.InstallerStep5Controller = Em.Contro
   },
 
   loadComponents: function (services) {
-    var self = this;
     var components = new Ember.Set();
-
-    var masterComponents = self.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);
+    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 = _componentInfo.display_name;
-        componentObj.selectedHost = this.selectHost(_componentInfo.component_name);   // call the method that plays selectNode algorithm or fetches from server
+        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;
   },
 
@@ -128,16 +136,10 @@ App.InstallerStep5Controller = Em.Contro
             this.get('selectedServicesMasters').pushObject(_service);
           }, this);
         }
-        this.set('zId', this.get('zId') + 1);
+        this.set('zId', parseInt(this.get('zId')) + 1);
         zookeeperComponent = Ember.Object.create(item);
         zookeeperComponent.set('zId', this.get('zId'));
-        zookeeperComponent.set("showAddControl", true);
-        if (zookeeperComponent.get('zId') === 1) {
-          zookeeperComponent.set("showRemoveControl", false);
-        } else {
-          zookeeperComponent.set("showRemoveControl", true);
-        }
-
+        zookeeperComponent.set("showRemoveControl", true);
         zookeeperComponent.set("availableHosts", this.get("hosts").slice(0));
         this.get("selectedServicesMasters").pushObject(Ember.Object.create(zookeeperComponent));
 
@@ -147,7 +149,6 @@ App.InstallerStep5Controller = Em.Contro
         this.get("selectedServicesMasters").pushObject(componentObj);
       }
     }, this);
-
   },
 
   getKerberosServer: function (noOfHosts) {
@@ -403,18 +404,26 @@ App.InstallerStep5Controller = Em.Contro
       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);
-      }
-
-    }
+   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 () {
@@ -441,7 +450,7 @@ App.InstallerStep5Controller = Em.Contro
     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) {
+      if (currentZooKeepers.get("length") >= 1) {
         currentZooKeepers.set("lastObject.showRemoveControl", true);
       }
 
@@ -471,6 +480,7 @@ App.InstallerStep5Controller = Em.Contro
 
       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);
 
@@ -498,6 +508,11 @@ App.InstallerStep5Controller = Em.Contro
       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;

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=1396847&r1=1396846&r2=1396847&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 Wed Oct 10 22:57:53 2012
@@ -116,6 +116,7 @@ module.exports = Em.Route.extend({
     },
     back: Em.Router.transitionTo('step3'),
     next: function (router, context) {
+      App.db.setMasterComponentHosts(undefined);
       router.transitionTo('step5');
     }
   }),

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=1396847&r1=1396846&r2=1396847&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 Wed Oct 10 22:57:53 2012
@@ -26,6 +26,7 @@ App.InstallerStep5View = Em.View.extend(
   didInsertElement: function () {
     var controller = this.get('controller');
     controller.loadStep();
+    controller.lastZooKeeper().set('showAddControl',true);
   }
 
 });