-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Adding support for listing templates across multiple sites (…
…#31086) ### Proposed Changes * Wildcard host support was included in the endpoint that lists templates to be able to get all the templates across multiple sites ### Checklist - [x] Tests This pull request includes several changes to improve the handling of template selection and filtering in both the backend and frontend of the dotCMS application. The most important changes include updates to the `TemplateResource` class, improvements to the template selection logic in the frontend, and the addition of a new test case. ### Backend changes: * [`dotCMS/src/main/java/com/dotcms/rest/api/v1/template/TemplateResource.java`](diffhunk://#diff-448b3630547f743e0d556752c2e68b797b03e9c4b9d7e238c84889274435635eL139-R156): Refactored the method to handle template listing by incorporating logic to support wildcard host IDs, which allows fetching templates across multiple sites. ### Frontend changes: * [`dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/template_custom_field.vtl`](diffhunk://#diff-27bf5cec90b9630400c776d8f3fd37151da487ffbebbef2a630946b559bf0dd6L96-R122): Added a new function `resetTemplateSelection` to reset the template selection, and modified the template fetch logic to handle the wildcard host ID. [[1]](diffhunk://#diff-27bf5cec90b9630400c776d8f3fd37151da487ffbebbef2a630946b559bf0dd6L96-R122) [[2]](diffhunk://#diff-27bf5cec90b9630400c776d8f3fd37151da487ffbebbef2a630946b559bf0dd6L154-R158) [[3]](diffhunk://#diff-27bf5cec90b9630400c776d8f3fd37151da487ffbebbef2a630946b559bf0dd6L173-R177) [[4]](diffhunk://#diff-27bf5cec90b9630400c776d8f3fd37151da487ffbebbef2a630946b559bf0dd6L185-R189) * [`dotCMS/src/main/webapp/html/js/dotcms/dojo/data/TemplateReadStore.js`](diffhunk://#diff-5453f9a344625845fd35818fe8b7853f0b5ef2428b53b0e775a6f5cd13bf7c22R14-L17): Added a new constant `ALL_SITE_TEMPLATE` to emulate the old backend behavior and updated the fetch logic to include this template when the wildcard host ID is used. [[1]](diffhunk://#diff-5453f9a344625845fd35818fe8b7853f0b5ef2428b53b0e775a6f5cd13bf7c22R14-L17) [[2]](diffhunk://#diff-5453f9a344625845fd35818fe8b7853f0b5ef2428b53b0e775a6f5cd13bf7c22R111-R130) ### Test changes: * [`dotcms-integration/src/test/java/com/dotcms/rest/api/v1/template/TemplateResourceTest.java`](diffhunk://#diff-745f7eccb02b77ba5b0bc21bba208f1fa5113e2e1b93261173f2091a579936b5R1072-R1114): Added a new test case `test_listTemplate_filterByHost_usingWildcardHost` to verify the correct behavior when listing templates with a wildcard host ID. ### Video https://github.com/user-attachments/assets/0fbb9f5a-3341-4760-a4d0-d477a584192e --------- Co-authored-by: Rafael Velazco <[email protected]>
- Loading branch information
Showing
4 changed files
with
133 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters