Scaffold filters creation and deletion (#12990)

When the feature flag is activated, we can now create filters and delete
them. This PR mainly updates how we generate workflow diagrams.


https://github.com/user-attachments/assets/1a4aef46-7c3c-45fa-953f-0bd1908b9be7
This commit is contained in:
Baptiste Devessier
2025-07-02 17:01:44 +02:00
committed by GitHub
parent ba67e0d5f4
commit e8a2d71844
21 changed files with 818 additions and 204 deletions

View File

@ -1,9 +1,15 @@
import { WorkflowWithCurrentVersion } from '@/workflow/types/Workflow';
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
import {
WorkflowActionType,
WorkflowWithCurrentVersion,
} from '@/workflow/types/Workflow';
import { RightDrawerStepListContainer } from '@/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepContainer';
import { RightDrawerWorkflowSelectStepTitle } from '@/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepTitle';
import { useCreateStep } from '@/workflow/workflow-steps/hooks/useCreateStep';
import { workflowInsertStepIdsComponentState } from '@/workflow/workflow-steps/states/workflowInsertStepIdsComponentState';
import { RECORD_ACTIONS } from '@/workflow/workflow-steps/workflow-actions/constants/RecordActions';
import { useFilteredOtherActions } from '@/workflow/workflow-steps/workflow-actions/hooks/useFilteredOtherActions';
import { isDefined } from 'twenty-shared/utils';
import { useIcons } from 'twenty-ui/display';
import { MenuItemCommand } from 'twenty-ui/navigation';
@ -13,11 +19,36 @@ export const CommandMenuWorkflowSelectActionContent = ({
workflow: WorkflowWithCurrentVersion;
}) => {
const { getIcon } = useIcons();
const { createStep } = useCreateStep({
workflow,
});
const filteredOtherActions = useFilteredOtherActions();
const [workflowInsertStepIds, setWorkflowInsertStepIds] =
useRecoilComponentStateV2(workflowInsertStepIdsComponentState);
const handleCreateStep = async (actionType: WorkflowActionType) => {
const { parentStepId, nextStepId } = workflowInsertStepIds;
if (!isDefined(parentStepId)) {
throw new Error(
'No parentStepId. Please select a parent step to create from.',
);
}
await createStep({
newStepType: actionType,
parentStepId,
nextStepId,
});
setWorkflowInsertStepIds({
parentStepId: undefined,
nextStepId: undefined,
});
};
return (
<RightDrawerStepListContainer>
<RightDrawerWorkflowSelectStepTitle>
@ -28,7 +59,7 @@ export const CommandMenuWorkflowSelectActionContent = ({
key={action.type}
LeftIcon={getIcon(action.icon)}
text={action.label}
onClick={() => createStep(action.type)}
onClick={() => handleCreateStep(action.type)}
/>
))}
<RightDrawerWorkflowSelectStepTitle>
@ -39,7 +70,7 @@ export const CommandMenuWorkflowSelectActionContent = ({
key={action.type}
LeftIcon={getIcon(action.icon)}
text={action.label}
onClick={() => createStep(action.type)}
onClick={() => handleCreateStep(action.type)}
/>
))}
</RightDrawerStepListContainer>