mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-26 13:31:45 +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.FullName,
|
||||||
FieldMetadataType.Rating,
|
FieldMetadataType.Rating,
|
||||||
FieldMetadataType.Currency,
|
FieldMetadataType.Currency,
|
||||||
|
FieldMetadataType.Links,
|
||||||
];
|
];
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
|
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
|
||||||
import { OrderBy } from '@/object-metadata/types/OrderBy';
|
import { OrderBy } from '@/object-metadata/types/OrderBy';
|
||||||
import { RecordGqlOperationOrderBy } from '@/object-record/graphql/types/RecordGqlOperationOrderBy';
|
import { RecordGqlOperationOrderBy } from '@/object-record/graphql/types/RecordGqlOperationOrderBy';
|
||||||
|
import { FieldLinksValue } from '@/object-record/record-field/types/FieldMetadata';
|
||||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||||
|
|
||||||
export const getOrderByForFieldMetadataType = (
|
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:
|
default:
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user