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

Fixed tooltips with undefined shortcuts #8578

Merged
merged 3 commits into from
Oct 22, 2024

Conversation

bsekachev
Copy link
Member

@bsekachev bsekachev commented Oct 22, 2024

Motivation and context

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)
  • I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

Summary by CodeRabbit

  • New Features

    • Introduced a search functionality for annotations in the top bar.
    • Enhanced tooltip display by fixing 'undefined' shortcut issues.
  • Bug Fixes

    • Resolved the issue with undefined shortcuts in the user interface.
  • Improvements

    • Updated keyboard shortcuts for drawing mode to standardize controls across components.

@bsekachev bsekachev requested a review from nmanovic as a code owner October 22, 2024 09:14
Copy link
Contributor

coderabbitai bot commented Oct 22, 2024

Walkthrough

This update addresses multiple modifications across various components in the application. It resolves an issue with undefined shortcuts in tooltips and introduces changes to shortcut key mappings for drawing and object removal functionalities. Notably, the DELETE_OBJECT shortcut is renamed, and several components receive updates to their props to standardize control schemes. Additionally, a new method for searching annotations is added to the top bar component, enhancing the overall usability of the interface.

Changes

File Path Change Summary
changelog.d/20241022_121246_sekachev.bs_fixed_undefined_shortcuts.md Fixed issue with tooltips displaying 'undefined' shortcuts.
cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/object-item.tsx Renamed DELETE_OBJECT to DELETE_OBJECT_STANDARD_WORKSPACE in normalizedKeyMap.
cvat-ui/src/containers/annotation-page/standard-workspace/controls-side-bar/draw-shape-popover.tsx Updated repeatShapeShortcut from SWITCH_DRAW_MODE to SWITCH_DRAW_MODE_STANDARD_CONTROLS.
cvat-ui/src/containers/annotation-page/standard-workspace/controls-side-bar/setup-tag-popover.tsx Updated repeatShapeShortcut from SWITCH_DRAW_MODE to SWITCH_DRAW_MODE_STANDARD_CONTROLS.
cvat-ui/src/containers/annotation-page/top-bar/top-bar.tsx Added onSearchAnnotations method and prop; updated drawShortcut from SWITCH_DRAW_MODE to SWITCH_DRAW_MODE_STANDARD_CONTROLS.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AnnotationTopBar
    participant DrawShapePopover
    participant SetupTagPopover
    participant ObjectItem

    User->>AnnotationTopBar: Search Annotations
    AnnotationTopBar->>AnnotationTopBar: onSearchAnnotations()
    User->>DrawShapePopover: Draw Shape (Shortcut)
    DrawShapePopover->>DrawShapePopover: Handle SWITCH_DRAW_MODE_STANDARD_CONTROLS
    User->>SetupTagPopover: Setup Tag (Shortcut)
    SetupTagPopover->>SetupTagPopover: Handle SWITCH_DRAW_MODE_STANDARD_CONTROLS
    User->>ObjectItem: Delete Object (Shortcut)
    ObjectItem->>ObjectItem: Handle DELETE_OBJECT_STANDARD_WORKSPACE
Loading

🐰 In the land of code where shortcuts play,
A fix was made to brighten the day.
With tools now clear and actions defined,
Our interface shines, perfectly aligned!
So hop along, dear friends, rejoice,
For usability sings, let’s raise our voice! 🎉


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.

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.

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

🧹 Outside diff range and nitpick comments (1)
cvat-ui/src/containers/annotation-page/top-bar/top-bar.tsx (1)

680-680: New onSearchAnnotations prop added

A new prop onSearchAnnotations has been added to the AnnotationTopBarComponent. This suggests the introduction of a new feature for searching annotations.

Consider adding a comment or documentation to explain the purpose and expected behavior of this new search functionality. This will help other developers understand how to use this feature and its impact on the component.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4354f72 and 55e033d.

📒 Files selected for processing (5)
  • changelog.d/20241022_121246_sekachev.bs_fixed_undefined_shortcuts.md (1 hunks)
  • cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/object-item.tsx (1 hunks)
  • cvat-ui/src/containers/annotation-page/standard-workspace/controls-side-bar/draw-shape-popover.tsx (1 hunks)
  • cvat-ui/src/containers/annotation-page/standard-workspace/controls-side-bar/setup-tag-popover.tsx (1 hunks)
  • cvat-ui/src/containers/annotation-page/top-bar/top-bar.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • changelog.d/20241022_121246_sekachev.bs_fixed_undefined_shortcuts.md
  • cvat-ui/src/containers/annotation-page/standard-workspace/controls-side-bar/draw-shape-popover.tsx
🧰 Additional context used
🔇 Additional comments (4)
cvat-ui/src/containers/annotation-page/standard-workspace/controls-side-bar/setup-tag-popover.tsx (1)

157-157: LGTM! Verify consistency across the codebase.

The change from SWITCH_DRAW_MODE to SWITCH_DRAW_MODE_STANDARD_CONTROLS aligns with the PR objective of fixing undefined shortcuts in tooltips. This update is consistent with similar changes in other components, as mentioned in the AI-generated summary.

To ensure consistency across the codebase, run the following script:

This script will help ensure that:

  1. There are no remaining instances of the old SWITCH_DRAW_MODE (without the _STANDARD_CONTROLS suffix).
  2. The new SWITCH_DRAW_MODE_STANDARD_CONTROLS is used consistently.
  3. There are no lingering TODO comments related to this change.

Please review the results and make any necessary adjustments to ensure consistency across the codebase.

✅ Verification successful

Re-running verification scripts to ensure consistency across the codebase.

Please execute the following updated scripts:


Verification successful: SWITCH_DRAW_MODE_STANDARD_CONTROLS is consistently used across the codebase, and no instances of SWITCH_DRAW_MODE or related TODO comments were found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of SWITCH_DRAW_MODE_STANDARD_CONTROLS across the codebase

# Test 1: Check for any remaining usage of SWITCH_DRAW_MODE
echo "Checking for any remaining usage of SWITCH_DRAW_MODE:"
rg "SWITCH_DRAW_MODE[^_]" --type ts --type tsx

# Test 2: Verify the usage of SWITCH_DRAW_MODE_STANDARD_CONTROLS
echo "Verifying the usage of SWITCH_DRAW_MODE_STANDARD_CONTROLS:"
rg "SWITCH_DRAW_MODE_STANDARD_CONTROLS" --type ts --type tsx

# Test 3: Check for any TODO comments related to this change
echo "Checking for any TODO comments related to this change:"
rg "TODO.*SWITCH_DRAW_MODE" --type ts --type tsx

Length of output: 607


Script:

#!/bin/bash
# Description: Verify the usage of SWITCH_DRAW_MODE_STANDARD_CONTROLS across the codebase

# Test 1: Check for any remaining usage of SWITCH_DRAW_MODE
echo "Checking for any remaining usage of SWITCH_DRAW_MODE:"
rg "SWITCH_DRAW_MODE[^_]" --glob "*.ts" --glob "*.tsx"

# Test 2: Verify the usage of SWITCH_DRAW_MODE_STANDARD_CONTROLS
echo "Verifying the usage of SWITCH_DRAW_MODE_STANDARD_CONTROLS:"
rg "SWITCH_DRAW_MODE_STANDARD_CONTROLS" --glob "*.ts" --glob "*.tsx"

# Test 3: Check for any TODO comments related to this change
echo "Checking for any TODO comments related to this change:"
rg "TODO.*SWITCH_DRAW_MODE" --glob "*.ts" --glob "*.tsx"

Length of output: 1567

cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/object-item.tsx (1)

121-121: LGTM. Verify consistency and update documentation if needed.

The change from normalizedKeyMap.DELETE_OBJECT to normalizedKeyMap.DELETE_OBJECT_STANDARD_WORKSPACE looks good and aligns with the PR objectives of fixing undefined shortcuts.

To ensure consistency across the codebase, please run the following script:

Consider updating the documentation to reflect this change in shortcut naming if necessary.

✅ Verification successful

Verification Successful

All instances of DELETE_OBJECT have been successfully replaced with DELETE_OBJECT_STANDARD_WORKSPACE. No remaining occurrences found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining instances of DELETE_OBJECT and compare with DELETE_OBJECT_STANDARD_WORKSPACE

echo "Occurrences of DELETE_OBJECT:"
rg "DELETE_OBJECT[^_]" --type ts --type tsx

