diff --git a/awx/ui_next/src/components/Lookup/HostFilterLookup.jsx b/awx/ui_next/src/components/Lookup/HostFilterLookup.jsx index dbbf5a1d9a..e819973083 100644 --- a/awx/ui_next/src/components/Lookup/HostFilterLookup.jsx +++ b/awx/ui_next/src/components/Lookup/HostFilterLookup.jsx @@ -84,12 +84,13 @@ const buildSearchColumns = i18n => [ key: 'groups__name', }, { - name: i18n._(t`Inventory`), + name: i18n._(t`Inventory ID`), key: 'inventory', }, { name: i18n._(t`Enabled`), key: 'enabled', + isBoolean: true, }, { name: i18n._(t`Instance ID`), @@ -103,10 +104,6 @@ const buildSearchColumns = i18n => [ name: i18n._(t`Insights system ID`), key: 'insights_system_id', }, - { - name: i18n._(t`Ansible facts modified`), - key: 'ansible_facts_modified', - }, ]; function HostFilterLookup({ diff --git a/awx/ui_next/src/components/Lookup/shared/HostFilterUtils.jsx b/awx/ui_next/src/components/Lookup/shared/HostFilterUtils.jsx index e8996bf2d6..27be7b3c99 100644 --- a/awx/ui_next/src/components/Lookup/shared/HostFilterUtils.jsx +++ b/awx/ui_next/src/components/Lookup/shared/HostFilterUtils.jsx @@ -7,13 +7,14 @@ export function toSearchParams(string = '') { if (string === '') { return {}; } - return string .replace(/^\?/, '') - .replace(/&/, ' and ') + .replace(/&/g, ' and ') .split(/ and | or /) .map(s => s.split('=')) - .reduce((searchParams, [key, value]) => { + .reduce((searchParams, [k, v]) => { + const key = decodeURIComponent(k); + const value = decodeURIComponent(v); if (searchParams[key] === undefined) { searchParams[key] = value; } else if (Array.isArray(searchParams[key])) { @@ -61,13 +62,9 @@ export function toHostFilter(searchParams = {}) { return Object.keys(searchParams) .flatMap(key => { if (Array.isArray(searchParams[key])) { - return searchParams[key].map( - val => `${encodeURIComponent(key)}=${encodeURIComponent(val)}` - ); + return searchParams[key].map(val => `${key}=${val}`); } - return `${encodeURIComponent(key)}=${encodeURIComponent( - searchParams[key] - )}`; + return `${key}=${searchParams[key]}`; }) .join(' and '); } diff --git a/awx/ui_next/src/components/Search/Search.jsx b/awx/ui_next/src/components/Search/Search.jsx index 916629c691..8049a326e7 100644 --- a/awx/ui_next/src/components/Search/Search.jsx +++ b/awx/ui_next/src/components/Search/Search.jsx @@ -97,13 +97,16 @@ function Search({ }; const getLabelFromValue = (value, colKey) => { + let label = value; const currentSearchColumn = columns.find(({ key }) => key === colKey); if (currentSearchColumn?.options?.length) { - return currentSearchColumn.options.find( + [, label] = currentSearchColumn.options.find( ([optVal]) => optVal === value - )[1]; + ); + } else if (currentSearchColumn?.booleanLabels) { + label = currentSearchColumn.booleanLabels[value]; } - return value.toString(); + return label.toString(); }; const getChipsByKey = () => { @@ -227,7 +230,7 @@ function Search({ aria-label={name} onToggle={setIsFilterDropdownOpen} onSelect={(event, selection) => onReplaceSearch(key, selection)} - selections={chipsByKey[key].chips[0]} + selections={chipsByKey[key].chips[0]?.label} isOpen={isFilterDropdownOpen} placeholderText={`Filter By ${name}`} > diff --git a/awx/ui_next/src/screens/Inventory/shared/SmartInventoryForm.jsx b/awx/ui_next/src/screens/Inventory/shared/SmartInventoryForm.jsx index 971f848142..12cd3ee215 100644 --- a/awx/ui_next/src/screens/Inventory/shared/SmartInventoryForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/SmartInventoryForm.jsx @@ -81,7 +81,6 @@ const SmartInventoryFormFields = withI18n()(({ i18n }) => { id="variables" name="variables" label={i18n._(t`Variables`)} - promptId="variables" tooltip={i18n._( t`Enter inventory variables using either JSON or YAML syntax. Use the radio button to toggle between the two. Refer to the