-
Notifications
You must be signed in to change notification settings - Fork 894
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
[Workspace][Bug] Check if workspaces exists when creating saved objects #8739
base: main
Are you sure you want to change the base?
[Workspace][Bug] Check if workspaces exists when creating saved objects #8739
Conversation
Signed-off-by: yubonluo <[email protected]>
@@ -48,25 +49,70 @@ export class WorkspaceIdConsumerWrapper { | |||
return type === UI_SETTINGS_SAVED_OBJECTS_TYPE; | |||
} | |||
|
|||
private async checkWorkspacesExist( |
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.
Nice refactor.
: this.formatWorkspaceIdParams(wrapperOptions.request, options) | ||
), | ||
bulkCreate: <T = unknown>( | ||
create: async <T>(type: string, attributes: T, options: SavedObjectsCreateOptions = {}) => { |
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 do the check for addToWorkspace?
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.
Do you think we also need to check the update and bulk update api?
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 think it should be fine for update and bulkUpdate because these 2 APIs won't touch workspaces
fields.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8739 +/- ##
==========================================
- Coverage 60.75% 60.75% -0.01%
==========================================
Files 3798 3798
Lines 90679 90689 +10
Branches 14269 14272 +3
==========================================
+ Hits 55093 55096 +3
- Misses 32089 32095 +6
- Partials 3497 3498 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
src/plugins/workspace/server/saved_objects/workspace_id_consumer_wrapper.ts
Show resolved
Hide resolved
I think we also need to fix the tests. Then I could help to approve. |
Signed-off-by: yubonluo <[email protected]>
…yubonluo/OpenSearch-Dashboards into 2.18/fix-create-saved-objects-api-issue
Signed-off-by: yubonluo <[email protected]>
Description
When calling create/bulkCreate/update/bulkUpdate/addToWorkspace save object with API, it needs to check if the passed workspaces exist.
Issues Resolved
Screenshot
Testing the changes
Create a saved object
bulk create saved objects
update saved object
bulk update saved objects
Changelog
Check List
yarn test:jest
yarn test:jest_integration