diff --git a/awx/ui_next/src/components/DataListToolbar/DataListToolbar.jsx b/awx/ui_next/src/components/DataListToolbar/DataListToolbar.jsx index c87d8cbc92..1864ebcb5f 100644 --- a/awx/ui_next/src/components/DataListToolbar/DataListToolbar.jsx +++ b/awx/ui_next/src/components/DataListToolbar/DataListToolbar.jsx @@ -39,6 +39,7 @@ function DataListToolbar({ additionalControls, qsConfig, pagination, + enableNegativeFiltering, }) { const showExpandCollapse = onCompact && onExpand; const [isKebabOpen, setIsKebabOpen] = useState(false); @@ -90,6 +91,7 @@ function DataListToolbar({ onReplaceSearch={onReplaceSearch} onShowAdvancedSearch={onShowAdvancedSearch} onRemove={onRemove} + enableNegativeFiltering={enableNegativeFiltering} /> {sortColumns && ( @@ -170,6 +172,7 @@ DataListToolbar.propTypes = { onSelectAll: PropTypes.func, onSort: PropTypes.func, additionalControls: PropTypes.arrayOf(PropTypes.node), + enableNegativeFiltering: PropTypes.bool, }; DataListToolbar.defaultProps = { @@ -188,6 +191,7 @@ DataListToolbar.defaultProps = { onSelectAll: null, onSort: null, additionalControls: [], + enableNegativeFiltering: true, }; export default DataListToolbar; diff --git a/awx/ui_next/src/components/Lookup/HostFilterLookup.jsx b/awx/ui_next/src/components/Lookup/HostFilterLookup.jsx index bdbb0342cc..1d08ea30c7 100644 --- a/awx/ui_next/src/components/Lookup/HostFilterLookup.jsx +++ b/awx/ui_next/src/components/Lookup/HostFilterLookup.jsx @@ -111,13 +111,13 @@ const buildSearchColumns = () => [ function HostFilterLookup({ helperTextInvalid, - isValid, isDisabled, onBlur, onChange, organizationId, value, + enableNegativeFiltering, }) { const history = useHistory(); const location = useLocation(); @@ -342,7 +342,13 @@ function HostFilterLookup({ item={{ ...item, url: `/hosts/${item.id}/details` }} /> )} - renderToolbar={props => } + renderToolbar={props => ( + + )} toolbarSearchColumns={searchColumns} toolbarSortColumns={[ { @@ -374,6 +380,7 @@ HostFilterLookup.propTypes = { onChange: func, organizationId: number, value: string, + enableNegativeFiltering: bool, }; HostFilterLookup.defaultProps = { isValid: true, @@ -381,6 +388,7 @@ HostFilterLookup.defaultProps = { onChange: () => {}, organizationId: null, value: '', + enableNegativeFiltering: true, }; export default withRouter(HostFilterLookup); diff --git a/awx/ui_next/src/components/Search/AdvancedSearch.jsx b/awx/ui_next/src/components/Search/AdvancedSearch.jsx index 2b0d6ba333..ef7d8f497c 100644 --- a/awx/ui_next/src/components/Search/AdvancedSearch.jsx +++ b/awx/ui_next/src/components/Search/AdvancedSearch.jsx @@ -32,6 +32,7 @@ function AdvancedSearch({ searchableKeys, relatedSearchableKeys, maxSelectHeight, + enableNegativeFiltering, }) { // TODO: blocked by pf bug, eventually separate these into two groups in the select // for now, I'm spreading set to get rid of duplicate keys...when they are grouped @@ -111,12 +112,14 @@ function AdvancedSearch({ value="or" description={t`Returns results that satisfy this one or any other filters.`} /> - + {enableNegativeFiltering && ( + + )}