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

Fix filtered modal tagging #4723

Merged
merged 5 commits into from
Aug 27, 2024

Conversation

benjaminpkane
Copy link
Contributor

@benjaminpkane benjaminpkane commented Aug 23, 2024

What changes are proposed in this pull request?

When tagging in the modal, the updated samples returned by the /tag route incorrectly include sidebar filters which results in seemingly lost data when tagging with sidebar filters applied.

As an aside, I added c as a hot key to hide the actions row because I could not figure out how to trigger the mouseleave event. This allows for a pure screenshot of the looker canvas

How is this patch tested? If it is not, please explain why.

Added e2e spec

Release Notes

Fixed tagging in the modal when sidebar filters are applied

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

Summary by CodeRabbit

  • New Features

    • Introduced keyboard navigation support in the SampleWrapper component for enhanced accessibility.
    • Added new properties to the PillEntry type for improved testing capabilities.
    • Implemented new asynchronous methods for enhanced interactions with the modal sidebar.
    • Simplified filtering mechanism in the tag management process for improved performance.
  • Bug Fixes

    • Resolved issues related to the management of PillButton properties for better usability.
  • Documentation

    • Updated test specifications for improved clarity and organization in the test suite.

@benjaminpkane benjaminpkane requested a review from a team August 23, 2024 20:29
@benjaminpkane benjaminpkane self-assigned this Aug 23, 2024
Copy link
Contributor

coderabbitai bot commented Aug 23, 2024

Walkthrough

The changes encompass modifications across multiple components, enhancing functionality, simplifying interfaces, and improving the structure of types and props. Notable updates include the addition of new methods for interaction in the modal sidebar, the integration of keyboard events for enhanced user experience, and the refinement of type definitions to improve maintainability.

Changes

Files Change Summary
.../PillButton/PillButton.tsx Reordered properties in PillButtonProps type definition for improved readability.
.../Modal/Sample.tsx Integrated useKeyDown hook into SampleWrapper component to toggle hovering state via keyboard input.
.../Sidebar/Entries/GroupEntries.tsx Added optional dataCy property to PillEntry type and updated Pills component to enhance data attributes for testing.
.../modal/modal-sidebar.ts Introduced new asynchronous methods in ModalSidebarPom class for enhanced interactions with modal sidebar.
.../smoke-tests/tagger.spec.ts Refactored test cases to utilize new ModalPom class for modal interactions, replacing previous grid-related actions.
.../routes/tag.py Modified post method to simplify filtering by replacing previous parameters with an empty dictionary in the get_tag_view function call.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ModalSidebar
    participant SampleWrapper

    User->>SampleWrapper: Press "c" key
    SampleWrapper->>ModalSidebar: Toggle hovering state
    ModalSidebar-->>User: Update UI
Loading

🐇
In a world where changes bloom,
New features dance and old ones zoom.
With props arranged in neat rows,
The code now flows where logic goes.
So hop along, let’s celebrate,
For brighter paths we now create! 🌼

Warning

Review ran into problems

Problems (1)
  • Git: Failed to clone repository. Please contact CodeRabbit support.

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.

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
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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2deee54 and a7bd80f.

Files ignored due to path filters (2)
  • e2e-pw/src/oss/specs/smoke-tests/tagger.spec.ts-snapshots/labels-chromium-darwin.png is excluded by !**/*.png, !**/*.png
  • e2e-pw/src/oss/specs/smoke-tests/tagger.spec.ts-snapshots/labels-chromium-linux.png is excluded by !**/*.png, !**/*.png
Files selected for processing (6)
  • app/packages/components/src/components/PillButton/PillButton.tsx (1 hunks)
  • app/packages/core/src/components/Modal/Sample.tsx (2 hunks)
  • app/packages/core/src/components/Sidebar/Entries/GroupEntries.tsx (3 hunks)
  • e2e-pw/src/oss/poms/modal/modal-sidebar.ts (2 hunks)
  • e2e-pw/src/oss/specs/smoke-tests/tagger.spec.ts (7 hunks)
  • fiftyone/server/routes/tag.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/packages/components/src/components/PillButton/PillButton.tsx
Additional context used
Path-based instructions (4)
app/packages/core/src/components/Modal/Sample.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

