From b843aaaa96a2d743015bb392277c2919eb9e0fa1 Mon Sep 17 00:00:00 2001 From: Raphael Schweikert Date: Fri, 11 Oct 2024 12:21:22 +0200 Subject: [PATCH] feat(editor): implement createChildNode configurator --- .../frontend/sections/editor/PipelineStep.tsx | 3 + .../editor/types/CreateChildNodeStep.tsx | 59 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 src/main/frontend/sections/editor/types/CreateChildNodeStep.tsx diff --git a/src/main/frontend/sections/editor/PipelineStep.tsx b/src/main/frontend/sections/editor/PipelineStep.tsx index c1782ab..dd437f8 100644 --- a/src/main/frontend/sections/editor/PipelineStep.tsx +++ b/src/main/frontend/sections/editor/PipelineStep.tsx @@ -7,6 +7,7 @@ import { CopyNodeStep } from './types/CopyNodeStep'; import { DeclareStep } from './types/DeclareStep'; import { FallbackStep } from './types/FallbackStep'; +import { CreateChildNodeStep } from './types/CreateChildNodeStep'; export const PipelineStep: FC<{ parentHops: Hop[]; hop: Hop }> = ({ parentHops, hop }) => { switch (hop.type) { @@ -14,6 +15,8 @@ export const PipelineStep: FC<{ parentHops: Hop[]; hop: Hop }> = ({ parentHops, return ; case 'copyNode': return ; + case 'createChildNode': + return ; case 'declare': return ; default: diff --git a/src/main/frontend/sections/editor/types/CreateChildNodeStep.tsx b/src/main/frontend/sections/editor/types/CreateChildNodeStep.tsx new file mode 100644 index 0000000..aa9687b --- /dev/null +++ b/src/main/frontend/sections/editor/types/CreateChildNodeStep.tsx @@ -0,0 +1,59 @@ +import React, { FC } from 'react'; + +import { Hop } from '../../../model/hops'; +import { StepEditor } from '../../../widgets/StepEditor'; + +import { shortDescription, Type } from '../../../model/hops/createChildNode'; +import { Help } from '../../../widgets/Help'; +import { Input } from '../../../widgets/Input'; +import { Pipeline } from '../Pipeline'; +import { Conflict } from '../../../widgets/Conflict'; + +export const CreateChildNodeStep: FC<{ parentHops: Hop[]; hop: Type }> = ({ parentHops, hop }) => { + return ( + }> + + + (hop.conflict = conflict)} + /> + +
Name of New Child Node
+

The name of the child node to be created.

+

+ Can be prepended with a path to an existing resource. Relative and absolute paths are allowed. Paths to + non-existing parents will throw an exception. +

+

+ For example, a value of node1/newNodeName will create the node{' '} + newNodeName as a child of the existing{' '} + node1 child of the current node and throw if{' '} + node1 doesn’t exist. +

+
jcr:primaryType of new node
+

+ The primary type to set on the new node. If left empty, defaults to{' '} + nt:unstructured +

+
If the target node exists
+

+ 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. +

+
+
+ ); +};