How to use the ilios-common/utils/query-utils.cleanQuery function in ilios-common

To help you get started, we’ve selected a few ilios-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ilios / frontend / app / components / global-search-box.js View on Github external
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 });
github ilios / frontend / app / components / global-search-box.js View on Github external
search() {
      const q = cleanQuery(this.query);

      if (q.length > 0) {
        this.autocompleteCache = [];
        this.search(q);
        this.set('showResults', false);
      }
    },
github ilios / frontend / app / components / ilios-users.js View on Github external
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(),
github ilios / frontend / app / components / manage-users-summary.js View on Github external
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) {

ilios-common

Common shared code for ilios ember apps.

MIT
Latest version published 3 months ago

Package Health Score

45 / 100
Full package analysis