core icon indicating copy to clipboard operation
core copied to clipboard

[Templates] : The 'Template' dropdown in Page Properties is not displaying the expected Custom Template value

Open jcastro-dotcms opened this issue 1 year ago • 1 comments

Parent Issue

No response

Problem Statement

The Template dropdown in the Page Properties modal is NOT displaying the correct value when a custom Template is generated. When you update the page's layout, it displays System Template (System Host) instead.

If you check the contentlet table in the database, in the contentlet_as_json column, the Template data points to a custom Template. This means there might be a problem at UI level. This will confuse users as they will think their HTML Page is using the System Template, which is not correct.

Steps to Reproduce

  1. Create a test HTML Page using the Default Template.
  2. Add a test Rich Text to the page.
  3. Click the LAYOUT button and add a new row above or below the existing one. Click the CONTENT button.
  4. Finally, click the PROPERTIES button, You'll see that the value of the Template dropdown is System Template (System Host)

Acceptance Criteria

The Template dropdown must indicate that the current Template is actually a Custom Template, just like it used to.

dotCMS Version

Latest master.

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

This issue might be related to:

  • https://github.com/dotCMS/core/issues/28563

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

jcastro-dotcms avatar Jun 27 '24 16:06 jcastro-dotcms

I will take a look

jdotcms avatar Jun 27 '24 18:06 jdotcms

This issue is happening after the changes applied on this PR.

I could identified that the /api/v1/templates endpoint is called multiple times and the last call removes the Custom Page Layout from the dropdown list. After removing these lines , the issue gets fixed. However, when you select the File Template Advanced example, the dropdown breaks again.

Other findings:

  • the api/v1/templates/64269d16-2710-4919-88ec-3b09c89ea004/working is called twice
  • the /api/v1/templates/image fails when no image is found. In my opinion, we shouldn't log that exception because the template image is optional
  • Code duplication

I suggest to clean up the logic in the complete custom field to avoid unnecessary calls that might be affecting the field's behavior.

nollymar avatar Aug 19 '24 22:08 nollymar

Internal QA: Failed.

There is a small issue:

  • Create a Page using System Template and go to edit it
  • Create a custom layout for it and open the Properties modal right after. It still shows the System Template, but if you close the Properties modal and open it again, the Page Custom Layout is loaded correctly.

This issue happens in both, the new and old page editors. I have attached a video with the steps.

https://github.com/user-attachments/assets/930d66f8-8971-4341-ac63-74ce46d6e53c

nollymar avatar Aug 21 '24 17:08 nollymar

We are going to address this issue for the UVE here but for the old Edit Page is going to be in a separate ticket https://github.com/dotCMS/core/issues/29697, @nollymar

rjvelazco avatar Aug 21 '24 21:08 rjvelazco

IQA Passed

Now the Template field is populating correctly

Docker Image: [dotcms/dotcms:trunk_36f72e4]

Screenshot

https://github.com/user-attachments/assets/62b932b8-dc34-49b4-a0d7-b6f0de29512e

zJaaal avatar Aug 26 '24 16:08 zJaaal

We lost the notification when you apply some change here:

https://github.com/user-attachments/assets/0b4f52ce-9e8b-49ba-9979-1275583ac93a

bryanboza avatar Aug 26 '24 20:08 bryanboza

@bryanboza I updated the QA server with the latest trunk image dotcms/dotcms:trunk_2f3045b [dotcms/dotcms Tags] and I'm not able to reproduce the issue in any supported Browser. I used the System Template, Default Template, and a Custom Page Template to test the issue. Let me know the image, starter, and the template you used

I noticed you are testing in the old page editor in your local environment and in the UVE editor on the QA server.

If this is not happening in the QA: Server/UVE we should not add the Needs Work label

Videos

Default Template

https://github.com/user-attachments/assets/43843449-aa23-4c80-9a2c-bd4a6f0f5144

System Template

https://github.com/user-attachments/assets/ba71abe9-94c4-4f3c-ba98-b57bc12ad7a0

rjvelazco avatar Aug 27 '24 02:08 rjvelazco

ok, this is something related to the new edit mode, tested in the last trunk with the new edit mode and this is working as expected.

bryanboza avatar Aug 27 '24 18:08 bryanboza