-
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
feature: cannot delete last admin user/group in workspace settings #235
feature: cannot delete last admin user/group in workspace settings #235
Conversation
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Codecov Report
@@ Coverage Diff @@
## workspace #235 +/- ##
=============================================
+ Coverage 66.19% 66.21% +0.01%
=============================================
Files 3431 3438 +7
Lines 65952 66262 +310
Branches 10616 10691 +75
=============================================
+ Hits 43659 43876 +217
- Misses 19645 19704 +59
- Partials 2648 2682 +34
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 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/workspace_creator.tsx
Show resolved
Hide resolved
const [userNonDeletableIndex, setUserNonDeletableIndex] = useState<number>(-1); | ||
const [groupNonDeletableIndex, setGroupNonDeletableIndex] = useState<number>(-1); |
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.
These two states are derived values from userPermissionSettings
, groupPermissionSettings
, I do not think it is a good practice to declare these two states. You can get these two value by using
const { userNonDeletableIndex, groupNonDeletableIndex } = useMemo(() => {}, [userPermissionSettings, groupPermissionSettings]);
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 update this.
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Description
In workspace update page, users cannot delete the last user or group with admin permission.
Issues Resolved
Screenshot
Testing the changes
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr