diff --git a/superset-frontend/spec/javascripts/explore/components/FilterBoxItemControl_spec.jsx b/superset-frontend/spec/javascripts/explore/components/FilterBoxItemControl_spec.jsx index fb942459b8b74..d5300256dc219 100644 --- a/superset-frontend/spec/javascripts/explore/components/FilterBoxItemControl_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/components/FilterBoxItemControl_spec.jsx @@ -27,6 +27,7 @@ import FormRow from 'src/components/FormRow'; import datasources from '../../../fixtures/mockDatasource'; const defaultProps = { + label: 'some label', datasource: datasources['7__table'], onChange: sinon.spy(), }; @@ -51,6 +52,9 @@ describe('FilterBoxItemControl', () => { it('renderForms does the job', () => { const popover = shallow(inst.renderForm()); expect(popover.find(FormRow)).toHaveLength(8); + expect(popover.find(FormRow).get(1).props.control.props.value).toEqual( + 'some label', + ); }); it('convert type for single value filter_box', () => { diff --git a/superset-frontend/src/explore/components/controls/CollectionControl.jsx b/superset-frontend/src/explore/components/controls/CollectionControl.jsx index cdc630356b96f..0a19864e32fcc 100644 --- a/superset-frontend/src/explore/components/controls/CollectionControl.jsx +++ b/superset-frontend/src/explore/components/controls/CollectionControl.jsx @@ -92,33 +92,37 @@ export default class CollectionControl extends React.Component { lockAxis="y" onSortEnd={this.onSortEnd.bind(this)} > - {this.props.value.map((o, i) => ( - -
- -
-
- -
-
- -
-
- ))} + {this.props.value.map((o, i) => { + // label relevant only for header, not here + const { label, ...commonProps } = this.props; + return ( + +
+ +
+
+ +
+
+ +
+
+ ); + })} ); } diff --git a/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx b/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx index 3df9ae89aed6a..8e4b21e8a9f8e 100644 --- a/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx +++ b/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx @@ -52,6 +52,7 @@ const propTypes = { clearable: PropTypes.bool, multiple: PropTypes.bool, column: PropTypes.string, + label: PropTypes.string, metric: PropTypes.string, searchAllOptions: PropTypes.bool, defaultValue: PropTypes.string, @@ -77,11 +78,13 @@ export default class FilterBoxItemControl extends React.Component { clearable, multiple, searchAllOptions, + label, defaultValue, } = props; const state = { column, metric, + label, asc, clearable, multiple,