Repository: ambari Updated Branches: refs/heads/trunk 9efa8f9c8 -> fd66b4120
AMBARI-11421. Ranger requirements popup is displayed twice (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fd66b412 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fd66b412 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fd66b412 Branch: refs/heads/trunk Commit: fd66b4120c33e01d520e9d644eb88d16d2f655a8 Parents: 9efa8f9 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Wed May 27 15:19:34 2015 +0300 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Wed May 27 15:41:05 2015 +0300 ---------------------------------------------------------------------- .../app/controllers/wizard/step4_controller.js | 15 ++++++++-- .../test/controllers/wizard/step4_test.js | 29 ++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/fd66b412/ambari-web/app/controllers/wizard/step4_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step4_controller.js b/ambari-web/app/controllers/wizard/step4_controller.js index 3b889f9..4eefbcf 100644 --- a/ambari-web/app/controllers/wizard/step4_controller.js +++ b/ambari-web/app/controllers/wizard/step4_controller.js @@ -29,6 +29,8 @@ App.WizardStep4Controller = Em.ArrayController.extend({ */ content: [], + isValidating: false, + /** * Check / Uncheck 'Select All' checkbox with one argument; Check / Uncheck all other checkboxes with more arguments * @type {bool} @@ -64,7 +66,9 @@ App.WizardStep4Controller = Em.ArrayController.extend({ * Drop errorStack content on selected state changes. **/ clearErrors: function() { - this.set('errorStack', []); + if (!this.get('isValidating')) { + this.set('errorStack', []); + } }.observes('@each.isSelected'), /** @@ -155,6 +159,8 @@ App.WizardStep4Controller = Em.ArrayController.extend({ * @method validate **/ validate: function() { + var result; + this.set('isValidating', true); this.serviceDependencyValidation(); this.fileSystemServiceValidation(); if (this.get('wizardController.name') == 'installerController') { @@ -164,9 +170,12 @@ App.WizardStep4Controller = Em.ArrayController.extend({ this.sparkValidation(); if (!!this.get('errorStack').filterProperty('isShown', false).length) { this.showError(this.get('errorStack').findProperty('isShown', false)); - return false; + result = false; + } else { + result = true; } - return true; + this.set('isValidating', false); + return result; }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/fd66b412/ambari-web/test/controllers/wizard/step4_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step4_test.js b/ambari-web/test/controllers/wizard/step4_test.js index 6e803ce..1327a44 100644 --- a/ambari-web/test/controllers/wizard/step4_test.js +++ b/ambari-web/test/controllers/wizard/step4_test.js @@ -778,4 +778,33 @@ describe('App.WizardStep4Controller', function () { }); + describe('#clearErrors', function () { + + var cases = [ + { + isValidating: true, + errorStack: [{}], + title: 'error stack shouldn\'t be cleared during validation' + }, + { + isValidating: false, + errorStack: [], + title: 'error stack should be cleared' + } + ]; + + beforeEach(function () { + controller.set('errorStack', [{}]); + }); + + cases.forEach(function (item) { + it(item.title, function () { + controller.set('isValidating', item.isValidating); + controller.propertyDidChange('@each.isSelected'); + expect(controller.get('errorStack')).to.eql(item.errorStack); + }); + }); + + }); + });