keystone icon indicating copy to clipboard operation
keystone copied to clipboard

Add search by relationship fields

Open pnodet opened this issue 1 year ago • 12 comments

Allow admin users inside a list page to search by relations text fields

pnodet avatar Dec 15 '23 16:12 pnodet

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit e1f1bef7803362a3e10e1bc2c758abb882a2e03d:

Sandbox Source
@keystone-6/sandbox Configuration

codesandbox-ci[bot] avatar Dec 15 '23 16:12 codesandbox-ci[bot]

Hi @dcousens I see some tests failing but some are due to CI setup failure I think, not sure what to do tbh

pnodet avatar Dec 18 '23 17:12 pnodet

Thanks @pnodet, I'll check that out as soon as I can

dcousens avatar Dec 18 '23 22:12 dcousens

HNY @dcousens thanks for the formatting commit! I this PR something you are interested in? do you think this will get merged or I better publish a npm fork?

pnodet avatar Jan 02 '24 07:01 pnodet

@dcousens from the 58 tests the failing one seem to be related to tsx, not sure how to fix tbh

> @keystone-6/[email protected] test /home/runner/work/keystone/keystone/examples/testing
> node --loader tsx example-test.ts


node:internal/process/esm_loader:40
      internalBinding('errors').triggerUncaughtException(
                                ^
Error: tsx must be loaded with --import instead of --loader
The --loader flag was deprecated in Node v20.6.0

pnodet avatar Jan 25 '24 00:01 pnodet

@pnodet happy new years to you too :yellow_heart:

I'm not convinced this will be intuitive and could result in unexpected performance costs in some usecases. Can the user opt-in to the behavior?

dcousens avatar Jan 25 '24 03:01 dcousens

@dcousens

By user you mean end-user (ie: a checkbox with label Activate search by relation fields) or keystone user the developers in the schema for example?

pnodet avatar Jan 25 '24 03:01 pnodet

sorry, I mean developer (but, maybe the user too...)

dcousens avatar Jan 25 '24 03:01 dcousens

Sure, for the developer we could have something in the schema / list. Inside the relationship field there is already a isFilterable and isOrderable properties if I'm not mistaken. I'm not an expert and I don't quite remember how we use them but I imagine we could have another field like isSearchable for exemple, defaults to false for backward compatibility.

pnodet avatar Jan 29 '24 10:01 pnodet

Hi @dcousens What do you have in mind? anything I can do to get this PR merged?

pnodet avatar Mar 14 '24 08:03 pnodet