Skip to content

fix: add allowed extensions props on formik input component#913

Open
tomrndom wants to merge 4 commits intomasterfrom
fix/page-module-download-extensions
Open

fix: add allowed extensions props on formik input component#913
tomrndom wants to merge 4 commits intomasterfrom
fix/page-module-download-extensions

Conversation

@tomrndom
Copy link
Copy Markdown

@tomrndom tomrndom commented May 5, 2026

ref: https://app.clickup.com/t/86b9c38wj

image image

Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com

Summary by CodeRabbit

  • New Features

    • Upload components now support configurable allowed file extensions for finer control over accepted files.
    • Document upload now accepts PDFs plus standard inventory image formats for broader document selection.
  • Chores

    • Updated underlying library to a newer patch version.
  • Tests

    • Updated test mocks to reference the external upload implementation.

Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a033637b-ec62-400c-adae-f76599112a76

📥 Commits

Reviewing files that changed from the base of the PR and between 24585dd and b2683d5.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • package.json
  • src/pages/sponsors-global/page-templates/page-template-popup/page-template-module-form.test.js
✅ Files skipped from review due to trivial changes (2)
  • src/pages/sponsors-global/page-templates/page-template-popup/page-template-module-form.test.js
  • package.json

📝 Walkthrough

Walkthrough

The MuiFormikUpload component now accepts an allowedExtensions prop which overrides mediaType.type.allowed_extensions (defaults to ALLOWED_INVENTORY_IMAGE_FORMATS). A document-download module passes ["pdf", ...ALLOWED_INVENTORY_IMAGE_FORMATS] to allow PDFs plus images.

Changes

Upload Component Flexibility

Layer / File(s) Summary
Data Shape / Constants
src/components/mui/formik-inputs/mui-formik-upload.js
Introduces allowedExtensions prop usage to determine mediaType.type.allowed_extensions (falls back to ALLOWED_INVENTORY_IMAGE_FORMATS).
Component Implementation
src/components/mui/formik-inputs/mui-formik-upload.js
Destructures allowedExtensions from props and applies it when building the mediaType config.
PropTypes / API
src/components/mui/formik-inputs/mui-formik-upload.js
Adds allowedExtensions: PropTypes.arrayOf(PropTypes.string) and explicitly declares maxFiles: PropTypes.number.
Integration / Usage
src/pages/sponsors-global/page-templates/page-template-popup/modules/page-template-document-download-module.js
Imports ALLOWED_INVENTORY_IMAGE_FORMATS and passes allowedExtensions={["pdf", ...ALLOWED_INVENTORY_IMAGE_FORMATS]} to MuiFormikUpload.
Tests / Mocks
src/pages/sponsors-global/page-templates/page-template-popup/page-template-module-form.test.js
Updates Jest mock target for the upload component to the external openstack-uicore-foundation path while keeping the mock implementation.
Dependencies
package.json
Bumps openstack-uicore-foundation from 5.0.16 to 5.0.17.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • smarcet
  • martinquiroga-exo

Poem

🐰 I hopped through props and fields today,
Gave uploads room for PDFs to play.
Images still dance in formats so bright,
Now all can join the file-upload night. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding an allowedExtensions prop to the formik input upload component, which is reflected across multiple files in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/page-module-download-extensions
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch fix/page-module-download-extensions

Comment @coderabbitai help to get the list of available commands and usage tips.

@tomrndom tomrndom requested review from smarcet and removed request for smarcet May 6, 2026 12:57
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
@tomrndom tomrndom requested a review from smarcet May 7, 2026 14:59
@tomrndom
Copy link
Copy Markdown
Author

tomrndom commented May 7, 2026

@smarcet waiting changes from OpenStackweb/openstack-uicore-foundation#236 to update uicore version

tomrndom added 2 commits May 7, 2026 18:17
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
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.

1 participant