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 - Import/Export saved search configuration #22229

Merged
merged 7 commits into from
Dec 21, 2021

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Dec 8, 2021

Overview

Provides a UI for importing and exporting SavedSearches in JSON format. This allows power-users to copy and paste their Searches between sites. For extension developers, includes a direct link to generate a .mgd.php file from the API Explorer.

image

image

Technical Details

Exporting smart groups depends on #22228

@civibot
Copy link

civibot bot commented Dec 8, 2021

(Standard links)

@civibot civibot bot added the master label Dec 8, 2021
@colemanw colemanw changed the title Search kit export SearchKit - Import/Export saved search configuration Dec 8, 2021
@herbdool
Copy link
Contributor

@colemanw I've tested this by patching just this PR on the latest 5.46-alpha1. The export works but it requires "Form Core" extension to be enabled, which might not be obvious to many. I only figured that out by looking at the console log and it said "Afform does not exist."

Once I enabled the export works.

Just for testing I tried to rename the search name in the export and import it, but it gives me a db error: already exists. Not sure what I'm doing wrong. I understand that with a clone button this is not strictly needed.

Maybe as a follow-up it could have a checkbox to allow someone to overwrite an existing Saved Search if they have the same name.

@herbdool
Copy link
Contributor

Oh, actually it did import the search with my changed name despite the error message.

@colemanw
Copy link
Member Author

@herbdool if your export includes other stuff like displays, forms, etc you have to change the name of the search they reference too.

@colemanw
Copy link
Member Author

colemanw commented Dec 19, 2021

Thank you for testing this @herbdool.
That was a good catch, I didn't mean to create a hard-dependency on Afform, as SearchKit thus far has not required it.
I've amended the commit to add a conditional around the Afform bits so it will skip them if that extension is missing. Without Afform enabled, the export screen no longer crashes and looks like this (note no checkbox for "Forms"):

image

@colemanw colemanw added the merge ready PR will be merged after a few days if there are no objections label Dec 19, 2021
@colemanw colemanw merged commit bf21413 into civicrm:master Dec 21, 2021
@colemanw colemanw deleted the searchKitExport branch December 21, 2021 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master merge ready PR will be merged after a few days if there are no objections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants