1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Separates search dropdown items from sort dropdown items

This commit is contained in:
mabashian 2018-12-17 13:16:08 -05:00
parent 21cf1d85e3
commit 6ce88fdf4d

View File

@ -1,6 +1,6 @@
import React from 'react';
import { I18n } from '@lingui/react';
import { Trans, t } from '@lingui/macro';
import { t } from '@lingui/macro';
import {
Button,
Checkbox,
@ -115,7 +115,17 @@ class DataListToolbar extends React.Component {
return icon;
};
const dropdownItems = columns.filter(({ key }) => key !== searchKey).map(({ key, name }) => (
const searchDropdownItems = columns
.filter(({ key }) => key !== searchKey)
.map(({ key, name }) => (
<DropdownItem key={key} component="button">
{ name }
</DropdownItem>
));
const sortDropdownItems = columns
.filter(({ key, isSortable }) => isSortable && key !== sortedColumnKey)
.map(({ key, name }) => (
<DropdownItem key={key} component="button">
{ name }
</DropdownItem>
@ -153,7 +163,7 @@ class DataListToolbar extends React.Component {
{ searchColumnName }
</DropdownToggle>
)}
dropdownItems={dropdownItems}
dropdownItems={searchDropdownItems}
/>
<TextInput
type="search"
@ -185,7 +195,7 @@ class DataListToolbar extends React.Component {
{ sortedColumnName }
</DropdownToggle>
)}
dropdownItems={dropdownItems}
dropdownItems={sortDropdownItems}
/>
</ToolbarItem>
<ToolbarItem>