diff --git a/src/designer/elsa-workflows-studio/package.json b/src/designer/elsa-workflows-studio/package.json index c1d0f6a71..bee8cf2bb 100644 --- a/src/designer/elsa-workflows-studio/package.json +++ b/src/designer/elsa-workflows-studio/package.json @@ -1,6 +1,6 @@ { "name": "@elsa-workflows/elsa-workflows-studio", - "version": "2.1.11", + "version": "2.1.12", "description": "Elsa Workflow Studio is a collection of web components to manage Elsa workflows stored on an Elsa Workflows server.", "repository": { "type": "git", 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 e6b12233f..b68558746 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 @@ -2,7 +2,7 @@ import {Component, Event, EventEmitter, h, Host, Method, Prop, State, Watch} fro import {v4 as uuid} from 'uuid'; import {addConnection, findActivity, getChildActivities, getInboundConnections, getOutboundConnections, Map, removeActivity, removeConnection} from '../../../../utils/utils'; import {ActivityDescriptor, ActivityDesignDisplayContext, ActivityModel, ActivityTraits, ConnectionModel, EventTypes, WorkflowModel, WorkflowPersistenceBehavior,} from '../../../../models'; -import {eventBus} from '../../../../services/event-bus'; +import {eventBus} from '../../../../services'; import * as d3 from 'd3'; import dagreD3 from 'dagre-d3'; import state from '../../../../utils/store'; @@ -125,15 +125,20 @@ export class ElsaWorkflowDesigner { this.activityDisplayContexts = displayContexts; } - - getActivityDisplayContext(activityModel: ActivityModel) : ActivityDesignDisplayContext{ + + getActivityDisplayContext(activityModel: ActivityModel): ActivityDesignDisplayContext { const activityDescriptors: Array = state.activityDescriptors; - const descriptor = activityDescriptors.find(x => x.type == activityModel.type); - const description = activityModel.description; + let descriptor = activityDescriptors.find(x => x.type == activityModel.type); + let descriptorExists = !!descriptor; + + if(!descriptorExists) + descriptor = this.createNotFoundActivityDescriptor(activityModel); + + const description = descriptorExists ? activityModel.description : `(Not Found) ${descriptorExists}`; const bodyText = description && description.length > 0 ? description : undefined; const bodyDisplay = bodyText ? `

${bodyText}

` : undefined; const color = (descriptor.traits &= ActivityTraits.Trigger) == ActivityTraits.Trigger ? 'rose' : 'sky'; - const displayName = activityModel.displayName; + const displayName = descriptorExists ? activityModel.displayName : `(Not Found) ${activityModel.displayName}`; const displayContext: ActivityDesignDisplayContext = { activityModel: activityModel, @@ -148,6 +153,20 @@ export class ElsaWorkflowDesigner { return displayContext; } + createNotFoundActivityDescriptor(activityModel: ActivityModel): ActivityDescriptor { + return { + outcomes: ['Done'], + inputProperties: [], + type: `(Not Found) ${activityModel.type}`, + outputProperties: [], + displayName: `(Not Found) ${activityModel.displayName || activityModel.name || activityModel.type}`, + traits: ActivityTraits.Action, + description: `(Not Found) ${activityModel.description}`, + category: 'Not Found', + browsable: false + }; + } + showActivityEditorInternal(activity: ActivityModel, animate: boolean) { eventBus.emit(EventTypes.ShowActivityEditor, this, activity, animate); } @@ -358,7 +377,7 @@ export class ElsaWorkflowDesigner { } applyInitialZoom() { - const { width: widthSvg }: { width: number } = this.svgD3Selected.node().getBBox(); + const {width: widthSvg}: { width: number } = this.svgD3Selected.node().getBBox(); const middleScreen: number = this.svgD3Selected.node().clientWidth / 2; const nodeStartTransform: string = d3.select('.node.start').attr('transform'); const nodeStartTranslateX: number = parseInt(nodeStartTransform.replace(/translate|((\)|\())/g, '').split(',')[0]); @@ -369,10 +388,10 @@ export class ElsaWorkflowDesigner { this.zoom.scaleTo(this.svgD3Selected, zoomParamsScale); this.zoom.translateTo(this.svgD3Selected, zoomParamsX, zoomParamsY); - + this.svgD3Selected - .call(this.zoom.transform, d3.zoomIdentity.scale(zoomParamsScale) - .translate(zoomParamsX, zoomParamsY)); + .call(this.zoom.transform, d3.zoomIdentity.scale(zoomParamsScale) + .translate(zoomParamsX, zoomParamsY)); this.zoomParams.initialZoom = false; } diff --git a/src/designer/elsa-workflows-studio/src/components/screens/workflow-definition-editor/elsa-workflow-definition-editor-screen/elsa-workflow-definition-editor-screen.tsx b/src/designer/elsa-workflows-studio/src/components/screens/workflow-definition-editor/elsa-workflow-definition-editor-screen/elsa-workflow-definition-editor-screen.tsx index 646315075..ca009e7e9 100644 --- a/src/designer/elsa-workflows-studio/src/components/screens/workflow-definition-editor/elsa-workflow-definition-editor-screen/elsa-workflow-definition-editor-screen.tsx +++ b/src/designer/elsa-workflows-studio/src/components/screens/workflow-definition-editor/elsa-workflow-definition-editor-screen/elsa-workflow-definition-editor-screen.tsx @@ -280,6 +280,7 @@ export class ElsaWorkflowDefinitionEditorScreen { mapActivityModel(source: ActivityDefinition): ActivityModel { const activityDescriptors: Array = state.activityDescriptors; const activityDescriptor = activityDescriptors.find(x => x.type == source.type); + const outcomes = !!activityDescriptor ? activityDescriptor.outcomes : ['Done']; return { activityId: source.activityId, @@ -288,7 +289,7 @@ export class ElsaWorkflowDefinitionEditorScreen { name: source.name, type: source.type, properties: source.properties, - outcomes: [...activityDescriptor.outcomes], + outcomes: [...outcomes], persistWorkflow: source.persistWorkflow, saveWorkflowContext: source.saveWorkflowContext, loadWorkflowContext: source.loadWorkflowContext,