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

How to Prevent Automatic Upload in UploadSetwithTable? Critique on Predefined Upload Flow #4176

Open
luizcarlospedrosogomes opened this issue Dec 27, 2024 · 2 comments

Comments

@luizcarlospedrosogomes
Copy link

Hello SAP Team,

I am currently working with the UploadSetwithTable control and encountered a limitation regarding the automatic upload behavior. While exploring the documentation and the implementation in the UploadSetwithTable.js file, I noticed that there is no clear or documented way to completely prevent automatic uploads. This poses challenges for scenarios where the upload process needs to be fully controlled by the application logic.
Issue Details:

Automatic Upload by Default:
    It seems that UploadSet and its derivatives, such as UploadSetwithTable, are designed to start uploads automatically unless explicitly configured otherwise.
    There is no apparent method or property exposed in the UploadSetwithTable API that directly disables this behavior.

Lack of Control:
    In many enterprise-grade applications, the upload process is highly dependent on business rules or user interactions. Forcing a predefined upload flow makes it harder to integrate these controls seamlessly.
    Even though there are events like beforeUploadStarts, using these as workarounds to prevent uploads can lead to less maintainable code.

SAP's Approach to Upload Flow:
    While I understand the intent behind simplifying the user experience, the current implementation limits customization.
    By enforcing a specific upload flow, it can lead to friction in adopting the control in complex use cases where developers need full control over the file lifecycle (e.g., validations, approvals, manual uploads, etc.).

Questions and Suggestions:

Is there a documented or recommended way to disable automatic uploads in UploadSetwithTable?
Why does the control assume a specific upload flow instead of offering flexibility for custom logic?
I would suggest exposing a property like uploadAutomatically (similar to UploadSet) directly in UploadSetwithTable to allow developers to disable automatic uploads without relying on events or custom overrides.

Final Thoughts:

The UploadSet family of controls is powerful and useful for file handling in SAP applications, but the lack of flexibility in controlling the upload process can hinder its adoption in real-world enterprise scenarios. Providing developers with greater control over the upload lifecycle would make these controls more versatile and developer-friendly.

Looking forward to your feedback and thoughts on this matter

@GerganaKremenska GerganaKremenska self-assigned this Dec 30, 2024
@GerganaKremenska
Copy link
Member

Thank you for sharing this finding. I've created an internal incident DINC0370970. The status of the issue will be updated here in GitHub.

@I562693
Copy link
Contributor

I562693 commented Jan 21, 2025

Hi,

There is a way to restrict automatic upload of files and let application control the timing of the upload which can be done by using the “itemValidationHandler” property which is a callback when attached it expects promise to be returned by the callback function to the plugin and plugin waits for the promise to be resolved for every file to proceed with the upload. We have a sample to demonstrate the same for the usage. Please find the below links for the API reference and sample for the same. Please have a look and let us know if u need more assistance on this further. Thank you for reaching out to us.

API reference - https://sapui5.hana.ondemand.com/#/api/sap.m.plugins.UploadSetwithTable%23controlProperties (check property ItemValidationHandler)

itemValidationHandler API reference - https://sapui5.hana.ondemand.com/#/api/sap.m.plugins.UploadSetwithTable.itemValidationHandler

Demokit sample using itemValidationHandler - https://sapui5.hana.ondemand.com/#/entity/sap.m.plugins.UploadSetwithTable/sample/sap.m.sample.UploadSetwithTablePlugin.ResponsiveTableFileDialogs (please check the code for itemValidationHandler configuration)

Regards,
Vinay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants