From c9ffc0e7c14a0e9c2bdf6663d8f1811558e72175 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Fri, 29 Sep 2017 14:20:53 -0700 Subject: [PATCH] adding extra logic check for ansible_facts in smart search a change related to related-group-searches caused a regression when searching for ansible_facts --- .../src/shared/smart-search/smart-search.controller.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/shared/smart-search/smart-search.controller.js b/awx/ui/client/src/shared/smart-search/smart-search.controller.js index a673d0e783..cb42b09984 100644 --- a/awx/ui/client/src/shared/smart-search/smart-search.controller.js +++ b/awx/ui/client/src/shared/smart-search/smart-search.controller.js @@ -194,15 +194,18 @@ export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', ' } else { let root = termParts[0].split(".")[0].replace(/^-/, ''); - if(_.has($scope.models[$scope.list.name].base, root)) { - if($scope.models[$scope.list.name].base[root].type && $scope.models[$scope.list.name].base[root].type === 'field') { + if(_.has($scope.models[$scope.list.name].base, root) || root === "ansible_facts") { + if(_.has($scope.models[$scope.list.name].base[root], "type") && $scope.models[$scope.list.name].base[root].type === 'field'){ + // Intent is to land here for searching on the base model. params = _.merge(params, qs.encodeParam({term: term, relatedSearchTerm: true, singleSearchParam: $scope.singleSearchParam ? $scope.singleSearchParam : false}), combineSameSearches); } else { + // Intent is to land here when performing ansible_facts searches params = _.merge(params, qs.encodeParam({term: term, searchTerm: true, singleSearchParam: $scope.singleSearchParam ? $scope.singleSearchParam : false}), combineSameSearches); } } else if(_.contains($scope.models[$scope.list.name].related, root)) { + // Intent is to land here for related searches params = _.merge(params, qs.encodeParam({term: term, relatedSearchTerm: true, singleSearchParam: $scope.singleSearchParam ? $scope.singleSearchParam : false}), combineSameSearches); } // Its not a search term or a related search term - treat it as a string