ソースを参照

AMBARI-16941. Cluster install wizard hangs and cannot proceed if Knox is the only service selected for install (alexantonenko)

Alex Antonenko 9 年 前
コミット
e47be79584

+ 2 - 2
ambari-web/app/controllers/wizard/step6_controller.js

@@ -144,7 +144,7 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, {
   anyGeneralIssues: Em.computed.or('anyGeneralErrors', 'anyGeneralWarnings'),
 
   anyHostErrors: function () {
-    return this.get('hosts').some(function(h) { return h.errorMessages.length > 0; });
+    return this.get('hosts').some(function(h) { return h.errorMessages ? (h.errorMessages.length > 0) : false;});
   }.property('hosts.@each.errorMessages'),
 
   /**
@@ -153,7 +153,7 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, {
   anyErrors: Em.computed.or('anyGeneralErrors', 'anyHostErrors'),
 
   anyHostWarnings: function () {
-    return this.get('hosts').some(function(h) { return h.warnMessages.length > 0; });
+    return this.get('hosts').some(function(h) { return h.warnMessages ? (h.warnMessages.length > 0) : false;});
   }.property('hosts.@each.warnMessages'),
 
   /**

+ 54 - 0
ambari-web/test/controllers/wizard/step6_test.js

@@ -1825,5 +1825,59 @@ describe('App.WizardStep6Controller', function () {
     });
 
   });
+   
+  describe('#anyHostErrors', function () {
+
+    var tests = [
+    {
+       it: "anyHostErrors returns true if errorMessages are defined",
+       host: Em.A([Em.Object.create({
+          errorMessages: "Error Message"
+       })]),
+       result: true
+     },
+     {
+       it: "anyHostErrors returns false if errorMessages are not defined",
+       host: Em.A([Em.Object.create({
+       })]),
+       result: false
+     }
+    ];
+
+    tests.forEach(function(test) {
+      it(test.it, function() {
+        controller.set('hosts', test.host);
+        expect(controller.get('anyHostErrors')).to.equal(test.result);
+      })
+    });   
+  });
+
+
+   
+  describe('#anyHostWarnings', function () {
+
+    var tests = [
+    {
+       it: "anyHostWarnings returns true if warnMessages are defined",
+       host: Em.A([Em.Object.create({
+          warnMessages: "Warning Message"
+       })]),
+       result: true
+     },
+     {
+       it: "anyHostWarnings returns false if warnMessages are not defined",
+       host: Em.A([Em.Object.create({
+       })]),
+       result: false
+     }
+    ];
+
+    tests.forEach(function(test) {
+      it(test.it, function() {
+        controller.set('hosts', test.host);
+        expect(controller.get('anyHostWarnings')).to.equal(test.result);
+      })
+    });   
+  });
 
 });