Skip to content
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

Create an Admin view for UserGroups #391

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft

Conversation

katyasoup
Copy link
Collaborator

@katyasoup katyasoup commented Feb 24, 2025

PULL REQUEST

Summary

Adds logic for a restricted Admin view of the User Management page:

  • Only the User Groups table should display (no User Permissions)
  • Table Tabs (to click between views) should not display
  • If there are no user groups in the database, a message appears "No user groups found."
  • Otherwise, users, groups, and queries should load from the database and render appropriately in the table and/or the side drawer
  • Admins can view members of a group, but not edit them
  • Admins can view queries assigned to a group, AND can toggle the checkboxes to assign/unassign them (full functionality to be covered in separate ticket)

Related Issue

Fixes #276

Additional Information

How to test:

  1. Login as qc-admin; it should default to Standard User, so you should not see the "User Management" link in the gear menu dropdown
  2. Manually upgrade your role to "Admin" in the database
  3. Seed some additional user/group/query data in the db - you'll want at least one additional user, at least two groups, and at least one query assigned to each group
  4. Log out, then log back in; your updated role means you can now access User Management from the gear icon
  5. Click to the User Management page; confirm that you only see User Groups and not the User Permissions table. Also confirm that there are no table tabs to toggle between views
  6. If a group has at least one member, you should be able to click and view the member list in the drawer. You should not be able to click/edit the individual members in the drawer.
  7. If there are no members, the link to open the drawer should be disabled
  8. If a group has at least one assigned query, the drawer link should behave as above. You should be able to toggle the query checkboxes to assign/un-assign queries from the group (does not persist in db). A toast confirmation should fire when toggling the checkbox.
  9. (Optional) Update your role to Super Admin; log out then log back in. Confirm that you now can see the User Permissions table, and that the User Group team names populate appropriately, and that you can interact with the group member drawer.

tk: video walkthrough
tk: tests

Checklist

  • Descriptive Pull Request title
  • Link to relevant issues
  • Provide necessary context for design reviewers
  • Update documentation

Copy link

github-actions bot commented Feb 24, 2025

Coverage report for ./query-connector

Caution

Test run failed

St.
Category Percentage Covered / Total
🔴 Statements
59.25% (-2.84% 🔻)
1249/2108
🔴 Branches
52.6% (-3.74% 🔻)
354/673
🔴 Functions
58.18% (-4.82% 🔻)
249/428
🔴 Lines
59.42% (-2.75% 🔻)
1176/1979
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟡
... / UserGroupsTable.tsx
68% 46.67% 71.43% 66.67%
🟢
... / utils.ts
100% 100% 100% 100%
🟢
... / test-utils.tsx
72.73% 100% 100% 100%
🔴
... / userPermissionsTable.tsx
40.63% 0% 0% 38.71%
🟡
... / RoleDropdown.tsx
54.55% 100% 0% 60%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / user-management.ts
70.34% (-8.29% 🔻)
43.9% (-11.65% 🔻)
86.67% (-13.33% 🔻)
69.72% (-8.35% 🔻)
🟢
... / Toast.tsx
91.67%
53.85% (-23.08% 🔻)
50% (-50% 🔻)
100%
🟢
... / Drawer.tsx
87.5% (-12.5% 🔻)
100%
75% (-25% 🔻)
86.67% (-13.33% 🔻)
🔴
... / UserManagementProvider.tsx
21.88% (-70.43% 🔻)
0% (-100% 🔻)
0% (-46.15% 🔻)
20% (-71.67% 🔻)

Test suite run failed

