volto
volto copied to clipboard
Control panel for relations
Needs plone.restapi endpoint @relations PR: https://github.com/plone/plone.restapi/pull/1431 Issue: https://github.com/plone/plone.restapi/issues/1432
A binary relation is a subset of the cartesian product of source set and target set. This UI provides this cartesian product as a matrix with checkboxes with event handlers to add or delete a relation. The event handler adds or delete a relation element and gives a confirmation with a toast. Apart from this, batch editing is possible via the checkbox row on top: check 'Chassis' and all displayed sources (filter by search field or filter by filter on the right side) get a relation to 'Chassis'.
The example shows that 'Light system' has relation 'comprisescomponentpart' to ['Chassis', 'Electronics','Navigation System'] 'Navigation System' has one relation of type 'comprisescomponentpart': the one to 'Electronics'
TODO
- [ ] Pagination (many relations) fetching batch per batch
- [ ] Filter by target
- [ ] Rebuild relations action
- [ ] Stats: how many relation elements per relation
Nice to have
- [ ]
Deploy Preview for volto canceled.
Name | Link |
---|---|
Latest commit | 74276575d153eb7341055d93da4e1d745b3042af |
Latest deploy log | https://app.netlify.com/sites/volto/deploys/646c7d1fcbaf530008e06fe5 |
Passing run #5258 ↗︎
![]() |
![]() |
![]() |
![]() |
![]() |
Details:
Update info on required plone.api version to edit relations | |||
Project: Volto | Commit: 74276575d1 |
||
Status: Passed | Duration: 15:17 💡 | ||
Started: May 23, 2023 8:48 AM | Ended: May 23, 2023 9:03 AM |
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.
I like the ability to filter by source and target.
But I don't really understand how the output in the screenshot should work. When relations always point from one content item to another content what is then "Chassis" etc? I would prefer to duplicate the same UI as it is used in classic with links to source and to target. Or change the classic UI as well if there is better proposal. So far in classic inspecting looks like this:
A binary relation is a subset of the cartesian product of source set and target set. This UI provides this cartesian product as a matrix with checkboxes with event handlers to add or delete a relation. The event handler adds or delete a relation element and gives a confirmation with a toast. Apart from this, batch editing is possible via the checkbox row on top: check 'Chassis' and all displayed sources (filter by search field or filter by filter on the right side) get a relation to 'Chassis'.
The example above shows that 'Light system' has relation 'comprisescomponentpart' to ['Chassis', 'Electronics','Navigation System'] 'Navigation System' has one relation of type 'comprisescomponentpart': the one to 'Electronics'
does this PR add an action to get the relations of a given object? That would be useful too.
does this PR add an action to get the relations of a given object? That would be useful too.
you mean, show all relations, no matter which type, of an object? Sounds interesting! I'll add it to the TODOs above.
Yes I mean exactly that.
Nowadays when we have a relation field in an object, to be able to get the related objects, we index the UID of the objects and then query the catalog to get that information. If an action is available, we can use that action that under the hood calls this endpoint and this way getting the related items could be easier.
It could have several parameters to get the backreleations and also the name of the relation to query.
Oh my, now I get it, you mean a Volto action to fetch the relations! @pbauer started working on endpoints for relations in general and the relations controlpanel. In this PR I provide (will provide) Volto actions for relations in general and the relations control panel, which will attack these endpoints. So these actions can be taken for whatever you want to do with relations in Volto. How the actions will look like (and are already drafted here) with parameters relation name/type, backrelation, etc can be seen in Philips elaborated documentation for the future endpoints on the backend side: [will paste the link later. Netlify preview of PRs needs to be fixed]
Nice. I saw both the actions to get all relations and the plone.restapi endpoint documentation for it and that's why I asked about the context-relation action, I thought that everything was going to be here :smile:
@ksuess @pbauer This PR needs some love :)
I am prepared. Now I need the plone.restapi endpoint please, @pbauer. https://github.com/plone/plone.restapi/issues/1432#issuecomment-1279761099 No endpoint on context, but one single endpoint /@relations on portal root. @relations deals with the source/target/relation parameters.
Did you know that you can manage your relations in Volto? Check it out! ^ @nileshgulia1 @avoinea @tiberiuichim @pnicolli @sneridagh @fredvd @giuliaghisini @tisto @claudiaifrim @JeffersonBledsoe @pbauer @spereverde
UI recomendations are turned into code. Tests are green. Let's review!
@ksuess I am currently writing the official roadmap for Plone 6.x. I am adding a link to the documentation for every PLIP. Do we have any kind of documentation for the relations control panel?
I'd also like to give people proper credit. Did anyone help you with this or did you work on this on your own?
@ksuess @tisto I think this is the User Manual for it. Finding links and references to the current page.
There's also developer docs:
I hope that captured all of them. This was a huge effort!
@ksuess I am currently writing the official roadmap for Plone 6.x. I am adding a link to the documentation for every PLIP. Do we have any kind of documentation for the relations control panel?
No, control panels are not documented. The relations control panel has a superb user experience ;-) and is therefore self-explaining.
I'd also like to give people proper credit. Did anyone help you with this or did you work on this on your own?
The relations control panel is my work.