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
This commit is contained in:
Jared Tabor 2018-08-01 19:40:53 -07:00
parent b191f6cfc3
commit f6a960d8f4
No known key found for this signature in database
GPG Key ID: CC50E67C506270C9
2 changed files with 9 additions and 9 deletions

View File

@ -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);
}

View File

@ -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;
}, {});
},