Add Record Create action in the frontend (#8514)
In this PR: - Updated the front-end types for workflows to include CRUD actions and global naming changes - Allow users to create a Record Create action - Scaffold the edit for Record Create action; for now, I render a `<VariableTagInput />` component for every editable field; it's likely we'll change it soon Closes https://github.com/twentyhq/private-issues/issues/142 Demo: https://github.com/user-attachments/assets/6f0b207a-b7d2-46d9-b5ab-9e32bde55d76
This commit is contained in:
committed by
GitHub
parent
316537a68a
commit
c17e18b1e9
@@ -1,10 +1,15 @@
|
||||
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { WorkflowStep, WorkflowStepType } from '@/workflow/types/Workflow';
|
||||
import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
export const getStepDefaultDefinition = (
|
||||
type: WorkflowStepType,
|
||||
): WorkflowStep => {
|
||||
export const getStepDefaultDefinition = ({
|
||||
type,
|
||||
activeObjectMetadataItems,
|
||||
}: {
|
||||
type: WorkflowStepType;
|
||||
activeObjectMetadataItems: ObjectMetadataItem[];
|
||||
}): WorkflowStep => {
|
||||
const newStepId = v4();
|
||||
|
||||
switch (type) {
|
||||
@@ -57,6 +62,34 @@ export const getStepDefaultDefinition = (
|
||||
},
|
||||
};
|
||||
}
|
||||
case 'RECORD_CRUD.CREATE': {
|
||||
return {
|
||||
id: newStepId,
|
||||
name: 'Record Create',
|
||||
type: 'RECORD_CRUD',
|
||||
valid: false,
|
||||
settings: {
|
||||
input: {
|
||||
type: 'CREATE',
|
||||
objectName: activeObjectMetadataItems[0].nameSingular,
|
||||
objectRecord: {},
|
||||
},
|
||||
outputSchema: {},
|
||||
errorHandlingOptions: {
|
||||
continueOnFailure: {
|
||||
value: false,
|
||||
},
|
||||
retryOnFailure: {
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
case 'RECORD_CRUD.DELETE':
|
||||
case 'RECORD_CRUD.UPDATE': {
|
||||
throw new Error('Not implemented yet');
|
||||
}
|
||||
default: {
|
||||
return assertUnreachable(type, `Unknown type: ${type}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user