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 - default displays and ACL-aware links #21929

Merged
merged 7 commits into from
Nov 2, 2021

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Oct 28, 2021

Overview

This gives every SavedSearch an auto-generated table display, and makes use of it in the UI to more conveniently view or embed a saved search without needing to manually create a display. In the UI it's referred to as the "Search results table" to emphasize the fact that it's the same table as shown on the "compose search" screen, and is not configurable like other displays.

In the process I refactored the way links are understood by SearchKit to take ACLs into account.

Before

  • Search displays must be manually created.
  • Links and in-place edit fields are not ACL aware, and show up regardless of user's permission level,

After

  • Every saved search automatically gets a default display.
  • Default displays are calculated at runtime, not stored in the database (so they are always up-to-date if search params are changed).
  • Links and in-place edit fields are ACL aware and will gracefully degrade to plain text if the user lacks edit permission.
  • Added a "View" link from the SavedSearch listing screen which links to a full-screen view of the default display.
  • UI supports creating an Afform based on the default search display.

image

image

@civibot
Copy link

civibot bot commented Oct 28, 2021

(Standard links)

@civibot civibot bot added the master label Oct 28, 2021
@colemanw colemanw force-pushed the searchKitDefaultDisplays branch from de72630 to b2f8959 Compare October 28, 2021 16:33
…lculate links by entity+action

This adds a SearchDisplay.getDefault APIv4 action, which autogenerates the default table display
which is used on the admin screen.

It also refactors links so they can be calculated based on a given entity+action which does not
require paths to be stored in the search display.
… path

Now that SearchDisplay.Run understands this new link syntax, the admin UI
can use it too. The old links set in existing search displays will still work,
but in order for ACLs to be checked they need to use the new syntax.
Remove clutter if an org does not use tags.
Also removes an unused copy-pasted function.
Adds a 'view' link to the searchKit admin listing, which links to the default display
Adds a 'view' dropdown to the compose search screen, with links to the default + all other displays
Updates Afform to work with default search displays
@colemanw colemanw force-pushed the searchKitDefaultDisplays branch from dea3eed to 5c952e5 Compare October 31, 2021 18:29
@eileenmcnaughton
Copy link
Contributor

I tested this & it seems to work well. The annoyance I continue to hit is that the label has no defaults & is not near the 'save' button - not sure what others think but I would move it & also give it a default

Anyway - I was able to see the acls working fine & the save worked.

However, the checkboxes to select individual contacts don't seem to be selectable (I have the follow up formatting PR applied locally). I seem to be able to replicate this locally with the admin user too so will try on the test site

image

@eileenmcnaughton
Copy link
Contributor

@colemanw check http://core-21929-1mu15.test-3.civicrm.org:8001/civicrm/admin/search#/edit/1 - the rows cannot be selected for actions

@colemanw
Copy link
Member Author

colemanw commented Nov 2, 2021

Thanks @eileenmcnaughton - I think the action checkboxes might have been broken by the previous refactor but anyway I've pushed up a fix to this PR.

@colemanw
Copy link
Member Author

colemanw commented Nov 2, 2021

@eileenmcnaughton I've pushed up a default label for search displays as well, just for you :)

@colemanw colemanw force-pushed the searchKitDefaultDisplays branch from ac0c0b2 to d4381c0 Compare November 2, 2021 02:24
@eileenmcnaughton
Copy link
Contributor

The defaults kick in on the add display - not the original screen - which was the one that I was thinking of above.

Action links work now - merging

@eileenmcnaughton
Copy link
Contributor

unrelated test fails

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.

2 participants