-
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
feat: update workspace settings page UI #237
Conversation
Codecov Report
@@ Coverage Diff @@
## workspace #237 +/- ##
=============================================
- Coverage 66.24% 60.40% -5.85%
=============================================
Files 3438 2162 -1276
Lines 66264 42118 -24146
Branches 10694 7731 -2963
=============================================
- Hits 43899 25440 -18459
+ Misses 19757 14988 -4769
+ Partials 2608 1690 -918
Flags with carried forward coverage won't be shown. Click here to find out more. see 1579 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
src/plugins/workspace/public/components/workspace_creator/constants.ts
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/utils.ts
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_form.tsx
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_form.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/utils.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
} | ||
>; | ||
|
||
export type UserOrGroupPermissionEditingData = Array< |
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'd rename it to PermissionFieldData
, that becomes
export type PermissionFieldData = {
id?: string;
modes?: WorkspacePermissionMode[]
}
And in getUserAndGroupPermissions
function, I will do
const userPermissions: PermissionFieldData[] = [];
const groupPermissions: PermissionFieldData[] = [];
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.
How about declaring both variables in PermissionFieldData
and create a new type for editing permission data:
type PermissionEditingData = Array<Partial<PermissionFieldData>>;
return [userPermissions, groupPermissions]; | ||
}; | ||
|
||
const getUnsavedUserOrGroupPermissionChangesCount = ( |
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'd rename getUnsavedPermissionsCount
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 will simplify it in this way:
Convert the original form data: initialFormData.permissions
which type is UserPermissionSetting
to a data structure:
Map<string, string>
The key is ${type}/${userId}
or ${type}/${groupName}
, for example:
user key: "user/u123"
group key: "group/g123"
The value is a merge of modes: modes.join('/')
, for example read/library_read
Then I can simply iterate currentFormData.groupPermissions
and currentFormData.userPermissions
to find those changed/added/deleted
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, I will implement your idea. I just have two thoughts:
- Since I treat user permissions and group permissions separately, the key for the map only needs the id.
- Given that
read/library_read
andlibrary_read/read
should be considered equal, I will usegetPermissionModeId
as the value for the map.
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
…nto update-settings
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Description
Update the UI for workspace update page.
Issues Resolved
Screenshot
Testing the changes
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr