ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-8508. Deleting all zookeeper servers and adding one again is not updating Hbase config properly (onechiporenko)
Date Tue, 02 Dec 2014 14:51:40 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b7ddffc76 -> 15343acd8


AMBARI-8508. Deleting all zookeeper servers and adding one again is not updating Hbase config
properly (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 15343acd852f7bae43e282b14764ed19ed3ab5f9
Parents: b7ddffc
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Tue Dec 2 15:48:53 2014 +0200
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Tue Dec 2 15:48:53 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 26 ++++++++++++++------
 .../app/mappers/service_metrics_mapper.js       |  7 ++++--
 .../test/controllers/main/host/details_test.js  | 18 +++++++++++++-
 3 files changed, 41 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/15343acd/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 2a4cfce..b8df72c 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -265,7 +265,7 @@ App.MainHostDetailsController = Em.Controller.extend({
     } else if (component.get('isClient')) {
       count = App.ClientComponent.find(component.get('componentName')).get('totalCount');
     } else {
-      count = App.HostComponent.find().filterProperty('componentName', component.get('componentName')).get('length')
+      count = App.HostComponent.find().filterProperty('componentName', component.get('componentName')).get('length');
     }
     return count || 0;
   },
@@ -311,6 +311,7 @@ App.MainHostDetailsController = Em.Controller.extend({
    */
   _doDeleteHostComponentSuccessCallback: function (response, request, data) {
     this.set('_deletedHostComponentResult', null);
+    this.removeHostComponentModel(data.componentName, data.hostName);
     if (data.componentName == 'ZOOKEEPER_SERVER') {
       this.set('fromDeleteZkServer', true);
       this.loadConfigs();
@@ -332,6 +333,17 @@ App.MainHostDetailsController = Em.Controller.extend({
   },
 
   /**
+   * Remove host component data from App.HostComponent model.
+   * 
+   * @param {String} componentName
+   * @param {String} hostName
+   */
+  removeHostComponentModel: function(componentName, hostName) {
+    var component = App.HostComponent.find().filterProperty('componentName', componentName).findProperty('hostName',
hostName);
+    App.serviceMapper.deleteRecord(component);
+  },
+  
+  /**
    * Send command to server to upgrade selected host component
    * @param {object} event
    * @method upgradeComponent
@@ -1065,7 +1077,7 @@ App.MainHostDetailsController = Em.Controller.extend({
           }
         }
       });
-      id++
+      id++;
     }
     batches.push({
         "order_id": id,
@@ -1385,7 +1397,7 @@ App.MainHostDetailsController = Em.Controller.extend({
    * @method updateHost
    */
   updateHostComponent: function (data, opt, params) {
-    params.component.set('passiveState', params.passive_state)
+    params.component.set('passiveState', params.passive_state);
     batchUtils.infoPassiveState(params.passive_state);
   },
 
@@ -1545,7 +1557,7 @@ App.MainHostDetailsController = Em.Controller.extend({
         templateName: require('templates/main/host/details/raiseDeleteComponentErrorPopup')
       }),
       secondary: null
-    })
+    });
   },
 
   /**
@@ -1593,7 +1605,7 @@ App.MainHostDetailsController = Em.Controller.extend({
         };
         self.doDeleteHost(completeCallback);
       }
-    })
+    });
   },
 
   /**
@@ -1634,7 +1646,7 @@ App.MainHostDetailsController = Em.Controller.extend({
           callback: completeCallback,
           success: 'deleteHostSuccessCallback',
           error: 'deleteHostErrorCallback'
-        })
+        });
       }
       else {
         completeCallback();
@@ -1644,7 +1656,7 @@ App.MainHostDetailsController = Em.Controller.extend({
     });
   },
   deleteHostSuccessCallback: function (data) {
-    var self = this
+    var self = this;
     App.router.get('updateController').updateHost(function () {
       self.loadConfigs();
       App.router.transitionTo('hosts.index');

http://git-wip-us.apache.org/repos/asf/ambari/blob/15343acd/ambari-web/app/mappers/service_metrics_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js
index bdab96b..28b001a 100644
--- a/ambari-web/app/mappers/service_metrics_mapper.js
+++ b/ambari-web/app/mappers/service_metrics_mapper.js
@@ -191,8 +191,11 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
        * services contains constructed service-components structure from components array
        */
 
-      services.setEach('components', []);
-
+      services.forEach(function(service) {
+        service.host_components = [];
+        service.components = [];
+      });
+      
       json.items.forEach(function (component) {
         var serviceName = component.ServiceComponentInfo.service_name;
         var service = services.findProperty('ServiceInfo.service_name', serviceName);

http://git-wip-us.apache.org/repos/asf/ambari/blob/15343acd/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index b1fe394..0828cda 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -344,7 +344,7 @@ describe('App.MainHostDetailsController', function () {
       clock = sinon.useFakeTimers();
     });
     afterEach(function () {
-      clock.restore()
+      clock.restore();
     });
 
     it('change status of object', function () {
@@ -1923,6 +1923,14 @@ describe('App.MainHostDetailsController', function () {
   });
 
   describe('#_doDeleteHostComponentSuccessCallback()', function () {
+    beforeEach(function() {
+      sinon.stub(controller, 'removeHostComponentModel', Em.K);      
+    });
+    
+    afterEach(function() {
+      controller.removeHostComponentModel.restore();      
+    });
+    
     it('ZOOKEEPER_SERVER component', function () {
       var data = {
         componentName: 'ZOOKEEPER_SERVER'
@@ -1943,6 +1951,14 @@ describe('App.MainHostDetailsController', function () {
       expect(controller.get('_deletedHostComponentResult')).to.be.null;
       expect(controller.get('fromDeleteZkServer')).to.be.false;
     });
+    it('should call `removeHostComponentModel` with correct params', function() {
+      var data = {
+        componentName: 'COMPONENT',
+        hostName: 'h1'
+      };
+      controller._doDeleteHostComponentSuccessCallback({}, {}, data);
+      expect(controller.removeHostComponentModel.calledWith('COMPONENT', 'h1')).to.be.true;
+    });
   });
 
   describe('#upgradeComponentSuccessCallback()', function () {


Mime
View raw message