-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: Graphql verbatim search terms #1174
feat: Graphql verbatim search terms #1174
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1174 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 245 245
Lines 17246 17270 +24
Branches 6232 6241 +9
=========================================
+ Hits 17246 17270 +24
|
I'm not entirely sure what you mean but manipulation... is it because some null are changed to empty string or something similar? is that what this is about to leave some data untouched, like |
Yeah, exactly. Specifically, Further, So yes, this PR allow some columns to leave the searchTerms untouched. |
Note that there are some reasons why some of these are being transformed, it might not work with all type of Filters (some filters might require string only, for example an input value in theory only works with string). As long as you are aware of the reasons and that you're not introducing breaking changes, it should be fine and I have plenty of unit tests and E2E tests to cover them, so that should be fine, that's really where all these unit tests become handy :) |
Thanks again for reviewing this so quickly.
Yeah, that's acceptable. In those cases, if using
For sure. Should be safe since the behaviour is opt-in.
Absolutely. |
packages/graphql/src/interfaces/graphqlServiceOption.interface.ts
Outdated
Show resolved
Hide resolved
@@ -21,5 +21,5 @@ export interface CurrentFilter { | |||
* When false, searchTerms may be manipulated to be functional with certain filters eg: string only filters. | |||
* When true, JSON.stringify is used on the searchTerms and used in the query "as-is". It is then the responsibility of the developer to sanitise the `searchTerms` property if necessary. | |||
*/ | |||
verbatimSearchTerms?: boolean; | |||
useVerbatimSearchTerms?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I think I didn't explain well, I wanted to keep this one as verbatimSearchTerms
because this one here is not a flag but a prop, so can you rename it back to verbatimSearchTerms
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some comments for code change, thanks
looks good thanks, do you have anything planned? I'm currently working on the |
No, nothing immediate. I'm considering at some point looking into extending the pagination to allow for an infinite scrolling table so you could just scroll back up to see previous rows, rather than having to navigate back and forth through pages. Could be triggered by reaching the scroll bottom or a stand alone "fetch more" button. |
If you want a hint on how to do that, I decided long time ago that in my libs we'll only use the SlickGrid DataView, so with that in mind you can use the methods from the DataView to push data with Anyway out of context, but similar approach, with Backend Services I clear the DataView data and insert data of the next page. Also another similar approach, in the past, I've done a lazy loading implementation where I was loading the first 500 rows so that the user can start using the grid right away and then keep pushing sets of 5000 in a lazy loading way... in summary, these 2 approaches are similar to how infinite scroll would work but also a little different because I don't know how to deal with the "when you reach the end" |
@Harsgalt86 this is now available in Slickgrid-Universal v3.5.0 and Aurelia-Slickgrid v6.5.0 Note also please note that I deprecated Thanks again for all your contributions 🚀 |
==== Purpose of this PR ===
A PR to use filter search terms in a query "verbatim" without modification
Currently the backendService
updateFilters()
performs some manipulation of the columnFilter.searchTerms property. The flag on the columncolumnFilter.verbatimSearchTerms
bypasses this manipulation and stringifies the search terms "as is".Some examples of problematic manipulation are searching for columns that can be nullable
Please see unit tests for more output differences.
=== Usage ===
I did consider putting the flag on the backend service instead of the column, but it's possible that different backend end points may want to treat properties differently for backwards compatibility. By putting the flag on the column itself it allows for more flexibility.
=== TODO ===
Currently this flag is only respected on the graphqlService. This needs to be applied to other backend services.