-
Notifications
You must be signed in to change notification settings - Fork 41
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: create delete user groups modal #1703
feat: create delete user groups modal #1703
Conversation
078cfaf
to
3b08e37
Compare
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.
Looking good! Just a few tweaks here and there.
title={ | ||
<FormattedMessage | ||
{...messages.deleteUserGroupModalTitle} | ||
values={{ | ||
count: currentGroups.length, | ||
plural: currentGroups.length > 1 ? intl.formatMessage(messages.groups) : intl.formatMessage(messages.group), | ||
}} | ||
/> | ||
} |
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.
Looks like title
props can only be string
. You already have a message preconfigured to work with plural values
title={ | |
<FormattedMessage | |
{...messages.deleteUserGroupModalTitle} | |
values={{ | |
count: currentGroups.length, | |
plural: currentGroups.length > 1 ? intl.formatMessage(messages.groups) : intl.formatMessage(messages.group), | |
}} | |
/> | |
} | |
title={intl.formatMessage(messages.deleteUserGroupModalTitle, { count: currentGroups.length })} |
onClick: () => { | ||
handleDeleteModalToggle(groups.filter((group) => selected.some((selectedGroup) => selectedGroup.id === group.uuid))); | ||
}, |
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.
selectedGroup
has implicit any
type
onClick: () => { | |
handleDeleteModalToggle(groups.filter((group) => selected.some((selectedGroup) => selectedGroup.id === group.uuid))); | |
}, | |
onClick: () => { | |
handleDeleteModalToggle( | |
groups.filter((group) => selected.some((selectedGroup: { id: string }) => selectedGroup.id === group.uuid)) | |
); | |
}, |
cell: ( | ||
<ActionsColumn | ||
items={[ | ||
{ | ||
title: intl.formatMessage(messages['usersAndUserGroupsEditUserGroup']), | ||
onClick: () => console.log('EDIT USER GROUP'), | ||
}, | ||
{ | ||
title: intl.formatMessage(messages['usersAndUserGroupsDeleteUserGroup']), | ||
onClick: () => handleDeleteModalToggle([group]), | ||
}, | ||
]} | ||
rowData={group} | ||
/> | ||
), |
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.
If the group has either system=true
or platform_default=true
flag enabled we can't show the kebab menu at all. These groups can't be changed or removed.
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.
} | ||
actions={ | ||
<div data-ouia-component-id={`${ouiaId}-actions-dropdown`}> | ||
<ActionsColumn |
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.
Let's use newer functionality from DataView https://react-data-view-pr-data-view-131.surge.sh/extensions/data-view/components#actions-example this would allow us to keep actions button visible all the times.
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.
@karelhala The <ResponsiveActions>
component doesn't currently support disabling actions through any props like isDisabled
or disabled
. I'll switch to using it once that functionality is added. We need that here in the case that no rows are selected or any rows are system
or platform_default
(see #1703 (comment)).
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.
All other feedback should be resolved ✅
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.
You can disable each action by setting isDisabled
on ResponsiveAction
<ResponsiveActions breakpoint="lg">
<ResponsiveAction isPersistent isDisabled>
Persistent Action
</ResponsiveAction>
<ResponsiveAction isDisabled isPinned variant='secondary'>
Pinned Action
</ResponsiveAction>
<ResponsiveAction>
Overflow Action
</ResponsiveAction>
</ResponsiveActions>
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.
@karelhala It's working when the ResponsiveAction
is marked isPersistent
, but for actions within the dropdown (not isPersistent
or isPinned
), isDisabled
isn't disabling them.
For example, both actions in the screenshot are isDisabled={true}
, but only the Edit button is being disabled.
looks like some tests are failing for the roles page:
|
/retest |
Description
RHCLOUD-32237
Create the modal that handled deletion of User Groups fitting the criteria below:
Screenshots
Checklist ☑️