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(web): Team List - Move frontend logic to the backend #15965

Merged
merged 4 commits into from
Sep 12, 2024

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Sep 11, 2024

Team List - Move frontend logic to the backend

What

  • Extract team member tag data into a new graphql field called "tagGroups" instead of doing so in the frontend

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced a new optional property for filtering team members by tag groups.
    • Added a structured representation for team member tags, enhancing organization and clarity.
    • Improved uniqueness of team member identifiers in the display list.
  • Bug Fixes

    • Enhanced logic for processing team members and their associated tags, ensuring unique tags are included.
  • Refactor

    • Streamlined the logic for processing team members, simplifying data retrieval and enhancing performance.

Copy link
Contributor

coderabbitai bot commented Sep 11, 2024

Walkthrough

The changes primarily involve refactoring the handling of team member data across several components and services. The TeamListSlice.tsx file has been simplified by removing complex transformation logic, while the GraphQL query structure has been updated to use a flatter representation of tags. Additionally, new properties and classes have been introduced to enhance the organization of team member tags, and the mapping logic has been centralized for better maintainability. A unique identifier generation for team members has also been modified to prevent key collisions.

Changes

Files Change Summary
apps/web/components/Organization/Slice/TeamListSlice/TeamListSlice.tsx Removed complex transformation logic for processing team member items; items now directly assigned from itemsResponse.
apps/web/screens/queries/TeamList.ts Modified GET_TEAM_MEMBERS_QUERY structure from filterTags with nested properties to tagGroups with groupLabel and tagLabels.
libs/cms/src/lib/generated/contentfulTypes.d.ts Added optional property filterGroups to ITeamListFields interface for categorizing tags.
libs/cms/src/lib/models/teamList.model.ts Refactored mapTeamList function to enhance logic for filtering and organizing team member tags, ensuring unique tags are included based on filter groups.
libs/cms/src/lib/models/teamMember.model.ts Introduced TeamMemberTagGroup class; modified TeamMember class to include new tagGroups field; refactored mapTeamMember function to populate tagGroups and return createdAt timestamp.
libs/cms/src/lib/search/importers/teamList.service.ts Refactored TeamListSyncService to use a mapping function for processing team members, improving code clarity and maintainability.
libs/island-ui/contentful/src/lib/TeamList/TeamList.tsx Modified unique identifier generation for team members to include the index in the teamMembers array, ensuring uniqueness in the rendered list.

Possibly related PRs


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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

Copy link

codecov bot commented Sep 11, 2024

Codecov Report

Attention: Patch coverage is 17.74194% with 51 lines in your changes missing coverage. Please review.

Project coverage is 36.82%. Comparing base (b5778d2) to head (340be0e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
libs/cms/src/lib/models/teamMember.model.ts 27.27% 24 Missing ⚠️
libs/cms/src/lib/models/teamList.model.ts 4.76% 20 Missing ⚠️
...s/cms/src/lib/search/importers/teamList.service.ts 14.28% 6 Missing ⚠️
...Organization/Slice/TeamListSlice/TeamListSlice.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15965      +/-   ##
==========================================
- Coverage   36.85%   36.82%   -0.04%     
==========================================
  Files        6715     6715              
  Lines      137663   137673      +10     
  Branches    39134    39135       +1     
==========================================
- Hits        50737    50699      -38     
- Misses      86926    86974      +48     
Flag Coverage Δ
api 3.39% <ø> (ø)
api-domains-auth-admin 49.89% <ø> (ø)
api-domains-communications 40.43% <18.03%> (-0.12%) ⬇️
application-system-api 41.67% <18.03%> (-0.03%) ⬇️
application-template-api-modules 23.49% <ø> (+0.01%) ⬆️
cms 0.42% <0.00%> (-0.01%) ⬇️
cms-translations 39.58% <18.03%> (-0.12%) ⬇️
judicial-system-api 19.35% <ø> (ø)
judicial-system-backend 55.72% <18.03%> (-0.10%) ⬇️
services-user-notification 47.61% <18.03%> (-0.10%) ⬇️
web 1.84% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
apps/web/screens/queries/TeamList.ts 0.00% <ø> (ø)
...Organization/Slice/TeamListSlice/TeamListSlice.tsx 0.00% <0.00%> (ø)
...s/cms/src/lib/search/importers/teamList.service.ts 17.39% <14.28%> (-0.80%) ⬇️
libs/cms/src/lib/models/teamList.model.ts 29.41% <4.76%> (-26.15%) ⬇️
libs/cms/src/lib/models/teamMember.model.ts 44.00% <27.27%> (-18.50%) ⬇️

... and 22 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5778d2...340be0e. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Sep 11, 2024

Datadog Report

All test runs a3bb4fc 🔗

11 Total Test Services: 0 Failed, 10 Passed
🔻 Test Sessions change in coverage: 5 decreased, 23 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 2.77s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 12.59s 1 no change Link
api-domains-communications 0 0 0 5 0 30.15s 1 decreased (-0.19%) Link
api-domains-license-service 0 0 0 0 0 575.3ms 1 no change Link
application-system-api 0 0 0 111 2 3m 19.3s 1 no change Link
application-template-api-modules 0 0 0 109 0 1m 44.55s 1 no change Link
cms-translations 0 0 0 3 0 30.88s 1 decreased (-0.21%) Link
judicial-system-api 0 0 0 57 0 6.72s 1 no change Link
judicial-system-backend 0 0 0 21021 0 18m 37.25s 1 decreased (-0.13%) Link
services-user-notification 0 0 0 51 0 1m 24.87s 1 decreased (-0.11%) Link

🔻 Code Coverage Decreases vs Default Branch (5)

  • cms-translations - jest 49.21% (-0.21%) - Details
  • api-domains-communications - jest 49.76% (-0.19%) - Details
  • judicial-system-backend - jest 59.29% (-0.13%) - Details
  • services-user-notification - jest 70.16% (-0.11%) - Details
  • cms - jest 0.5% (-0.01%) - Details

@RunarVestmann RunarVestmann changed the title Order tags feat(web): Team List - Visual iteration Sep 12, 2024
@RunarVestmann RunarVestmann changed the title feat(web): Team List - Visual iteration feat(web): Team List - Move frontend logic to the backend Sep 12, 2024
@RunarVestmann RunarVestmann added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 12, 2024
@RunarVestmann RunarVestmann marked this pull request as ready for review September 12, 2024 09:57
@RunarVestmann RunarVestmann requested review from a team as code owners September 12, 2024 09:57
@RunarVestmann RunarVestmann removed the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 12, 2024
@RunarVestmann RunarVestmann requested a review from a team as a code owner September 12, 2024 10:06
Copy link
Member

@Toti91 Toti91 left a comment

Choose a reason for hiding this comment

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

island-ui LGTM

Copy link
Member

@disaerna disaerna left a comment

Choose a reason for hiding this comment

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

UI-Core files look good - Tiny comment on other 🐈‍⬛

@RunarVestmann RunarVestmann added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 12, 2024
@kodiakhq kodiakhq bot merged commit 754cc56 into main Sep 12, 2024
62 checks passed
@kodiakhq kodiakhq bot deleted the feature/web-team-list-iteration branch September 12, 2024 12:41
jonnigs pushed a commit that referenced this pull request Sep 12, 2024
* Order tags

* Change key

* Tag team members

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants