You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/02/26 14:59:06 UTC

git commit: AMBARI-4841 Incorrect behavior of HA wizard on second step. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/trunk 884b1e8ce -> 1aeb5aa1c


AMBARI-4841 Incorrect behavior of HA wizard on second step. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1aeb5aa1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1aeb5aa1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1aeb5aa1

Branch: refs/heads/trunk
Commit: 1aeb5aa1cecf7674a8c5229871d09a38c873753b
Parents: 884b1e8
Author: atkach <at...@hortonworks.com>
Authored: Wed Feb 26 15:56:35 2014 +0200
Committer: atkach <at...@hortonworks.com>
Committed: Wed Feb 26 15:56:35 2014 +0200

----------------------------------------------------------------------
 .../main/admin/highAvailability/step2_controller.js       | 10 +++++++---
 ambari-web/app/controllers/wizard/step5_controller.js     |  7 +++++--
 ambari-web/app/messages.js                                |  2 ++
 .../app/templates/main/admin/highAvailability/step2.hbs   |  5 ++---
 ambari-web/app/views/wizard/step5_view.js                 |  6 ++++--
 5 files changed, 20 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1aeb5aa1/ambari-web/app/controllers/main/admin/highAvailability/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/step2_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/step2_controller.js
index b729100..7e4c153 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/step2_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/step2_controller.js
@@ -25,6 +25,11 @@ App.HighAvailabilityWizardStep2Controller = App.WizardStep5Controller.extend({
   name:"highAvailabilityWizardStep2Controller",
 
   /**
+   * master components which could be assigned to multiple hosts
+   */
+  multipleComponents: ['NAMENODE', 'JOURNALNODE'],
+
+  /**
    * Load services info to appropriate variable and return masterComponentHosts
    * @return Array
    */
@@ -42,12 +47,12 @@ App.HighAvailabilityWizardStep2Controller = App.WizardStep5Controller.extend({
 
       var masterServices = self.get("selectedServicesMasters").filterProperty("selectedHost", item);
       masterServices.forEach(function(item){
-        if(item.component_name == "NAMENODE" || item.component_name == "JOURNALNODE"){
+        if(this.get('multipleComponents').contains(item.component_name)){
           item.set('color','green');
         }else{
           item.set('color','grey');
         }
-      });
+      }, this);
 
       mappingObject = Ember.Object.create({
         host_name:item,
@@ -108,7 +113,6 @@ App.HighAvailabilityWizardStep2Controller = App.WizardStep5Controller.extend({
 
     masterComponents.forEach(function (item) {
       var componentObj = Ember.Object.create(item);
-      componentObj.set("availableHosts", this.get("hosts"));
       result.push(componentObj);
     }, this);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1aeb5aa1/ambari-web/app/controllers/wizard/step5_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step5_controller.js b/ambari-web/app/controllers/wizard/step5_controller.js
index 91264b1..374e1da 100644
--- a/ambari-web/app/controllers/wizard/step5_controller.js
+++ b/ambari-web/app/controllers/wizard/step5_controller.js
@@ -40,7 +40,10 @@ App.WizardStep5Controller = Em.Controller.extend({
   isReassignHive: function () {
     return this.get('servicesMasters').objectAt(0) && this.get('servicesMasters').objectAt(0).component_name == 'HIVE_SERVER' && this.get('isReassignWizard');
   }.property('isReassignWizard', 'servicesMasters'),
-
+  /**
+   * master components which could be assigned to multiple hosts
+   */
+  multipleComponents: ['ZOOKEEPER_SERVER', 'HBASE_MASTER'],
   /**
    * Define state for submit button. Return true only for Reassign Master Wizard and if more than one master component was reassigned.
    */
@@ -169,7 +172,7 @@ App.WizardStep5Controller = Em.Controller.extend({
       var componentInfo = masterComponents.filterProperty('service_name', services[index]);
 
       componentInfo.forEach(function (_componentInfo) {
-        if (_componentInfo.component_name == 'ZOOKEEPER_SERVER' || _componentInfo.component_name == 'HBASE_MASTER') {
+        if (this.get('multipleComponents').contains(_componentInfo.component_name)) {
           var savedComponents = masterHosts.filterProperty('component', _componentInfo.component_name);
           if (savedComponents.length) {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1aeb5aa1/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 45d533c..c45173b 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -185,6 +185,8 @@ Em.I18n.translations = {
   'common.url': 'URL',
   'common.advanced': 'Advanced',
   'common.download': 'Download',
+  'common.current': 'Current',
+  'common.additional': 'Additional',
   'common.time.start': 'Start Time',
   'common.time.end': 'End Time',
   'common.hostLog.popup.logDir.path':'/var/lib/ambari-agent/data/',

http://git-wip-us.apache.org/repos/asf/ambari/blob/1aeb5aa1/ambari-web/app/templates/main/admin/highAvailability/step2.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/step2.hbs b/ambari-web/app/templates/main/admin/highAvailability/step2.hbs
index d92c47d..ce37d01 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/step2.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/step2.hbs
@@ -28,16 +28,15 @@
       <div class="control-group">
         <label class="control-label">
           {{#if isCurNameNode}}
-          Current
+            {{t common.current}}
           {{/if}}
           {{#if isAddNameNode}}
-          Additional
+            {{t common.additional}}
           {{/if}}
           {{display_name}}:
         </label>
         <div class="controls">
           {{view App.SelectHostView
-            contentBinding="availableHosts"
             optionValuePath="content.host_name"
             optionLabelPath="content.host_info"
             selectedHostBinding="selectedHost"

http://git-wip-us.apache.org/repos/asf/ambari/blob/1aeb5aa1/ambari-web/app/views/wizard/step5_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step5_view.js b/ambari-web/app/views/wizard/step5_view.js
index fb19b74..c0d501e 100644
--- a/ambari-web/app/views/wizard/step5_view.js
+++ b/ambari-web/app/views/wizard/step5_view.js
@@ -43,6 +43,7 @@ App.SelectHostView = Em.Select.extend({
 
   change: function () {
     this.get('controller').assignHostToMaster(this.get("componentName"), this.get("value"), this.get("zId"));
+    this.set('selectedHost', this.get('value'));
     this.get('controller').set('componentToRebalance', this.get("componentName"));
     this.get('controller').incrementProperty('rebalanceComponentHostsCounter');
   },
@@ -60,17 +61,18 @@ App.SelectHostView = Em.Select.extend({
 
   /**
    * get available hosts
-   * Since ZOOKEEPER_SERVER or HBASE_MASTER component can be assigned to multiple hosts,
+   * @multipleComponents component can be assigned to multiple hosts,
    * shared hosts among the same component should be filtered out
    * @return {*}
    */
   getAvailableHosts: function () {
     var hosts = this.get('controller.hosts').slice();
     var componentName = this.get('componentName');
+    var multipleComponents = this.get('controller.multipleComponents');
     var occupiedHosts = this.get('controller.selectedServicesMasters')
       .filterProperty('component_name', componentName)
       .mapProperty('selectedHost').without(this.get('selectedHost'));
-    if (componentName == 'ZOOKEEPER_SERVER' || componentName == 'HBASE_MASTER') {
+    if (multipleComponents.contains(componentName)) {
       return hosts.filter(function (host) {
         return !occupiedHosts.contains(host.get('host_name'));
       }, this);