Skip to content

feat: Use UploadHandler in documentation #4317

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

Draft
wants to merge 13 commits into
base: latest
Choose a base branch
from

Conversation

caalador
Copy link
Contributor

fixes #4304

@caalador caalador force-pushed the issues/4304-downloadHandler branch from d950ac9 to 3456b23 Compare May 16, 2025 11:00
Copy link

github-actions bot commented May 16, 2025

AI Language Review

The changes in the source code primarily replace the previous file upload approach using MultiFileMemoryBuffer with a new method, employing InMemoryUploadHandler from UploadHandler. Key areas for review include:

  1. UploadAllFiles.java:

    • The snippet comment indicates // tag::snippet[] without providing surrounding context or description. Provide clear context for the snippet for better understanding.
    • Retain consistency in comments when referring to hidden lines for training models or code samples that should not be a permanent part of the code.
  2. UploadAutoUploadDisabled.java:

    • Ensure consistency in using InMemoryUploadHandler for better code organization and readability.
  3. UploadBasic.java:

    • You might need to provide appropriate context for the metadata fields (fileName, mimeType, contentLength) used within the lambda block for InMemoryUploadHandler. This would aid any developer in understanding the significance of the metadata.
  4. UploadDragAndDrop.java:

    • Ensure consistency in using InMemoryUploadHandler over multiple instances to aid clarity in handling drag-and-drop functionalities.
  5. UploadDropLabel.java:

    • Ensure the Upload component metadata or additional handlers do not throw unexpected errors by testing scenarios where metadata information might be incomplete or malformed.
  6. UploadFileBuffer.java:

    • Transition from using separate FileBuffer and MultiFileBuffer to FileUploadHandler approaches. Ensure the generic approach via UploadHandler.toFile(...) accommodates both single and multi-file scenarios seamlessly.

In terms of documentation, the transition to using InMemoryUploadHandler and FileUploadHandler needs to reflect changes clearly across documentation examples, accommodating for both single and multi-file uploads seamlessly. This would potentially impact various examples detailed under sections such as "Handling Uploaded Files in Flow", "File Handling", and "Upload Progress Tracking". Ensure any mention of previous handler methods (MultiFileMemoryBuffer, FileBuffer) are updated wherever appropriate to align with code changes to UploadHandler implementations.

@caalador caalador changed the title feat: Use UploadHanlder in documentation feat: Use UploadHandler in documentation May 16, 2025
@caalador caalador force-pushed the issues/4304-downloadHandler branch from 3456b23 to ed6c5c6 Compare May 16, 2025 11:14
@caalador caalador force-pushed the issues/4304-downloadHandler branch from ed6c5c6 to 90cb0c5 Compare May 16, 2025 11:14
caalador added 2 commits May 16, 2025 15:01
fix sample code in asciidoc
vaadin/flow#21443 makes the method protected
so it shouldn't be mentioned in the doc.
@mshabarov mshabarov self-requested a review May 19, 2025 11:31
Copy link
Contributor

@mshabarov mshabarov left a comment

Choose a reason for hiding this comment

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

In addition to other comments, I'd would add to the article a description for UploadEvent, UploadMetadata and
(can be borrowed from downloads docs) also for TransferContext, allowInert, urlPostfix and disableMode.

@caalador caalador marked this pull request as ready for review May 23, 2025 06:59
@mshabarov
Copy link
Contributor

Converted to draft to not being merged before RC/GA

@mshabarov mshabarov marked this pull request as draft May 23, 2025 10:53
@mshabarov
Copy link
Contributor

Methods getRequestSizeMax, getFileSizeMax and getFileCountMax of UploadHandler should be documented.
Also responseHandled is mentioned in examples, but not described in a sentence.

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.

Documentation for the new Upload API
2 participants