mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-25 13:02:15 +03:00
Add sort feature for Links type (#6503)
Closes https://github.com/twentyhq/twenty/issues/5741 Filtering was already working. I just added the required logic in the frontend to allow sorting by primary link url (because label can be empty)
This commit is contained in:
parent
f0ca3439a8
commit
68120d529c
@ -12,4 +12,5 @@ export const SORTABLE_FIELD_METADATA_TYPES = [
|
||||
FieldMetadataType.FullName,
|
||||
FieldMetadataType.Rating,
|
||||
FieldMetadataType.Currency,
|
||||
FieldMetadataType.Links,
|
||||
];
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
|
||||
import { OrderBy } from '@/object-metadata/types/OrderBy';
|
||||
import { RecordGqlOperationOrderBy } from '@/object-record/graphql/types/RecordGqlOperationOrderBy';
|
||||
import { FieldLinksValue } from '@/object-record/record-field/types/FieldMetadata';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const getOrderByForFieldMetadataType = (
|
||||
@ -25,6 +26,14 @@ export const getOrderByForFieldMetadataType = (
|
||||
},
|
||||
},
|
||||
];
|
||||
case FieldMetadataType.Links:
|
||||
return [
|
||||
{
|
||||
[field.name]: {
|
||||
primaryLinkUrl: direction ?? 'AscNullsLast',
|
||||
} satisfies { [key in keyof FieldLinksValue]?: OrderBy },
|
||||
},
|
||||
];
|
||||
default:
|
||||
return [
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user