function getArrow()

in karavan-designer/src/designer/route/DslConnections.tsx [390:481]


    function getArrow(pos: DslPosition): JSX.Element[] {
        const list: JSX.Element[] = [];

        if (pos.parent && pos.parent.dslName === 'TryDefinition' && pos.position === 0) {
            const parent = steps.get(pos.parent.uuid);
            list.push(...addArrowToList(list, parent, pos, true, false))
        } else if (pos.parent && ['RouteConfigurationDefinition', 'MulticastDefinition', 'LoadBalanceDefinition'].includes(pos.parent.dslName)) {
            const parent = steps.get(pos.parent.uuid);
            list.push(...addArrowToList(list, parent, pos, true, false))
            if (parent?.nextstep) {
                const to = steps.get(parent.nextstep.uuid);
                list.push(...addArrowToList(list, pos, to, true, true))
            }
        } else if (pos.parent && pos.parent.dslName === 'ChoiceDefinition') {
            const parent = steps.get(pos.parent.uuid);
            list.push(...addArrowToList(list, parent, pos, true, false))
        } else if (pos.parent && ['WhenDefinition', 'OtherwiseDefinition', 'CatchDefinition', 'FinallyDefinition', 'TryDefinition'].includes(pos.parent.dslName)) {
            if (pos.position === 0) {
                const parent = steps.get(pos.parent.uuid);
                list.push(...addArrowToList(list, parent, pos, true, false))
            }
            if (pos.position === (pos.inStepsLength - 1) && !isSpecial(pos)) {
                const nextElement = getNext(pos);
                const parentDsl1 = getParentDsl(nextElement?.uuid);
                if (parentDsl1 && ['RouteConfigurationDefinition', 'MulticastDefinition', 'LoadBalanceDefinition'].includes(parentDsl1)) {
                    // do nothing
                } else if (nextElement) {
                    const next = steps.get(nextElement.uuid);
                    list.push(...addArrowToList(list, pos, next, true, true))
                }
            }
        } else if (pos.step && !isSpecial(pos)) {
            if (pos.nextstep) {
                const next = steps.get(pos.nextstep.uuid);
                const fromHeader = !pos.step.hasSteps();
                list.push(...addArrowToList(list, pos, next, fromHeader, true))
            }
            if (pos.step.hasSteps() && (pos.step as any).steps.length > 0) {
                const firstStep = (pos.step as any).steps[0];
                const next = steps.get(firstStep.uuid);
                list.push(...addArrowToList(list, pos, next, true, true))
            }
        }

        if (['WhenDefinition', 'OtherwiseDefinition'].includes(pos.step.dslName) && pos.step.hasSteps() && (pos.step as any).steps.length === 0) {
            const parentDsl = getParentDsl(pos?.nextstep?.uuid);
            if (parentDsl && ['RouteConfigurationDefinition', 'MulticastDefinition', 'LoadBalanceDefinition'].includes(parentDsl)) {
                // do nothing
            } else if (pos.nextstep) {
                const to = steps.get(pos.nextstep.uuid);
                list.push(...addArrowToList(list, pos, to, true, true))
            } else {
                const next = getNext(pos);
                const parentDsl1 = getParentDsl(next?.uuid);
                if (parentDsl1 && ['RouteConfigurationDefinition', 'MulticastDefinition', 'LoadBalanceDefinition'].includes(parentDsl1)) {
                    // do nothing
                } else if (next) {
                    const to = steps.get(next.uuid);
                    list.push(...addArrowToList(list, pos, to, true, true))
                }
            }
        }

        if (pos.parent?.dslName === 'TryDefinition' && pos.inSteps && pos.position === (pos.inStepsLength - 1)) {
            const parent = steps.get(pos.parent.uuid);
            if (parent && parent.nextstep) {
                const to = steps.get(parent.nextstep.uuid);
                list.push(...addArrowToList(list, pos, to, true, true))
            }
        }

        if (!isSpecial(pos) && pos.inSteps && pos.nextstep && (pos.parent?.dslName &&
            !['MulticastDefinition', 'LoadBalanceDefinition'].includes(pos.parent?.dslName))) {
            const next = steps.get(pos.nextstep.uuid);
            if (pos.step.hasSteps() && pos.prevStep) {
            } else {
                list.push(...addArrowToList(list, pos, next, true, true))
            }
        }

        if (!isSpecial(pos) && pos.inSteps && pos.nextstep && (pos.parent?.dslName &&
            !['MulticastDefinition', 'LoadBalanceDefinition'].includes(pos.parent?.dslName))) {
            const next = steps.get(pos.nextstep.uuid);
            if (next && !isSpecial(next) && next.inSteps) {
                // console.log(pos)
                // const to = steps.get(parent.nextstep.uuid);
                // list.push(...addArrowToList(list, pos, to, true, true))
            }
        }

        return list;
    }