-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
SavedObjectFinder
backward compatible (#162904)
## Summary close #161545 close #153257 This PR makes `SavedObjectFinder` component backward compatible. It is achieved by going through content- management layer, more technical details [here](https://docs.google.com/document/d/1ssYmqSEUPrsuCR4iz8DohkEWekoYrm2yL4QR_fVxXLg/edit) ### Testing `SavedObjectFinder` is this component that allows to pick a saved object (supports: `search` `index-pattern` `map` `visualization` `lens` `event-annotation-group`: ![Screenshot 2023-08-07 at 16 53 32](https://github.com/elastic/kibana/assets/7784120/5c283ea5-3682-4dc8-a8ff-422e6f4f3195) It is used in the following places: - Dashboard - Add panel - Replace panel - Discover - Open Search - Visualization - Select search as a source for new viz - Graph - select source - Cases - markdown editor add lens - ML (3 places) - Canvas - select embeddable panel - Transform - Lens > select event annotation ### Risks / Follow up The `SavedObjectFinder` should stay mostly the same, the only notable functional change is that now `SavedObjectFinder` doesn't support `includeFields` which allowed partial saved object returns, this was done to make the call backward-compatible without making the system even more complicated as otherwise we'll need a way to abstract `includeFields` from so attributes and allow to run migrations on it before making a search. follow up issue to bring it back #163043 The risk with that is that some client that have a lot of large objects might run into performance issues when using `SavedObjectFinder`. This can be mitigated by changing listing limit in advanced setting from default 1000 to something lower
- Loading branch information
Showing
98 changed files
with
636 additions
and
938 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
"developerExamples", | ||
"kibanaReact", | ||
"savedObjectsTaggingOss" | ||
] | ||
], | ||
"requiredBundles": ["savedObjectsFinder"] | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
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,70 @@ | ||
/* | ||
* 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, | ||
uiSettings: props.core.uiSettings, | ||
}} | ||
onChoose={(...args) => { | ||
alert(JSON.stringify(args)); | ||
}} | ||
savedObjectMetaData={[ | ||
{ | ||
type: `search`, | ||
getIconForSavedObject: () => 'discoverApp', | ||
name: 'Saved search', | ||
}, | ||
{ | ||
type: 'index-pattern', | ||
getIconForSavedObject: () => 'indexPatternApp', | ||
name: 'Data view', | ||
}, | ||
{ | ||
type: `visualization`, | ||
getIconForSavedObject: () => 'visualizeApp', | ||
name: 'Visualization', | ||
}, | ||
{ | ||
type: 'lens', | ||
getIconForSavedObject: () => 'lensApp', | ||
name: 'Lens', | ||
}, | ||
{ | ||
type: 'map', | ||
getIconForSavedObject: () => 'logoMaps', | ||
name: 'Map', | ||
}, | ||
{ | ||
type: 'event-annotation-group', | ||
getIconForSavedObject: () => 'annotation', | ||
name: 'Annotation', | ||
}, | ||
]} | ||
/> | ||
</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
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
Oops, something went wrong.