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

feat(MembersRoute): add actions dropdown to the table of organization members TASK-987 TASK-990 #5309

Merged
merged 92 commits into from
Dec 11, 2024

Conversation

magicznyleszek
Copy link
Member

@magicznyleszek magicznyleszek commented Nov 28, 2024

πŸ“£ Summary

In Members Table (from Account β†’ Team/Organization β†’ Members) add actions dropdown with one action. The action allows removing a member or leaving the organization.

πŸ“– Description

The availability of "Remove" action is based on the role of the logged in user. When trying to remove user (or leave organization) a confirmation prompt is being shown.

πŸ‘€ Preview steps

  1. ℹ️ have multiple different users
  2. for one of the users (e.g. "joe"), use http://kf.kobo.local/admin/organizations/organization/ to add multiple users into joe's organization
  3. For one of the users (e.g. "sue") set the role to "admin"
  4. enable "Multi-members override" for joe's organization
  5. enable feature flag mmosEnabled
  6. navigate to #/account/organization/members
  7. 🟒 notice that a table of organization members displays a list of users added in step 2
  8. 🟒 notice that in the table "joe" (as owner) has an ability to remove all organization members (excluding themselves) including "sue" who's an admin

As continuation for above steps:

  1. log in as "sue"
  2. navigate to #/account/organization/members
  3. 🟒 notice that in the table "joe" (the owner) has no actions available
  4. 🟒 notice that any "member" user in the table has actions available, and if you click "Remove" a confirmation prompt will appear
  5. 🟒 notice that for "sue" the action available is "Leave team"/"Leave organization", and if you click it, a confirmation prompt will appear - and it will have different content than confirmation prompt for removing a member

As continuation for above steps:

  1. pick a "member" user and use "Remove" action
  2. confirm prompt
  3. 🟒 verify that user was removed successfuly

πŸ’­ Notes

Build atop #5281

rajpatel24 and others added 30 commits November 7, 2024 01:42
…hook more customizable

and then use it in `MembersRoute`
…hook more customizable

and then use it in `MembersRoute`
Base automatically changed from leszek/task-985-member-mutation-api to main December 5, 2024 17:26
Copy link
Contributor

@jamesrkiger jamesrkiger left a comment

Choose a reason for hiding this comment

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

Looks good, works good. I just left some code style comments.

@jamesrkiger
Copy link
Contributor

The dropdown here is running into trouble when it is near the bottom of the list:
image

(Same applies to the org member role selector, fyi)

Copy link
Contributor

@jamesrkiger jamesrkiger left a comment

Choose a reason for hiding this comment

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

Left two minor comments

Copy link
Contributor

@jamesrkiger jamesrkiger left a comment

Choose a reason for hiding this comment

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

lgtm

@magicznyleszek magicznyleszek merged commit af28266 into main Dec 11, 2024
7 checks passed
@magicznyleszek magicznyleszek deleted the task-987-members-table-actions-dropdown branch December 11, 2024 11:53
magicznyleszek added a commit that referenced this pull request Dec 11, 2024
### πŸ“£ Summary
In Members Table (from Account β†’ Team/Organization β†’ Members) add UI for
changing member's role.

### πŸ“– Description
Only owner and admins can modify the role.

### πŸ‘€ Preview steps
1. ℹ️ have multiple different users
2. for one of the users (e.g. "joe"), use
http://kf.kobo.local/admin/organizations/organization/ to add multiple
users into joe's organization
3. For one of the users (e.g. "sue") set the role to "admin"
4. enable "Multi-members override" for joe's organization
5. enable feature flag `mmosEnabled`
6. navigate to `#/account/organization/members` (as "joe")
7. 🟒 notice that in the table there is no way to change "joe" (owner)
role
8. 🟒 notice that in the table you can change any other user role

As continuation for above steps:
1. log in as "sue"
2. navigate to `#/account/organization/members`
3. 🟒 notice (again) that in the table there is no way to change "joe"
(owner) role (even though you're an "admin")
4. 🟒 notice that for "sue" you can change the role (to stop being an
admin)

### πŸ’­ Notes
Build atop #5309
magicznyleszek added a commit that referenced this pull request Dec 12, 2024
### πŸ“£ Summary
Improve multiple pinned columns handling. Allow pinning columns to right
side. Improve pinned column styling based on table having horizontal
scrollbar. Add reusable `useViewportSize` and `useWindowEvent` hooks.
Add extensive story for testing the component, including left/right
column pinning, the amount of columns and much more.

### πŸ’­ Notes
Both `useViewportSize` and `useWindowEvent` hooks were copied from
`@mantine/hooks`, retaining the original code as closely as possible. We
most possibly will use Mantine in near future, and we should replace
both with the ones from Mantine package.

Pinned columns have visual shadow to distinct them from other columns
(useful when scrolling table horizontally). That shadow is not being
added if table has no horizontal scrollbar.

@magicznyleszek this should be used in actions column added in
#5309 (should be always pinned to
right)

### πŸ‘€ Preview steps
Best way to test component changes:
1. run storybook locally
2. go to http://localhost:6006/?path=/docs/misc-universaltable--docs
3. 🟒 verify columns pinning works for all possible combinations - story
allows pinning one or two columns on both sides
4. 🟒 verify pinned columns have shadow only if table has lots of columns
(i.e. if there is horizontal scrollbar)
5. 🟒 verify all the other props of component work as expected

Verify that Organization Members table still works:
1. ℹ️ have multiple different users
2. for one of the users (e.g. "joe"), use
http://kf.kobo.local/admin/organizations/organization/ to add multiple
users into joe's organization
3. for one of the users (e.g. "sue") set the role to "admin"
4. enable "Multi-members override" for joe's organization
5. enable feature flag `mmosEnabled`
7. navigate to `#/account/organization/members` (as "joe")
8. 🟒 notice that the table works as previously πŸ‘Œ 

Verify that Recent Project Activity table still works:
1. note: this particular table displays mock data right now
2. for a deployed project go to `#/forms/<uid>/settings/activity`
3. 🟒 notice that the table works as previously πŸ‘Œ

---------

Co-authored-by: RuthShryock <81720958+RuthShryock@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants