Repository: ambari Updated Branches: refs/heads/trunk efb923547 -> fdf2e2ab1
AMBARI-10756. Combobox items on the right column should be aligned right (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fdf2e2ab Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fdf2e2ab Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fdf2e2ab Branch: refs/heads/trunk Commit: fdf2e2ab13a1ce9724f26dcaa9c16adb20982dcc Parents: efb9235 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Mon Apr 27 12:47:43 2015 +0300 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Mon Apr 27 12:47:43 2015 +0300 ---------------------------------------------------------------------- ambari-web/app/models/configs/section.js | 72 ++++++++++++++++++-- ambari-web/app/models/configs/sub_section.js | 71 +++++++++++++++++-- .../configs/widgets/combo_config_widget.hbs | 2 +- .../configs/widget_popover_support_test.js | 62 ----------------- 4 files changed, 132 insertions(+), 75 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/fdf2e2ab/ambari-web/app/models/configs/section.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/configs/section.js b/ambari-web/app/models/configs/section.js index 56bcf58..92909fb 100644 --- a/ambari-web/app/models/configs/section.js +++ b/ambari-web/app/models/configs/section.js @@ -19,16 +19,57 @@ var App = require('app'); App.Section = DS.Model.extend({ + id: DS.attr('string'), + + /** + * @type {string} + */ name: DS.attr('string'), + + /** + * @type {string} + */ displayName: DS.attr('string'), + + /** + * @type {number} + */ rowIndex: DS.attr('number', {defaultValue: 1}), + + /** + * @type {number} + */ rowSpan: DS.attr('number', {defaultValue: 1}), + + /** + * @type {number} + */ columnIndex: DS.attr('number', {defaultValue: 1}), + + /** + * @type {number} + */ columnSpan: DS.attr('number', {defaultValue: 1}), + + /** + * @type {number} + */ sectionColumns: DS.attr('number', {defaultValue: 1}), + + /** + * @type {number} + */ sectionRows: DS.attr('number', {defaultValue: 1}), + + /** + * @type {App.SubSection[]} + */ subSections: DS.hasMany('App.SubSection'), + + /** + * @type {App.Tab} + */ tab: DS.belongsTo('App.Tab'), /** @@ -40,29 +81,48 @@ App.Section = DS.Model.extend({ return errors.length ? errors.reduce(Em.sum) : 0; }.property('subSections.@each.errorsCount'), + /** + * @type {boolean} + */ isFirstRow: function () { return this.get('rowIndex') == 0; - }.property(), + }.property('rowIndex'), + /** + * @type {boolean} + */ isMiddleRow: function () { return this.get('rowIndex') != 0 && (this.get('rowIndex') + this.get('rowSpan') < this.get('tab.rows')); - }.property(), + }.property('rowIndex', 'rowSpan', 'tab.rows'), + /** + * @type {boolean} + */ isLastRow: function () { return this.get('rowIndex') + this.get('rowSpan') == this.get('tab.rows'); - }.property(), + }.property('rowIndex', 'rowSpan', 'tab.rows'), + /** + * @type {boolean} + */ isFirstColumn: function () { return this.get('columnIndex') == 0; - }.property(), + }.property('columnIndex'), + /** + * @type {boolean} + */ isMiddleColumn: function () { return this.get('columnIndex') != 0 && (this.get('columnIndex') + this.get('columnSpan') < this.get('tab.columns')); - }.property(), + }.property('columnIndex', 'columnSpan', 'tab.columns'), + /** + * @type {boolean} + */ isLastColumn: function () { return this.get('columnIndex') + this.get('columnSpan') == this.get('tab.columns'); - }.property() + }.property('columnIndex', 'columnSpan', 'tab.columns') + }); http://git-wip-us.apache.org/repos/asf/ambari/blob/fdf2e2ab/ambari-web/app/models/configs/sub_section.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/configs/sub_section.js b/ambari-web/app/models/configs/sub_section.js index 1767b5d..54d3559 100644 --- a/ambari-web/app/models/configs/sub_section.js +++ b/ambari-web/app/models/configs/sub_section.js @@ -19,16 +19,57 @@ var App = require('app'); App.SubSection = DS.Model.extend({ + id: DS.attr('string'), + + /** + * @type {string} + */ name: DS.attr('string'), + + /** + * @type {string} + */ displayName: DS.attr('string'), + + /** + * @type {boolean} + */ border: DS.attr('boolean', {defaultValue: false}), + + /** + * @type {number} + */ rowIndex: DS.attr('number', {defaultValue: 1}), + + /** + * @type {number} + */ columnIndex: DS.attr('number', {defaultValue: 1}), + + /** + * @type {number} + */ rowSpan: DS.attr('number', {defaultValue: 1}), + + /** + * @type {number} + */ columnSpan: DS.attr('number', {defaultValue: 1}), + + /** + * @type {App.Section} + */ section: DS.belongsTo('App.Section'), + + /** + * @type {App.StackConfigProperty[]} + */ configProperties: DS.hasMany('App.StackConfigProperty'), + + /** + * @type {App.ServiceConfigProperty[]} + */ configs: [], /** @@ -39,29 +80,47 @@ App.SubSection = DS.Model.extend({ return this.get('configs').filterProperty('isValid', false).length; }.property('configs.@each.isValid'), + /** + * @type {boolean} + */ isFirstRow: function () { return this.get('rowIndex') == 0; - }.property(), + }.property('rowIndex'), + /** + * @type {boolean} + */ isMiddleRow: function () { return this.get('rowIndex') != 0 && (this.get('rowIndex') + this.get('rowSpan') < this.get('section.sectionRows')); - }.property(), + }.property('rowIndex', 'rowSpan', 'section.sectionRows'), + /** + * @type {boolean} + */ isLastRow: function () { return this.get('rowIndex') + this.get('rowSpan') == this.get('section.sectionRows'); - }.property(), + }.property('rowIndex', 'rowSpan', 'section.sectionRows'), + /** + * @type {boolean} + */ isFirstColumn: function () { return this.get('columnIndex') == 0; - }.property(), + }.property('columnIndex'), + /** + * @type {boolean} + */ isMiddleColumn: function () { return this.get('columnIndex') != 0 && (this.get('columnIndex') + this.get('columnSpan') < this.get('section.sectionColumns')); - }.property(), + }.property('columnIndex', 'columnSpan', 'section.sectionColumns'), + /** + * @type {boolean} + */ isLastColumn: function () { return this.get('columnIndex') + this.get('columnSpan') == this.get('section.sectionColumns'); - }.property() + }.property('columnIndex', 'columnSpan', 'section.sectionColumns') }); http://git-wip-us.apache.org/repos/asf/ambari/blob/fdf2e2ab/ambari-web/app/templates/common/configs/widgets/combo_config_widget.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/widgets/combo_config_widget.hbs b/ambari-web/app/templates/common/configs/widgets/combo_config_widget.hbs index ab57419..04a8493 100644 --- a/ambari-web/app/templates/common/configs/widgets/combo_config_widget.hbs +++ b/ambari-web/app/templates/common/configs/widgets/combo_config_widget.hbs @@ -26,7 +26,7 @@ <button {{bindAttr class="view.disabled:disabled :btn :dropdown-toggle"}} data-toggle="dropdown"> <span class="caret"></span> </button> - <ul {{bindAttr class="view.isWidgetInTheRightColumn:pull-right :dropdown-menu"}}> + <ul {{bindAttr class="view.section.isLastColumn:pull-right :dropdown-menu"}}> {{#each item in view.content.valuesList}} <li> <a href="#" {{action setConfigValue item.configValue target="view"}}>{{item.widgetValue}}</a> http://git-wip-us.apache.org/repos/asf/ambari/blob/fdf2e2ab/ambari-web/test/mixins/main/service/configs/widget_popover_support_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mixins/main/service/configs/widget_popover_support_test.js b/ambari-web/test/mixins/main/service/configs/widget_popover_support_test.js index 4d28dc7..557ea91 100644 --- a/ambari-web/test/mixins/main/service/configs/widget_popover_support_test.js +++ b/ambari-web/test/mixins/main/service/configs/widget_popover_support_test.js @@ -25,67 +25,5 @@ describe('App.WidgetPopoverSupport', function () { view = Em.View.create(App.WidgetPopoverSupport, {}); }); - describe.skip('#isWidgetInTheRightColumn', function () { - - Em.A([ - { - v: { - section: { - columnIndex: 1, - columnSpan: 2, - sectionColumns: 3 - }, - tab: { - columns: 3 - }, - subSection: { - columnSpan: 1, - columnIndex: 2 - } - }, - e: true - }, - { - v: { - section: { - columnIndex: 1, - columnSpan: 2, - sectionColumns: 4 - }, - tab: { - columns: 4 - }, - subSection: { - columnSpan: 1, - columnIndex: 2 - } - }, - e: false - }, - { - v: { - section: { - columnIndex: 1, - columnSpan: 2, - sectionColumns: 3 - }, - tab: { - columns: 4 - }, - subSection: { - columnSpan: 1, - columnIndex: 3 - } - }, - e: false - } - ]).forEach(function (test, index) { - it('test #' + index, function () { - view.setProperties(test.v); - expect(view.get('isWidgetInTheRightColumn')).to.equal(test.e); - }); - }); - - }); }); \ No newline at end of file