Repository: ambari Updated Branches: refs/heads/trunk de4499546 -> fa2f440a5
AMBARI-17097. Unable to uncheck Ranger Tagsync in Add Service wizard (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fa2f440a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fa2f440a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fa2f440a Branch: refs/heads/trunk Commit: fa2f440a5fc083a53ce88e94ca9c6542ac121eb6 Parents: de44995 Author: Aleksandr Kovalenko <[email protected]> Authored: Tue Jun 7 17:30:01 2016 +0300 Committer: Aleksandr Kovalenko <[email protected]> Committed: Wed Jun 8 14:04:32 2016 +0300 ---------------------------------------------------------------------- .../app/controllers/wizard/step6_controller.js | 18 +++++++---- .../test/controllers/wizard/step6_test.js | 33 +++++++++++++++----- 2 files changed, 38 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/fa2f440a/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 e1d3953..e900f47 100644 --- a/ambari-web/app/controllers/wizard/step6_controller.js +++ b/ambari-web/app/controllers/wizard/step6_controller.js @@ -445,6 +445,9 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { host.checkboxes.forEach(function(checkbox) { checkbox.isInstalled = installedComponents.contains(checkbox.component); + if (checkbox.isInstalled) { + checkbox.checked = true; + } }); }); }, @@ -494,14 +497,17 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { var checkboxes = host.checkboxes; var hostComponents = recommendedMap[host.hostName] || []; checkboxes.forEach(function (checkbox) { - var checked = hostComponents.contains(checkbox.component); + var checked; + if (!checkbox.isDisabled) { + checked = hostComponents.contains(checkbox.component); - if (checkbox.component === 'CLIENT' && !checked) { - checked = hostComponents.some(function(componentName) { - return clientComponentsMap[componentName]; - }); + if (checkbox.component === 'CLIENT' && !checked) { + checked = hostComponents.some(function (componentName) { + return clientComponentsMap[componentName]; + }); + } + checkbox.checked = checked; } - checkbox.checked = checked; }); }); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/fa2f440a/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 bfef7ea..ed8f16a 100644 --- a/ambari-web/test/controllers/wizard/step6_test.js +++ b/ambari-web/test/controllers/wizard/step6_test.js @@ -259,11 +259,13 @@ describe('App.WizardStep6Controller', function () { checkboxes: [ { component: 'C1', - isInstalled: false + isInstalled: false, + checked: false }, { component: 'C2', - isInstalled: false + isInstalled: false, + checked: false } ] }]; @@ -288,6 +290,8 @@ describe('App.WizardStep6Controller', function () { controller.setInstalledComponents(hostsObj); expect(hostsObj[0].checkboxes[0].isInstalled).to.be.true; expect(hostsObj[0].checkboxes[1].isInstalled).to.be.false; + expect(hostsObj[0].checkboxes[0].checked).to.be.true; + expect(hostsObj[0].checkboxes[1].checked).to.be.false; }); }); @@ -369,15 +373,23 @@ describe('App.WizardStep6Controller', function () { checkboxes: [ { component: 'C1', - checked: false + checked: false, + isDisabled: false }, { component: 'C2', - checked: false + checked: false, + isDisabled: true + }, + { + component: 'C3', + checked: false, + isDisabled: false }, { component: 'CLIENT', - checked: false + checked: false, + isDisabled: false } ] }]; @@ -389,6 +401,7 @@ describe('App.WizardStep6Controller', function () { name: 'g1', components: [ {name: 'C1'}, + {name: 'C2'}, {name: 'C_CLIENT'} ] } @@ -418,16 +431,22 @@ describe('App.WizardStep6Controller', function () { expect(hostsObj[0].checkboxes[0].checked).to.be.true; }); - it("C2 should not be checked", function() { + it("C2 should not be checked, as it is disabled", function() { controller.set('content.recommendations', recommendations); controller.selectRecommendedComponents(hostsObj); expect(hostsObj[0].checkboxes[1].checked).to.be.false; }); + it("C3 should not be checked", function() { + controller.set('content.recommendations', recommendations); + controller.selectRecommendedComponents(hostsObj); + expect(hostsObj[0].checkboxes[2].checked).to.be.false; + }); + it("CLIENT should be checked", function() { controller.set('content.recommendations', recommendations); controller.selectRecommendedComponents(hostsObj); - expect(hostsObj[0].checkboxes[2].checked).to.be.true; + expect(hostsObj[0].checkboxes[3].checked).to.be.true; }); });
