-
Notifications
You must be signed in to change notification settings - Fork 43
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 edit user group page #1732
feat: create edit user group page #1732
Conversation
eaccedb
to
75b4e66
Compare
8595f6c
to
4893df8
Compare
@CodyWMitchell the navigation and breadcrumbs needs to be fixed to highlight and show correctly after changes introduced in #1735, there should be also |
@@ -75,6 +76,10 @@ const getRoutes = ({ enableServiceAccounts, isITLess, isWorkspacesFlag, isCommon | |||
}, | |||
], | |||
}, | |||
{ |
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.
should be a child route
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.
{ type: validatorTypes.REQUIRED }, | ||
(value: string) => { | ||
if (value === group?.name) { | ||
return undefined; | ||
} | ||
|
||
const isDuplicate = allGroups.some( | ||
(existingGroup) => existingGroup.name.toLowerCase() === value?.toLowerCase() && existingGroup.uuid !== groupId | ||
); | ||
|
||
return isDuplicate ? intl.formatMessage(Messages.groupNameTakenTitle) : undefined; | ||
}, |
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 don't think this will work correctly. The groups' response is paginated so you probably won't get all the data to validate properly. Mabe we could reuse the denounced validator currently used in former add group wizard.
|
||
return ( | ||
<React.Fragment> | ||
<ContentHeader title={intl.formatMessage(Messages.usersAndUserGroupsEditUserGroup)} subtitle={''} /> |
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.
<ContentHeader title={intl.formatMessage(Messages.usersAndUserGroupsEditUserGroup)} subtitle={''} /> | |
<ContentHeader title={intl.formatMessage(Messages.usersAndUserGroupsEditUserGroup)} /> |
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.
It looks like typescript requires the subtitle
prop in the ContentHeader
, it's not marked as optional. I see an error when I remove it.
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.
Ahh, I see. I'll open an issue in the component groups
import { ServiceAccountsState } from '../../redux/reducers/service-account-reducer'; | ||
import { LAST_PAGE, ServiceAccount } from '../../helpers/service-account/service-account-helper'; | ||
import { BulkSelect, BulkSelectValue } from '@patternfly/react-component-groups'; | ||
import DateFormat from '@redhat-cloud-services/frontend-components/DateFormat'; |
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.
we should rather use PatternFly Timestamp
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.
The mocks show the time formatted as 1 month ago
. I didn't see a straightforward way to do this with the PatternFly Timestamp in the docs without defining it custom somehow.
|
||
return ( | ||
<React.Fragment> | ||
<FormGroup label="Select users and/or service accounts"> |
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.
Should be localized
<React.Fragment> | ||
<FormGroup label="Select users and/or service accounts"> | ||
<Tabs activeKey={activeTabKey} onSelect={handleTabSelect}> | ||
<Tab eventKey={0} title="Users"> |
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.
Should be localized
src/smart-components/access-management/EditUserGroupUsersAndServiceAccounts.tsx
Outdated
Show resolved
Hide resolved
/> | ||
} | ||
/> | ||
<DataViewTable variant="compact" columns={['Org Admin', 'Username', 'Email', 'First name', 'Last name', 'Status']} rows={rows} /> |
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.
Should be localized
It would be also nice to disable "Submit" button when there are no changes - it should be pretty easy using the form state |
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.
Maybe we could just reuse the existingUsersTable
, what do you think? Also, it might be good to add loading state when changing pages (the UsersTable
already has them)
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.
Since selection is being used for enabling and disabling users here - with the mocks showing the Org Admin
column shuffled around and no action buttons - I made this into its own component instead of reusing the users table. I can try to make the original users table work for both cases if you think that's better though. Either way, I'll make sure to add loading states to this version. 👍
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.
@CodyWMitchell columns shuffled around is an interesting thing --it might be good to ask Margot, who prepared the mockups if that's intentional. But, I agree that this table will probably be much simpler than the regular Users view - it's probably a safer solution in this case 👍
const calculateTotalCount = () => { | ||
if (!serviceAccounts) return 0; | ||
const currentCount = (page - 1) * perPage + serviceAccounts.length; | ||
return status === LAST_PAGE ? currentCount : currentCount + 1; | ||
}; | ||
const totalCount = calculateTotalCount(); |
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.
could be memoized
@CodyWMitchell looks good! Just few comments |
4d273c4
to
fdad5f6
Compare
@CodyWMitchell when opening the detail, the URL should contain Also, the link to groups in the local breadcrumbs has the same issue |
@CodyWMitchell just three small comments, it looks much better now! Thank you 🙂 |
@fhlavac for the breadcrumbs the workspaces effort has them broken and we'll have to fix a few of the screens. For the pristine state, that's connected to DDF and DW interaction and we'll have to write custom component and fix it in tech debt. As for the non updated values @CodyWMitchell will create a ticket to address this in a different ticket since this looks like API race condition. |
Description
Created the Edit User Group page
Will be handled in future ticket
Currently values are diffed and displayed, then logged to the console. Another ticket will handle sending out the appropriate requests.
RHCLOUD-32236
Improve the integration between DataView and data-driven-forms, and potentially create a custom DataView component which could simplify this logic and enable disabling the submit button when no changes have been made here:
RHCLOUD-37436 & RHCLOUD-37435
Screenshots
After:
Checklist ☑️