Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions DSL/Ruuter/services/GET/services/services-detailed/nok.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ declaration:
- field: sorting
type: string
description: "Parameter 'sorting'"
- field: order
type: string
description: "Parameter 'order'"

getFaults:
call: http.post
Expand Down
5 changes: 4 additions & 1 deletion GUI/src/components/FlowElementsPopup/PreviousVariables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ const PreviousVariables: FC<PreviousVariablesProps> = ({ nodeId }) => {
setAssignedObjectTree={setAssignedObjectTree}
popupBodyCss={popupBodyCss}
border={border}
isAssignSection={true}
/>
)}

Expand Down Expand Up @@ -235,6 +236,7 @@ const VariableSection = ({
setAssignedObjectTree,
popupBodyCss,
border,
isAssignSection = false,
}: any) => {
const { t } = useTranslation();

Expand Down Expand Up @@ -280,7 +282,7 @@ const VariableSection = ({
: {
data: variable.data,
path: variable.value,
},
}
);
}}
>
Expand All @@ -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}
</OutputElementBox>
Expand Down
6 changes: 5 additions & 1 deletion GUI/src/components/OutputElementBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type OutputElementBoxProps = {
readonly onClick?: () => void;
readonly style?: CSSProperties;
readonly className?: string;
readonly isAssignElement?: boolean;
};

const OutputElementBox: FC<OutputElementBoxProps> = ({
Expand All @@ -20,6 +21,7 @@ const OutputElementBox: FC<OutputElementBoxProps> = ({
style,
className,
children,
isAssignElement = false,
}) => {
const node = useServiceStore((state) => state.selectedNode);
const mergedStyle: CSSProperties = {
Expand All @@ -36,12 +38,14 @@ const OutputElementBox: FC<OutputElementBoxProps> = ({
const handleDragStart = (event: DragEvent<HTMLDivElement>) => {
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
);
};

Expand Down
8 changes: 7 additions & 1 deletion GUI/src/hooks/flow/useLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Node>()
.nodeSize([400, 180])
Expand Down Expand Up @@ -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 {
Expand Down
Loading