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

[GSoC2024] fix and refactor import-dataset-modal code (#7428) #7599

Merged
merged 5 commits into from
Mar 15, 2024

Conversation

umangapatel123
Copy link
Contributor

@umangapatel123 umangapatel123 commented Mar 12, 2024

Refactor code to use useReducer instead of useState. Fixes #7428
'file' and 'fileName' in the uploadParams were not set to null after import. To avoid this change the code to set 'file' and 'fileName' to null after importing is done.

Motivation and context

This change is required to make the code clear. The previous code uses many useState to manage the state but this version uses useReducer to manage all the states.
In the previous code file and fileName in the uploadParams were not set to null after importing was done but this version set it to null so it can not use the previous file while importing annotation.
it solves issue #7428

How has this been tested?

The changes have been tested manually. The code was tested using different sequences of annotation uploads. The state of each parameter is tested by logging its state to the console.

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.

Refactor code to use useReducer instead of useState.
Fixes cvat-ai#7428
'file' and 'fileName' in the uploadParams was not set to null after import.
To avoid this changed the code to set 'file' and 'fileName' null after importing is done.
@nmanovic nmanovic requested review from klakhov and removed request for bsekachev and nmanovic March 13, 2024 07:37
@umangapatel123
Copy link
Contributor Author

@klakhov can you please review?

Copy link
Contributor

@klakhov klakhov left a comment

Choose a reason for hiding this comment

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

Could you also check the import cypress test? Its failed here
Tests docs

From quick look on the failed test I see the wrong notification is shown. Looks like while importing a project locally incorrect resourse param is inside uploadParams.

@umangapatel123
Copy link
Contributor Author

@klakhov I've made the changes based on your suggestion and resolved the failing Cypress test. Could you please review it now?

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Merging #7599 (63d573e) into develop (ae7999b) will decrease coverage by 0.01%.
The diff coverage is n/a.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7599      +/-   ##
===========================================
- Coverage    83.46%   83.45%   -0.01%     
===========================================
  Files          373      373              
  Lines        39739    39739              
  Branches      3741     3741              
===========================================
- Hits         33168    33166       -2     
- Misses        6571     6573       +2     
Components Coverage Δ
cvat-ui 79.26% <ø> (-0.01%) ⬇️
cvat-server 87.32% <ø> (-0.01%) ⬇️

@umangapatel123
Copy link
Contributor Author

@klakhov can you please approve the changes?

@klakhov klakhov merged commit 787a0c8 into cvat-ai:develop Mar 15, 2024
34 checks passed
@klakhov
Copy link
Contributor

klakhov commented Mar 15, 2024

@umangapatel123, Thanks for contribution.
As you've fixed a bug with importing a dataset, would you mind to contribute a cypress test covering this bug? I belive we need to reproduce the original issue's scenario. You may be familiar with test system already, as it helped to identify a problem in the pr.
For inspiration, you can look on project export test and tests concerning cloud storages here and here

@umangapatel123
Copy link
Contributor Author

Okay, I will do that.

@klakhov
Copy link
Contributor

klakhov commented Mar 21, 2024

Hi @umangapatel123 , can you share with us your progress with test? Are you still going to contribute?

@umangapatel123
Copy link
Contributor Author

Hi @umangapatel123 , can you share with us your progress with test? Are you still going to contribute?

I am still working on it. yes, I am contributing. I was busy for some days due to university examinations.

umangapatel123 added a commit to umangapatel123/cvat that referenced this pull request Mar 24, 2024
g-kartik pushed a commit to g-kartik/cvat that referenced this pull request Mar 29, 2024
@umangapatel123 umangapatel123 deleted the refactor-into-usereducer branch March 29, 2024 17:06
@cvat-bot cvat-bot bot mentioned this pull request Apr 2, 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.

Wrong filename used when importing from cloud storage after another import
3 participants