admin
admin copied to clipboard
Filter by parameter defined in API which are not object property
Hello,
We have a custom filter defined on our API, the parameter name is modificationRestrict and not rely on a property. I see that the code hide this filter because the schemaAnalyser doesn't find it in the properties list. I don't understand why this choice has been made, but it's seems this restrict to much the admin.
As I don't know if this is a bug or a design choice and consequently a feature request, I send a support question.
It's a design choice: the admin needs to receive the filter information from the API in order to display it correctly.
As it, the filters from api are presents, the admin is aware from there. You can see them in the ["hydra:search"]["hydra:mapping"] path. So it seems to me that the admin receive enough informations about theres, and should display them.
You're talking about this line then: https://github.com/api-platform/admin/blob/7a266802656e04f4c7ef1ccba17f7e445b260bd0/src/hydra/schemaAnalyzer.js#L58 I think it has been done like this to prevent showing filters if a user doesn't have the rights to display some fields.
Yes i think this is the line, but authorized fields is just the fields mention by this line :
https://github.com/api-platform/admin/blob/7a266802656e04f4c7ef1ccba17f7e445b260bd0/src/hydra/schemaAnalyzer.js#L50
Do you see a method that permit to see the filters ? (without add a empty property on the model).
@alanpoulain ping :)