How to use ilios-common - 6 common examples

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) {
github ilios / frontend / app / components / competency-title-editor.js View on Github external
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { dropTask } from 'ember-concurrency-decorators';
import { validatable, Length, NotBlank } from 'ilios-common/decorators/validation';

@validatable
export default class CompetencyTitleEditorComponent extends Component {
  @Length(1, 200) @NotBlank() @tracked title;

  constructor() {
    super(...arguments);
    this.title = this.args.competency.title;
  }

  @action
  revert() {
    this.title = this.args.competency.title;
  }

  @dropTask
  *save() {
    this.addErrorDisplayFor('title');
    const isValid = yield this.isValid('title');
    if (!isValid) {
github ilios / frontend / app / components / curriculum-inventory-report-overview.js View on Github external
transitionToRollover() {
      this.router.transitionTo('curriculumInventoryReport.rollover', this.report);
      scrollTo('.rollover-form');
    }
  }

ilios-common

Common shared code for ilios ember apps.

MIT
Latest version published 3 months ago

Package Health Score

45 / 100
Full package analysis