Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control panel for relations #3382

Merged
merged 77 commits into from
May 23, 2023
Merged

Control panel for relations #3382

merged 77 commits into from
May 23, 2023

Conversation

ksuess
Copy link
Member

@ksuess ksuess commented May 22, 2022

  • Inspect relations
  • Edit relations
  • Add relations to arbitrary targets
  • Batch edit relations
  • Second tab with actions to fix broken relations.

TODO

  • Inspect relations
  • Modify relations: Add relation. Delete relation.
  • Implementation of service in plone.restapi ( -> Add universal relations service plone.restapi#1602)
  • Stats: how many relation elements per relation
  • Actions to fix broken relations (two actions: "rebuild" and "regenerate intids and rebuild relations")
  • many relations: fetching batch per batch. No. Search by source and target has to be narrowed down by UI user.
  • Filter by target: title, path
  • Filter by source: title, path
  • Add potential targets to add more relations
  • Add potential sources to add more relations
  • Bug fix in upcoming plone.api 2.0.3 "Create relation only if there is no existing one" Create relation only if there is no existing one with same … plone.api#507

relations panel
Inspect and modify relations

fix relationsl
Fix relations

Nice to have

  • ? Filter by target: content type, review state, …

@netlify
Copy link

netlify bot commented May 22, 2022

Deploy Preview for volto canceled.

Name Link
🔨 Latest commit 7427657
🔍 Latest deploy log https://app.netlify.com/sites/volto/deploys/646c7d1fcbaf530008e06fe5

@cypress
Copy link

cypress bot commented May 22, 2022

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.

@arky arky requested a review from sneridagh May 23, 2022 03:45
@pbauer
Copy link
Sponsor Member

pbauer commented May 24, 2022

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

@ksuess
Copy link
Member Author

ksuess commented May 24, 2022

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 ksuess modified the milestones: 16.x.x, Plone 6.0 Jun 5, 2022
@erral
Copy link
Sponsor Member

erral commented Jun 8, 2022

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

@ksuess
Copy link
Member Author

ksuess commented Jun 8, 2022

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.

@erral
Copy link
Sponsor Member

erral commented Jun 8, 2022

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.

@ksuess
Copy link
Member Author

ksuess commented Jun 8, 2022

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]

@erral
Copy link
Sponsor Member

erral commented Jun 8, 2022

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 😄

@avoinea
Copy link
Sponsor Member

avoinea commented Sep 22, 2022

@ksuess @pbauer This PR needs some love :)

@sneridagh sneridagh removed this from the Plone 6.0 milestone Oct 1, 2022
@ksuess
Copy link
Member Author

ksuess commented Nov 8, 2022

I am prepared. Now I need the plone.restapi endpoint please, @pbauer.
plone/plone.restapi#1432 (comment)
No endpoint on context, but one single endpoint /@relations on portal root.
@relations deals with the source/target/relation parameters.

@ksuess ksuess self-assigned this Feb 2, 2023
@ksuess
Copy link
Member Author

ksuess commented May 23, 2023

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

@ksuess ksuess merged commit 4453774 into master May 23, 2023
@ksuess ksuess deleted the relations-control-panel branch May 23, 2023 21:59
sneridagh added a commit that referenced this pull request May 26, 2023
* master:
  Release changelog for 16.20.7 (#4816)
  Release 17.0.0-alpha.8
  Add supported languages (#4811)
  Fix html tag lang attribute in SSR (#4803)
  Finnish translation forwardport (#4084) (#4810)
  Control panel for relations (#3382)
  Add guard in case of malformed blocks are present (at least id and title should be present) (#4802)
  fixed the issue #4660 - shouldn't use a hook like function name for a variable (#4693)
  Fix HMR of @plone/volto (#4799)
sneridagh added a commit that referenced this pull request Jun 8, 2023
* master: (26 commits)
  Update Brazilian Portuguese translations (Fixes #4853)
  Convert header class to function (#4767)
  Use a Container from the registry in the Form component and fallback to the Semantic UI one (#4849)
  Display password validation error if available; update minimum password length (#4801)
  Do not break requires validation on number fields with value 0 (#4841)
  Search Block: Add support for advanced facets that are displayed on demand (#4784)
  Release 17.0.0-alpha.9
  Fix navigation sections in 404 pages (#4836)
  fix special characters in request urls (#4825)
  Fix block is undefined in StyleWrapper helper when building classnames (#4827)
  Fix glossary warning due to lack of empty line before a term (#4820)
  Release changelog for 16.20.7 (#4816)
  Release 17.0.0-alpha.8
  Add supported languages (#4811)
  Fix html tag lang attribute in SSR (#4803)
  Finnish translation forwardport (#4084) (#4810)
  Control panel for relations (#3382)
  Add guard in case of malformed blocks are present (at least id and title should be present) (#4802)
  fixed the issue #4660 - shouldn't use a hook like function name for a variable (#4693)
  Fix HMR of @plone/volto (#4799)
  ...
@tisto
Copy link
Sponsor Member

tisto commented Feb 12, 2024

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

@stevepiercy
Copy link
Collaborator

@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
Copy link
Member Author

ksuess commented Feb 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

9 participants