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 && (
+
+ )}
', () => {
wrapper.update();
expect(advancedSearchMock).toBeCalledWith('', 'baz');
});
+
+ test('Remove not operator from set type', () => {
+ wrapper = mountWithContexts(
+
+ );
+ wrapper
+ .find('Select[aria-label="Set type select"] SelectToggle')
+ .simulate('click');
+ const selectOptions = wrapper.find(
+ 'Select[aria-label="Set type select"] SelectOption'
+ );
+ expect(selectOptions).toHaveLength(2);
+ expect(
+ selectOptions.find('SelectOption[id="or-option-select"]').prop('value')
+ ).toBe('or');
+ expect(
+ selectOptions.find('SelectOption[id="and-option-select"]').prop('value')
+ ).toBe('and');
+ });
});
diff --git a/awx/ui_next/src/components/Search/Search.jsx b/awx/ui_next/src/components/Search/Search.jsx
index 9b4751b47d..9b422dad62 100644
--- a/awx/ui_next/src/components/Search/Search.jsx
+++ b/awx/ui_next/src/components/Search/Search.jsx
@@ -32,7 +32,6 @@ const NoOptionDropdown = styled.div`
function Search({
columns,
-
onSearch,
onReplaceSearch,
onRemove,
@@ -43,6 +42,7 @@ function Search({
onShowAdvancedSearch,
isDisabled,
maxSelectHeight,
+ enableNegativeFiltering,
}) {
const [isSearchDropdownOpen, setIsSearchDropdownOpen] = useState(false);
const [searchKey, setSearchKey] = useState(
@@ -206,6 +206,7 @@ function Search({
searchableKeys={searchableKeys}
relatedSearchableKeys={relatedSearchableKeys}
maxSelectHeight={maxSelectHeight}
+ enableNegativeFiltering={enableNegativeFiltering}
/>
)) ||
(options && (
@@ -325,6 +326,7 @@ Search.propTypes = {
onShowAdvancedSearch: PropTypes.func.isRequired,
isDisabled: PropTypes.bool,
maxSelectHeight: PropTypes.string,
+ enableNegativeFiltering: PropTypes.bool,
};
Search.defaultProps = {
@@ -332,6 +334,7 @@ Search.defaultProps = {
onRemove: null,
isDisabled: false,
maxSelectHeight: '300px',
+ enableNegativeFiltering: true,
};
export default withRouter(Search);
diff --git a/awx/ui_next/src/screens/Inventory/shared/SmartInventoryForm.jsx b/awx/ui_next/src/screens/Inventory/shared/SmartInventoryForm.jsx
index 766f169094..77523ffe32 100644
--- a/awx/ui_next/src/screens/Inventory/shared/SmartInventoryForm.jsx
+++ b/awx/ui_next/src/screens/Inventory/shared/SmartInventoryForm.jsx
@@ -81,6 +81,7 @@ const SmartInventoryFormFields = ({ inventory }) => {
onBlur={() => hostFilterHelpers.setTouched()}
isValid={!hostFilterMeta.touched || !hostFilterMeta.error}
isDisabled={!organizationField.value}
+ enableNegativeFiltering={false}
/>