Skip to content

Disable upload button when max count is reached#493

Merged
yashmeet29 merged 11 commits into
developfrom
hideUploadButton
May 28, 2026
Merged

Disable upload button when max count is reached#493
yashmeet29 merged 11 commits into
developfrom
hideUploadButton

Conversation

@yashmeet29

@yashmeet29 yashmeet29 commented May 21, 2026

Copy link
Copy Markdown
Contributor

Describe your changes

Added populateUploadableFlags — an @after READ handler in SDMReadAttachmentsHandler that computes and injects virtual uploadable flag fields (e.g. isAttachmentsUploadable) into read results at runtime. Fiori Elements reads these flags via InsertRestrictions.Insertable to enable/disable the Upload button when a facet reaches its @SDM.Attachments.maxCount limit.

Consumer setup (CDS annotations only, no Java changes)

// 1. Virtual field on parent entity
entity Books { virtual isAttachmentsUploadable : Boolean; }

// 2. Wire InsertRestrictions + SideEffects on the parent
annotate AdminService.Books.attachments with @(
Capabilities: { InsertRestrictions: { Insertable: up_.isAttachmentsUploadable } }
);
annotate AdminService.Books with @(
Common.SideEffects #sdmAttachmentsUploadable: {
SourceEntities: ['attachments'],
TargetEntities: [''] // re-reads the parent entity after upload/delete
}
);

Any documentation

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist before requesting a review

  • I follow Java Development Guidelines for SAP
  • I have tested the functionality on my cloud environment.
  • I have provided sufficient automated/ unit tests for the code.
  • I have increased or maintained the test coverage.
  • I have ran integration tests on my cloud environment.
  • I have validated blackduck portal for any vulnerability after my commit.

Upload Screenshots/lists of the scenarios tested

  • I have Uploaded Screenshots or added lists of the scenarios tested in description

Single-tenant Integration tests: https://github.com/cap-java/sdm/actions/runs/26389837903
Multi-tenant Integration tests: https://github.com/cap-java/sdm/actions/runs/26442233609

Created 4 attachments in attachments facet one by one, once the 4th attachment got uploaded Upload button got disabled. Then deleted one of the attachment, Upload button was re-enabled and then uploaded one more attachment. After successfull upload, the Upload button got disabled.

@yashmeet29 yashmeet29 changed the title Read Handler to disable and re-enable upload button Disable and re-enable upload button when max count is reached May 26, 2026
@yashmeet29 yashmeet29 changed the title Disable and re-enable upload button when max count is reached Disable upload button when max count is reached May 26, 2026
rashmiangadi05
rashmiangadi05 previously approved these changes May 28, 2026
PujaDeshmukh17
PujaDeshmukh17 previously approved these changes May 28, 2026
@yashmeet29 yashmeet29 dismissed stale reviews from PujaDeshmukh17 and rashmiangadi05 via 27546f9 May 28, 2026 11:57

@PujaDeshmukh17 PujaDeshmukh17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, Thanks

@yashmeet29 yashmeet29 merged commit 810a2e8 into develop May 28, 2026
8 checks passed
@yashmeet29 yashmeet29 deleted the hideUploadButton branch May 28, 2026 12:10
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.

3 participants