admin icon indicating copy to clipboard operation
admin copied to clipboard

Filter by parameter defined in API which are not object property

Open nicodmf opened this issue 4 years ago • 5 comments

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.

nicodmf avatar Aug 31 '20 15:08 nicodmf

It's a design choice: the admin needs to receive the filter information from the API in order to display it correctly.

alanpoulain avatar Aug 31 '20 16:08 alanpoulain

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.

image

nicodmf avatar Sep 01 '20 07:09 nicodmf

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.

alanpoulain avatar Sep 01 '20 07:09 alanpoulain

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).

nicodmf avatar Sep 01 '20 13:09 nicodmf

@alanpoulain ping :)

nicodmf avatar Sep 03 '20 12:09 nicodmf