Skip to content

Commit

Permalink
Move search bar filter definitions to table render.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Jul 26, 2018
1 parent 80779b2 commit eb9495b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,27 @@ export class BeatsTable extends React.Component<BeatsTableProps, BeatsTableState
const tagOptions = this.getTagsOptions();
const typeOptions = this.getTypeOptions();

const searchBarFilters = [
{
type: 'field_value_selection',
field: 'type',
name: 'Type',
options: typeOptions,
},
{
type: 'field_value_selection',
field: 'tag',
name: 'Tags',
options: tagOptions,
},
];

return (
<TableContainer>
<BulkActionControlBar
onBulkAction={this.handleBulkAction}
onSearchQueryChange={this.onSearchQueryChange}
tagOptions={tagOptions}
typeOptions={typeOptions}
searchBarFilters={searchBarFilters}
/>
<EuiInMemoryTable
columns={columns}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,10 @@ interface BulkActionControlBarState {
isPopoverVisible: boolean;
}

interface FilterOption {
value: string;
}

interface BulkActionControlBarProps {
onBulkAction: any;
onSearchQueryChange: any;
tagOptions: FilterOption[];
typeOptions: FilterOption[];
searchBarFilters: any[];
}

export class BulkActionControlBar extends React.Component<
Expand All @@ -45,14 +40,15 @@ export class BulkActionControlBar extends React.Component<
}

public render() {
const { searchBarFilters } = this.props;
const { isPopoverVisible } = this.state;

const bulkActionButton = (
<EuiButton iconSide="right" iconType="arrowDown" onClick={this.showPopover}>
Bulk Action
</EuiButton>
);
const { onSearchQueryChange, tagOptions, typeOptions } = this.props;
const { onSearchQueryChange } = this.props;
const panels = [
{
id: 0,
Expand Down Expand Up @@ -97,20 +93,7 @@ export class BulkActionControlBar extends React.Component<
box={{
incremental: true,
}}
filters={[
{
type: 'field_value_selection',
field: 'type',
name: 'Type',
options: typeOptions,
},
{
type: 'field_value_selection',
field: 'tag',
name: 'Tags',
options: tagOptions,
},
]}
filters={searchBarFilters}
onChange={onSearchQueryChange}
/>
</EuiFlexItem>
Expand Down

0 comments on commit eb9495b

Please sign in to comment.