e2e-pw/src/oss/poms/modal/modal-sidebar.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

e2e-pw/src/oss/specs/smoke-tests/tagger.spec.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/core/src/components/Sidebar/Entries/GroupEntries.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

Additional comments not posted (17)
app/packages/core/src/components/Modal/Sample.tsx (2)

8-8: Import useKeyDown is correctly added.

The useKeyDown hook is imported appropriately for use in the component.


29-29: useKeyDown usage is correct.

The useKeyDown hook is effectively used to toggle the hovering state with the "c" key, enhancing interactivity.

fiftyone/server/routes/tag.py (1)

72-72: Verify the impact of removing filters.

Replacing the filters parameter with an empty dictionary simplifies the function call. Ensure this aligns with the intended behavior and does not affect functionality.

Run the following script to check for any usage of the filters parameter in the codebase that might be affected by this change:

e2e-pw/src/oss/poms/modal/modal-sidebar.ts (5)

16-21: applyFilter method implementation is correct.

The method correctly interacts with the checkbox element to apply a filter.


23-27: applySearch method implementation is correct.

The method correctly performs the search operation by filling the input and pressing "Enter".


29-31: clearGroupFilters method implementation is correct.

The method correctly interacts with the button to clear filters for a specific group.


33-36: clickFieldDropdown method implementation is correct.

The method correctly interacts with the dropdown element.


74-76: toggleLabelCheckbox method implementation is correct.

The method correctly toggles the checkbox for the specified field.

e2e-pw/src/oss/specs/smoke-tests/tagger.spec.ts (6)

4-4: Import of ModalPom is appropriate.

The import of ModalPom is necessary for the new modal interactions in the tests.


12-14: Test setup changes are appropriate.

The inclusion of modal and removal of gridActionsRow align with the new testing requirements for modal interactions.

Also applies to: 19-20


Line range hint 42-54: Test case changes for tag aggregation are appropriate.

The test case correctly interacts with the grid and tagger components to verify tag aggregation numbers.


Line range hint 57-75: Test case for adding a new sample tag is well-structured.

The test case effectively validates the addition of a new sample tag to all samples using the grid and tagger components.


Line range hint 78-98: Test case for adding a new label tag is well-structured.

The test case effectively ensures the correct addition of a new label tag to all samples.


102-128: Test case for adding a label tag in modal is comprehensive.

The test case thoroughly tests the modal interactions and label tagging functionality.

app/packages/core/src/components/Sidebar/Entries/GroupEntries.tsx (3)

35-36: Addition of dataCy to PillEntry is beneficial.

The optional dataCy property enhances testing capabilities by allowing data attributes for testing.


47-52: Passing dataCy to PillButton is appropriate.

The change ensures that dataCy is utilized for testing purposes in the rendered component.


311-332: Inclusion of dataCy attributes in PathGroupEntry is beneficial.

The use of dataCy attributes improves the traceability and testing of UI components.

@benjaminpkane benjaminpkane marked this pull request as draft August 23, 2024 21:18
@benjaminpkane benjaminpkane marked this pull request as ready for review August 26, 2024 13:41
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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a7bd80f and bd13890.

Files selected for processing (1)
  • fiftyone/server/routes/tag.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • fiftyone/server/routes/tag.py

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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bd13890 and 9572a63.

Files selected for processing (1)
  • app/packages/core/src/components/Modal/Sample.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/packages/core/src/components/Modal/Sample.tsx

Copy link
Contributor

@sashankaryal sashankaryal left a comment

Choose a reason for hiding this comment

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

love it!

Comment on lines +52 to +59
arrow?: boolean;
highlight?: boolean;
text?: string;
icon?: JSX.Element;
arrow?: boolean;
id?: string;
onClick: (event: Event) => void;
open?: boolean;
style?: React.CSSProperties;
text?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

🔤 🚀
(although my personal pref is to first list sorted non-optional fields, followed by optional fields)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Set up an automated lint rule and I will abide 😄

@benjaminpkane benjaminpkane merged commit d103621 into release/v0.25.1 Aug 27, 2024
19 checks passed
@benjaminpkane benjaminpkane deleted the bugfix/filtered-modal-tagging branch August 27, 2024 19: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.

2 participants