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

SearchKit - Support the Group.parents field #25994

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Apr 3, 2023

Overview

Enables Group.parents field to function correctly in SearchKit.

Before

Create a Search for Groups. Add "Parents" column. It displays nothing.

After

Works.

Technical Details

This adds a 2nd field to the schema with options.prefetch = false (the first being Campaigns) This time the field is serialized and not a real FK, but prefetch=false makes sense because of the potentially very large number of groups in the database. In order to accommodate that I enabled SK to lookup FK entity from the pseudoconstant metadata, in case there are any more weird fields like this, they will work!

Comments

This change subtly changes the way the "Campaign" column works, e.g. when doing a search for Contributions and showing "Campaigns" the prefetch=false pseudoconstant continues to not load options client-side, but now it does use the option list when rendering values (instead of a join) and it removes the confusing dual fields "Campaign ID" and "Campaign Title" in favor of just "Campaign". Requires #25995

@civibot
Copy link

civibot bot commented Apr 3, 2023

(Standard links)

@civibot civibot bot added the master label Apr 3, 2023
@eileenmcnaughton
Copy link
Contributor

Hmm that title looks like one of those teachable examples of why it matters where you put the comma

@colemanw colemanw changed the title SearchKit - Support Group.parents field SearchKit - Support the Group.parents field Apr 3, 2023
@colemanw
Copy link
Member Author

colemanw commented Apr 3, 2023

@eileenmcnaughton I've updated the title to clarify that I'm not starting a SearchKit Support Group.
Although maybe we need one of those too!

…o-fk fields

This adds a 2nd field to the schema with options.prefetch = false (the first being Campaigns)
This time the field is serialized and not a real FK, but prefetch=false makes sense because of the potentially
very large number of groups in the database.
@samuelsov
Copy link
Contributor

@colemanw Mostly works but I'm not able to remove a parent once added (reproduced and dmaster) :

Peek 17-04-2023 15-33

@colemanw
Copy link
Member Author

Ok thanks @samuelsov I'll do a followup PR to fix the inline-edit.

@colemanw colemanw merged commit 4fe4df2 into civicrm:master Apr 17, 2023
@colemanw colemanw deleted the groupParents branch April 17, 2023 19:38
@colemanw
Copy link
Member Author

@samuelsov it's a bug in the BAO. I haven't solved it but have made #26074 to clarify and document the problem.

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

Successfully merging this pull request may close these issues.

3 participants