Repository: ambari Updated Branches: refs/heads/branch-2.4 1e4fc9a7d -> e47be7958
AMBARI-16941. Cluster install wizard hangs and cannot proceed if Knox is the only service selected for install (alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e47be795 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e47be795 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e47be795 Branch: refs/heads/branch-2.4 Commit: e47be7958442e9e7ee0b5f52a8d145018ac027e6 Parents: 1e4fc9a Author: Alex Antonenko <[email protected]> Authored: Mon May 30 14:17:35 2016 +0300 Committer: Alex Antonenko <[email protected]> Committed: Mon May 30 14:17:47 2016 +0300 ---------------------------------------------------------------------- .../app/controllers/wizard/step6_controller.js | 4 +- .../test/controllers/wizard/step6_test.js | 54 ++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/e47be795/ambari-web/app/controllers/wizard/step6_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step6_controller.js b/ambari-web/app/controllers/wizard/step6_controller.js index 6090f74..9e1dce9 100644 --- a/ambari-web/app/controllers/wizard/step6_controller.js +++ b/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('[email protected]'), /** @@ -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('[email protected]'), /** http://git-wip-us.apache.org/repos/asf/ambari/blob/e47be795/ambari-web/test/controllers/wizard/step6_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js index 56b9e96..bfef7ea 100644 --- a/ambari-web/test/controllers/wizard/step6_test.js +++ b/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); + }) + }); + }); });
