Repository: ambari Updated Branches: refs/heads/trunk a6df75fd6 -> de18175ff
AMBARI-8823 Install Wizard Step 5 should have a checkbox for 'Select All' instead of 'all/none' (wangy6 via jaoki) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/de18175f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/de18175f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/de18175f Branch: refs/heads/trunk Commit: de18175ff2cbb23603a33cc79f29e1650941d335 Parents: a6df75f Author: Jun Aoki <[email protected]> Authored: Wed Jan 14 13:45:02 2015 -0800 Committer: Jun Aoki <[email protected]> Committed: Wed Jan 14 13:45:02 2015 -0800 ---------------------------------------------------------------------- .../app/controllers/wizard/step4_controller.js | 50 ++++++-------------- ambari-web/app/styles/application.less | 5 ++ ambari-web/app/templates/wizard/step4.hbs | 10 +--- .../test/controllers/wizard/step4_test.js | 30 ++---------- 4 files changed, 25 insertions(+), 70 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/de18175f/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 0f8b998..2620fae 100644 --- a/ambari-web/app/controllers/wizard/step4_controller.js +++ b/ambari-web/app/controllers/wizard/step4_controller.js @@ -30,6 +30,21 @@ App.WizardStep4Controller = Em.ArrayController.extend({ content: [], /** + * Check / Uncheck 'Select All' checkbox with one argument; Check / Uncheck all other checkboxes with more arguments + * @type {bool} + */ + isAllChecked: function(key, value) { + if (arguments.length > 1) { + this.filterProperty('isInstalled', false).setEach('isSelected', value); + return value; + } else { + return this.filterProperty('isInstalled', false). + filterProperty('isHiddenOnSelectServicePage', false). + everyProperty('isSelected', true); + } + }.property('@each.isSelected'), + + /** * Is Submit button disabled * @type {bool} */ @@ -46,46 +61,11 @@ App.WizardStep4Controller = Em.ArrayController.extend({ errorStack: [], /** - * Check whether all properties are selected - * @type {bool} - */ - isAll: function () { - return this.filterProperty('isInstalled', false). - filterProperty('isHiddenOnSelectServicePage', false). - everyProperty('isSelected', true); - }.property('@each.isSelected'), - - /** - * Check whether none properties(minimum) are selected - * @type {bool} - */ - isMinimum: function () { - return this.filterProperty('isInstalled', false). - filterProperty('isHiddenOnSelectServicePage', false). - everyProperty('isSelected', false); - }.property('@each.isSelected'), - - /** * Drop errorStack content on selected state changes. **/ clearErrors: function() { this.set('errorStack', []); }.observes('@each.isSelected'), - /** - * Onclick handler for <code>select all</code> link - * @method selectAll - */ - selectAll: function () { - this.filterProperty('isInstalled', false).setEach('isSelected', true); - }, - - /** - * Onclick handler for <code>select minimum</code> link - * @method selectMinimum - */ - selectMinimum: function () { - this.filterProperty('isInstalled', false).setEach('isSelected', false); - }, /** * Check if multiple distributed file systems were selected http://git-wip-us.apache.org/repos/asf/ambari/blob/de18175f/ambari-web/app/styles/application.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less index 8a28084..1c02346 100644 --- a/ambari-web/app/styles/application.less +++ b/ambari-web/app/styles/application.less @@ -853,6 +853,11 @@ h1 { i.icon-asterisks { color: #00688B; } + th { + input { + margin-right: 5px; + } + } } #step6 { a.remove-link { http://git-wip-us.apache.org/repos/asf/ambari/blob/de18175f/ambari-web/app/templates/wizard/step4.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/wizard/step4.hbs b/ambari-web/app/templates/wizard/step4.hbs index 68a7e0e..71835d5 100644 --- a/ambari-web/app/templates/wizard/step4.hbs +++ b/ambari-web/app/templates/wizard/step4.hbs @@ -25,14 +25,8 @@ <table class="table table-striped"> <thead> <tr> - <th class="span3">{{t common.service}} - <span style="margin-left:10px"> - <a href="#" id="all" {{action selectAll target="controller"}} {{bindAttr - class="isAll:selected:deselected"}}>{{t all}}</a> - | - <a href="#" id="none" {{action selectMinimum target="controller"}} {{bindAttr - class="isMinimum:selected:deselected"}}>{{t none}}</a> - </span> + <th class="span3"> + {{view Ember.Checkbox disabledBinding="isInstalled" checkedBinding="isAllChecked"}}{{t common.service}} </th> <th>{{t common.version}}</th> <th>{{t common.description}}</th> http://git-wip-us.apache.org/repos/asf/ambari/blob/de18175f/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 9d12275..bb4e15d 100644 --- a/ambari-web/test/controllers/wizard/step4_test.js +++ b/ambari-web/test/controllers/wizard/step4_test.js @@ -75,40 +75,16 @@ describe('App.WizardStep4Controller', function () { }); }); - describe('#isAll', function () { + describe('#isAllChecked', function () { it('should return true if all services are selected', function () { controller.setEach('isInstalled', false); controller.findProperty('serviceName', 'HDFS').set('isSelected', true); - expect(controller.get('isAll')).to.equal(true); + expect(controller.get('isAllChecked')).to.equal(true); }); it('should return false if at least one service is not selected', function () { controller.findProperty('serviceName', 'HDFS').set('isSelected', false); - expect(controller.get('isAll')).to.equal(false); - }); - }); - - describe('#isMinimum', function () { - it('should return true if there are no services selected, except disabled', function () { - controller.setEach('isSelected', false); - expect(controller.get('isMinimum')).to.equal(true); - }); - }); - - describe('#selectAll()', function () { - it('should select all services', function () { - controller.setEach('isSelected', false); - controller.selectAll(); - expect(controller.filterProperty('canBeSelected', true).everyProperty('isSelected', true)).to.equal(true); - }); - }); - - describe('#selectMinimum()', function () { - it('should set isSelected false for all services', function () { - controller.setEach('isSelected', true); - controller.selectMinimum(); - expect(controller.findProperty('serviceName', 'HDFS').get('isSelected')).to.equal(false); - expect(controller.filterProperty('isDisabled', false).everyProperty('isSelected', false)).to.equal(true); + expect(controller.get('isAllChecked')).to.equal(false); }); });
