3548751be2
- Create a workflow version when the user visits an empty workflow. - If the trigger is not defined yet and the user selects either the standard object type or the event type first, we automatically select the first option of the other value. Indeed, every state update is automatically saved on the backend and we need both standard object and event types to save the event name. - Introduces a change in the backend. I removed the assertions that throw when a workflow version is not complete, that is, when it doesn't have a defined trigger, which is the case when scaffolding a new workflow with a first empty workflow version. - We should keep validating the workflow versions, at least when we publish them. That should be done in a second step.
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
|
import { WorkflowDiagramCanvas } from '@/workflow/components/WorkflowDiagramCanvas';
|
|
import { WorkflowEffect } from '@/workflow/components/WorkflowEffect';
|
|
import { workflowDiagramState } from '@/workflow/states/workflowDiagramState';
|
|
import styled from '@emotion/styled';
|
|
import '@xyflow/react/dist/style.css';
|
|
import { useRecoilValue } from 'recoil';
|
|
|
|
const StyledFlowContainer = styled.div`
|
|
height: 100%;
|
|
width: 100%;
|
|
|
|
/* Below we reset the default styling of Reactflow */
|
|
.react-flow__node-input,
|
|
.react-flow__node-default,
|
|
.react-flow__node-output,
|
|
.react-flow__node-group {
|
|
padding: 0;
|
|
}
|
|
|
|
--xy-node-border-radius: none;
|
|
--xy-node-border: none;
|
|
--xy-node-background-color: none;
|
|
--xy-node-boxshadow-hover: none;
|
|
--xy-node-boxshadow-selected: none;
|
|
`;
|
|
|
|
export const Workflow = ({
|
|
targetableObject,
|
|
}: {
|
|
targetableObject: ActivityTargetableObject;
|
|
}) => {
|
|
const workflowId = targetableObject.id;
|
|
|
|
const workflowDiagram = useRecoilValue(workflowDiagramState);
|
|
|
|
return (
|
|
<>
|
|
<WorkflowEffect workflowId={workflowId} />
|
|
|
|
<StyledFlowContainer>
|
|
{workflowDiagram === undefined ? null : (
|
|
<WorkflowDiagramCanvas diagram={workflowDiagram} />
|
|
)}
|
|
</StyledFlowContainer>
|
|
</>
|
|
);
|
|
};
|