You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2014/07/17 16:35:09 UTC

git commit: AMBARI-6524. Assign Master functionality doesn't work. (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk cc7211f3a -> bb9b9cdcd


AMBARI-6524. Assign Master functionality doesn't work. (akovalenko)


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

Branch: refs/heads/trunk
Commit: bb9b9cdcdad7ad0e666dc49be05e95f960c739d1
Parents: cc7211f
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu Jul 17 17:34:45 2014 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Thu Jul 17 17:34:45 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/app.js                                 | 2 +-
 ambari-web/app/controllers/wizard/step5_controller.js | 9 ++++-----
 ambari-web/app/models/stack_service_component.js      | 5 +++++
 ambari-web/app/views/wizard/step5_view.js             | 6 +++---
 ambari-web/test/views/wizard/step5_view_test.js       | 6 +++---
 5 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bb9b9cdc/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index 7baea87..b4e3657 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -158,7 +158,7 @@ module.exports = Em.Application.create({
     }.property('App.router.clusterController.isLoaded'),
 
     addableMasterInstallerWizard: function () {
-      return App.StackServiceComponent.find().filterProperty('isMasterWithMultipleInstances', true).mapProperty('componentName')
+      return App.StackServiceComponent.find().filterProperty('isMasterAddableInstallerWizard', true).mapProperty('componentName')
     }.property('App.router.clusterController.isLoaded'),
 
     addableMasterHaWizard: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb9b9cdc/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 a8276a0..f8f14b1 100644
--- a/ambari-web/app/controllers/wizard/step5_controller.js
+++ b/ambari-web/app/controllers/wizard/step5_controller.js
@@ -386,9 +386,8 @@ App.WizardStep5Controller = Em.Controller.extend({
       console.log("TRACE: render master component name is: " + item.component_name);
       var masterComponent = App.StackServiceComponent.find().findProperty('componentName', item.component_name);
       if (masterComponent.get('isMasterWithMultipleInstances')) {
-        if (item.component_name !== previousComponentName) serviceComponentId = 1;
         previousComponentName = item.component_name;
-        componentObj.set('serviceComponentId', serviceComponentId++);
+        componentObj.set('serviceComponentId', result.filterProperty('component_name', item.component_name).length + 1);
         componentObj.set("showRemoveControl", showRemoveControl);
       }
       componentObj.set('isHostNameValid', true);
@@ -509,7 +508,7 @@ App.WizardStep5Controller = Em.Controller.extend({
   assignHostToMaster: function (componentName, selectedHost, serviceComponentId) {
     var flag = this.isHostNameValid(componentName, selectedHost);
     this.updateIsHostNameValidFlag(componentName, serviceComponentId, flag);
-    if (zId) {
+    if (serviceComponentId) {
       this.get('selectedServicesMasters').filterProperty('component_name', componentName).findProperty("serviceComponentId", serviceComponentId).set("selectedHost", selectedHost);
     }
     else {
@@ -543,9 +542,9 @@ App.WizardStep5Controller = Em.Controller.extend({
   /**
    * Update <code>isHostNameValid</code> property with <code>flag</code> value
    * for component with name <code>componentName</code> and
-   * <code>zId</code>-property equal to <code>zId</code>-parameter value
+   * <code>serviceComponentId</code>-property equal to <code>serviceComponentId</code>-parameter value
    * @param {string} componentName
-   * @param {number} zId
+   * @param {number} serviceComponentId
    * @param {bool} flag
    * @method updateIsHostNameValidFlag
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb9b9cdc/ambari-web/app/models/stack_service_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service_component.js b/ambari-web/app/models/stack_service_component.js
index 10e9a51..f759194 100644
--- a/ambari-web/app/models/stack_service_component.js
+++ b/ambari-web/app/models/stack_service_component.js
@@ -94,6 +94,11 @@ App.StackServiceComponent = DS.Model.extend({
   }.property('isShownOnInstallerAssignMasterPage','App.isHaEnabled'),
 
   isMasterWithMultipleInstances: function() {
+    var masters = ['ZOOKEEPER_SERVER', 'HBASE_MASTER', 'NAMENODE', 'JOURNALNODE'];
+    return masters.contains(this.get('componentName'));
+  }.property('componentName'),
+
+  isMasterAddableInstallerWizard: function() {
     var masters = ['ZOOKEEPER_SERVER', 'HBASE_MASTER'];
     return masters.contains(this.get('componentName'));
   }.property('componentName'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb9b9cdc/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 c78cb4c..33a2aea 100644
--- a/ambari-web/app/views/wizard/step5_view.js
+++ b/ambari-web/app/views/wizard/step5_view.js
@@ -73,10 +73,10 @@ App.InputHostView = Em.TextField.extend(App.SelectHost, {
     if (!this.shouldChangeHandlerBeCalled()) return;
     var host = this.get('controller.hosts').findProperty('host_info', this.get('value'));
     if (Em.isNone(host)) {
-      this.get('controller').updateIsHostNameValidFlag(this.get("component.component_name"), this.get("component.zId"), false);
+      this.get('controller').updateIsHostNameValidFlag(this.get("component.component_name"), this.get("component.serviceComponentId"), false);
       return;
     }
-    this.get('controller').assignHostToMaster(this.get("component.component_name"), host.get('host_name'), this.get("component.zId"));
+    this.get('controller').assignHostToMaster(this.get("component.component_name"), host.get('host_name'), this.get("component.serviceComponentId"));
     this.tryTriggerRebalanceForMultipleComponents();
   }.observes('controller.hostNameCheckTrigger'),
 
@@ -135,7 +135,7 @@ App.SelectHostView = Em.Select.extend(App.SelectHost, {
    */
   changeHandler: function () {
     if (!this.shouldChangeHandlerBeCalled()) return;
-    this.get('controller').assignHostToMaster(this.get("component.component_name"), this.get("value"), this.get("component.zId"));
+    this.get('controller').assignHostToMaster(this.get("component.component_name"), this.get("value"), this.get("component.serviceComponentId"));
     this.tryTriggerRebalanceForMultipleComponents();
   }.observes('controller.hostNameCheckTrigger'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb9b9cdc/ambari-web/test/views/wizard/step5_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step5_view_test.js b/ambari-web/test/views/wizard/step5_view_test.js
index 9cf6bdf..7c631b1 100644
--- a/ambari-web/test/views/wizard/step5_view_test.js
+++ b/ambari-web/test/views/wizard/step5_view_test.js
@@ -94,7 +94,7 @@ describe('App.SelectHostView', function() {
   describe('#changeHandler', function() {
 
     beforeEach(function() {
-      view.set('component', {component_name: 'ZOOKEEPER_SERVER', zId: 1});
+      view.set('component', {component_name: 'ZOOKEEPER_SERVER', serviceComponentId: 1});
       view.set('controller.hosts', [Em.Object.create({host_info: 'h1 info', host_name: 'h1'})]);
       view.set('value', 'h1 info');
       view.set('controller.rebalanceComponentHostsCounter', 0);
@@ -173,7 +173,7 @@ describe('App.InputHostView', function() {
   describe('#changeHandler', function() {
 
     beforeEach(function() {
-      view.set('component', {component_name: 'ZOOKEEPER_SERVER', zId: 1});
+      view.set('component', {component_name: 'ZOOKEEPER_SERVER', serviceComponentId: 1});
       view.set('controller.hosts', [Em.Object.create({host_info: 'h1 info', host_name: 'h1'})]);
       view.set('value', 'h1 info');
       view.set('controller.rebalanceComponentHostsCounter', 0);
@@ -379,7 +379,7 @@ describe('App.RemoveControlView', function() {
       view.get('controller').removeComponent.restore();
     });
     it('should call removeComponent', function() {
-      view.set('zId', 1);
+      view.set('serviceComponentId', 1);
       view.set('componentName', 'c1');
       view.click();
       expect(view.get('controller').removeComponent.calledWith('c1', 1)).to.equal(true);