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(orgAdmin): org admins can archive teams #10022

Merged
merged 25 commits into from
Aug 1, 2024

Conversation

tianrunhe
Copy link
Contributor

@tianrunhe tianrunhe commented Jul 23, 2024

Fixes #10011

Description

A couple of new feature & improvements in the organization view:

  1. Org Admin can see all teams in their org
  2. Team lead can archive their team in the Org Teams view; Org Admin can archive all teams
  3. People can peek if they lead the team or they are just a member of the team

Demo

https://www.loom.com/share/a63ff49655614390a711912c51a3445c

Testing scenarios

  • Team member/team lead view

    • Logged in as a team member or team lead
    • Go to the Org Teams View
    • See only the team you are a member of
    • If you are a lead of a team, the team is properly labelled
    • You can archive your lead team
  • Org admin view

    • Logged in as an org admin
    • Go to the Org Teams view
    • See all the teams within the org
    • You can archive any teams in the org

Final checklist

  • I checked the code review guidelines
  • I have added Metrics Representative as reviewer(s) if my PR invovles metrics/data/analytics related changes
  • I have performed a self-review of my code, the same way I'd do it for any other team member
  • I have tested all cases I listed in the testing scenarios and I haven't found any issues or regressions
  • Whenever I took a non-obvious choice I added a comment explaining why I did it this way
  • I added the label Skip Maintainer Review Indicating the PR only requires reviewer review and can be merged right after it's approved if the PR introduces only minor changes, does not contain any architectural changes or does not introduce any new patterns and I think one review is sufficient'
  • PR title is human readable and could be used in changelog

Summary by CodeRabbit

  • New Features

    • Introduced an ArchiveTeamModal for archiving teams within the user dashboard, enhancing team management capabilities.
    • Improved the OrgTeamsRow component to display team information based on user roles, including a new isOrgAdmin prop for tailored interface interactions.
    • Added a menu button to the OrgTeamMembers component, providing additional options based on user permissions.
  • Bug Fixes

    • Updated messaging in the OrgTeams component for clearer user feedback regarding team visibility.
  • Documentation

    • Enhanced variable naming in the OrgNav component for improved clarity and readability.

@tianrunhe tianrunhe marked this pull request as ready for review July 23, 2024 23:39
Copy link
Contributor

coderabbitai bot commented Jul 23, 2024

Walkthrough

The changes enhance the user interface and functionality within the team management components of the dashboard. An ArchiveTeamModal is introduced to allow organisation admins to archive teams, while existing components are updated for better user feedback and accessibility based on user roles. These modifications ensure that relevant actions and information are presented to users, aligning with the needs of organisation admins.

Changes

File Path Change Summary
.../TaskColumn/ArchiveAllDoneTasksModal.tsx Renamed UserAvatarInput to ArchiveAllDoneTasksModal. Props structure and internal logic unchanged.
.../OrgTeams/ArchiveTeamModal.tsx Introduced ArchiveTeamModal for archiving teams, including props for team details and mutation handling.
.../OrgTeams/OrgTeams.tsx Updated visibility messages and added isOrgAdmin prop to OrgTeamsRow for improved rendering based on user roles.
.../OrgTeams/OrgTeamsRow.tsx Enhanced functionality with preferredName and viewerTeamMember, modified rendering logic for clarity.
.../OrgTeamMembers/OrgTeamMembers.tsx Added menu button functionality and improved role-based rendering based on isBillingLeader.
.../OrgTeamMembers/OrgTeamMembersMenu.tsx Replaced direct MenuItem usage with LinkButton for enhanced user interaction.
.../Organization/OrgNav.tsx Renamed organization name variable for improved clarity.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant OrgTeamsRow
    participant ArchiveTeamModal
    participant Backend

    User->>OrgTeamsRow: Clicks on Archive button
    OrgTeamsRow->>ArchiveTeamModal: Opens modal with team details
    User->>ArchiveTeamModal: Confirms archiving
    ArchiveTeamModal->>Backend: Sends archive request
    Backend-->>ArchiveTeamModal: Returns success
    ArchiveTeamModal->>User: Closes modal
Loading

Assessment against linked issues

Objective Addressed Explanation
Org Admin can archive/delete teams (10011)

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b52d027 and 6998fa4.

Files selected for processing (1)
  • packages/client/modules/userDashboard/components/OrgTeams/OrgTeamsRow.tsx (2 hunks)
Additional comments not posted (5)
packages/client/modules/userDashboard/components/OrgTeams/OrgTeamsRow.tsx (5)

23-24: LGTM!

The inclusion of isLead and preferredName in the teamMembers structure is appropriate for the new functionality.


32-34: LGTM!

The logic for identifying the current user's role within the team using viewerTeamMember, isLead, and isMember is clear and robust.


43-54: LGTM!

The conditional rendering of role indicators (Team Lead and Member) based on the isLead and isMember flags enhances the user interface and provides clear visual feedback.


55-57: LGTM!

The display of the team member count using the plural utility is clear and correctly handles singular and plural forms.


Line range hint 58-60:
LGTM!

The inclusion of the ChevronRight icon for navigation provides a clear visual cue and aligns with common UI patterns.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tianrunhe tianrunhe requested a review from Dschoordsch July 24, 2024 21:30
@Dschoordsch
Copy link
Contributor

@tianrunhe I just noticed that there seem to have been some changes on master to restructure this view:
https://www.loom.com/share/ebf9933bbd3148fc81dd2b68ced02695?sid=21f517d3-997b-4f54-b21e-e561f8a0fe3c

@github-actions github-actions bot removed the size/m label Jul 31, 2024
@tianrunhe
Copy link
Contributor Author

Turns out there's some existing design on this from Enrique and there's some code Bartosz has already written. So, I just modify the code to reuse them. As a result, much less changes 🎉

@tianrunhe tianrunhe requested a review from Dschoordsch July 31, 2024 18:54
Copy link
Contributor

@Dschoordsch Dschoordsch left a comment

Choose a reason for hiding this comment

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

I like it except for the "Other's Team" tag. I would prefer a "Team lead" and "Member" tag on the others and no tag on the ones where they're not a member.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@Dschoordsch Dschoordsch merged commit 31cd317 into master Aug 1, 2024
7 checks passed
@Dschoordsch Dschoordsch deleted the feat/10011/orgAdminArchiveTeams branch August 1, 2024 13:45
@github-actions github-actions bot mentioned this pull request Aug 2, 2024
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Org Admin can archive/delete teams
2 participants