From c19f24c1d2e0590dab2741c63168c82b5bc608a4 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Wed, 5 Oct 2022 11:39:55 +0200 Subject: [PATCH] Add setting for "can start workflow" --- .../components/shared/forms/form-entry.tsx | 15 ++++++++++++ .../components/activity-properties-editor.tsx | 24 ++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/designer/elsa-workflows-designer/src/components/shared/forms/form-entry.tsx b/src/designer/elsa-workflows-designer/src/components/shared/forms/form-entry.tsx index 0ed5f13f0..90d8b3b92 100644 --- a/src/designer/elsa-workflows-designer/src/components/shared/forms/form-entry.tsx +++ b/src/designer/elsa-workflows-designer/src/components/shared/forms/form-entry.tsx @@ -23,3 +23,18 @@ export const FormEntry: FunctionalComponent = ({label, hint, fie ); }; + +export const CheckboxFormEntry: FunctionalComponent = ({label, hint, fieldId, key, padding}, children) => { + padding ??= 'p-4'; + return ( +
+
+ {children} + +
+ +
+ ); +}; diff --git a/src/designer/elsa-workflows-designer/src/modules/workflow-definitions/components/activity-properties-editor.tsx b/src/designer/elsa-workflows-designer/src/modules/workflow-definitions/components/activity-properties-editor.tsx index c1220c2ee..c67e3545c 100644 --- a/src/designer/elsa-workflows-designer/src/modules/workflow-definitions/components/activity-properties-editor.tsx +++ b/src/designer/elsa-workflows-designer/src/modules/workflow-definitions/components/activity-properties-editor.tsx @@ -11,7 +11,7 @@ import { import {InputDriverRegistry} from "../../../services"; import {Container} from "typedi"; import {ActivityInputContext} from "../../../services/node-input-driver"; -import {FormEntry} from "../../../components/shared/forms/form-entry"; +import {CheckboxFormEntry, FormEntry} from "../../../components/shared/forms/form-entry"; import {isNullOrWhitespace} from "../../../utils"; import descriptorsStore from "../../../data/descriptors-store"; @@ -204,6 +204,23 @@ export class ActivityPropertiesEditor { }); } + private onCanStartWorkflowChanged(e: any) { + const activity: Activity = this.activity; + const inputElement = e.target as HTMLInputElement; + + activity.canStartWorkflow = inputElement.checked; + + const activityDescriptor = this.findActivityDescriptor(); + const activityId = activity.id; + + this.activityUpdated.emit({ + newId: activityId, + originalId: activityId, + activity, + activityDescriptor + }); + } + private onInputPropertyEditorChanged = (inputDescriptor: InputDescriptor, propertyValue: any, syntax: string) => { const activity = this.activity; const activityId = activity.id; @@ -259,6 +276,7 @@ export class ActivityPropertiesEditor { const {activity,} = this.renderContext; const activityId = activity.id; const displayText: string = activity.metadata?.displayText ?? ''; + const canStartWorkflow: boolean = activity.canStartWorkflow; const key = `${activityId}`; return
@@ -270,6 +288,10 @@ export class ActivityPropertiesEditor { this.onActivityDisplayTextChanged(e)}/> + + this.onCanStartWorkflowChanged(e)}/> + +
};