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: add async validation on uploading file #150

Merged
merged 11 commits into from
Jan 26, 2024

Conversation

ArthurTriis1
Copy link
Contributor

@ArthurTriis1 ArthurTriis1 commented Jan 24, 2024

What problem is this solving?

When the first version of Bulk Import was launched, the B2B team quickly realized the need for asynchronous file validation. To achieve this, the route responsible for uploading and validating the file was split into two parts: the first for uploading the file and the second for initiating its validation. This PR integrates b2b-organizations with the new validation routes. The following sequence occurs after the user uploads a new file:

  1. The Uploading route is called with the file.
  2. The Validation route is called, and the modal transitions to the "awaiting validation" state.
  3. The Item Details route is called every 5 seconds, checking the status. Upon successful validation, the modal can be closed, and the import process begins. In case of validation issues, the modal enters a reporting state, allowing the user to view more details about the error from the validation file.

During each request, if an unexpected error occurs, the modal enters a generic error state, allowing the user to restart the process.

How to test it?

Workspace

Screenshots or example usage:

Screenshot 2024-01-24 at 18 28 37

How does this PR make you feel? 🔗

B2BTEAM-1544

Copy link

vtex-io-ci-cd bot commented Jan 24, 2024

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

Copy link

github-actions bot commented Jan 24, 2024

Warnings
⚠️

Looks like this PR is too large [:bulb: smaller PRs are easy to review and approve]

Messages
📖 ❤️ Thanks!
📖

🎉 PR additions = 224, PR deletions = 22

Generated by 🚫 dangerJS against dc75cd6

Signed-off-by: Arthur Andrade <[email protected]>
Signed-off-by: Arthur Andrade <[email protected]>
Signed-off-by: Arthur Andrade <[email protected]>
@ArthurTriis1 ArthurTriis1 requested a review from mairatma January 24, 2024 21:36
@ArthurTriis1 ArthurTriis1 self-assigned this Jan 24, 2024
export const bytesToSize = (bytes: number) => {
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']

if (bytes === 0) return '0 Bytes'
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be translated? In Portuguese I think we use the same term, but not sure if we can guarantee the same for other languages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, good question! I will ask to translation team and confirm.

react/hooks/useBulkImportDetailsQuery.ts Outdated Show resolved Hide resolved
react/hooks/useValidateBulkImport.ts Outdated Show resolved Hide resolved
@ArthurTriis1 ArthurTriis1 force-pushed the feat/Add-async-validation-pages-B2BTEAM-1544 branch from 10369a3 to 0297eeb Compare January 25, 2024 14:07
@ArthurTriis1 ArthurTriis1 force-pushed the feat/Add-async-validation-pages-B2BTEAM-1544 branch from 0297eeb to 1f75c93 Compare January 25, 2024 14:08
Signed-off-by: Arthur Andrade <[email protected]>
Signed-off-by: Arthur Andrade <[email protected]>
Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

1 New issue
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@ArthurTriis1 ArthurTriis1 requested a review from mairatma January 25, 2024 17:11
@ArthurTriis1 ArthurTriis1 merged commit 7a083d6 into master Jan 26, 2024
12 checks passed
@ArthurTriis1 ArthurTriis1 deleted the feat/Add-async-validation-pages-B2BTEAM-1544 branch January 26, 2024 13:06
Copy link

vtex-io-ci-cd bot commented Jan 26, 2024

Your PR has been merged! App is being published. 🚀
Version 1.29.2 → 1.30.0

After the publishing process has been completed (check #vtex-io-releases) and doing A/B tests with the new version, you can deploy your release by running:

vtex deploy [email protected]

After that your app will be updated on all accounts.

For more information on the deployment process check the docs. 📖

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