dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
860 stars 467 forks source link

Edit Page V2: Research if the page API contains information about containers in contentlets inside the HTML #27518

Closed fmontes closed 8 months ago

fmontes commented 8 months ago

Parent

27546

Task Description

As a dotCMS developer, I need to research if the page API provides all the necessary information about the containers within contentlets in the HTML, specifically in the page.render property.

This research is essential to determine if we can use the current API to edit velocity pages in the new edit page as is or if we need to develop a new endpoint.

### Acceptance Criteria
- [x] Determine if the page API includes information about containers within contentlets in the HTML.
- [x] Confirm whether the existing API can be used without any modifications or if a new endpoint needs to be developed.
- [x] Provide an estimate of the effort required to implement any necessary changes or enhancements.
- [x] Document any limitations or constraints regarding the existing API and its ability to provide container information.

External Links

N/A

Assumptions & Initiation Needs

fmontes commented 8 months ago

Currently the data that the editor needs from the client looks like this:

{
  "action": "CUSTOMER_ACTIONS.SET_CONTENTLET",
  "payload": {
    "x": "100",
    "y": "200",
    "width": "300",
    "height": "400",
    "container": {
      "acceptTypes": "blog,news,article", 
      "identifier": "identifier-123", 
      "contentletsId": ["contentlet-123", "contentlet-456"],
      "maxContentlets": 20, 
      "uuid": "uuid-123" 
    },
    "contentlet": {
      "identifier": "contentlet-123", 
      "title": "My Contentlet", 
      "inode": "contentlet-456" 
    },
    "pageContainers": [ 
      {
        "identifier": "//demo.dotcms.com/application/containers/default/",
        "uuid": "10", 
        "contentletsId": ["contentlet-123", "contentlet-456"]
      },
      {
        "identifier": "//demo.dotcms.com/application/containers/default/",
        "uuid": "1", 
        "contentletsId": ["contentlet-789", "contentlet-000"]
      }
    ],
    "pageId": "page.indentifier",
    "personaTag": "page.viewAs.persona.keyTag",
    "language_id": "page.viewAs.language_id" 
  }
}

In the HTML of the VTL:

✅ We have

❌ We missing

[!NOTE]
We can calculate the missing HTML from the API response in the SDK using the same response available in the editor.

Solution

We need to get the missing data in the editor and not passing it from the client.

The editor will pass the contentlet and container and with that we can go a fish from the rest of the data in the store where we have the page api response.