github.com/outbrain/consul@v1.4.5/ui-v2/app/controllers/dc/acls/tokens/index.js (about)

     1  import Controller from '@ember/controller';
     2  import { get } from '@ember/object';
     3  import WithFiltering from 'consul-ui/mixins/with-filtering';
     4  export default Controller.extend(WithFiltering, {
     5    queryParams: {
     6      s: {
     7        as: 'filter',
     8        replace: true,
     9      },
    10    },
    11    filter: function(item, { s = '', type = '' }) {
    12      const sLower = s.toLowerCase();
    13      return (
    14        get(item, 'AccessorID')
    15          .toLowerCase()
    16          .indexOf(sLower) !== -1 ||
    17        get(item, 'Name')
    18          .toLowerCase()
    19          .indexOf(sLower) !== -1 ||
    20        get(item, 'Description')
    21          .toLowerCase()
    22          .indexOf(sLower) !== -1 ||
    23        (get(item, 'Policies') || []).some(function(item) {
    24          return item.Name.toLowerCase().indexOf(sLower) !== -1;
    25        })
    26      );
    27    },
    28    actions: {
    29      sendClone: function(item) {
    30        this.send('clone', item);
    31      },
    32    },
    33  });