Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show label for filters in filter box in explore #10412

Merged
merged 7 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
Expand All @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,33 +92,37 @@ export default class CollectionControl extends React.Component {
lockAxis="y"
onSortEnd={this.onSortEnd.bind(this)}
>
{this.props.value.map((o, i) => (
<SortableListGroupItem
className="clearfix"
key={this.props.keyAccessor(o)}
index={i}
>
<div className="pull-left m-r-5">
<SortableDragger />
</div>
<div className="pull-left">
<Control
{...this.props}
{...o}
onChange={this.onChange.bind(this, i)}
/>
</div>
<div className="pull-right">
<InfoTooltipWithTrigger
icon="times"
label="remove-item"
tooltip="remove item"
bsStyle="primary"
onClick={this.removeItem.bind(this, i)}
/>
</div>
</SortableListGroupItem>
))}
{this.props.value.map((o, i) => {
// label relevant only for header, not here
const { label, ...commonProps } = this.props;
return (
<SortableListGroupItem
className="clearfix"
key={this.props.keyAccessor(o)}
index={i}
>
<div className="pull-left m-r-5">
<SortableDragger />
</div>
<div className="pull-left">
<Control
{...commonProps}
{...o}
onChange={this.onChange.bind(this, i)}
/>
</div>
<div className="pull-right">
<InfoTooltipWithTrigger
icon="times"
label="remove-item"
tooltip="remove item"
bsStyle="primary"
onClick={this.removeItem.bind(this, i)}
/>
</div>
</SortableListGroupItem>
);
})}
</SortableListGroup>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down