Skip to content

Commit

Permalink
Improve routing in RBAC workspaces (#1735)
Browse files Browse the repository at this point in the history
* fix: fix translations

* fix: not issue causing actions not being disabled

* feat: improve users and user groups routing

* chore: update users and user groups tests
  • Loading branch information
fhlavac authored Jan 3, 2025
1 parent 4e6972c commit 7e4dc40
Show file tree
Hide file tree
Showing 24 changed files with 323 additions and 224 deletions.
11 changes: 8 additions & 3 deletions cypress/e2e/users-and-user-groups.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ describe('Users and User Groups page', () => {
statusCode: 200,
body: mockUserGroups,
}).as('getUserGroups');

cy.visit('/iam/access-management/users-and-user-groups');
cy.wait('@getUsers', { timeout: 30000 });
});

it('should display the Users table and correct data', () => {
cy.visit('/iam/access-management/users-and-user-groups');
cy.wait('@getUsers', { timeout: 30000 });
// Check if the table exists
cy.get('[data-ouia-component-id^="iam-users-table"]').should('exist');

Expand All @@ -90,12 +89,18 @@ describe('Users and User Groups page', () => {
});

it('should display warning modal when removing user', () => {
cy.visit('/iam/access-management/users-and-user-groups');
cy.wait('@getUsers', { timeout: 30000 });

cy.get('[data-ouia-component-id^="iam-users-table-table-td-0-6"]').click();
cy.get('[data-ouia-component-id^="OUIA-Generated-DropdownItem-2"]').click();
cy.get('[data-ouia-component-id^="iam-users-table-remove-user-modal"]').should('be.visible');
});

it('should display the User groups table and correct data', () => {
cy.visit('/iam/access-management/users-and-user-groups/user-groups');
cy.wait('@getUserGroups', { timeout: 30000 });

// Check if the table exists
cy.get('[data-ouia-component-id^="iam-users-table"]').should('exist');

Expand Down
16 changes: 10 additions & 6 deletions locales/translation-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -1738,10 +1738,6 @@
"defaultMessage": "Add",
"description": "Add label"
},
"usersAndUserGroupsAddToGroup": {
"defaultMessage": "Remove from user group",
"description": "Remove from user group label"
},
"usersAndUserGroupsAddUserDescription": {
"defaultMessage": "Select a user group to add <b>{numUsers} {plural}</b> to. These are all the user groups in your account. To manage user groups, go to user groups.",
"description": "Description within add user to user group modal"
Expand Down Expand Up @@ -1774,6 +1770,10 @@
"defaultMessage": "No description",
"description": "No description label"
},
"usersAndUserGroupsRemoveFromGroup": {
"defaultMessage": "Remove from user group",
"description": "Remove from user group label"
},
"usersAndUserGroupsYes": {
"defaultMessage": "Yes",
"description": "Yes is Org Admin label"
Expand Down Expand Up @@ -1949,13 +1949,17 @@
"defaultMessage": "Get started with workspaces",
"description": "workspaces page section title"
},
"workspacesOverviewSubtitle": {
"defaultMessage": "Securely manage user access and organize assets within your organization using workspaces. Implement granular access controls to streamline permission management and ensure efficient, secure access to resources. View assets and roles organization diagram.",
"description": "Securely manage user access and organize assets within your organization using workspaces."
},
"workspacesServiceCardDescription": {
"defaultMessage": "Configure workspaces to fit your organizational structure. They can be structured in a heirarchy (parent-child relationships). Permissions assigned to a parent workspace are automatically inherited by its child workspaces, saving you congfiguration time.",
"description": "workspaces service card description"
},
"workspacesSubtitle": {
"defaultMessage": "Securely manage user access and organize assets within your organization using workspaces. Implement granular access controls to streamline permission management and ensure efficient, secure access to resources. View assets and roles organization diagram.",
"description": "Securely manage user access and organize assets within your organization using workspaces."
"defaultMessage": "Workspaces provide a flexible, hierarchical, approach to organizing your assets and streamlining access management. Configure workspaces to fit your organizational structure.",
"description": "Workspaces subtitle"
},
"workspacesSuccessAlertTitle": {
"defaultMessage": "Your workspace migration is complete and ready to manage!",
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@data-driven-forms/react-form-renderer": "^3.23.5",
"@formatjs/cli": "6.2.2",
"@patternfly/quickstarts": "^5.1.0",
"@patternfly/react-component-groups": "^5.5.5",
"@patternfly/react-component-groups": "^5.5.6",
"@patternfly/react-core": "^5.1.1",
"@patternfly/react-data-view": "^5.7.1",
"@patternfly/react-icons": "^5.1.1",
Expand Down
9 changes: 2 additions & 7 deletions src/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2318,7 +2318,7 @@ export default defineMessages({
defaultMessage: 'Access Management',
},
workspacesOverviewSubtitle: {
id: 'workspacesSubtitle',
id: 'workspacesOverviewSubtitle',
description: 'Securely manage user access and organize assets within your organization using workspaces.',
defaultMessage:
'Securely manage user access and organize assets within your organization using workspaces. Implement granular access controls to streamline permission management and ensure efficient, secure access to resources. View assets and roles organization diagram.',
Expand Down Expand Up @@ -2370,11 +2370,6 @@ export default defineMessages({
description: 'Add label',
defaultMessage: 'Add',
},
usersAndUserGroupsAddToGroup: {
id: 'usersAndUserGroupsAddToGroup',
description: 'Add to user group label',
defaultMessage: 'Add to user group',
},
usersAndUserGroupsEditUserGroup: {
id: 'usersAndUserGroupsEditUserGroup',
description: 'Edit user group label',
Expand All @@ -2386,7 +2381,7 @@ export default defineMessages({
defaultMessage: 'Delete user group',
},
usersAndUserGroupsRemoveFromGroup: {
id: 'usersAndUserGroupsAddToGroup',
id: 'usersAndUserGroupsRemoveFromGroup',
description: 'Remove from user group label',
defaultMessage: 'Remove from user group',
},
Expand Down
26 changes: 22 additions & 4 deletions src/Routing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,34 @@ const AddGroupServiceAccounts = lazy(() => import('./smart-components/group/serv
const RemoveServiceAccountFromGroup = lazy(() => import('./smart-components/group/service-account/remove-group-service-accounts'));
const QuickstartsTest = lazy(() => import('./smart-components/quickstarts/quickstarts-test'));

const UsersAndUserGroups = lazy(() => import('./smart-components/access-management/users-and-user-groups'));
const UsersAndUserGroups = lazy(() => import('./smart-components/access-management/users-and-user-groups/users-and-user-groups'));
const UsersView = lazy(() => import('./smart-components/access-management/users-and-user-groups/users/UsersView'));
const UserGroupsView = lazy(() => import('./smart-components/access-management/users-and-user-groups/user-groups/UserGroupsView'));

const getRoutes = ({ enableServiceAccounts, isITLess, isWorkspacesFlag, isCommonAuthModel }: Record<string, boolean>) => [
{
path: pathnames['users-and-user-groups'].path,
element: UsersAndUserGroups,
childRoutes: [
isCommonAuthModel && {
path: pathnames['invite-group-users'].path,
element: InviteUsersModalCommonAuth,
{
path: pathnames['users-new'].path,
element: UsersView,
childRoutes: [
isCommonAuthModel && {
path: pathnames['invite-group-users'].path,
element: InviteUsersModalCommonAuth,
},
],
},
{
path: pathnames['user-groups'].path,
element: UserGroupsView,
childRoutes: [
{
path: pathnames['create-user-group'].path,
element: AddGroupWizard,
},
],
},
],
},
Expand Down
5 changes: 3 additions & 2 deletions src/locales/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@
"usersAndUserGroups": "Users and User Groups",
"usersAndUserGroupsActive": "Active",
"usersAndUserGroupsAdd": "Add",
"usersAndUserGroupsAddToGroup": "Remove from user group",
"usersAndUserGroupsAddUserDescription": "Select a user group to add <b>{numUsers} {plural}</b> to. These are all the user groups in your account. To manage user groups, go to user groups.",
"usersAndUserGroupsCancel": "Cancel",
"usersAndUserGroupsDeleteUserGroup": "Delete user group",
Expand All @@ -444,6 +443,7 @@
"usersAndUserGroupsInactive": "Inactive",
"usersAndUserGroupsNo": "No",
"usersAndUserGroupsNoDescription": "No description",
"usersAndUserGroupsRemoveFromGroup": "Remove from user group",
"usersAndUserGroupsYes": "Yes",
"usersDescription": "These are all of the users in your Red Hat organization.",
"usersEmptyStateSubtitle": "This filter criteria matches no users.{br}Try changing your filter input.",
Expand Down Expand Up @@ -488,8 +488,9 @@
"workspacesLearnMore": "Learn more about workspaces",
"workspacesOverviewPageSubtitle": "Workspaces let's you group related assets together (such as RHEL hosts). This simplifies management and user access control.",
"workspacesOverviewPageTitle": "Get started with workspaces",
"workspacesOverviewSubtitle": "Securely manage user access and organize assets within your organization using workspaces. Implement granular access controls to streamline permission management and ensure efficient, secure access to resources. View assets and roles organization diagram.",
"workspacesServiceCardDescription": "Configure workspaces to fit your organizational structure. They can be structured in a heirarchy (parent-child relationships). Permissions assigned to a parent workspace are automatically inherited by its child workspaces, saving you congfiguration time.",
"workspacesSubtitle": "Securely manage user access and organize assets within your organization using workspaces. Implement granular access controls to streamline permission management and ensure efficient, secure access to resources. View assets and roles organization diagram.",
"workspacesSubtitle": "Workspaces provide a flexible, hierarchical, approach to organizing your assets and streamlining access management. Configure workspaces to fit your organizational structure.",
"workspacesSuccessAlertTitle": "Your workspace migration is complete and ready to manage!",
"workspacesTitle": "Access Management",
"workspacesTooltip": "Add permission to these workspaces.",
Expand Down
5 changes: 3 additions & 2 deletions src/locales/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@
"usersAndUserGroups": "Users and User Groups",
"usersAndUserGroupsActive": "Active",
"usersAndUserGroupsAdd": "Add",
"usersAndUserGroupsAddToGroup": "Remove from user group",
"usersAndUserGroupsAddUserDescription": "Select a user group to add <b>{numUsers} {plural}</b> to. These are all the user groups in your account. To manage user groups, go to user groups.",
"usersAndUserGroupsCancel": "Cancel",
"usersAndUserGroupsDeleteUserGroup": "Delete user group",
Expand All @@ -443,6 +442,7 @@
"usersAndUserGroupsInactive": "Inactive",
"usersAndUserGroupsNo": "No",
"usersAndUserGroupsNoDescription": "No description",
"usersAndUserGroupsRemoveFromGroup": "Remove from user group",
"usersAndUserGroupsYes": "Yes",
"usersDescription": "These are all of the users in your Red Hat organization.",
"usersEmptyStateSubtitle": "This filter criteria matches no users.{br}Try changing your filter input.",
Expand Down Expand Up @@ -487,8 +487,9 @@
"workspacesLearnMore": "Learn more about workspaces",
"workspacesOverviewPageSubtitle": "Workspaces let's you group related assets together (such as RHEL hosts). This simplifies management and user access control.",
"workspacesOverviewPageTitle": "Get started with workspaces",
"workspacesOverviewSubtitle": "Securely manage user access and organize assets within your organization using workspaces. Implement granular access controls to streamline permission management and ensure efficient, secure access to resources. View assets and roles organization diagram.",
"workspacesServiceCardDescription": "Configure workspaces to fit your organizational structure. They can be structured in a heirarchy (parent-child relationships). Permissions assigned to a parent workspace are automatically inherited by its child workspaces, saving you congfiguration time.",
"workspacesSubtitle": "Securely manage user access and organize assets within your organization using workspaces. Implement granular access controls to streamline permission management and ensure efficient, secure access to resources. View assets and roles organization diagram.",
"workspacesSubtitle": "Workspaces provide a flexible, hierarchical, approach to organizing your assets and streamlining access management. Configure workspaces to fit your organizational structure.",
"workspacesSuccessAlertTitle": "Your workspace migration is complete and ready to manage!",
"workspacesTitle": "Access Management",
"workspacesTooltip": "Add permission to these workspaces.",
Expand Down
106 changes: 0 additions & 106 deletions src/smart-components/access-management/users-and-user-groups.tsx

This file was deleted.

Loading

0 comments on commit 7e4dc40

Please sign in to comment.