- Issue created by @mglaman
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Definitely is blocked on ๐ Controllers performing data modification should make use of CSRF tokens via /session/token Active .
- ๐บ๐ธUnited States mglaman WI, USA
After reading ๐ Controllers performing data modification should make use of CSRF tokens via /session/token Active , I think the approach should be changed. Originally the idea was just a regular link which would redirect to the editor. Instead it should be a POST request and then redirect based off of the response data.
Request:
POST /api/create/xb_page
Response
201 Created { "data": { "xb_page": { "id": 123 } } }
Then the editor can redirect to
/xb/xb_page/123
.This unblocks the need for CSRF since we're using a
POST
method - ๐บ๐ธUnited States mglaman WI, USA
After looking at the update route
experience_builder.api.content.update: path: '/xb/api/content-update/{entity_type}/{entity}'
I suppose it should be
experience_builder.api.content.create: path: '/xb/api/content-update/{entity_type}
But we have logic in the controller which fails if the entity type is anything else but xb_page (for now.)
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
๐ Controllers performing data modification should make use of CSRF tokens via /session/token Active landed.
#5: hm โฆ so then the entity would exist immediately, but need to be invalid, because the
requiredtitle
cannot yet be specified by the author.
Plus, it'd need to be marked as unpublished (EntityPublishedInterface::setUnpublished()
).I'm sure we can make all that work at the technical level. I'm not sure what the UX would look like exactly?
- ๐บ๐ธUnited States mglaman WI, USA
required title cannot yet be specified by the author.
The title is populated as "Untitled page"
It is also specified that it should be unpublished.
This was approved by laurii and I believe effulgentsia
Edit:
The UX is: Click "New", brought to editor for a page named "Untitled page"
- Merge request !579Resolve #3500046 "Provide a way to create a new page" โ (Merged) created by attilatilman
- ๐บ๐ธUnited States mglaman WI, USA
Ready for review. I'm going to ping laurii about:
If โจ Open navigation modal by clicking on page title in XB navigation Postponed isn't ready, place the "New" button in the XB top bar.
- ๐บ๐ธUnited States mglaman WI, USA
Leaving in review for the backend code. But @attilatilman can you add a button to the editor's topbar?
In
ui/src/components/topbar/Topbar.tsx
let's add a "New" button right before<DemoPublishButton />
You'll need a new mutation for the onclick handler, see something like
ui/src/services/preview.ts
to POST to your new endpoint,I'm not 100% sure how to handle routing to the new page once it has been clicked.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Found a number of critical problems that would've caused problems in future issues that'll build upon this one:
- OpenAPI schema was incorrect
- no test coverage for authorization (which is necessary here, but not for XB's config entity HTTP API tests, because those do not yet have per-config entity type permissions)
- incorrect catching and recasting of exceptions
I fixed all of these (plus more minor things). Please look at the MR and search for to check out the most important remarks and the fixes, to avoid repeating them in the future ๐
-
wim leers โ
committed 67bb2e2a on 0.x authored by
attilatilman โ
Issue #3500046 by attilatilman, wim leers, mglaman: Provide HTTP API to...
-
wim leers โ
committed 67bb2e2a on 0.x authored by
attilatilman โ
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Next up: โจ Provide an API for listing available pages Active .
Automatically closed - issue fixed for 2 weeks with no activity.