From 98798c8dfd4c9cfe388caf86a44e34947acb368f Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Tue, 9 Mar 2021 14:08:16 +0100 Subject: [PATCH] Fix designer to insert new activities connected between Start and existing target --- .../tree/elsa-designer-tree/elsa-designer-tree.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/designer/elsa-workflows-studio/src/components/designers/tree/elsa-designer-tree/elsa-designer-tree.tsx b/src/designer/elsa-workflows-studio/src/components/designers/tree/elsa-designer-tree/elsa-designer-tree.tsx index dda4aefc6..12bb4bd1d 100644 --- a/src/designer/elsa-workflows-studio/src/components/designers/tree/elsa-designer-tree/elsa-designer-tree.tsx +++ b/src/designer/elsa-workflows-studio/src/components/designers/tree/elsa-designer-tree/elsa-designer-tree.tsx @@ -44,7 +44,10 @@ export class ElsaWorkflowDesigner { eventBus.on(EventTypes.ActivityPicked, async args => { const activityDescriptor = (args as ActivityDescriptor); - const activityModel = this.addActivity(activityDescriptor, this.parentActivityId, null, this.parentActivityOutcome); + const connectFromRoot = !this.parentActivityOutcome || this.parentActivityOutcome == ""; + const sourceId = connectFromRoot ? null : this.parentActivityId; + const targetId = connectFromRoot ? this.parentActivityId : null; + const activityModel = this.addActivity(activityDescriptor, sourceId, targetId, this.parentActivityOutcome); if (activityDescriptor.properties.length > 0) this.showActivityEditor(activityModel, false); @@ -351,9 +354,7 @@ export class ElsaWorkflowDesigner { }; workflowModel.connections = [...connections, newConnection]; - } - else - { + } else { // Create new connection. const newConnection: ConnectionModel = { sourceId: sourceActivityId, @@ -416,7 +417,7 @@ export class ElsaWorkflowDesigner { return
  • - {isRoot ? this.renderOutcomeButton(`start-button-plus-${x.activityId}`, '', activityId, e => this.onOutcomeButtonClick(e, null, null)) : undefined} + {isRoot ? this.renderOutcomeButton(`start-button-plus-${x.activityId}`, '', activityId, e => this.onOutcomeButtonClick(e, null, activityId)) : undefined} {this.renderActivity(displayContext)} {this.renderOutcomeButtons(displayContext)}