Merge pull request #8919 from strapi/rf/front-telemetry

RF Telemetry
This commit is contained in:
ELABBASSI Hicham 2020-12-17 11:26:25 +01:00 committed by GitHub
commit 32d68f26d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -9,14 +9,16 @@ const Header = ({ fieldSchema: { type }, metadatas: { label, sortable, mainField
const [sortBy, sortOrder] = _sort.split(':');
let sortField = name;
let useRelation = false;
if (type === 'relation') {
useRelation = true;
sortField = `${name}.${mainField.name}`;
}
const handleClick = () => {
if (sortable) {
emitEvent('didSortEntries');
emitEvent('didSortEntries', { useRelation });
const isCurrentSort = sortField === sortBy;
const nextOrder = isCurrentSort && sortOrder === 'ASC' ? 'DESC' : 'ASC';

View File

@ -165,8 +165,9 @@ function FilterPicker({
e => {
e.preventDefault();
const nextFilters = formatFiltersToQuery(modifiedData, metadatas);
const useRelation = nextFilters._where.some(obj => Object.keys(obj)[0].includes('.'));
emitEventRef.current('didFilterEntries');
emitEventRef.current('didFilterEntries', { useRelation });
setQuery(nextFilters);
toggleFilterPickerState();
},