瀏覽代碼

AMBARI-3443. "Assign Slaves and Clients" step. "all | none" click error. (onechiporenko)

Oleg Nechiporenko 12 年之前
父節點
當前提交
7e538964cd

+ 3 - 4
ambari-web/app/controllers/wizard/step6_controller.js

@@ -132,7 +132,7 @@ App.WizardStep6Controller = Em.Controller.extend({
    */
   setAllNodes: function (label, checked) {
     this.get('hosts').forEach(function (host) {
-      host.get('checkboxes').forEach(function (checkbox) {
+      host.get('checkboxes').filterProperty('isInstalled', false).forEach(function (checkbox) {
         if (checkbox.get('title') === label) {
           checkbox.set('checked', checked);
         }
@@ -161,7 +161,7 @@ App.WizardStep6Controller = Em.Controller.extend({
     var allTrue = true;
     var allFalse = true;
     hosts.forEach(function (host) {
-      host.get('checkboxes').forEach(function (cb) {
+      host.get('checkboxes').filterProperty('isInstalled', false).forEach(function (cb) {
         if (cb.get('title') === title) {
           allTrue &= cb.get('checked');
           allFalse &= !cb.get('checked');
@@ -464,5 +464,4 @@ App.WizardStep6Controller = Em.Controller.extend({
     return !isError;
   }
 
-})
-;
+});

+ 1 - 1
ambari-web/test/controllers/main/service/reassign_controller_test.js

@@ -27,7 +27,7 @@ describe('App.ReassignMasterController', function () {
 
   describe('#totalSteps', function () {
     it('check', function () {
-      expect(reassignMasterController.get('totalSteps')).to.equal(4);
+      expect(reassignMasterController.get('totalSteps')).to.equal(6);
     });
   });
 

+ 4 - 1
ambari-web/test/installer/step6_test.js

@@ -137,7 +137,10 @@ describe('App.WizardStep6Controller', function () {
         controller.setAllNodes(test.title, test.state);
         var hosts = controller.get('hosts');
         hosts.forEach(function(host) {
-          expect(host.get('checkboxes').findProperty('title', test.title).get('checked')).to.equal(test.state);
+          var cb = host.get('checkboxes').filterProperty('isInstalled', false).findProperty('title', test.title);
+          if (cb) {
+            expect(cb.get('checked')).to.equal(test.state);
+          }
         });
       });
     });

+ 6 - 3
ambari-web/test/mappers/status_mapper_test.js

@@ -34,7 +34,8 @@ describe('App.statusMapper', function () {
                 {
                   HostRoles : {
                     component_name: "OOZIE_CLIENT",
-                    host_name: "ip-10-40-35-199.ec2.internal"
+                    host_name: "ip-10-40-35-199.ec2.internal",
+                    state: "STATE"
                   }
                 }
               ]
@@ -44,9 +45,11 @@ describe('App.statusMapper', function () {
       ]
     };
     var result = App.statusMapper.parse_host_components(test_data);
-    var e = 'OOZIE_CLIENT_ip-10-40-35-199.ec2.internal';
+    var k = 'OOZIE_CLIENT_ip-10-40-35-199.ec2.internal';
+    var e = 'STATE';
+    console.log(result);
     it('get host_component id', function() {
-      expect(result[e].id).to.equal(e);
+      expect(result[k].work_status).to.equal(e);
     });
   });