-
Notifications
You must be signed in to change notification settings - Fork 1
LPD-55983 Add Entity Field Type for filter and serialize the URL with… #4955
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: master
Are you sure you want to change the base?
LPD-55983 Add Entity Field Type for filter and serialize the URL with… #4955
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.
@RoselaineMarquesMontero LGTM, but @dsanz should take a look
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.
Hi Rose, I think this is mostly ok, just see inline comment as we might need some polishing on the way we generate the value
|
||
if (success) { | ||
let formData: any = { | ||
entityFieldType: selectedField?.type, |
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.
we might need to extend this in order to set the actual entityFieldType
value as expected by the FDS. Most likely, this works like that for the case of striung and integers, nevertheless, for arrays and objects we are using collection
as the entity type.
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.
We are working on this use case now, for array of String and Integers
Rose told us she plans to send a followup. So no additional review is needed here |
3b326df
to
ef86b62
Compare
Hi @dsanz , @markocikos I've finished the changes, could you please review the PR, take into account that this one is to fix the issue sending always String for the OData Query, so we have added the Entity Field Type for Data Set Selection Filter and compatibility with older filters. |
ci:test:sf |
ci:test:frontend |
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.
Rose, thanks for sending this. I believe we should change some logic in the serializer in order to avoid a breaking change. Please take a look to the inline comments and let me know. Best
...mpl/src/main/java/com/liferay/frontend/data/set/internal/serializer/CustomFDSSerializer.java
Outdated
Show resolved
Hide resolved
|
||
return fieldName.substring(0, index); | ||
} | ||
"id", fieldName |
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.
Why this code was removed? Is now object REST api able to filter by a picklist field using parent/child
format in the field name and using a non-collection entity type?
We had to add this special case for picklist because object REST api expects the parent field name (as exposed by the REST) even if the value used for comparison is a child field indeed.
}); | ||
} | ||
|
||
field.entityFieldType = type; |
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.
Note, this piece of code will make data set manager to store types like 'object' or 'array' as valid values for the entityFieldType field, in addition to the well known string
, date
or integer
This is fine 👍 . At this level, we don't want to "translate" anything to the FDS domain but just persist information provided by REST openapi metadata.
"entityFieldType", | ||
() -> { | ||
if (Validator.isNotNull(entityFieldType)) { | ||
return entityFieldType; |
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.
This change represents a breaking change, as follows:
- Consider a new filter over a child-leaf field of a root-level field of type
object
orarray
(let's imagine they are announced as filterable) - Prior to this change, the method
_isCollection()
was able to guess the type using the field name. - In case it was considered a collection, we returned
FDSEntityFieldTypes.COLLECTION
- However, this code now returns literally the field type as coming in the filter object entry, that is,
object
orarray
in this example
Another example:
- Consider a pre-existing filter (say, created a month ago) over a child-leaf field of a root-level field of type
object
orarray
(older versions of Data Set Manager allowed this) - Open the filter in the DSM, then save. This updates
entityFieldType
in the filter object entry, toobject
orarray
- Now, the serializer would send literally the field type as coming in the filter object entry, that is,
object
orarray
Note FDS can't handle these values for entity field type, so odata query would be generated in a different way. This is the breaking change we'd like to avoid.
We can fix it bu translating both object
and array
field types to FDSEntityFieldTypes.COLLECTION
to keep backwards compatibility
entityFieldType === EEntityFieldType.STRING | ||
? `'${item.value}'` | ||
: item.value | ||
entityFieldType === EEntityFieldType.INTEGER |
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.
👏 this is great, now we don't need to guess.
This logic should be fine for old data sets which have STRING
as default entity field type. Also, situation in case of a collection looks fine for the purposes of calculating quotedSelectedItems
👍
Hi @dsanz , I've added the changes here, just missing the one to control the name when there is a |
ci:test:frontend |
469ecf4
to
a43c464
Compare
… this value in case exist
…r preselected value
…before this extension.
…id breaking change for CX FDS created before this extension.
a43c464
to
4948d60
Compare
38628a4
to
d2a1576
Compare
Add the "Entity Type Field" to the Object "Data Set Selection Filter", this feature also fix the issue when sending the filter param always as String, as we are adding and validating whether this field is not null in the CustomFDSSerializer class, it should not generate any breaking change.