Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

yubonluo
Copy link
Contributor

@yubonluo yubonluo commented Nov 19, 2024

Description

Isolate objects based on workspace when calling get/bulkGet

Issues Resolved

Screenshot

No UI change

Testing the changes

Changelog

  • refactor: [Workspace] Isolate objects based on workspace when calling get/bulkGet

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

Attention: Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 60.87%. Comparing base (ab4e6e8) to head (1d13f30).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...ver/saved_objects/workspace_id_consumer_wrapper.ts 95.00% 1 Missing ⚠️
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              
Flag Coverage Δ
Linux_1 29.03% <95.00%> (+0.02%) ⬆️
Linux_2 56.39% <ø> (ø)
Linux_3 37.87% <ø> (+<0.01%) ⬆️
Linux_4 29.00% <ø> (ø)
Windows_1 29.05% <95.00%> (+0.02%) ⬆️
Windows_2 56.34% <ø> (ø)
Windows_3 37.88% <ø> (+0.01%) ⬆️
Windows_4 29.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
kavilla
kavilla previously approved these changes Nov 20, 2024
@@ -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>(
Copy link
Member

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.

Copy link
Contributor Author

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)) {
Copy link
Member

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?

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants