-
Notifications
You must be signed in to change notification settings - Fork 467
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
Image Field: "Select Existing File" functionality #30060
Comments
QA Notes:
2024-11-20.11-11-38.mp4 |
…ayed. (#30712) ### Parent Isssue #30060 ### Proposed Changes This pull request includes several updates to the `core-web/libs/edit-content` library, focusing on refactoring and improving the file field preview and selection components. The most important changes include the introduction of a new `FileInfo` type, updates to the `DotFileFieldPreviewComponent`, and modifications to the `DotSelectExistingFileComponent` and its store. ### Refactoring and Type Definitions: * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-preview/dot-file-field-preview.component.ts`](diffhunk://#diff-9d3250303440cce67e959a59ed17f44ad49d690c04e36cbf4fadc011f206001eR37-R46): Introduced `FileInfo` type to consolidate file-related properties and updated the component to use this new type. [[1]](diffhunk://#diff-9d3250303440cce67e959a59ed17f44ad49d690c04e36cbf4fadc011f206001eR37-R46) [[2]](diffhunk://#diff-9d3250303440cce67e959a59ed17f44ad49d690c04e36cbf4fadc011f206001eL73-R114) * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-import-url/dot-form-import-url.component.ts`](diffhunk://#diff-5efc519c0e3b6fc75fe06f8115527c72874b15e764a0c05508e341d0643ca624L15-R24): Added `DialogData` type for better type safety in dialog configurations. [[1]](diffhunk://#diff-5efc519c0e3b6fc75fe06f8115527c72874b15e764a0c05508e341d0643ca624L15-R24) [[2]](diffhunk://#diff-5efc519c0e3b6fc75fe06f8115527c72874b15e764a0c05508e341d0643ca624L39-R44) ### Component Updates: * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-preview/dot-file-field-preview.component.html`](diffhunk://#diff-64ed272338ca8810a9254c03bad8f295b77e25c76d92cf3db5c76038ed215474L1-R20): Refactored to use `fileInfo` instead of multiple individual variables for file properties. [[1]](diffhunk://#diff-64ed272338ca8810a9254c03bad8f295b77e25c76d92cf3db5c76038ed215474L1-R20) [[2]](diffhunk://#diff-64ed272338ca8810a9254c03bad8f295b77e25c76d92cf3db5c76038ed215474L59-R63) [[3]](diffhunk://#diff-64ed272338ca8810a9254c03bad8f295b77e25c76d92cf3db5c76038ed215474L82-R86) * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-preview/dot-file-field-preview.component.ts`](diffhunk://#diff-9d3250303440cce67e959a59ed17f44ad49d690c04e36cbf4fadc011f206001eL129-R135): Updated the component initialization and methods to work with the new `FileInfo` type. [[1]](diffhunk://#diff-9d3250303440cce67e959a59ed17f44ad49d690c04e36cbf4fadc011f206001eL129-R135) [[2]](diffhunk://#diff-9d3250303440cce67e959a59ed17f44ad49d690c04e36cbf4fadc011f206001eL163-R169) ### Store and Service Updates: * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/store/select-existing-file.store.ts`](diffhunk://#diff-4e8a1b332dae5fb8ead291b76bf6099437aaf4aa6fd0a759ffe71c3074ffe7f0L2-R9): Added `mimeTypes` state and related methods to handle file type filtering. [[1]](diffhunk://#diff-4e8a1b332dae5fb8ead291b76bf6099437aaf4aa6fd0a759ffe71c3074ffe7f0L2-R9) [[2]](diffhunk://#diff-4e8a1b332dae5fb8ead291b76bf6099437aaf4aa6fd0a759ffe71c3074ffe7f0L40-R50) [[3]](diffhunk://#diff-4e8a1b332dae5fb8ead291b76bf6099437aaf4aa6fd0a759ffe71c3074ffe7f0L57-R67) [[4]](diffhunk://#diff-4e8a1b332dae5fb8ead291b76bf6099437aaf4aa6fd0a759ffe71c3074ffe7f0R80-R84) * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/store/select-existing-file.store.test.ts`](diffhunk://#diff-547a685cc26753b615660d1f7014944ee45e352b8629ba7daa2d10522fa6c77dL16-R32): Updated tests to use `editContentService` instead of `service` for better clarity and consistency. [[1]](diffhunk://#diff-547a685cc26753b615660d1f7014944ee45e352b8629ba7daa2d10522fa6c77dL16-R32) [[2]](diffhunk://#diff-547a685cc26753b615660d1f7014944ee45e352b8629ba7daa2d10522fa6c77dL33-R41) [[3]](diffhunk://#diff-547a685cc26753b615660d1f7014944ee45e352b8629ba7daa2d10522fa6c77dL44-R52) [[4]](diffhunk://#diff-547a685cc26753b615660d1f7014944ee45e352b8629ba7daa2d10522fa6c77dL59-R67) [[5]](diffhunk://#diff-547a685cc26753b615660d1f7014944ee45e352b8629ba7daa2d10522fa6c77dL79-R87) ### Configuration Changes: * [`core-web/libs/edit-content/jest.config.ts`](diffhunk://#diff-a5a47422d33499f0f3d15a48bc9a17e7b3af763708f81899272096fd5457550dL21-R22): Added `@happy-dom/jest-environment` as the test environment for better compatibility with DOM-related tests. ### Checklist - [x] Tests - [x] Translations - [x] Security Implications Contemplated (add notes if applicable) ### Result 1. Image Field: When the user clicks on the “Select Existing File” option, only image files should be displayed. 2. File Field: When the user clicks on the “Select Existing File” option, all types of content should be displayed. https://github.com/user-attachments/assets/83c6ce24-015c-4577-af10-5354eb32a11e
Internal QA feedback: Screenshare.-.2024-11-25.4_11_27.PM.mp4 |
### Parent Isssue #30060 ### Proposed Changes This pull request includes changes to the `dot-select-existing-file` component and its associated store to improve the initialization process. The most important changes involve modifying the loading behavior of content data. Initialization process improvements: * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/dot-select-existing-file.component.ts`](diffhunk://#diff-18bf6e06cc08560259db33d84f324194172c43e47220f07b1de0990cf71077acR79): Added a call to `this.store.loadContent()` to ensure content is loaded during the component's initialization. * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/store/select-existing-file.store.ts`](diffhunk://#diff-4e8a1b332dae5fb8ead291b76bf6099437aaf4aa6fd0a759ffe71c3074ffe7f0L210): Removed the call to `store.loadContent()` from the `onInit` hook to prevent redundant loading of content. ### Checklist - [x] Tests - [x] Translations - [x] Security Implications Contemplated (add notes if applicable)
Pass internal QA: both fields File and Image, show the files filtered by type. |
Please add to the card the name of the feature flag (FF) that needs to be enabled to see this field. It’s important to ensure anyone can take the card and test it without needing to reach out to the developer for additional details. |
|
Approved: Tested on trunk_e15f58e, Docker, macOS 14.5, FF v126.0.1 |
Parent Issue
#29692
User Story
As a content editor, I want to select an existing file and have the system display only image files, so that I can quickly find and choose the appropriate image for my content.
Acceptance Criteria
The text was updated successfully, but these errors were encountered: