kibana/x-pack/plugins/global_search
Mikhail Shustov 88c0631344
Update @typescript-eslint to ensure compatibility with TypeScript v3.9 (#74091)
* bump @typescript-eslint deps

* update rules

* fix errors in pacakges

* fix src/

* fix x-pack

* fix test

* fix typings

* fix examples

* allow _ as prefix and suffix

* roll back prefix and suffix changes

* add eslint-plugin-eslint-comments

* report unused rules

* remove unused eslint comments from tests

* remove unused eslint comments 2nd pass

* remove unused eslint comments from src/

* remove unused comments in x-pack

* use no-script-url and no-unsanitized/property for ts files

* remove unused eslint comments

* eui/href-or-on-click removed when not complained

* no import/* rules for ts files

* cleanup

* remove the unused eslint-disable

* rollback unnecessary changes

* allow underscore prefix & sufix in type name

* update docs

* fix type error in enterprise search plugin mocks

* rename platform hack __coreProvider --> _coreProvider

* rollback space removal in src/core/public/legacy/legacy_service.test.ts

* fix naming convention in APM
2020-08-05 17:32:19 +02:00
..
common
public
server Update @typescript-eslint to ensure compatibility with TypeScript v3.9 (#74091) 2020-08-05 17:32:19 +02:00
kibana.json
README.md

Kibana GlobalSearch plugin

The GlobalSearch plugin provides an easy way to search for various objects, such as applications or dashboards from the Kibana instance, from both server and client-side plugins

Consuming the globalSearch API

startDeps.globalSearch.find('some term').subscribe({
  next: ({ results }) => {
    addNewResultsToList(results);
  },
  error: () => {},
  complete: () => {
    showAsyncSearchIndicator(false);
  }
});

Registering custom result providers

The GlobalSearch API allows to extend provided results by registering your own provider.

setupDeps.globalSearch.registerResultProvider({
  id: 'my_provider',
  find: (term, options, context) => {
    const resultPromise = myService.search(term, context.core.savedObjects.client);
    return from(resultPromise).pipe(takeUntil(options.aborted$);
  },
});

Known limitations

Client-side registered providers

Results from providers registered from the client-side registerResultProvider API will not be available when performing a search from the server-side. For this reason, prefer registering providers using the server-side API when possible.

Refer to the RFC for more details

Search completion cause

There is currently no way to identify globalSearch.find observable completion cause: searches completing because all providers returned all their results and searches completing because the consumer aborted the search using the aborted$ option or because the internal timout period has been reaches will both complete the same way.