From f6a960d8f49bbd3aa0431f16d28daf540f8a000d Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 1 Aug 2018 19:40:53 -0700 Subject: [PATCH] Changes the encodeQuerysetObject function for the job details search widget With this change, the stdout search will perform a search like search=A,B instead of search=A&search=B --- awx/ui/client/features/output/index.js | 1 + .../src/shared/smart-search/queryset.service.js | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/awx/ui/client/features/output/index.js b/awx/ui/client/features/output/index.js index 5434ab29d9..70ce3f2572 100644 --- a/awx/ui/client/features/output/index.js +++ b/awx/ui/client/features/output/index.js @@ -92,6 +92,7 @@ function resolveResource ( if (job_event_search) { // eslint-disable-line camelcase const query = qs.encodeQuerysetObject(qs.decodeArr(job_event_search)); + Object.assign(config.params, query); } diff --git a/awx/ui/client/src/shared/smart-search/queryset.service.js b/awx/ui/client/src/shared/smart-search/queryset.service.js index 392ead279b..edfa33dcdf 100644 --- a/awx/ui/client/src/shared/smart-search/queryset.service.js +++ b/awx/ui/client/src/shared/smart-search/queryset.service.js @@ -80,16 +80,15 @@ function QuerysetService ($q, Rest, ProcessErrors, $rootScope, Wait, DjangoSearc }, // like encodeQueryset, but return an actual unstringified API-consumable http param object encodeQuerysetObject(params) { - console.log(params); return _.reduce(params, (obj, value, key) => { - const encodedTerms = this.encodeTerms(value, key); - console.log(encodedTerms); - for (let encodedIndex in encodedTerms) { - const [encodedKey, encodedValue] = encodedTerms[encodedIndex]; - obj[encodedKey] = obj[encodedKey] || []; - obj[encodedKey].push(encodedValue); - } - console.log(obj); + const encodedKey = this.replaceDefaultFlags(key); + const values = Array.isArray(value) ? value : [value]; + + obj[encodedKey] = values + .map(value => this.replaceDefaultFlags(value)) + .map(value => this.replaceEncodedTokens(value)) + .join(','); + return obj; }, {}); },