-
Notifications
You must be signed in to change notification settings - Fork 0
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 osd system index's mappings extendable for plugins #256
Conversation
@@ -206,6 +206,7 @@ export function createPluginSetupContext<TPlugin, TPluginDependencies>( | |||
getImportExportObjectLimit: deps.savedObjects.getImportExportObjectLimit, | |||
setRepositoryFactoryProvider: deps.savedObjects.setRepositoryFactoryProvider, | |||
setStatus: deps.savedObjects.setStatus, | |||
addExtendedSavedObjectsMappings: deps.savedObjects.addExtendedSavedObjectsMappings, |
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.
Shall we rename to setExtendedSavedObjectsMappings
? add
may confused. The old extended saved objects mappings will be override.
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've modified the variable extendedSavedObjectsMappings
to array type, it meant to make all other plugins can add their extended mappings, so addExtendedSavedObjectsMappings
makes more sense?
if (!this.extendedSavedObjectsMappings) { | ||
this.extendedSavedObjectsMappings = mappings; | ||
} else { | ||
this.extendedSavedObjectsMappings = [...this.extendedSavedObjectsMappings, ...mappings]; |
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.
We should check the existing properties so that it won't been overwritten by the newly added ones. similar to src/core/server/saved_objects/saved_objects_type_registry.ts
at line 53
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.
Sure, it's needed, I'll add this logic.
* [Workspace] Add ACL related functions for workspace (opensearch-project#146) * [Workspace] Add acl related functions for workspace Signed-off-by: gaobinlong <gbinlong@amazon.com> * Minor change Signed-off-by: gaobinlong <gbinlong@amazon.com> --------- Signed-off-by: gaobinlong <gbinlong@amazon.com> * Modify changelog Signed-off-by: gaobinlong <gbinlong@amazon.com> * Add more unit test cases Signed-off-by: gaobinlong <gbinlong@amazon.com> * Modify test case Signed-off-by: gaobinlong <gbinlong@amazon.com> * Some minor change Signed-off-by: gaobinlong <gbinlong@amazon.com> * Add more test cases Signed-off-by: gaobinlong <gbinlong@amazon.com> * Optimize some code and the comments of the functions Signed-off-by: gaobinlong <gbinlong@amazon.com> * Add more comments for some basic functions Signed-off-by: gaobinlong <gbinlong@amazon.com> * Export more interfaces Signed-off-by: gaobinlong <gbinlong@amazon.com> * consume permissions in repository Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: consume permissions in serializer Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * Add unit tests for consuming permissions in repository Signed-off-by: gaobinlong <gbinlong@amazon.com> * Remove double exclamation Signed-off-by: gaobinlong <gbinlong@amazon.com> * Rename some variables Signed-off-by: gaobinlong <gbinlong@amazon.com> * Remove duplicated semicolon Signed-off-by: gaobinlong <gbinlong@amazon.com> * Add permissions field to the mapping only if the permission control is enabled Signed-off-by: gaobinlong <gbinlong@amazon.com> * Fix test failure Signed-off-by: gaobinlong <gbinlong@amazon.com> * Add feature flag config to the yml file Signed-off-by: gaobinlong <gbinlong@amazon.com> * Make the comment of feature flag more clear Signed-off-by: gaobinlong <gbinlong@amazon.com> * Make comment more clear Signed-off-by: gaobinlong <gbinlong@amazon.com> * Remove management permission type Signed-off-by: gaobinlong <gbinlong@amazon.com> * Fix test failure Signed-off-by: gaobinlong <gbinlong@amazon.com> --------- Signed-off-by: gaobinlong <gbinlong@amazon.com> Signed-off-by: SuZhou-Joe <suzhou@amazon.com> Co-authored-by: Josh Romero <rmerqg@amazon.com> Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
Description
This PR aims to make osd system index(.kibana)'s mappings extendable for plugins, the main point is to add a function
addExtendedSavedObjectsMappings
to savedObjectsService, and then plugins can call this method to add extended mappings when setup.Issues Resolved
Screenshot
Testing the changes
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr