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 reset bug with issue tool #8236

Merged
merged 9 commits into from
Aug 8, 2024
Merged

Fixed reset bug with issue tool #8236

merged 9 commits into from
Aug 8, 2024

Conversation

klakhov
Copy link
Contributor

@klakhov klakhov commented Jul 30, 2024

Motivation and context

Resolved #8147

There are two problems:

  • Issue tool icon resets on start of the creating issue
  • Issue tool is not disabled after successful issue creation

And small enhancement:

  • Removed flashing of new issue form in case of using quick issue

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

  • Bug Fixes

    • Resolved an issue where the issue tool was not resetting after creating a new issue, enhancing user experience and reducing confusion.
  • New Features

    • Added functionality to the CreateIssueDialog to trigger external actions upon successful issue creation.
    • Introduced a new function to the issue aggregator allowing users to create issues directly from the canvas, improving interactivity.
  • User Interface Enhancements

    • Updated cursor behavior in the canvas to reflect the current interaction mode accurately, improving usability.
    • Adjusted control flow in the canvas wrapper to prevent unintended canvas resets upon position selection.

Copy link
Contributor

coderabbitai bot commented Jul 30, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent changes enhance the functionality of the issue tool in the annotation application by addressing a bug that left the tool active after switching modes. Modifications include resetting the cursor state in the canvas interaction, refining the control flow in the canvas wrapper, and introducing a new property for creating issues in the dialog. These updates collectively improve user experience and ensure better responsiveness during the annotation process.

Changes

Files Change Summary
changelog.d/20240731_121418_klakhov_fix_issue_tool.md, cvat-ui/src/components/annotation-page/review/create-issue-dialog.tsx Added changelog entry for bug fix related to issue tool; introduced onCreateIssue property for interaction.
cvat-canvas/src/typescript/canvasView.ts, cvat-ui/src/components/annotation-page/canvas/views/canvas2d/canvas-wrapper.tsx Reset canvas cursor style; removed automatic canvas reset on position selection.
cvat-ui/src/components/annotation-page/review/issues-aggregator.tsx Introduced onCreateIssue function to handle issue creation and update control state.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CanvasWrapper
    participant IssueDialog
    participant IssueAggregator

    User->>CanvasWrapper: Select position
    CanvasWrapper-->>User: No reset action
    User->>IssueDialog: Create issue
    IssueDialog->>IssueAggregator: Trigger onCreateIssue
    IssueAggregator-->>CanvasWrapper: Update active control
    Note right of User: Issue created successfully
Loading

Assessment against linked issues

