Files
twenty/packages/twenty-front/src/testing/mock-data/views.ts
T
Weiko dff00e813c Add coreView state in FE (#14034)
Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
Co-authored-by: Raphaël Bosi <71827178+bosiraphael@users.noreply.github.com>
2025-08-25 15:49:21 +02:00

182 lines
5.3 KiB
TypeScript

import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { type CoreViewWithRelations } from '@/views/types/CoreViewWithRelations';
import { type View } from '@/views/types/View';
import { ViewKey } from '@/views/types/ViewKey';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
import { ViewType } from '@/views/types/ViewType';
import {
ViewKey as CoreViewKey,
ViewOpenRecordIn as CoreViewOpenRecordIn,
ViewType as CoreViewType,
} from '~/generated-metadata/graphql';
import { getMockObjectMetadataItemOrThrow } from '~/testing/utils/getMockObjectMetadataItemOrThrow';
const companyObjectMetadata = getMockObjectMetadataItemOrThrow('company');
const personObjectMetadata = getMockObjectMetadataItemOrThrow('person');
const opportunityObjectMetadata =
getMockObjectMetadataItemOrThrow('opportunity');
export const mockedViewsData: View[] = [
{
id: '37a8a866-eb17-4e76-9382-03143a2f6a80',
name: 'All companies',
objectMetadataId: companyObjectMetadata.id,
type: ViewType.Table,
icon: 'IconSkyline',
key: ViewKey.Index,
kanbanFieldMetadataId: '',
kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
openRecordIn: ViewOpenRecordInType.SIDE_PANEL,
viewFilterGroups: [],
viewGroups: [],
viewFields: [],
viewFilters: [],
viewSorts: [],
__typename: 'View',
},
{
id: '6095799e-b48f-4e00-b071-10818083593a',
name: 'All people',
objectMetadataId: personObjectMetadata.id,
type: ViewType.Table,
icon: 'IconPerson',
key: ViewKey.Index,
kanbanFieldMetadataId: '',
kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
openRecordIn: ViewOpenRecordInType.SIDE_PANEL,
viewFilterGroups: [],
viewGroups: [],
viewFields: [],
viewFilters: [],
viewSorts: [],
__typename: 'View',
},
{
id: 'e26f66b7-f890-4a5c-b4d2-ec09987b5308',
name: 'All opportunities',
objectMetadataId: opportunityObjectMetadata.id,
type: ViewType.Kanban,
icon: 'IconOpportunity',
key: ViewKey.Index,
kanbanFieldMetadataId: '',
kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
openRecordIn: ViewOpenRecordInType.SIDE_PANEL,
viewFilterGroups: [],
viewGroups: [],
viewFields: [],
viewFilters: [],
viewSorts: [],
__typename: 'View',
},
{
id: '5c307222-1dd5-4ff3-ab06-8d990e9b3c74',
name: 'All companies (v2)',
objectMetadataId: companyObjectMetadata.id,
type: ViewType.Table,
icon: 'IconSkyline',
key: null,
kanbanFieldMetadataId: '',
kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
openRecordIn: ViewOpenRecordInType.SIDE_PANEL,
viewFilterGroups: [],
viewGroups: [],
viewFields: [],
viewFilters: [],
viewSorts: [],
__typename: 'View',
},
];
export const mockedCoreViewsData: CoreViewWithRelations[] = [
{
id: '37a8a866-eb17-4e76-9382-03143a2f6a80',
name: 'All companies',
objectMetadataId: companyObjectMetadata.id,
type: CoreViewType.TABLE,
icon: 'IconSkyline',
key: CoreViewKey.INDEX,
kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
openRecordIn: CoreViewOpenRecordIn.SIDE_PANEL,
viewFilterGroups: [],
viewGroups: [],
viewFields: [],
viewFilters: [],
viewSorts: [],
__typename: 'CoreView',
},
{
id: '6095799e-b48f-4e00-b071-10818083593a',
name: 'All people',
objectMetadataId: personObjectMetadata.id,
type: CoreViewType.TABLE,
icon: 'IconPerson',
key: CoreViewKey.INDEX,
kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
openRecordIn: CoreViewOpenRecordIn.SIDE_PANEL,
viewFilterGroups: [],
viewGroups: [],
viewFields: [],
viewFilters: [],
viewSorts: [],
__typename: 'CoreView',
},
{
id: 'e26f66b7-f890-4a5c-b4d2-ec09987b5308',
name: 'All opportunities',
objectMetadataId: opportunityObjectMetadata.id,
type: CoreViewType.KANBAN,
icon: 'IconOpportunity',
key: CoreViewKey.INDEX,
kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
openRecordIn: CoreViewOpenRecordIn.SIDE_PANEL,
viewFilterGroups: [],
viewGroups: [],
viewFields: [],
viewFilters: [],
viewSorts: [],
__typename: 'CoreView',
},
{
id: '5c307222-1dd5-4ff3-ab06-8d990e9b3c74',
name: 'All companies (v2)',
objectMetadataId: companyObjectMetadata.id,
type: CoreViewType.TABLE,
icon: 'IconSkyline',
key: null,
kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
openRecordIn: CoreViewOpenRecordIn.SIDE_PANEL,
viewFilterGroups: [],
viewGroups: [],
viewFields: [],
viewFilters: [],
viewSorts: [],
__typename: 'CoreView',
},
];