-
Notifications
You must be signed in to change notification settings - Fork 968
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] fix: Fix workspace page hanging with none collaborators for non dashboard admin #9004
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9004 +/- ##
=======================================
Coverage 60.90% 60.90%
=======================================
Files 3808 3808
Lines 91196 91197 +1
Branches 14400 14400
=======================================
+ Hits 55544 55547 +3
+ Misses 32097 32096 -1
+ Partials 3555 3554 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
export const EMPTY_PERMISSIONS = { | ||
library_read: {}, | ||
library_write: {}, | ||
read: {}, | ||
write: {}, | ||
}; | ||
|
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.
Is this a WorkspacePermissionSetting
object? If so can we add the typing so that typescript can better infer the return type of convertPermissionSettingsToPermissions
?
We can also define this as readonly to ensure no consumer can modify this.
Ex.
export const EMPTY_PERMISSIONS: WorkspacePermissionSetting = {
library_read: {},
library_write: {},
read: {},
write: {},
} as const;
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. Its type is SavedObjectPermissions
, have updated.
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.
LGTM
return undefined; | ||
// Workspace object should always have permissions, set it as an empty object here instead of undefined. | ||
return EMPTY_PERMISSIONS; | ||
} |
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.
does it has any impact when permission control is turned off?
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 supposed it may not as this is a specific object for workspace object.
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.
when permission control is off, permission field will not initialized and add to kibana index, i am not sure it will cause any issue when try to save a object with empty permission, we can have a test
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.
This means the value of permission field will not be consistent between permission is on/off, right? So it seems updating client wrapper will be a better solution?
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
…tail page Signed-off-by: tygao <tygao@amazon.com>
58e4cbb
to
b9b7edd
Compare
…or non dashboard admin (#9004) * fix: fix page hanging when none collaborators for non dashboard admin Signed-off-by: tygao <tygao@amazon.com> * add const type Signed-off-by: tygao <tygao@amazon.com> * Changeset file for PR #9004 created/updated * Changeset file for PR #9004 created/updated * update empty permissions when permission is disabled for workspace detail page Signed-off-by: tygao <tygao@amazon.com> --------- Signed-off-by: tygao <tygao@amazon.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Co-authored-by: SuZhou-Joe <suzhou@amazon.com> (cherry picked from commit 40e61c7) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…or non dashboard admin (#9004) (#9141) * fix: fix page hanging when none collaborators for non dashboard admin * add const type * Changeset file for PR #9004 created/updated * Changeset file for PR #9004 created/updated * update empty permissions when permission is disabled for workspace detail page --------- (cherry picked from commit 40e61c7) Signed-off-by: tygao <tygao@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
Description
Fix workspace page hanging with none collaborators for non dashboard admin
Previously the permission field of a workspace with none collaborators is undefined, which will pass the workspace permission wrapper and cause page hanging. Actually this field could be an empty ACL object as workspace type object should always have this field.
Screenshot
Before
After
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration