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 ad14dd5344..2ac0550a2b 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 @@ -235,10 +235,14 @@ function SmartSearchController ( }; $scope.clearAllTerms = () => { + _.forOwn(defaults, (value, key) => { + // preserve the `credential_type` queryset param if it exists + if (key === 'credential_type') { + defaults[key] = queryset[key]; + } + }); const cleared = _(defaults).omit(_.isNull).value(); - delete cleared.page; - queryset = cleared; if (!$scope.querySet) { diff --git a/awx/ui/client/src/shared/stateDefinitions.factory.js b/awx/ui/client/src/shared/stateDefinitions.factory.js index a7a437ef11..8972b9c19a 100644 --- a/awx/ui/client/src/shared/stateDefinitions.factory.js +++ b/awx/ui/client/src/shared/stateDefinitions.factory.js @@ -880,7 +880,11 @@ function($injector, $stateExtender, $log, i18n) { $stateParams[`${list.iterator}_search`].role_level = "admin_role"; $stateParams[`${list.iterator}_search`].credential_type = InsightsCredTypePK.toString() ; } - + if(list.iterator === 'credential') { + if($state.current.name.includes('projects.edit') || $state.current.name.includes('projects.add')) { + state.params[`${list.iterator}_search`].value = _.merge(state.params[`${list.iterator}_search`].value, $stateParams[`${list.iterator}_search`]); + } + } return qs.search(path, $stateParams[`${list.iterator}_search`]); }