Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
autocomplete: task(function* () {
this.set('showResults', true);
const q = cleanQuery(this.query);
if (isBlank(q) || q.length < MIN_INPUT) {
return [];
}
const cachedResults = this.findCachedAutocomplete(q);
if (cachedResults.length) {
return cachedResults.map(text => {
return { text };
});
}
yield timeout(DEBOUNCE_MS);
const { autocomplete } = yield this.iliosSearch.forCurriculum(q, true);
this.autocompleteCache.pushObject({ q, autocomplete });
search() {
const q = cleanQuery(this.query);
if (q.length > 0) {
this.autocompleteCache = [];
this.search(q);
this.set('showResults', false);
}
},
searchForUsers: task(function* () {
const query = this.query;
const q = cleanQuery(query);
yield timeout(DEBOUNCE_TIMEOUT);
const { store, offset, limit } = this;
return yield store.query('user', {
limit, q, offset,
'order_by[lastName]': 'ASC',
'order_by[firstName]': 'ASC'
});
}).cancelOn('deactivate').restartable(),
searchForUsers: task(function * (query) {
const intl = this.intl;
const q = cleanQuery(query);
if (isBlank(q)) {
yield timeout(1);
return [];
}
yield timeout(DEBOUNCE_MS);
if (q.length < MIN_INPUT) {
return [{
type: 'text',
text: intl.t('general.moreInputRequiredPrompt')
}];
}
const searchEnabled = yield this.iliosConfig.searchEnabled;
const searchResults = searchEnabled ? yield this.indexSearch(q) : yield this.apiSearch(q);
if (searchResults.length === 0) {