-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create default view for workflows + fix task and note targets #6620
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { EntityManager } from 'typeorm'; | ||
import { v4 } from 'uuid'; | ||
|
||
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum'; | ||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity'; | ||
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; | ||
import { activitiesAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/activities-all.view'; | ||
import { companiesAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/companies-all.view'; | ||
|
@@ -10,12 +12,19 @@ import { opportunitiesByStageView } from 'src/engine/workspace-manager/standard- | |
import { peopleAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/people-all.view'; | ||
import { tasksAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/tasks-all.view'; | ||
import { tasksByStatusView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/tasks-by-status.view'; | ||
import { workflowsAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/workflows-all.view'; | ||
|
||
export const viewPrefillData = async ( | ||
entityManager: EntityManager, | ||
schemaName: string, | ||
objectMetadataMap: Record<string, ObjectMetadataEntity>, | ||
featureFlags?: FeatureFlagEntity[], | ||
) => { | ||
const IsWorkflowEnabled = | ||
featureFlags?.find( | ||
(featureFlag) => featureFlag.key === FeatureFlagKey.IsWorkflowEnabled, | ||
)?.value ?? false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider using a more descriptive variable name like 'isWorkflowEnabled' (camelCase) instead of 'IsWorkflowEnabled' |
||
|
||
const viewDefinitions = [ | ||
await companiesAllView(objectMetadataMap), | ||
await peopleAllView(objectMetadataMap), | ||
|
@@ -25,6 +34,7 @@ export const viewPrefillData = async ( | |
await notesAllView(objectMetadataMap), | ||
await tasksAllView(objectMetadataMap), | ||
await tasksByStatusView(objectMetadataMap), | ||
...(IsWorkflowEnabled ? [await workflowsAllView(objectMetadataMap)] : []), | ||
]; | ||
|
||
const viewDefinitionsWithId = viewDefinitions.map((viewDefinition) => ({ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; | ||
import { WORKFLOW_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids'; | ||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids'; | ||
|
||
export const workflowsAllView = async ( | ||
objectMetadataMap: Record<string, ObjectMetadataEntity>, | ||
) => { | ||
Comment on lines
+5
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider adding JSDoc comment for function description and parameters |
||
return { | ||
name: 'All Workflows', | ||
objectMetadataId: objectMetadataMap[STANDARD_OBJECT_IDS.workflow].id, | ||
type: 'table', | ||
key: null, | ||
position: 0, | ||
icon: 'IconSettingsAutomation', | ||
kanbanFieldMetadataId: '', | ||
filters: [], | ||
fields: [ | ||
{ | ||
fieldMetadataId: | ||
objectMetadataMap[STANDARD_OBJECT_IDS.workflow].fields[ | ||
WORKFLOW_STANDARD_FIELD_IDS.name | ||
], | ||
position: 0, | ||
isVisible: true, | ||
size: 210, | ||
}, | ||
{ | ||
fieldMetadataId: | ||
objectMetadataMap[STANDARD_OBJECT_IDS.workflow].fields[ | ||
WORKFLOW_STANDARD_FIELD_IDS.publishedVersionId | ||
], | ||
position: 1, | ||
isVisible: true, | ||
size: 150, | ||
}, | ||
], | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const isWorkflowEnabled