-
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
Add delete record action #8908
Add delete record action #8908
Conversation
thomtrp
commented
Dec 5, 2024
- Adding new action
- Adding tests
- Moving into action folder
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.
PR Summary
This PR adds a new Delete Record action to the workflow system, enabling users to delete records through workflow automation.
- Added new
RECORD_CRUD.DELETE
action type in/packages/twenty-front/src/modules/workflow/constants/Actions.ts
with corresponding UI components - Implemented
WorkflowEditActionFormRecordDelete
component in/workflow-actions/components/
for selecting objects and records to delete - Added type guard
isWorkflowRecordDeleteAction
with comprehensive test coverage in/workflow-actions/utils/
- Added server-side support in
workflow-version-step.workspace-service.ts
for handling delete record actions - Critical bug found in
isWorkflowRecordUpdateAction.test.ts
where test expectations are reversed for CREATE/UPDATE actions
13 file(s) reviewed, 11 comment(s)
Edit PR Review Bot Settings | Greptile
packages/twenty-front/src/modules/workflow/components/WorkflowStepDetail.tsx
Show resolved
Hide resolved
...ront/src/modules/workflow/workflow-actions/components/WorkflowEditActionFormRecordDelete.tsx
Show resolved
Hide resolved
...ront/src/modules/workflow/workflow-actions/components/WorkflowEditActionFormRecordDelete.tsx
Show resolved
Hide resolved
...t/src/modules/workflow/workflow-actions/utils/__tests__/isWorkflowRecordDeleteAction.test.ts
Outdated
Show resolved
Hide resolved
...t/src/modules/workflow/workflow-actions/utils/__tests__/isWorkflowRecordDeleteAction.test.ts
Outdated
Show resolved
Hide resolved
...t/src/modules/workflow/workflow-actions/utils/__tests__/isWorkflowRecordUpdateAction.test.ts
Outdated
Show resolved
Hide resolved
...t/src/modules/workflow/workflow-actions/utils/__tests__/isWorkflowRecordUpdateAction.test.ts
Outdated
Show resolved
Hide resolved
...t/src/modules/workflow/workflow-actions/utils/__tests__/isWorkflowRecordUpdateAction.test.ts
Outdated
Show resolved
Hide resolved
...ges/twenty-front/src/modules/workflow/workflow-actions/utils/isWorkflowRecordDeleteAction.ts
Show resolved
Hide resolved
...er/src/modules/workflow/common/workspace-services/workflow-version-step.workspace-service.ts
Show resolved
Hide resolved
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.
LGTM some comment
@@ -169,6 +169,27 @@ export class WorkflowVersionStepWorkspaceService { | |||
}, | |||
}; | |||
} | |||
case `${WorkflowActionType.RECORD_CRUD}.${WorkflowRecordCRUDType.DELETE}`: { |
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.
Indeed, we need to fix that, in a dedicated PR probably
if (actionOptions.readonly === true) { | ||
return; | ||
} | ||
|
||
actionOptions.onActionUpdate({ | ||
...action, | ||
name: newName, | ||
}); |
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.
I wonder why we don't just add this readonly
check directly in the onActionUpdate
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.
Actually when readonly is set, onActionUpdate has to be undefined (see props definition above).
We need the readonly props to disable buttons and fields in some actions. So we still need to pass the props. Adding the readonly in onActionUpdate would simply remove the check above.
But I actually like the component to have its logic and not trust blindly the parent so I am not sure I would even remove that check