Failed tests: 0/96. Failed suites: 2/14.
  ● Test suite failed to run

    Cannot find module '../../../../ui/designSystem/tabGroup/tabGroup' from 'src/app/(pages)/userManagement/components/usersTable/usersTable.tsx'

    Require stack:
      src/app/(pages)/userManagement/components/usersTable/usersTable.tsx
      src/app/(pages)/userManagement/components/usersTable/usersTable.test.tsx

    

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.<anonymous> (/home/runner/work/dibbs-query-connector/dibbs-query-connector/query-connector/src/app/(pages)../../../../../../userManagement/components/usersTable/usersTable.tsx:1346:65)
      at Object.<anonymous> (/home/runner/work/dibbs-query-connector/dibbs-query-connector/query-connector/src/app/(pages)../../../../../../userManagement/components/usersTable/usersTable.test.tsx:24:60)


  ● Test suite failed to run

    Cannot find module '../../../../ui/designSystem/tabGroup/tabGroup' from 'src/app/(pages)/userManagement/components/usersTable/usersTable.tsx'

    Require stack:
      src/app/(pages)/userManagement/components/usersTable/usersTable.tsx
      src/app/(pages)/userManagement/components/userPermissions/UserPermissionsTable.test.tsx

    

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.<anonymous> (/home/runner/work/dibbs-query-connector/dibbs-query-connector/query-connector/src/app/(pages)../../../../../../userManagement/components/usersTable/usersTable.tsx:1346:65)
      at Object.<anonymous> (/home/runner/work/dibbs-query-connector/dibbs-query-connector/query-connector/src/app/(pages)../../../../../../userManagement/components/userPermissions/UserPermissionsTable.test.tsx:25:60)

Report generated by 🧪jest coverage report action from 3fe7110

@katyasoup katyasoup changed the title Kcd/user mgmt admin view Create an Admin view for UserGroups Feb 24, 2025
@johanna-skylight
Copy link
Collaborator

@katyasoup do you know if there is a specific ticket to integrate the drawer with all admin roles(Super Admin and Admin)? I just started to review this PR and noticed that super admins cannot modify teams members (the link that opens the drawers shows disabled).

If there is no ticket to cover that functionality we should bring it up during stand up.

@katyasoup
Copy link
Collaborator Author

@katyasoup do you know if there is a specific ticket to integrate the drawer with all admin roles(Super Admin and Admin)? I just started to review this PR and noticed that super admins cannot modify teams members (the link that opens the drawers shows disabled).

If there is no ticket to cover that functionality we should bring it up during stand up.

@johanna-skylight I added this ticket yesterday, which should cover all the outstanding interactions for Admins and Super Admins. But the basic drawer functionality should be working on this branch - is the usergroup table seeded in your local db with at least one user-group relation?

@johanna-skylight
Copy link
Collaborator

@katyasoup yeah! I have one group setup but the members link displays disabled for the super admin. Even if the team has 0 members it should still open the drawer for the super admin so then super admin user can proceed to add members. I have added an image below.

Screenshot 2025-02-25 at 1 37 02 PM

Copy link
Collaborator

@johanna-skylight johanna-skylight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool work 🎉 😎 . I have left some comments/questions and a few nits. Thanks @katyasoup !

@katyasoup
Copy link
Collaborator Author

katyasoup commented Feb 25, 2025

@katyasoup yeah! I have one group setup but the members link displays disabled for the super admin. Even if the team has 0 members it should still open the drawer for the super admin so then super admin user can proceed to add members. I have added an image below.

@johanna-skylight Ah OK good catch! I had only been testing empty groups when logged in as an admin, so I'll fix that now. Thx!

@katyasoup katyasoup marked this pull request as ready for review February 28, 2025 19:21
@katyasoup katyasoup marked this pull request as draft February 28, 2025 19:22
@katyasoup katyasoup force-pushed the kcd/user-mgmt-admin-view branch from 03b37d8 to 1004755 Compare February 28, 2025 20:19
@katyasoup katyasoup force-pushed the kcd/user-mgmt-admin-view branch 2 times, most recently from 45a81fe to 71ef288 Compare February 28, 2025 21:46
Initialize backend add/delete for usergroup_to_users (#389)

Co-authored-by: fzhao99 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

update integration tests
@katyasoup katyasoup force-pushed the kcd/user-mgmt-admin-view branch from dc12eb1 to f8538dd Compare February 28, 2025 21:48
@katyasoup katyasoup force-pushed the kcd/user-mgmt-admin-view branch from fc2a214 to 6bd8df4 Compare February 28, 2025 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build a user management page view for Admin users
2 participants