Metadata api create entity in workspace custom app (#15911)
# Introduction Cleaner and fewer scope version of https://github.com/twentyhq/twenty/pull/15745 ( removed sync-metadata hack through, too ambitious migration and upgrade ) Please note that this PR won't have any interaction with the existing sync-metadata Which mean that the sync metadata does not update the standard entities applicationId and universalIdentifier, and it won't we will deprecate it on favor of a workspace migration aka twenty-standard app installation ## API Metadata Any operation going through the api metadata nows automatically scope the related entity to the workspace custom application instance. ( optionally passing an applicationId to allow current hacky implem of app sync service ) We need to either ignore the tests or remove the cli status check from the blocking status badges for a PR to be merged ## New workspace Already handled in previous https://github.com/twentyhq/twenty/pull/15625, when a workspace is created it gets created a twenty standard and custom workspace instance All his views and permissions will be prefilled to the its twenty standard app instance with a specific universalIdentifier ## New universalIdentifier At the contrary as before with standardIds, universalIdentifier are unique for a given workspace This means that createdAt field of both object company and opportunity will have a unique universalIdentifier whereas they share the same standardId ## FlatApplication Introduced the flatApplication and cache. Will migrate existing `MetadataName` to be `SyncableMetadataName` in a following PR ## What's next Next we will describe a twenty standard app configuration as json that will be used to generate a workspace migration that will be run instead of the sync metadata, in a nutshell we aim to deprecated the sync metadata So we can standardize any entity to have a non nullable applicationId and universalIdentifier ## Upgrade command Introduced an upgrade command that will create a custom workspace instance for any workspace that do not have one in order to align with the new behavior when creating a new workspace
This commit is contained in:
+45
-26
@@ -1,7 +1,7 @@
|
||||
import { isString } from '@sniptt/guards';
|
||||
import { type DataSource, type QueryRunner } from 'typeorm';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { ViewFieldEntity } from 'src/engine/metadata-modules/view-field/entities/view-field.entity';
|
||||
import { ViewFilterEntity } from 'src/engine/metadata-modules/view-filter/entities/view-filter.entity';
|
||||
@@ -39,6 +39,7 @@ type PrefillCoreViewsArgs = {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
featureFlags?: Record<string, boolean>;
|
||||
workspaceSchemaName: string;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
};
|
||||
|
||||
export const prefillCoreViews = async ({
|
||||
@@ -46,25 +47,32 @@ export const prefillCoreViews = async ({
|
||||
workspaceId,
|
||||
objectMetadataItems,
|
||||
workspaceSchemaName,
|
||||
twentyStandardFlatApplication,
|
||||
}: PrefillCoreViewsArgs): Promise<ViewEntity[]> => {
|
||||
const views = [
|
||||
companiesAllView(objectMetadataItems, true),
|
||||
peopleAllView(objectMetadataItems, true),
|
||||
opportunitiesAllView(objectMetadataItems, true),
|
||||
opportunitiesByStageView(objectMetadataItems, true),
|
||||
notesAllView(objectMetadataItems, true),
|
||||
tasksAllView(objectMetadataItems, true),
|
||||
tasksAssignedToMeView(objectMetadataItems, true),
|
||||
tasksByStatusView(objectMetadataItems, true),
|
||||
workflowsAllView(objectMetadataItems, true),
|
||||
workflowVersionsAllView(objectMetadataItems, true),
|
||||
workflowRunsAllView(objectMetadataItems, true),
|
||||
dashboardsAllView(objectMetadataItems, true),
|
||||
workspaceMembersAllView(objectMetadataItems, true),
|
||||
messagesAllView(objectMetadataItems, true),
|
||||
messageThreadsAllView(objectMetadataItems, true),
|
||||
calendarEventsAllView(objectMetadataItems, true),
|
||||
];
|
||||
companiesAllView,
|
||||
peopleAllView,
|
||||
opportunitiesAllView,
|
||||
opportunitiesByStageView,
|
||||
notesAllView,
|
||||
tasksAllView,
|
||||
tasksAssignedToMeView,
|
||||
tasksByStatusView,
|
||||
workflowsAllView,
|
||||
workflowVersionsAllView,
|
||||
workflowRunsAllView,
|
||||
dashboardsAllView,
|
||||
workspaceMembersAllView,
|
||||
messagesAllView,
|
||||
messageThreadsAllView,
|
||||
calendarEventsAllView,
|
||||
].map((seeder) =>
|
||||
seeder({
|
||||
objectMetadataItems,
|
||||
useCoreNaming: true,
|
||||
twentyStandardFlatApplication,
|
||||
}),
|
||||
);
|
||||
|
||||
const queryRunner = coreDataSource.createQueryRunner();
|
||||
|
||||
@@ -73,7 +81,12 @@ export const prefillCoreViews = async ({
|
||||
try {
|
||||
await queryRunner.startTransaction();
|
||||
|
||||
const createdViews = await createCoreViews(queryRunner, workspaceId, views);
|
||||
const createdViews = await createCoreViews(
|
||||
queryRunner,
|
||||
workspaceId,
|
||||
views,
|
||||
twentyStandardFlatApplication,
|
||||
);
|
||||
|
||||
await prefillWorkspaceFavorites(
|
||||
createdViews
|
||||
@@ -112,13 +125,9 @@ export const createCoreViews = async (
|
||||
queryRunner: QueryRunner,
|
||||
workspaceId: string,
|
||||
viewDefinitions: ViewDefinition[],
|
||||
twentyStandardFlatApplication: FlatApplication,
|
||||
): Promise<ViewEntity[]> => {
|
||||
const viewDefinitionsWithId = viewDefinitions.map((viewDefinition) => ({
|
||||
...viewDefinition,
|
||||
id: v4(),
|
||||
}));
|
||||
|
||||
const coreViews: Partial<ViewEntity>[] = viewDefinitionsWithId.map(
|
||||
const coreViews: Partial<ViewEntity>[] = viewDefinitions.map(
|
||||
({
|
||||
id,
|
||||
name,
|
||||
@@ -131,6 +140,8 @@ export const createCoreViews = async (
|
||||
openRecordIn,
|
||||
kanbanAggregateOperation,
|
||||
kanbanAggregateOperationFieldMetadataId,
|
||||
applicationId,
|
||||
universalIdentifier,
|
||||
}) => ({
|
||||
id,
|
||||
name: isString(name) ? name : name.message || '',
|
||||
@@ -150,13 +161,15 @@ export const createCoreViews = async (
|
||||
workspaceId,
|
||||
anyFieldFilterValue: null,
|
||||
visibility: ViewVisibility.WORKSPACE,
|
||||
applicationId,
|
||||
universalIdentifier,
|
||||
}),
|
||||
);
|
||||
|
||||
const viewRepository = queryRunner.manager.getRepository(ViewEntity);
|
||||
const createdViews = await viewRepository.save(coreViews);
|
||||
|
||||
for (const viewDefinition of viewDefinitionsWithId) {
|
||||
for (const viewDefinition of viewDefinitions) {
|
||||
if (viewDefinition.fields && viewDefinition.fields.length > 0) {
|
||||
const coreViewFields: Partial<ViewFieldEntity>[] =
|
||||
viewDefinition.fields.map((field) => ({
|
||||
@@ -166,6 +179,8 @@ export const createCoreViews = async (
|
||||
size: field.size,
|
||||
viewId: viewDefinition.id,
|
||||
workspaceId,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
universalIdentifier: field.universalIdentifier,
|
||||
}));
|
||||
|
||||
const viewFieldRepository =
|
||||
@@ -182,6 +197,8 @@ export const createCoreViews = async (
|
||||
operand: filter.operand,
|
||||
value: filter.value,
|
||||
workspaceId,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
universalIdentifier: filter.universalIdentifier,
|
||||
}));
|
||||
|
||||
const viewFilterRepository =
|
||||
@@ -203,6 +220,8 @@ export const createCoreViews = async (
|
||||
position: group.position,
|
||||
viewId: viewDefinition.id,
|
||||
workspaceId,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
universalIdentifier: group.universalIdentifier,
|
||||
}));
|
||||
|
||||
const viewGroupRepository =
|
||||
|
||||
+7
@@ -11,13 +11,18 @@ export interface ViewDefinition {
|
||||
type: string;
|
||||
key: string | null;
|
||||
position: number;
|
||||
applicationId: string;
|
||||
universalIdentifier: string;
|
||||
icon?: string;
|
||||
isCustom?: boolean;
|
||||
openRecordIn?: ViewOpenRecordInType;
|
||||
kanbanFieldMetadataId?: string;
|
||||
kanbanAggregateOperation?: AggregateOperations;
|
||||
kanbanAggregateOperationFieldMetadataId?: string;
|
||||
calendarFieldMetadataId?: string;
|
||||
calendarLayout?: string;
|
||||
fields?: {
|
||||
universalIdentifier: string;
|
||||
fieldMetadataId: string;
|
||||
position: number;
|
||||
isVisible: boolean;
|
||||
@@ -25,12 +30,14 @@ export interface ViewDefinition {
|
||||
aggregateOperation?: AggregateOperations;
|
||||
}[];
|
||||
filters?: {
|
||||
universalIdentifier: string;
|
||||
fieldMetadataId: string;
|
||||
displayValue: string;
|
||||
operand: ViewFilterOperand;
|
||||
value: string;
|
||||
}[];
|
||||
groups?: {
|
||||
universalIdentifier: string;
|
||||
fieldMetadataId: string;
|
||||
isVisible: boolean;
|
||||
fieldValue: string;
|
||||
|
||||
+43
-4
@@ -1,17 +1,26 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import { DEFAULT_VIEW_FIELD_SIZE } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/constants/DEFAULT_VIEW_FIELD_SIZE';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
CALENDAR_EVENT_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const calendarEventsAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
export const calendarEventsAllView = ({
|
||||
objectMetadataItems,
|
||||
twentyStandardFlatApplication,
|
||||
useCoreNaming,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const calendarEventObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.calendarEvent,
|
||||
);
|
||||
@@ -20,7 +29,13 @@ export const calendarEventsAllView = (
|
||||
throw new Error('CalendarEvent object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.calendarEvent.views.allCalendarEvents.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`All {objectLabelPlural}` : 'All Calendar Events',
|
||||
objectMetadataId: calendarEventObjectMetadata.id ?? '',
|
||||
type: 'calendar',
|
||||
@@ -45,6 +60,9 @@ export const calendarEventsAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: DEFAULT_VIEW_FIELD_SIZE,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.calendarEvent.views.allCalendarEvents.viewFields
|
||||
.title.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -55,6 +73,9 @@ export const calendarEventsAllView = (
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.calendarEvent.views.allCalendarEvents.viewFields
|
||||
.startsAt.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -65,6 +86,9 @@ export const calendarEventsAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.calendarEvent.views.allCalendarEvents.viewFields
|
||||
.endsAt.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -75,6 +99,9 @@ export const calendarEventsAllView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 100,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.calendarEvent.views.allCalendarEvents.viewFields
|
||||
.isFullDay.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -85,6 +112,9 @@ export const calendarEventsAllView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.calendarEvent.views.allCalendarEvents.viewFields
|
||||
.location.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -96,6 +126,9 @@ export const calendarEventsAllView = (
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.calendarEvent.views.allCalendarEvents.viewFields
|
||||
.conferenceLink.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -106,6 +139,9 @@ export const calendarEventsAllView = (
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 100,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.calendarEvent.views.allCalendarEvents.viewFields
|
||||
.isCanceled.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -116,6 +152,9 @@ export const calendarEventsAllView = (
|
||||
position: 7,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.calendarEvent.views.allCalendarEvents.viewFields
|
||||
.createdAt.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+42
-3
@@ -1,18 +1,27 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import { DEFAULT_VIEW_FIELD_SIZE } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/constants/DEFAULT_VIEW_FIELD_SIZE';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
COMPANY_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const companiesAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const companiesAllView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const companyObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.company,
|
||||
);
|
||||
@@ -21,7 +30,13 @@ export const companiesAllView = (
|
||||
throw new Error('Company object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.company.views.allCompanies.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`All {objectLabelPlural}` : 'All Companies',
|
||||
objectMetadataId: companyObjectMetadata.id ?? '',
|
||||
type: 'table',
|
||||
@@ -39,6 +54,9 @@ export const companiesAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: DEFAULT_VIEW_FIELD_SIZE,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.company.views.allCompanies.viewFields.name
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -50,6 +68,9 @@ export const companiesAllView = (
|
||||
isVisible: true,
|
||||
size: 100,
|
||||
aggregateOperation: AggregateOperations.COUNT,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.company.views.allCompanies.viewFields.domainName
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -60,6 +81,9 @@ export const companiesAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.company.views.allCompanies.viewFields.createdBy
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -70,6 +94,9 @@ export const companiesAllView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.company.views.allCompanies.viewFields.accountOwner
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -80,6 +107,9 @@ export const companiesAllView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.company.views.allCompanies.viewFields.createdAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -91,6 +121,9 @@ export const companiesAllView = (
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
aggregateOperation: AggregateOperations.MAX,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.company.views.allCompanies.viewFields.employees
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -102,6 +135,9 @@ export const companiesAllView = (
|
||||
isVisible: true,
|
||||
size: 170,
|
||||
aggregateOperation: AggregateOperations.PERCENTAGE_EMPTY,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.company.views.allCompanies.viewFields.linkedinLink
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -112,6 +148,9 @@ export const companiesAllView = (
|
||||
isVisible: true,
|
||||
size: 170,
|
||||
aggregateOperation: AggregateOperations.COUNT_NOT_EMPTY,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.company.views.allCompanies.viewFields.address
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { DEFAULT_VIEW_FIELD_SIZE } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/constants/DEFAULT_VIEW_FIELD_SIZE';
|
||||
|
||||
export const customAllView = (
|
||||
objectMetadataItem: ObjectMetadataEntity,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
const nameField = objectMetadataItem.fields.find(
|
||||
(field) => field.name === 'name',
|
||||
);
|
||||
|
||||
const otherFields = objectMetadataItem.fields.filter(
|
||||
(field) => field.name !== 'name',
|
||||
);
|
||||
|
||||
if (!nameField) {
|
||||
throw new Error(
|
||||
`Name field not found while creating All ${objectMetadataItem.namePlural} view`,
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
name: useCoreNaming
|
||||
? msg`All {objectLabelPlural}`
|
||||
: `All ${objectMetadataItem.labelPlural}`,
|
||||
objectMetadataId: objectMetadataItem.id,
|
||||
type: 'table',
|
||||
key: 'INDEX',
|
||||
position: 0,
|
||||
icon: 'IconList',
|
||||
isCustom: false,
|
||||
kanbanFieldMetadataId: '',
|
||||
filters: [],
|
||||
fields: [
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataItem.fields.find((field) => field.name === 'name')
|
||||
?.id ?? '',
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: DEFAULT_VIEW_FIELD_SIZE,
|
||||
},
|
||||
...otherFields.map((field, index) => ({
|
||||
fieldMetadataId: field.id,
|
||||
position: index + 1,
|
||||
isVisible: true,
|
||||
size: DEFAULT_VIEW_FIELD_SIZE,
|
||||
})),
|
||||
],
|
||||
};
|
||||
};
|
||||
+30
-3
@@ -1,17 +1,26 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { ViewOpenRecordInType } from 'src/engine/metadata-modules/view/types/view-open-record-in-type.type';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
DASHBOARD_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const dashboardsAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const dashboardsAllView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const dashboardObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.dashboard,
|
||||
);
|
||||
@@ -20,7 +29,13 @@ export const dashboardsAllView = (
|
||||
throw new Error('Dashboard object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.dashboard.views.allDashboards.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`All {objectLabelPlural}` : 'All Dashboards',
|
||||
objectMetadataId: dashboardObjectMetadata.id ?? '',
|
||||
type: 'table',
|
||||
@@ -39,6 +54,9 @@ export const dashboardsAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 200,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.dashboard.views.allDashboards.viewFields.title
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -49,6 +67,9 @@ export const dashboardsAllView = (
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.dashboard.views.allDashboards.viewFields.createdBy
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -59,6 +80,9 @@ export const dashboardsAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.dashboard.views.allDashboards.viewFields.createdAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -69,6 +93,9 @@ export const dashboardsAllView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.dashboard.views.allDashboards.viewFields.updatedAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+25
-4
@@ -1,17 +1,26 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import { DEFAULT_VIEW_FIELD_SIZE } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/constants/DEFAULT_VIEW_FIELD_SIZE';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
MESSAGE_THREAD_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const messageThreadsAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
export const messageThreadsAllView = ({
|
||||
objectMetadataItems,
|
||||
twentyStandardFlatApplication,
|
||||
useCoreNaming,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const messageThreadObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.messageThread,
|
||||
);
|
||||
@@ -20,7 +29,13 @@ export const messageThreadsAllView = (
|
||||
throw new Error('MessageThread object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.messageThread.views.allMessageThreads.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`All {objectLabelPlural}` : 'All Message Threads',
|
||||
objectMetadataId: messageThreadObjectMetadata.id ?? '',
|
||||
type: 'table',
|
||||
@@ -39,6 +54,9 @@ export const messageThreadsAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: DEFAULT_VIEW_FIELD_SIZE,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.messageThread.views.allMessageThreads.viewFields
|
||||
.messages.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -49,6 +67,9 @@ export const messageThreadsAllView = (
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.messageThread.views.allMessageThreads.viewFields
|
||||
.createdAt.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+40
-4
@@ -1,17 +1,26 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import { DEFAULT_VIEW_FIELD_SIZE } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/constants/DEFAULT_VIEW_FIELD_SIZE';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
MESSAGE_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const messagesAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
export const messagesAllView = ({
|
||||
objectMetadataItems,
|
||||
twentyStandardFlatApplication,
|
||||
useCoreNaming,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const messageObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.message,
|
||||
);
|
||||
@@ -20,7 +29,13 @@ export const messagesAllView = (
|
||||
throw new Error('Message object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.message.views.allMessages.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`All {objectLabelPlural}` : 'All Messages',
|
||||
objectMetadataId: messageObjectMetadata.id ?? '',
|
||||
type: 'table',
|
||||
@@ -38,6 +53,9 @@ export const messagesAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: DEFAULT_VIEW_FIELD_SIZE,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.message.views.allMessages.viewFields.subject
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -48,6 +66,9 @@ export const messagesAllView = (
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.message.views.allMessages.viewFields.messageThread
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -59,6 +80,9 @@ export const messagesAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.message.views.allMessages.viewFields
|
||||
.messageParticipants.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -69,6 +93,9 @@ export const messagesAllView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.message.views.allMessages.viewFields.receivedAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -79,6 +106,9 @@ export const messagesAllView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.message.views.allMessages.viewFields.headerMessageId
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -88,6 +118,9 @@ export const messagesAllView = (
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 200,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.message.views.allMessages.viewFields.text
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -98,6 +131,9 @@ export const messagesAllView = (
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.message.views.allMessages.viewFields.createdAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+35
-7
@@ -1,16 +1,25 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
NOTE_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const notesAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const notesAllView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const noteObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.note,
|
||||
);
|
||||
@@ -19,7 +28,13 @@ export const notesAllView = (
|
||||
throw new Error('Note object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.note.views.allNotes.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`All {objectLabelPlural}` : 'All Notes',
|
||||
objectMetadataId: noteObjectMetadata.id,
|
||||
type: 'table',
|
||||
@@ -37,6 +52,9 @@ export const notesAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 210,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.note.views.allNotes.viewFields.title
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -46,6 +64,9 @@ export const notesAllView = (
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.note.views.allNotes.viewFields.noteTargets
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -55,6 +76,9 @@ export const notesAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.note.views.allNotes.viewFields.bodyV2
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -64,6 +88,9 @@ export const notesAllView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.note.views.allNotes.viewFields.createdBy
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -74,18 +101,19 @@ export const notesAllView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.note.views.allNotes.viewFields.createdAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
/*
|
||||
TODO: Add later, since we don't have real-time it probably doesn't work well?
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.note].fields[
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS.updatedAt
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.note].fields[.updatedAt
|
||||
],
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 210,
|
||||
},
|
||||
size: 210},
|
||||
*/
|
||||
],
|
||||
};
|
||||
|
||||
+36
-3
@@ -1,14 +1,23 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import { OPPORTUNITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const opportunitiesAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const opportunitiesAllView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const opportunityObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.opportunity,
|
||||
);
|
||||
@@ -17,7 +26,13 @@ export const opportunitiesAllView = (
|
||||
throw new Error('Opportunity object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.opportunity.views.allOpportunities.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`All {objectLabelPlural}` : 'All Opportunities',
|
||||
objectMetadataId: opportunityObjectMetadata.id,
|
||||
type: 'table',
|
||||
@@ -35,6 +50,9 @@ export const opportunitiesAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.allOpportunities.viewFields.name
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -46,6 +64,9 @@ export const opportunitiesAllView = (
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
aggregateOperation: AggregateOperations.AVG,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.allOpportunities.viewFields.amount
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -56,6 +77,9 @@ export const opportunitiesAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.allOpportunities.viewFields
|
||||
.createdBy.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -67,6 +91,9 @@ export const opportunitiesAllView = (
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
aggregateOperation: AggregateOperations.MIN,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.allOpportunities.viewFields
|
||||
.closeDate.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -77,6 +104,9 @@ export const opportunitiesAllView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.allOpportunities.viewFields.company
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -88,6 +118,9 @@ export const opportunitiesAllView = (
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.allOpportunities.viewFields
|
||||
.pointOfContact.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+51
-3
@@ -1,14 +1,23 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import { OPPORTUNITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const opportunitiesByStageView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const opportunitiesByStageView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const opportunityObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.opportunity,
|
||||
);
|
||||
@@ -17,7 +26,13 @@ export const opportunitiesByStageView = (
|
||||
throw new Error('Opportunity object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`By Stage` : 'By Stage',
|
||||
objectMetadataId: opportunityObjectMetadata.id,
|
||||
type: 'kanban',
|
||||
@@ -43,6 +58,9 @@ export const opportunitiesByStageView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.viewFields.name
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -53,6 +71,9 @@ export const opportunitiesByStageView = (
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.viewFields.amount
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -63,6 +84,9 @@ export const opportunitiesByStageView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.viewFields.createdBy
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -73,6 +97,9 @@ export const opportunitiesByStageView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.viewFields.closeDate
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -83,6 +110,9 @@ export const opportunitiesByStageView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.viewFields.company
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -94,6 +124,9 @@ export const opportunitiesByStageView = (
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.viewFields.pointOfContact
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
groups: [
|
||||
@@ -106,6 +139,9 @@ export const opportunitiesByStageView = (
|
||||
isVisible: true,
|
||||
fieldValue: 'NEW',
|
||||
position: 0,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.viewGroups!.new
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -116,6 +152,9 @@ export const opportunitiesByStageView = (
|
||||
isVisible: true,
|
||||
fieldValue: 'SCREENING',
|
||||
position: 1,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.viewGroups!.screening
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -126,6 +165,9 @@ export const opportunitiesByStageView = (
|
||||
isVisible: true,
|
||||
fieldValue: 'MEETING',
|
||||
position: 2,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.viewGroups!.meeting
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -136,6 +178,9 @@ export const opportunitiesByStageView = (
|
||||
isVisible: true,
|
||||
fieldValue: 'PROPOSAL',
|
||||
position: 3,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.viewGroups!.proposal
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -146,6 +191,9 @@ export const opportunitiesByStageView = (
|
||||
isVisible: true,
|
||||
fieldValue: 'CUSTOMER',
|
||||
position: 4,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.opportunity.views.byStage.viewGroups!.customer
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
-150
@@ -1,150 +0,0 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
|
||||
import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { OPPORTUNITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const opportunitiesTableByStageView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
const opportunityObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.opportunity,
|
||||
);
|
||||
|
||||
if (!opportunityObjectMetadata) {
|
||||
throw new Error('Opportunity object metadata not found');
|
||||
}
|
||||
|
||||
return {
|
||||
name: useCoreNaming ? msg`By Stage` : 'By Stage',
|
||||
objectMetadataId: opportunityObjectMetadata.id,
|
||||
type: 'table',
|
||||
key: null,
|
||||
position: 1,
|
||||
icon: 'IconList',
|
||||
kanbanFieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) => field.standardId === OPPORTUNITY_STANDARD_FIELD_IDS.stage,
|
||||
)?.id ?? '',
|
||||
filters: [],
|
||||
fields: [
|
||||
{
|
||||
fieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) => field.standardId === OPPORTUNITY_STANDARD_FIELD_IDS.name,
|
||||
)?.id ?? '',
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) =>
|
||||
field.standardId === OPPORTUNITY_STANDARD_FIELD_IDS.amount,
|
||||
)?.id ?? '',
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
aggregateOperation: AggregateOperations.AVG,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) =>
|
||||
field.standardId === OPPORTUNITY_STANDARD_FIELD_IDS.createdBy,
|
||||
)?.id ?? '',
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) =>
|
||||
field.standardId === OPPORTUNITY_STANDARD_FIELD_IDS.closeDate,
|
||||
)?.id ?? '',
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
aggregateOperation: AggregateOperations.MAX,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) =>
|
||||
field.standardId === OPPORTUNITY_STANDARD_FIELD_IDS.company,
|
||||
)?.id ?? '',
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
aggregateOperation: AggregateOperations.COUNT,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) =>
|
||||
field.standardId ===
|
||||
OPPORTUNITY_STANDARD_FIELD_IDS.pointOfContact,
|
||||
)?.id ?? '',
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
],
|
||||
groups: [
|
||||
{
|
||||
fieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) =>
|
||||
field.standardId === OPPORTUNITY_STANDARD_FIELD_IDS.stage,
|
||||
)?.id ?? '',
|
||||
isVisible: true,
|
||||
fieldValue: 'NEW',
|
||||
position: 0,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) =>
|
||||
field.standardId === OPPORTUNITY_STANDARD_FIELD_IDS.stage,
|
||||
)?.id ?? '',
|
||||
isVisible: true,
|
||||
fieldValue: 'SCREENING',
|
||||
position: 1,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) =>
|
||||
field.standardId === OPPORTUNITY_STANDARD_FIELD_IDS.stage,
|
||||
)?.id ?? '',
|
||||
isVisible: true,
|
||||
fieldValue: 'MEETING',
|
||||
position: 2,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) =>
|
||||
field.standardId === OPPORTUNITY_STANDARD_FIELD_IDS.stage,
|
||||
)?.id ?? '',
|
||||
isVisible: true,
|
||||
fieldValue: 'PROPOSAL',
|
||||
position: 3,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
opportunityObjectMetadata.fields.find(
|
||||
(field) =>
|
||||
field.standardId === OPPORTUNITY_STANDARD_FIELD_IDS.stage,
|
||||
)?.id ?? '',
|
||||
isVisible: true,
|
||||
fieldValue: 'CUSTOMER',
|
||||
position: 4,
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
+48
-3
@@ -1,17 +1,26 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
PERSON_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const peopleAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const peopleAllView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const personObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.person,
|
||||
);
|
||||
@@ -20,7 +29,13 @@ export const peopleAllView = (
|
||||
throw new Error('Person object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.person.views.allPeople.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`All {objectLabelPlural}` : 'All People',
|
||||
objectMetadataId: personObjectMetadata.id,
|
||||
type: 'table',
|
||||
@@ -38,6 +53,9 @@ export const peopleAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 210,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.person.views.allPeople.viewFields.name
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -48,6 +66,9 @@ export const peopleAllView = (
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
aggregateOperation: AggregateOperations.COUNT_UNIQUE_VALUES,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.person.views.allPeople.viewFields.emails
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -57,6 +78,9 @@ export const peopleAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.person.views.allPeople.viewFields.createdBy
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -66,6 +90,9 @@ export const peopleAllView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.person.views.allPeople.viewFields.company
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -76,6 +103,9 @@ export const peopleAllView = (
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
aggregateOperation: AggregateOperations.PERCENTAGE_EMPTY,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.person.views.allPeople.viewFields.phones
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -87,6 +117,9 @@ export const peopleAllView = (
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
aggregateOperation: AggregateOperations.MIN,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.person.views.allPeople.viewFields.createdAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -96,6 +129,9 @@ export const peopleAllView = (
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.person.views.allPeople.viewFields.city
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -105,6 +141,9 @@ export const peopleAllView = (
|
||||
position: 7,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.person.views.allPeople.viewFields.jobTitle
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -115,6 +154,9 @@ export const peopleAllView = (
|
||||
position: 8,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.person.views.allPeople.viewFields.linkedinLink
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -124,6 +166,9 @@ export const peopleAllView = (
|
||||
position: 9,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.person.views.allPeople.viewFields.xLink
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+45
-9
@@ -1,16 +1,25 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
TASK_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const tasksAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const tasksAllView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const taskObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.task,
|
||||
);
|
||||
@@ -19,7 +28,13 @@ export const tasksAllView = (
|
||||
throw new Error('Task object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.task.views.allTasks.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`All {objectLabelPlural}` : 'All Tasks',
|
||||
objectMetadataId: taskObjectMetadata.id,
|
||||
type: 'table',
|
||||
@@ -35,8 +50,7 @@ export const tasksAllView = (
|
||||
],
|
||||
displayValue: 'Task',
|
||||
operand: 'is',
|
||||
value: '["TASK"]',
|
||||
},
|
||||
value: '["TASK"]'},
|
||||
],*/,
|
||||
fields: [
|
||||
{
|
||||
@@ -47,6 +61,9 @@ export const tasksAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 210,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.allTasks.viewFields.title
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -56,6 +73,9 @@ export const tasksAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.allTasks.viewFields.status
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -65,6 +85,9 @@ export const tasksAllView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.allTasks.viewFields.taskTargets
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -74,6 +97,9 @@ export const tasksAllView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.allTasks.viewFields.createdBy
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -83,6 +109,9 @@ export const tasksAllView = (
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.allTasks.viewFields.dueAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -92,6 +121,9 @@ export const tasksAllView = (
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.allTasks.viewFields.assignee
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -101,6 +133,9 @@ export const tasksAllView = (
|
||||
position: 7,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.allTasks.viewFields.bodyV2
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -111,18 +146,19 @@ export const tasksAllView = (
|
||||
position: 8,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.allTasks.viewFields.createdAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
/*
|
||||
TODO: Add later, since we don't have real-time it probably doesn't work well?
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.task].fields[
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS.updatedAt
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.task].fields[.updatedAt
|
||||
],
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 210,
|
||||
},
|
||||
size: 210},
|
||||
*/
|
||||
],
|
||||
};
|
||||
|
||||
+56
-6
@@ -1,17 +1,26 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { ViewFilterOperand } from 'twenty-shared/types';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { ViewFilterOperand } from 'twenty-shared/types';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
TASK_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const tasksAssignedToMeView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const tasksAssignedToMeView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const taskObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.task,
|
||||
);
|
||||
@@ -20,7 +29,13 @@ export const tasksAssignedToMeView = (
|
||||
throw new Error('Task object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`Assigned to Me` : 'Assigned to Me',
|
||||
objectMetadataId: taskObjectMetadata.id,
|
||||
type: 'table',
|
||||
@@ -40,6 +55,9 @@ export const tasksAssignedToMeView = (
|
||||
isCurrentWorkspaceMemberSelected: true,
|
||||
selectedRecordIds: [],
|
||||
}),
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewFilters!.assigneeIsMe
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
fields: [
|
||||
@@ -51,6 +69,9 @@ export const tasksAssignedToMeView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 210,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewFields.title
|
||||
.universalIdentifier,
|
||||
},
|
||||
/*{
|
||||
fieldMetadataId:
|
||||
@@ -59,8 +80,7 @@ export const tasksAssignedToMeView = (
|
||||
],
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},*/
|
||||
size: 150},*/
|
||||
{
|
||||
fieldMetadataId:
|
||||
taskObjectMetadata.fields.find(
|
||||
@@ -69,6 +89,9 @@ export const tasksAssignedToMeView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewFields.taskTargets
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -78,6 +101,9 @@ export const tasksAssignedToMeView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewFields.createdBy
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -87,6 +113,9 @@ export const tasksAssignedToMeView = (
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewFields.dueAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -96,6 +125,9 @@ export const tasksAssignedToMeView = (
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewFields.assignee
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -105,6 +137,9 @@ export const tasksAssignedToMeView = (
|
||||
position: 7,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewFields.bodyV2
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -115,6 +150,9 @@ export const tasksAssignedToMeView = (
|
||||
position: 8,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewFields.createdAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
groups: [
|
||||
@@ -126,6 +164,9 @@ export const tasksAssignedToMeView = (
|
||||
isVisible: true,
|
||||
fieldValue: 'TODO',
|
||||
position: 0,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewGroups!.todo
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -135,6 +176,9 @@ export const tasksAssignedToMeView = (
|
||||
isVisible: true,
|
||||
fieldValue: 'IN_PROGRESS',
|
||||
position: 1,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewGroups!.inProgress
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -144,6 +188,9 @@ export const tasksAssignedToMeView = (
|
||||
isVisible: true,
|
||||
fieldValue: 'DONE',
|
||||
position: 2,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewGroups!.done
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -153,6 +200,9 @@ export const tasksAssignedToMeView = (
|
||||
isVisible: true,
|
||||
fieldValue: '',
|
||||
position: 3,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.assignedToMe.viewGroups!.empty
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+45
-9
@@ -1,16 +1,25 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
TASK_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const tasksByStatusView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const tasksByStatusView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const taskObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.task,
|
||||
);
|
||||
@@ -19,7 +28,13 @@ export const tasksByStatusView = (
|
||||
throw new Error('Task object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.task.views.byStatus.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`By Status` : 'By Status',
|
||||
objectMetadataId: taskObjectMetadata.id,
|
||||
type: 'kanban',
|
||||
@@ -38,8 +53,7 @@ export const tasksByStatusView = (
|
||||
],
|
||||
displayValue: 'Task',
|
||||
operand: 'is',
|
||||
value: '["TASK"]',
|
||||
},
|
||||
value: '["TASK"]'},
|
||||
],*/,
|
||||
fields: [
|
||||
{
|
||||
@@ -50,6 +64,9 @@ export const tasksByStatusView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 210,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.byStatus.viewFields.title
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -59,6 +76,9 @@ export const tasksByStatusView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.byStatus.viewFields.status
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -68,6 +88,9 @@ export const tasksByStatusView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.byStatus.viewFields.dueAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -77,6 +100,9 @@ export const tasksByStatusView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.byStatus.viewFields.assignee
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -87,18 +113,19 @@ export const tasksByStatusView = (
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.byStatus.viewFields.createdAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
/*
|
||||
TODO: Add later, since we don't have real-time it probably doesn't work well?
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.task].fields[
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS.updatedAt
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.task].fields[.updatedAt
|
||||
],
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 210,
|
||||
},
|
||||
size: 210},
|
||||
*/
|
||||
],
|
||||
groups: [
|
||||
@@ -110,6 +137,9 @@ export const tasksByStatusView = (
|
||||
isVisible: true,
|
||||
fieldValue: 'TODO',
|
||||
position: 0,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.byStatus.viewGroups!.todo
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -119,6 +149,9 @@ export const tasksByStatusView = (
|
||||
isVisible: true,
|
||||
fieldValue: 'IN_PROGRESS',
|
||||
position: 1,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.byStatus.viewGroups!.inProgress
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -128,6 +161,9 @@ export const tasksByStatusView = (
|
||||
isVisible: true,
|
||||
fieldValue: 'DONE',
|
||||
position: 2,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.task.views.byStatus.viewGroups!.done
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+36
-3
@@ -1,14 +1,23 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { ViewOpenRecordInType } from 'src/engine/metadata-modules/view/types/view-open-record-in-type.type';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import { WORKFLOW_RUN_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const workflowRunsAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const workflowRunsAllView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const workflowRunObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.workflowRun,
|
||||
);
|
||||
@@ -17,7 +26,13 @@ export const workflowRunsAllView = (
|
||||
throw new Error('Workflow run object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.workflowRun.views.allWorkflowRuns.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`All {objectLabelPlural}` : 'All Workflow Runs',
|
||||
objectMetadataId: workflowRunObjectMetadata.id,
|
||||
type: 'table',
|
||||
@@ -37,6 +52,9 @@ export const workflowRunsAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflowRun.views.allWorkflowRuns.viewFields.name
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -47,6 +65,9 @@ export const workflowRunsAllView = (
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflowRun.views.allWorkflowRuns.viewFields.workflow
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -57,6 +78,9 @@ export const workflowRunsAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflowRun.views.allWorkflowRuns.viewFields.status
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -67,6 +91,9 @@ export const workflowRunsAllView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflowRun.views.allWorkflowRuns.viewFields
|
||||
.startedAt.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -77,6 +104,9 @@ export const workflowRunsAllView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflowRun.views.allWorkflowRuns.viewFields
|
||||
.createdBy.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -88,6 +118,9 @@ export const workflowRunsAllView = (
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflowRun.views.allWorkflowRuns.viewFields
|
||||
.workflowVersion.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+34
-3
@@ -1,17 +1,26 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { ViewOpenRecordInType } from 'src/engine/metadata-modules/view/types/view-open-record-in-type.type';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
WORKFLOW_VERSION_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const workflowVersionsAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const workflowVersionsAllView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const workflowVersionObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.workflowVersion,
|
||||
);
|
||||
@@ -20,7 +29,14 @@ export const workflowVersionsAllView = (
|
||||
throw new Error('Workflow version object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.workflowVersion.views.allWorkflowVersions
|
||||
.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming
|
||||
? msg`All {objectLabelPlural}`
|
||||
: 'All Workflow Versions',
|
||||
@@ -42,6 +58,9 @@ export const workflowVersionsAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 210,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflowVersion.views.allWorkflowVersions.viewFields
|
||||
.name.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -52,6 +71,9 @@ export const workflowVersionsAllView = (
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflowVersion.views.allWorkflowVersions.viewFields
|
||||
.workflow.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -62,6 +84,9 @@ export const workflowVersionsAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflowVersion.views.allWorkflowVersions.viewFields
|
||||
.status.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -72,6 +97,9 @@ export const workflowVersionsAllView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflowVersion.views.allWorkflowVersions.viewFields
|
||||
.updatedAt.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -82,6 +110,9 @@ export const workflowVersionsAllView = (
|
||||
position: 4,
|
||||
isVisible: false,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflowVersion.views.allWorkflowVersions.viewFields
|
||||
.runs.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+36
-3
@@ -1,17 +1,26 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { ViewOpenRecordInType } from 'src/engine/metadata-modules/view/types/view-open-record-in-type.type';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
WORKFLOW_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const workflowsAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
export const workflowsAllView = ({
|
||||
objectMetadataItems,
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
twentyStandardFlatApplication,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const workflowObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.workflow,
|
||||
);
|
||||
@@ -20,7 +29,13 @@ export const workflowsAllView = (
|
||||
throw new Error('Workflow object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.workflow.views.allWorkflows.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming ? msg`All {objectLabelPlural}` : 'All Workflows',
|
||||
objectMetadataId: workflowObjectMetadata.id,
|
||||
type: 'table',
|
||||
@@ -39,6 +54,9 @@ export const workflowsAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.views.allWorkflows.viewFields.name
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -49,6 +67,9 @@ export const workflowsAllView = (
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.views.allWorkflows.viewFields.statuses
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -59,6 +80,9 @@ export const workflowsAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.views.allWorkflows.viewFields.updatedAt
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -69,6 +93,9 @@ export const workflowsAllView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.views.allWorkflows.viewFields.createdBy
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -79,6 +106,9 @@ export const workflowsAllView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.views.allWorkflows.viewFields.versions
|
||||
.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -88,6 +118,9 @@ export const workflowsAllView = (
|
||||
position: 5,
|
||||
isVisible: false,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.views.allWorkflows.viewFields.runs
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+47
-4
@@ -1,17 +1,26 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { STANDARD_OBJECTS } from 'src/engine/core-modules/application/constants/standard-object.constant';
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface';
|
||||
import { DEFAULT_VIEW_FIELD_SIZE } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/constants/DEFAULT_VIEW_FIELD_SIZE';
|
||||
import {
|
||||
BASE_OBJECT_STANDARD_FIELD_IDS,
|
||||
WORKSPACE_MEMBER_STANDARD_FIELD_IDS,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
|
||||
export const workspaceMembersAllView = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
useCoreNaming = false,
|
||||
) => {
|
||||
export const workspaceMembersAllView = ({
|
||||
objectMetadataItems,
|
||||
twentyStandardFlatApplication,
|
||||
useCoreNaming,
|
||||
}: {
|
||||
objectMetadataItems: ObjectMetadataEntity[];
|
||||
useCoreNaming?: boolean;
|
||||
twentyStandardFlatApplication: FlatApplication;
|
||||
}): ViewDefinition => {
|
||||
const workspaceMemberObjectMetadata = objectMetadataItems.find(
|
||||
(object) => object.standardId === STANDARD_OBJECT_IDS.workspaceMember,
|
||||
);
|
||||
@@ -20,7 +29,14 @@ export const workspaceMembersAllView = (
|
||||
throw new Error('WorkspaceMember object metadata not found');
|
||||
}
|
||||
|
||||
const viewUniversalIdentifier =
|
||||
STANDARD_OBJECTS.workspaceMember.views.allWorkspaceMembers
|
||||
.universalIdentifier;
|
||||
|
||||
return {
|
||||
id: v4(),
|
||||
universalIdentifier: viewUniversalIdentifier,
|
||||
applicationId: twentyStandardFlatApplication.id,
|
||||
name: useCoreNaming
|
||||
? msg`All {objectLabelPlural}`
|
||||
: 'All Workspace Members',
|
||||
@@ -41,6 +57,9 @@ export const workspaceMembersAllView = (
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: DEFAULT_VIEW_FIELD_SIZE,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workspaceMember.views.allWorkspaceMembers.viewFields
|
||||
.name.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -52,6 +71,9 @@ export const workspaceMembersAllView = (
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workspaceMember.views.allWorkspaceMembers.viewFields
|
||||
.userEmail.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -63,6 +85,9 @@ export const workspaceMembersAllView = (
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workspaceMember.views.allWorkspaceMembers.viewFields
|
||||
.avatarUrl.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -74,6 +99,9 @@ export const workspaceMembersAllView = (
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workspaceMember.views.allWorkspaceMembers.viewFields
|
||||
.colorScheme.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -84,6 +112,9 @@ export const workspaceMembersAllView = (
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 120,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workspaceMember.views.allWorkspaceMembers.viewFields
|
||||
.locale.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -94,6 +125,9 @@ export const workspaceMembersAllView = (
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workspaceMember.views.allWorkspaceMembers.viewFields
|
||||
.timeZone.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -105,6 +139,9 @@ export const workspaceMembersAllView = (
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 120,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workspaceMember.views.allWorkspaceMembers.viewFields
|
||||
.dateFormat.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -116,6 +153,9 @@ export const workspaceMembersAllView = (
|
||||
position: 7,
|
||||
isVisible: true,
|
||||
size: 120,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workspaceMember.views.allWorkspaceMembers.viewFields
|
||||
.timeFormat.universalIdentifier,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
@@ -126,6 +166,9 @@ export const workspaceMembersAllView = (
|
||||
position: 8,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
universalIdentifier:
|
||||
STANDARD_OBJECTS.workspaceMember.views.allWorkspaceMembers.viewFields
|
||||
.createdAt.universalIdentifier,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user