volto icon indicating copy to clipboard operation
volto copied to clipboard

Control panel for relations

Open ksuess opened this issue 2 years ago • 10 comments

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

  • [ ]

relations_control_panel-2

ksuess avatar May 22 '22 15:05 ksuess

Deploy Preview for volto canceled.

Name Link
Latest commit 74276575d153eb7341055d93da4e1d745b3042af
Latest deploy log https://app.netlify.com/sites/volto/deploys/646c7d1fcbaf530008e06fe5

netlify[bot] avatar May 22 '22 15:05 netlify[bot]

Passing run #5258 ↗︎

0 493 20 0 Flakiness 0

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.

cypress[bot] avatar May 22 '22 15:05 cypress[bot]

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:

rels backrels

pbauer avatar May 24 '22 07:05 pbauer

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'

ksuess avatar May 24 '22 07:05 ksuess

does this PR add an action to get the relations of a given object? That would be useful too.

erral avatar Jun 08 '22 15:06 erral

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.

ksuess avatar Jun 08 '22 16:06 ksuess

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.

erral avatar Jun 08 '22 16:06 erral

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]

ksuess avatar Jun 08 '22 17:06 ksuess

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:

erral avatar Jun 08 '22 18:06 erral

@ksuess @pbauer This PR needs some love :)

avoinea avatar Sep 22 '22 16:09 avoinea

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.

ksuess avatar Nov 08 '22 05:11 ksuess

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

ksuess avatar Apr 28 '23 11:04 ksuess

UI recomendations are turned into code. Tests are green. Let's review!

ksuess avatar May 23 '23 09:05 ksuess

@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?

tisto avatar Feb 12 '24 18:02 tisto

@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!

stevepiercy avatar Feb 13 '24 00:02 stevepiercy

@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.

ksuess avatar Feb 15 '24 10:02 ksuess