mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 23:37:39 -02:30
Merge pull request #2847 from marshmalien/testing-smart-inv-host-filter
Fix host_filter smart search bug when searching by "or" operator Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
function searchWithoutKey (term, singleSearchParam = null) {
|
function searchWithoutKey (term, singleSearchParam = null) {
|
||||||
if (singleSearchParam) {
|
if (singleSearchParam === 'host_filter') {
|
||||||
|
return { [singleSearchParam]: `${encodeURIComponent(term)}` };
|
||||||
|
} else if (singleSearchParam) {
|
||||||
return { [singleSearchParam]: `search=${encodeURIComponent(term)}` };
|
return { [singleSearchParam]: `search=${encodeURIComponent(term)}` };
|
||||||
}
|
}
|
||||||
return { search: encodeURIComponent(term) };
|
return { search: encodeURIComponent(term) };
|
||||||
@@ -370,7 +372,8 @@ function QuerysetService ($q, Rest, ProcessErrors, $rootScope, Wait, DjangoSearc
|
|||||||
},
|
},
|
||||||
getSearchInputQueryset (searchInput, isFilterableBaseField = null, isRelatedField = null, isAnsibleFactField = null, singleSearchParam = null) {
|
getSearchInputQueryset (searchInput, isFilterableBaseField = null, isRelatedField = null, isAnsibleFactField = null, singleSearchParam = null) {
|
||||||
// XXX Should find a better approach than passing in the two 'is...Field' callbacks XXX
|
// XXX Should find a better approach than passing in the two 'is...Field' callbacks XXX
|
||||||
const space = '%20and%20';
|
const encodedAnd = '%20and%20';
|
||||||
|
const encodedOr = '%20or%20';
|
||||||
let params = {};
|
let params = {};
|
||||||
|
|
||||||
// Remove leading/trailing whitespace if there is any
|
// Remove leading/trailing whitespace if there is any
|
||||||
@@ -398,7 +401,13 @@ function QuerysetService ($q, Rest, ProcessErrors, $rootScope, Wait, DjangoSearc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (singleSearchParam) {
|
if (singleSearchParam) {
|
||||||
return `${a}${space}${b}`;
|
if (b === 'or') {
|
||||||
|
return `${a}${encodedOr}`;
|
||||||
|
} else if (a.match(/%20or%20$/g)) {
|
||||||
|
return `${a}${b}`;
|
||||||
|
} else {
|
||||||
|
return `${a}${encodedAnd}${b}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [a, b];
|
return [a, b];
|
||||||
|
|||||||
Reference in New Issue
Block a user