-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into discover-url-gene…
…rator
- Loading branch information
Showing
87 changed files
with
3,307 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export type Serializable = | ||
| string | ||
| number | ||
| boolean | ||
| null | ||
| SerializableArray | ||
| SerializableRecord; | ||
|
||
// we need interfaces instead of types here to allow cyclic references | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface SerializableArray extends Array<Serializable> {} | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface SerializableRecord extends Record<string, Serializable> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# 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 | ||
|
||
```ts | ||
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. | ||
|
||
```ts | ||
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](rfcs/text/0011_global_search.md#result_provider_registration) 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { GlobalSearchFindError } from './errors'; | ||
|
||
describe('GlobalSearchFindError', () => { | ||
describe('#invalidLicense', () => { | ||
it('create an error with the correct `type`', () => { | ||
const error = GlobalSearchFindError.invalidLicense('foobar'); | ||
expect(error.message).toBe('foobar'); | ||
expect(error.type).toBe('invalid-license'); | ||
}); | ||
|
||
it('can be identified via instanceof', () => { | ||
const error = GlobalSearchFindError.invalidLicense('foo'); | ||
expect(error instanceof GlobalSearchFindError).toBe(true); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.