Conversation
…erPath query param - Updated `DotCustomEventHandlerService` to include `folderPath` in the navigation query parameters when creating contentlets. - Added tests to verify that the `folderPath` is correctly passed during contentlet creation. - Enhanced existing tests to ensure proper handling of query parameters in navigation calls. This change improves the flexibility of contentlet creation by allowing the specification of a folder path directly through the event handler, facilitating better content organization.
|
Claude finished @nicobytes's task in 1m 50s —— View job PR Review
The overall approach is sound, but there are a few real issues worth addressing. 1. File assets get no
|
There was a problem hiding this comment.
Pull request overview
Adds end-to-end support for pre-filling the Host/Folder field when creating new content from the legacy browser by propagating a folderPath value through the legacy JS → custom event → Angular navigation/query params → edit-content store → field resolution.
Changes:
- Emit
folderPathin the legacy browser’screate-contentletcustom event (when available). - Pass
folderPathas an Angular route query param and capture it inDotEditContentStore. - Prefer
folderPath(from query params) when resolving the Host/Folder field initial value, with new/updated unit tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| dotCMS/src/main/webapp/html/portlet/ext/browser/view_browser_js_inc.jsp | Adds folderPath to the custom event payload when creating content from a selected folder context. |
| core-web/apps/dotcms-ui/src/app/api/services/dot-custom-event-handler/dot-custom-event-handler.service.ts | Reads folderPath from the event and navigates to the new-content route with queryParams. |
| core-web/apps/dotcms-ui/src/app/api/services/dot-custom-event-handler/dot-custom-event-handler.service.spec.ts | Updates/extends tests to cover navigation with folderPath. |
| core-web/libs/edit-content/src/lib/store/edit-content.store.ts | Captures supported query params (currently folderPath) into store state during route initialization. |
| core-web/libs/edit-content/src/lib/store/edit-content.store.spec.ts | Adds tests validating query param capture behavior. |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.ts | Passes store-captured query params into field resolution. |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form-resolutions.ts | Extends resolution signatures and prefers folderPath for Host/Folder when initializing new content. |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form-resolutions.spec.ts | Adds test coverage for Host/Folder resolution behavior with query params. |
- Updated the test for `DotCustomEventHandlerService` to assert that the router's `navigate` method is not called, streamlining the test logic. - Refactored the `edit-content` store to always patch the state with query parameters, removing unnecessary checks for empty parameters. - Added a return statement in the JSP file to prevent further execution when no valid HTML page asset type is selected. These changes enhance test clarity and ensure consistent state management in the application.
This pull request introduces support for pre-filling the Host/Folder field when creating new contentlets, by passing a
folderPathparameter through the UI and Angular application layers. It ensures that if a folder is selected in the legacy browser, the corresponding path is propagated and used to initialize the field value in the Angular edit content form. The changes include capturing the query param on the JavaScript side, updating Angular routing and state management, and enhancing field resolution logic and tests.End-to-end support for pre-filling Host/Folder field:
view_browser_js_inc.jsp) now passes afolderPathparameter as part of the custom event when creating a contentlet, based on the selected folder. [1] [2] [3]dot-custom-event-handler.service.ts) and its tests are updated to extract and passfolderPathas a query param when navigating to the new content route. [1] [2] [3] [4] [5]State management and field resolution updates:
edit-content.store.ts) captures supported query params (currentlyfolderPath) from the route and makes them available for form initialization, with corresponding tests to verify behavior. [1] [2] [3] [4]folderPathfrom query params when available, and the component passes these params to the resolution function. Tests were added to verify all scenarios. [1] [2] [3] [4] [5]These changes ensure that when a user creates content from a specific folder context in the legacy browser, the new content form will be pre-filled with the correct Host/Folder value, improving usability and consistency across the application.
This PR fixes: #34588