diff --git a/DSL/Ruuter/services/GET/services/services-detailed/nok.yml b/DSL/Ruuter/services/GET/services/services-detailed/nok.yml index 4a2d2a713..5fea87121 100644 --- a/DSL/Ruuter/services/GET/services/services-detailed/nok.yml +++ b/DSL/Ruuter/services/GET/services/services-detailed/nok.yml @@ -17,6 +17,9 @@ declaration: - field: sorting type: string description: "Parameter 'sorting'" + - field: order + type: string + description: "Parameter 'order'" getFaults: call: http.post diff --git a/GUI/src/components/FlowElementsPopup/PreviousVariables.tsx b/GUI/src/components/FlowElementsPopup/PreviousVariables.tsx index b0d553ae2..be1f786a7 100644 --- a/GUI/src/components/FlowElementsPopup/PreviousVariables.tsx +++ b/GUI/src/components/FlowElementsPopup/PreviousVariables.tsx @@ -129,6 +129,7 @@ const PreviousVariables: FC = ({ nodeId }) => { setAssignedObjectTree={setAssignedObjectTree} popupBodyCss={popupBodyCss} border={border} + isAssignSection={true} /> )} @@ -235,6 +236,7 @@ const VariableSection = ({ setAssignedObjectTree, popupBodyCss, border, + isAssignSection = false, }: any) => { const { t } = useTranslation(); @@ -280,7 +282,7 @@ const VariableSection = ({ : { data: variable.data, path: variable.value, - }, + } ); }} > @@ -298,6 +300,7 @@ const VariableSection = ({ dragData={variable.key ? variable : undefined} style={{ cursor: variable.key ? "grab" : "default" }} borderColor={typeColor.color} + isAssignElement={isAssignSection ? !predefinedInputKeys.includes(variable.id) : false} > {name} diff --git a/GUI/src/components/OutputElementBox/index.tsx b/GUI/src/components/OutputElementBox/index.tsx index 8448bd2bd..a50286ac5 100644 --- a/GUI/src/components/OutputElementBox/index.tsx +++ b/GUI/src/components/OutputElementBox/index.tsx @@ -11,6 +11,7 @@ type OutputElementBoxProps = { readonly onClick?: () => void; readonly style?: CSSProperties; readonly className?: string; + readonly isAssignElement?: boolean; }; const OutputElementBox: FC = ({ @@ -20,6 +21,7 @@ const OutputElementBox: FC = ({ style, className, children, + isAssignElement = false, }) => { const node = useServiceStore((state) => state.selectedNode); const mergedStyle: CSSProperties = { @@ -36,12 +38,14 @@ const OutputElementBox: FC = ({ const handleDragStart = (event: DragEvent) => { if (!dragData) return; + const dragValue = isAssignElement ? `\${${dragData.key}}` : dragData.value; + event.dataTransfer.setData( ASSIGN_DRAG_TYPE, // Need to check for StepType.Assign here since ReactQuill does not support custom onDrop events node?.data.stepType === StepType.Assign || node?.data.stepType === StepType.DynamicChoices ? JSON.stringify(dragData) - : dragData.value + : dragValue ); }; diff --git a/GUI/src/hooks/flow/useLayout.ts b/GUI/src/hooks/flow/useLayout.ts index 141c773c6..2782f7401 100644 --- a/GUI/src/hooks/flow/useLayout.ts +++ b/GUI/src/hooks/flow/useLayout.ts @@ -2,6 +2,7 @@ import { useCallback, useEffect, useRef } from "react"; import { useReactFlow, useStore, Node, Edge, ReactFlowState } from "@xyflow/react"; import { stratify, tree } from "d3-hierarchy"; import { timer } from "d3-timer"; +import { StepType } from "types"; const layout = tree() .nodeSize([400, 180]) @@ -67,17 +68,22 @@ function layoutNodes(nodes: Node[], edges: Edge[]): Node[] { for (const node of multiParentNodes) { const parentEdges = edgesCopy.filter((e) => e.target === node.id); const parentNodes = resultNodes.filter((n) => parentEdges.some((e) => e.source === n.id)); + const isParentNodesContainMultiPathNode = parentNodes.some( + (n) => n.data.stepType === StepType.MultiChoiceQuestion || n.data.stepType === StepType.Condition + ); if (parentNodes.length > 0) { const avgX = parentNodes.reduce((sum, parent) => sum + parent.position.x, 0) / parentNodes.length; const maxParentY = Math.max(...parentNodes.map((p) => p.position.y)); const newY = maxParentY + 180; + const multipathNewY = maxParentY + 300; + console.log(isParentNodesContainMultiPathNode); resultNodes.push({ ...node, position: { x: avgX, - y: newY, + y: isParentNodesContainMultiPathNode ? multipathNewY : newY, }, }); } else {