-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add globalSearch
x-pack plugin
#66293
Merged
pgayvallet
merged 55 commits into
elastic:master
from
pgayvallet:kbn-64284-global-search-API
Jun 4, 2020
Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
c7381da
add skeleton for global_search plugin
pgayvallet 4ca8898
base implementation of the server-side service
pgayvallet aa9a036
add utils tests
pgayvallet 25e7449
add server-side mocks
pgayvallet c38d26f
move take_in_array to common folder
pgayvallet 99af7a5
implements base of client-side plugin
pgayvallet e7657d1
add tests for server-side service
pgayvallet aea2702
fix server plugin tests
pgayvallet a1d0572
implement `navigateToUrl` core API
pgayvallet 7e2ea49
extract processResults for the client-side
pgayvallet 06391b9
fetch server results from the client side
pgayvallet 1774885
factorize process_results
pgayvallet 6032004
fix plugin start params
pgayvallet 70d9592
move things around
pgayvallet 72d9069
move all server types to single file
pgayvallet cc8c3ab
Merge remote-tracking branch 'upstream/master' into kbn-64284-global-…
pgayvallet 5da479e
fix types imports
pgayvallet 8e9ec76
add basic FTR tests
pgayvallet 1d563a8
Merge remote-tracking branch 'upstream/master' into kbn-64284-global-…
pgayvallet 54a4ccd
add client-side service tests
pgayvallet 3b79054
add tests for addNavigate
pgayvallet 1845286
add getDefaultPreference & tests
pgayvallet 337b2a2
use optional for RequestHandlerContext
pgayvallet 09324d3
add registerRoutes test
pgayvallet f911341
add base test for context
pgayvallet ee18aaf
resolve TODO
pgayvallet bcda46e
common nits/doc
pgayvallet c08042d
common nits/doc on public
pgayvallet 4220fe1
update CODEOWNERS
pgayvallet bc67cde
add import for declare statement
pgayvallet 114ec4d
add license check on the server-side
pgayvallet a8a58e6
Merge remote-tracking branch 'upstream/master' into kbn-64284-global-…
pgayvallet 1c6d1f4
add license check on the client-side
pgayvallet c5356c2
Merge remote-tracking branch 'upstream/master' into kbn-64284-global-…
pgayvallet 7fc6a77
eslint
pgayvallet a23a24c
Merge remote-tracking branch 'upstream/master' into kbn-64284-global-…
pgayvallet 2fecc4e
address some review comments
pgayvallet 9ba28ac
Merge remote-tracking branch 'upstream/master' into kbn-64284-global-…
pgayvallet fa3b8c0
use properly typed errors for obs
pgayvallet b66ccab
add integration tests for the find endpoint
pgayvallet ba1fcc0
fix unit tests
pgayvallet ab90710
use licensing start contract
pgayvallet 05d1372
translate the error message
pgayvallet a044fbf
fix eslint rule for test_utils
pgayvallet d7a489c
fix test_utils imports
pgayvallet 1bb244c
remove NavigableGlobalSearchResult, use `application.navigateToUrl` i…
pgayvallet 526e15a
use coreProvider plugin in FTR tests
pgayvallet 195d136
nits
pgayvallet dd39a4e
Merge remote-tracking branch 'upstream/master' into kbn-64284-global-…
pgayvallet 7e6013d
fix service start params
pgayvallet d2a2f42
fix service start params, bis
pgayvallet b387dd6
I really need to fix this typecheck oom error
pgayvallet 278638f
Merge remote-tracking branch 'upstream/master' into kbn-64284-global-…
pgayvallet 979b113
add README, update missing jsdoc
pgayvallet 3a89d29
nits on doc
pgayvallet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can link the RFC for more details provided