diff --git a/src/main/frontend/model/hops/createChildNode.ts b/src/main/frontend/model/hops/createChildNode.ts index 12a0509..21476a1 100644 --- a/src/main/frontend/model/hops/createChildNode.ts +++ b/src/main/frontend/model/hops/createChildNode.ts @@ -4,6 +4,7 @@ export interface Type extends AnyHop { type: 'createChildNode'; name: string; primaryType?: string; + runOnExistingNode: boolean; conflict: ConflictResolutionStrategy; hops?: Hop[]; } @@ -11,6 +12,7 @@ export interface Type extends AnyHop { export const defaultConfig: Partial = { conflict: 'ignore', name: 'child-name', + runOnExistingNode: false, }; export const title = 'Create Node'; diff --git a/src/main/frontend/sections/editor/types/CreateChildNodeStep.tsx b/src/main/frontend/sections/editor/types/CreateChildNodeStep.tsx index e49c8f1..e3ba1b0 100644 --- a/src/main/frontend/sections/editor/types/CreateChildNodeStep.tsx +++ b/src/main/frontend/sections/editor/types/CreateChildNodeStep.tsx @@ -8,6 +8,7 @@ import { Help } from '../../../widgets/Help'; import { Input } from '../../../widgets/Input'; import { Pipeline } from '../Pipeline'; import { Conflict } from '../../../widgets/Conflict'; +import { Switch } from '../../../widgets/Switch'; export const CreateChildNodeStep = forwardRef(function CreateChildNodeStep( { parentHops, hop }, @@ -32,9 +33,17 @@ export const CreateChildNodeStep = forwardRef (hop.conflict = conflict)} /> + {hop.conflict == 'ignore' ? ( + (hop.runOnExistingNode = runOnExistingNode)} + /> + ) : undefined}
Name of New Child Node

The name of the child node to be created.

@@ -52,10 +61,11 @@ export const CreateChildNodeStep = forwardRefnt:unstructured

If the target node exists
+

How to handle the case where the target node already exists.

+
Run on existing node

- How to handle the case where the target node already exists. Note that choosing “Ignore conflict” will use the - existing node to run descendent pipeline steps on. To stop the descendent pipeline from running in this case, - choose “Throw an exception” and place this step inside a “Catch Pipeline Errors” step. + Whether to run the descendant hops if the target node already existed (only applicable if “If the target node + exists” is set to “Ignore conflict”).

diff --git a/src/main/frontend/widgets/Conflict.tsx b/src/main/frontend/widgets/Conflict.tsx index 9b15c12..9bc53fb 100644 --- a/src/main/frontend/widgets/Conflict.tsx +++ b/src/main/frontend/widgets/Conflict.tsx @@ -9,16 +9,23 @@ export type Options = [value: string, label: string, icon?: CoralIcon][]; export const Conflict: FC<{ label?: string; forceLabel?: string; + ignoreLabel?: string; value: ConflictResolutionStrategy; onChange(newValue: ConflictResolutionStrategy): void; -}> = ({ label = 'Conflict Resolution', forceLabel = 'Force the given action', value, onChange }) => { +}> = ({ + label = 'Conflict Resolution', + forceLabel = 'Force the given action', + ignoreLabel = 'Ignore conflict, abort the current action', + value, + onChange, +}) => { return (