Objective Addressed Explanation
The "open an issue" tool should be switched off after use (#[8147])
Ensure user interactions with the canvas reflect current mode (#[8147])

Poem

In the canvas, swift and bright,
Cursors dance, a joyful sight.
With each click, and issues spun,
We fix the bugs, and then we run!
A tool that resets, what a delight,
Happy users, hearts take flight! 🐇✨


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.

@klakhov klakhov marked this pull request as ready for review July 31, 2024 09:48
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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 33ff6b3 and 4753ddb.

Files selected for processing (5)
  • changelog.d/20240731_121418_klakhov_fix_issue_tool.md (1 hunks)
  • cvat-canvas/src/typescript/canvasView.ts (1 hunks)
  • cvat-ui/src/components/annotation-page/canvas/views/canvas2d/canvas-wrapper.tsx (1 hunks)
  • cvat-ui/src/components/annotation-page/review/create-issue-dialog.tsx (2 hunks)
  • cvat-ui/src/components/annotation-page/review/issues-aggregator.tsx (3 hunks)
Files skipped from review due to trivial changes (1)
  • changelog.d/20240731_121418_klakhov_fix_issue_tool.md
Additional comments not posted (6)
cvat-ui/src/components/annotation-page/review/create-issue-dialog.tsx (2)

80-80: LGTM!

The onCreateIssue property is correctly typed as a function returning void.


Line range hint 88-104: LGTM! But verify the function usage in the codebase.

The onCreateIssue property is correctly used in the component logic.

However, ensure that the onCreateIssue property is correctly passed and utilized throughout the codebase.

Verification successful

LGTM! But verify the function usage in the codebase.

The onCreateIssue property is correctly used in the component logic and passed down as a prop. The verification confirms its proper usage in the codebase.

  • cvat-ui/src/components/annotation-page/review/issues-aggregator.tsx
  • cvat-ui/src/components/annotation-page/review/create-issue-dialog.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `onCreateIssue` property in the codebase.

# Test: Search for the usage of `onCreateIssue` property. Expect: Proper usage in all instances.
rg --type typescript -A 5 $'onCreateIssue'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify the usage of the `onCreateIssue` property in the codebase.

# Test: Search for the usage of `onCreateIssue` property. Expect: Proper usage in all instances.
rg --type ts -A 5 $'onCreateIssue'

Length of output: 3036

cvat-ui/src/components/annotation-page/review/issues-aggregator.tsx (2)

18-18: LGTM!

The updateActiveControl function is correctly imported from actions/annotation-actions.


91-96: LGTM! But verify the function usage in the codebase.

The onCreateIssue function is correctly implemented using useCallback and passed as a prop.

However, ensure that the onCreateIssue function is correctly utilized throughout the codebase.

Verification successful

Let's correct the file type and re-run the search to verify the usage of the onCreateIssue function in the codebase.


The onCreateIssue function is correctly utilized throughout the codebase.

The function is defined and used in cvat-ui/src/components/annotation-page/review/issues-aggregator.tsx and is also invoked in cvat-ui/src/components/annotation-page/review/create-issue-dialog.tsx.

  • issues-aggregator.tsx: The function is defined and passed as a prop.
  • create-issue-dialog.tsx: The function is invoked as expected.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `onCreateIssue` function in the codebase.

# Test: Search for the usage of `onCreateIssue` function. Expect: Proper usage in all instances.
rg --type typescript -A 5 $'onCreateIssue'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify the usage of the `onCreateIssue` function in the codebase.

# Test: Search for the usage of `onCreateIssue` function in .ts and .tsx files. Expect: Proper usage in all instances.
rg --type-add 'ts:*.{ts,tsx}' -t ts -A 5 'onCreateIssue'

Length of output: 3059

cvat-ui/src/components/annotation-page/canvas/views/canvas2d/canvas-wrapper.tsx (1)

729-729: LGTM! But verify the method's functionality.

The onCanvasPositionSelected method is correctly modified to remove the call to onResetCanvas().

However, ensure that the method functions correctly without the call to onResetCanvas().

Verification successful

Let's correct the rg command and search for the onCanvasPositionSelected method definition and its usage across the codebase.


Let's correct the rg command to search for the usage of the onCanvasPositionSelected method in TypeScript and JSX files.


Let's correct the rg command to search for the usage of the onCanvasPositionSelected method in TypeScript and JavaScript files.


Verification Successful

The onCanvasPositionSelected method is correctly modified to remove the call to onResetCanvas(). The method's functionality is localized to the canvas-wrapper.tsx file, and no issues were found with its usage.

  • cvat-ui/src/components/annotation-page/canvas/views/canvas2d/canvas-wrapper.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the functionality of the `onCanvasPositionSelected` method in the codebase.

# Test: Search for the usage of `onCanvasPositionSelected` method. Expect: Proper functionality in all instances.
rg --type typescript -A 5 $'onCanvasPositionSelected'

Length of output: 87


Script:

#!/bin/bash
# Description: Verify the functionality of the `onCanvasPositionSelected` method in the codebase.

# Test: Search for the definition of `onCanvasPositionSelected` method.
rg 'onCanvasPositionSelected' -t ts -A 5

# Test: Search for the usage of `onCanvasPositionSelected` method.
rg 'onCanvasPositionSelected' -t tsx -A 5

Length of output: 2565


Script:

#!/bin/bash
# Description: Verify the functionality of the `onCanvasPositionSelected` method in the codebase.

# Test: Search for the usage of `onCanvasPositionSelected` method in TypeScript files.
rg 'onCanvasPositionSelected' -t ts -A 5

# Test: Search for the usage of `onCanvasPositionSelected` method in JSX files.
rg 'onCanvasPositionSelected' -t jsx -A 5

Length of output: 2565


Script:

#!/bin/bash
# Description: Verify the functionality of the `onCanvasPositionSelected` method in the codebase.

# Test: Search for the usage of `onCanvasPositionSelected` method in TypeScript files.
rg 'onCanvasPositionSelected' -t ts -A 5

# Test: Search for the usage of `onCanvasPositionSelected` method in JavaScript files.
rg 'onCanvasPositionSelected' -t js -A 5

Length of output: 2536

cvat-canvas/src/typescript/canvasView.ts (1)

1878-1878: LGTM! Verify the impact of the cursor reset.

The change to reset the cursor style when regionSelector.select(false) is called is approved.

However, ensure that this change does not introduce any unintended side effects in other parts of the application.

@codecov-commenter
Copy link

codecov-commenter commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 83.37%. Comparing base (4a21352) to head (807854a).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8236      +/-   ##
===========================================
- Coverage    83.38%   83.37%   -0.02%     
===========================================
  Files          389      389              
  Lines        41526    41524       -2     
  Branches      3856     3857       +1     
===========================================
- Hits         34626    34619       -7     
- Misses        6900     6905       +5     
Components Coverage Δ
cvat-ui 79.64% <85.71%> (-0.04%) ⬇️
cvat-server 86.68% <ø> (+<0.01%) ⬆️

Copy link

sonarcloud bot commented Aug 8, 2024

@klakhov klakhov merged commit 581e6b4 into develop Aug 8, 2024
33 checks passed
@klakhov klakhov deleted the kl/fix-issue-tool branch August 9, 2024 08:40
@cvat-bot cvat-bot bot mentioned this pull request Aug 13, 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.

Stuck on "open an issue" tool when switching from "Review" to "Standard" mode
3 participants