-
Notifications
You must be signed in to change notification settings - Fork 898
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] Isolate objects based on workspace when calling get/bulkGet #8888
base: main
Are you sure you want to change the base?
[Workspace] Isolate objects based on workspace when calling get/bulkGet #8888
Conversation
Signed-off-by: yubonluo <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8888 +/- ##
==========================================
+ Coverage 60.85% 60.87% +0.01%
==========================================
Files 3802 3802
Lines 91059 91079 +20
Branches 14376 14378 +2
==========================================
+ Hits 55417 55444 +27
+ Misses 32103 32096 -7
Partials 3539 3539
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
...ugins/workspace/server/saved_objects/integration_tests/workspace_id_consumer_wrapper.test.ts
Show resolved
Hide resolved
src/plugins/workspace/server/saved_objects/workspace_id_consumer_wrapper.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: yubonluo <[email protected]>
@@ -48,6 +51,26 @@ export class WorkspaceIdConsumerWrapper { | |||
return type === UI_SETTINGS_SAVED_OBJECTS_TYPE; | |||
} | |||
|
|||
// If the object.workspaces is null/[] (as global object), return it directly. | |||
// If the workspace is specified, validate whether the object exists in the workspace. | |||
private validateObjectExistInWorkspaces<T>( |
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.
nit: the name of this function is a little bit confusing as it will not really just validate which implies returning true or false but it would modify the object if it exists in the workspace. perhaps this could be a return of true return if the object workspaces includes the workspace.
if this is the current standard of saved objects then please ignore.
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.
Thanks for your suggestion, I have updated the function name to formatObjectForWorkspaceValidation
workspace: string | ||
): SavedObject<T> { | ||
if (object.workspaces && object.workspaces.length > 0) { | ||
if (!object.workspaces.includes(workspace)) { |
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.
general question, and im not really sure if this could be possible because I don't think workspaces references any associated saved objects
if the object.workspaces
does not include the current workspace is there ever a workspace.objects
or something like that? or only the object keeps reference to the workspace?
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.
Hi @kavilla , only the object keeps reference to the workspace like object.workspaces
and there is no workspace.objects
Signed-off-by: yubonluo <[email protected]>
Description
Isolate objects based on workspace when calling get/bulkGet
Issues Resolved
Screenshot
No UI change
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration