mirror of
https://github.com/status-im/consul.git
synced 2025-01-09 05:23:04 +00:00
0f33700052
Moves search things around to match an interface that can be switched in and out of fuzzy searching using fuse.js. We add both fuzzy searching and regex based searching to the codebase here, but it is not yet compiled in.
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
import Service from '@ember/service';
|
|
|
|
import ExactSearch from 'consul-ui/utils/search/exact';
|
|
|
|
import intention from 'consul-ui/search/predicates/intention';
|
|
import upstreamInstance from 'consul-ui/search/predicates/upstream-instance';
|
|
import serviceInstance from 'consul-ui/search/predicates/service-instance';
|
|
import healthCheck from 'consul-ui/search/predicates/health-check';
|
|
import acl from 'consul-ui/search/predicates/acl';
|
|
import service from 'consul-ui/search/predicates/service';
|
|
import node from 'consul-ui/search/predicates/node';
|
|
import kv from 'consul-ui/search/predicates/kv';
|
|
import token from 'consul-ui/search/predicates/token';
|
|
import role from 'consul-ui/search/predicates/role';
|
|
import policy from 'consul-ui/search/predicates/policy';
|
|
import nspace from 'consul-ui/search/predicates/nspace';
|
|
|
|
const predicates = {
|
|
intention: intention,
|
|
service: service,
|
|
['service-instance']: serviceInstance,
|
|
['upstream-instance']: upstreamInstance,
|
|
['health-check']: healthCheck,
|
|
node: node,
|
|
kv: kv,
|
|
acl: acl,
|
|
token: token,
|
|
role: role,
|
|
policy: policy,
|
|
nspace: nspace,
|
|
};
|
|
|
|
export default class SearchService extends Service {
|
|
searchables = {
|
|
exact: ExactSearch,
|
|
// regex: RegExpSearch,
|
|
// fuzzy: FuzzySearch,
|
|
};
|
|
predicate(name) {
|
|
return predicates[name];
|
|
}
|
|
}
|