echo "\nOccurrences of DELETE_OBJECT_STANDARD_WORKSPACE:"
rg "DELETE_OBJECT_STANDARD_WORKSPACE" --type ts --type tsx

Length of output: 340


Script:

#!/bin/bash
# Description: Check for any remaining instances of DELETE_OBJECT and compare with DELETE_OBJECT_STANDARD_WORKSPACE in .ts and .tsx files

echo "Occurrences of DELETE_OBJECT:"
rg "DELETE_OBJECT[^_]" -g "*.ts" -g "*.tsx"

echo "\nOccurrences of DELETE_OBJECT_STANDARD_WORKSPACE:"
rg "DELETE_OBJECT_STANDARD_WORKSPACE" -g "*.ts" -g "*.tsx"

Length of output: 772

cvat-ui/src/containers/annotation-page/top-bar/top-bar.tsx (2)

Line range hint 1-720: Summary of changes

The modifications in this file include:

  1. Updating the drawShortcut prop to use a new keyboard mapping.
  2. Adding a new onSearchAnnotations prop for search functionality.
  3. An incomplete line of code that needs attention.

These changes suggest improvements to the user interface and the addition of new features. The updated keyboard shortcut may provide a more standardized control scheme, while the new search functionality could enhance the user's ability to navigate and find specific annotations.

To ensure the effectiveness of these changes:

  1. Complete or remove the incomplete line of code.
  2. Add documentation for the new search functionality.
  3. Verify that the keyboard shortcut change is consistent across the codebase.
  4. Consider adding tests for the new search feature to ensure its reliability.

701-701: Update to drawShortcut prop

The drawShortcut prop has been updated to use normalizedKeyMap.SWITCH_DRAW_MODE_STANDARD_CONTROLS instead of normalizedKeyMap.SWITCH_DRAW_MODE. This change suggests a modification in the keyboard shortcut mapping for the draw mode.

To ensure this change is consistent across the codebase, please run the following script:

✅ Verification successful

Verification Successful

The drawShortcut prop has been consistently updated across the codebase to use normalizedKeyMap.SWITCH_DRAW_MODE_STANDARD_CONTROLS. No remaining instances of SWITCH_DRAW_MODE were found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining usage of SWITCH_DRAW_MODE and compare with SWITCH_DRAW_MODE_STANDARD_CONTROLS

echo "Occurrences of SWITCH_DRAW_MODE:"
rg "SWITCH_DRAW_MODE[^_]" --type ts --type tsx

echo "\nOccurrences of SWITCH_DRAW_MODE_STANDARD_CONTROLS:"
rg "SWITCH_DRAW_MODE_STANDARD_CONTROLS" --type ts --type tsx

Length of output: 355


Script:

#!/bin/bash
# Description: Check for any remaining usage of SWITCH_DRAW_MODE and compare with SWITCH_DRAW_MODE_STANDARD_CONTROLS

echo "Occurrences of SWITCH_DRAW_MODE:"
rg "SWITCH_DRAW_MODE[^_]" -g "*.ts" -g "*.tsx"

echo "\nOccurrences of SWITCH_DRAW_MODE_STANDARD_CONTROLS:"
rg "SWITCH_DRAW_MODE_STANDARD_CONTROLS" -g "*.ts" -g "*.tsx"

Length of output: 1319

cvat-ui/src/containers/annotation-page/top-bar/top-bar.tsx Outdated Show resolved Hide resolved
Copy link

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.28%. Comparing base (4354f72) to head (ab9a5f6).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8578      +/-   ##
===========================================
+ Coverage    74.24%   74.28%   +0.04%     
===========================================
  Files          403      403              
  Lines        43287    43287              
  Branches      3914     3914              
===========================================
+ Hits         32137    32156      +19     
+ Misses       11150    11131      -19     
Components Coverage Δ
cvat-ui 78.76% <ø> (+0.09%) ⬆️
cvat-server 70.47% <ø> (ø)

@bsekachev bsekachev merged commit 2cca2dd into develop Oct 22, 2024
34 checks passed
@bsekachev bsekachev deleted the bs/fixed_undefined_shortcuts branch October 24, 2024 05:15
@cvat-bot cvat-bot bot mentioned this pull request Oct 24, 2024
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