-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Make SavedObjectFinder
backward compatible
#162904
Merged
Dosant
merged 21 commits into
elastic:main
from
Dosant:d/2023-07-28-saved-object-finder-msearch
Aug 8, 2023
Merged
Changes from 4 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
8f08e60
wip bwc savedobjectfinder
Dosant 6eb21f1
fix ml
Dosant 7aa01ca
Merge branch 'main' of github.com:elastic/kibana into d/2023-07-28-sa…
Dosant 6b1ed04
Merge branch 'main' into d/2023-07-28-saved-object-finder-msearch
kibanamachine 1a51e1f
move to `SOWithMetadata` instead of `SavedObject`
Dosant 4dc1742
fix tsconfig
Dosant 91755e4
Merge branch 'd/2023-07-28-saved-object-finder-msearch' of github.com…
Dosant f4cbe2c
Merge branch 'main' of github.com:elastic/kibana into d/2023-07-28-sa…
Dosant 7cdc2bb
fix types
Dosant 98f6464
improve msearch and finder tests
Dosant 11bfad7
fix
Dosant 80b5bd2
Merge branch 'main' into d/2023-07-28-saved-object-finder-msearch
kibanamachine 275e584
Merge branch 'main' of github.com:elastic/kibana into d/2023-07-28-sa…
Dosant 8ae4af9
Merge branch 'd/2023-07-28-saved-object-finder-msearch' of github.com…
Dosant 015d6d1
Merge branch 'main' of github.com:elastic/kibana into d/2023-07-28-sa…
Dosant 372a104
revert passing uiSettings
Dosant 20e7b1f
lint projects
Dosant b7153e3
fix ts
Dosant 3271943
fix example
Dosant 935ce7d
fix test
Dosant 1b64a97
Merge branch 'main' into d/2023-07-28-saved-object-finder-msearch
kibanamachine 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
"developerExamples", | ||
"kibanaReact", | ||
"savedObjectsTaggingOss" | ||
] | ||
], | ||
"requiredBundles": ["savedObjectsFinder"] | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
examples/content_management_examples/public/examples/finder/finder_app.tsx
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 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { ContentClientProvider, type ContentClient } from '@kbn/content-management-plugin/public'; | ||
import type { CoreStart } from '@kbn/core/public'; | ||
import { I18nProvider } from '@kbn/i18n-react'; | ||
import { SavedObjectTaggingOssPluginStart } from '@kbn/saved-objects-tagging-oss-plugin/public'; | ||
import { SavedObjectFinder } from '@kbn/saved-objects-finder-plugin/public'; | ||
|
||
export const FinderApp = (props: { | ||
contentClient: ContentClient; | ||
core: CoreStart; | ||
savedObjectsTagging: SavedObjectTaggingOssPluginStart; | ||
}) => { | ||
return ( | ||
<ContentClientProvider contentClient={props.contentClient}> | ||
<I18nProvider> | ||
<SavedObjectFinder | ||
showFilter={true} | ||
services={{ | ||
savedObjectsTagging: props.savedObjectsTagging.getTaggingApi(), | ||
contentClient: props.contentClient, | ||
}} | ||
onChoose={(...args) => { | ||
alert(JSON.stringify(args)); | ||
}} | ||
savedObjectMetaData={[ | ||
{ | ||
type: `search`, | ||
getIconForSavedObject: () => 'discoverApp', | ||
name: 'Saved search', | ||
}, | ||
{ | ||
type: 'index-pattern', | ||
getIconForSavedObject: () => 'indexPatternApp', | ||
name: 'Data view', | ||
}, | ||
]} | ||
/> | ||
</I18nProvider> | ||
</ContentClientProvider> | ||
); | ||
}; |
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
17 changes: 17 additions & 0 deletions
17
src/plugins/dashboard/public/services/content_management/content_management_service.stub.ts
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,17 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { PluginServiceFactory } from '@kbn/presentation-util-plugin/public'; | ||
import { ContentManagementPublicStart } from '@kbn/content-management-plugin/public'; | ||
import { contentManagementMock } from '@kbn/content-management-plugin/public/mocks'; | ||
|
||
export type ContentManagementServiceFactory = PluginServiceFactory<ContentManagementPublicStart>; | ||
|
||
export const contentManagementServiceFactory: ContentManagementServiceFactory = () => { | ||
return contentManagementMock.createStartContract(); | ||
}; |
24 changes: 24 additions & 0 deletions
24
src/plugins/dashboard/public/services/content_management/content_management_service.ts
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,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { KibanaPluginServiceFactory } from '@kbn/presentation-util-plugin/public'; | ||
import { ContentManagementPublicStart } from '@kbn/content-management-plugin/public'; | ||
import { DashboardStartDependencies } from '../../plugin'; | ||
|
||
export type ContentManagementServiceFactory = KibanaPluginServiceFactory< | ||
ContentManagementPublicStart, | ||
DashboardStartDependencies | ||
>; | ||
|
||
export const contentManagementServiceFactory: ContentManagementServiceFactory = ({ | ||
startPlugins, | ||
}) => { | ||
const { contentManagement } = startPlugins; | ||
|
||
return contentManagement; | ||
}; |
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
4 changes: 1 addition & 3 deletions
4
.../public/application/main/components/top_nav/__snapshots__/open_search_panel.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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.
I am still a bit puzzeled why we allow any field name to be passed here instead of having a set of fixed fields to be added to the search (e.g. 'name' | 'description' )
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.
title
anddescription
are common, but onlyDataView
hasname
and wants it searchable. ThismSearchAdditionalSearchFields
is forDataView
to configure thename
that belongs to them without hardcoding itThere 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.
So why not set this type as
mSearchAdditionalSearchFields?: Array<'name'>
?