-
Notifications
You must be signed in to change notification settings - Fork 17
Dynamic filter #231
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
base: next
Are you sure you want to change the base?
Dynamic filter #231
Conversation
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.
I think if we did not disable poly search and do validating, lets finish it so it will be universal (might happen indeed)
: [col.foreignResource.searchableFields]; | ||
|
||
searchableFields.forEach((fieldName) => { | ||
if (typeof fieldName !== 'string') { |
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.
@SerVitasik or text at least
const targetResource = this.inputConfig.resources.find((r) => r.resourceId === pr.resourceId || r.table === pr.resourceId); | ||
if (targetResource) { | ||
const hasField = targetResource.columns.some((targetCol) => targetCol.name === fieldName); | ||
if (!hasField) { |
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.
so if at least one resource will not have column it will crash. This should be changed to - if there are no resources which have this column then crash.
Probably a little bit implicit but i suggest next behaviour:
if poly has 2 resources:
- if res A has column C and res be has no col C - then when searching use column C in where of res A query, but dont use in query of res B (in query for res b use columns which exist)
- if both res A and B has col C - use it in both queries (to both resources)
- if no of resources has column C - drop this error here and say explicitly - we can't find this column neither in A nor in B.
So when applying poly search (later in code) - extract subset of this searchable fields which exist in resource and use only them in search with disjunction way
@@ -905,6 +905,34 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI { | |||
throw new Error(`Wrong filter object value: ${JSON.stringify(filters)}`); | |||
} | |||
} | |||
|
|||
if (search && search.trim() && columnConfig.foreignResource.searchableFields) { |
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.
I think poly case is not implemented here at all - it should do parallel queries
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.
or probably you can do it on frontend (later) - should be possible also, maybe even better
No description provided.