From 0f683ed24aca79c088287a63152007e011fb5881 Mon Sep 17 00:00:00 2001 From: jasquat Date: Mon, 31 Oct 2022 16:58:10 -0400 Subject: [PATCH] cleaned up some frontend code and put back logic for script unit tests w/ burnettk danfunk --- .../src/components/ReactDiagramEditor.tsx | 4 ++-- .../src/routes/ProcessModelEditDiagram.tsx | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx index 0a604972b..9728e7d50 100644 --- a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx +++ b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx @@ -185,8 +185,8 @@ export default function ReactDiagramEditor({ ) { if (onLaunchScriptEditor) { setPerformingXmlUpdates(true); - // const modeling = diagramModeler.get('modeling'); - onLaunchScriptEditor(element, script, scriptType, eventBus); + const modeling = diagramModeler.get('modeling'); + onLaunchScriptEditor(element, script, scriptType, eventBus, modeling); } } diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index 53f335a29..aa1643d84 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -280,15 +280,20 @@ export default function ProcessModelEditDiagram() { const onLaunchScriptEditor = ( element: any, script: string, - scriptType: string, - eventBus: any + scriptTypeString: string, + eventBus: any, + modeling: any ) => { + // TODO: modeling is only needed for script unit tests. + // we should update this to act like updating scripts + // where we pass an event to bpmn-js + setScriptModeling(modeling); + setScriptText(script || ''); - setScriptType(scriptType); + setScriptType(scriptTypeString); setScriptEventBus(eventBus); - // setScriptModeling(modeling); setScriptElement(element); - // setScriptUnitTestElementWithIndex(0, element); + setScriptUnitTestElementWithIndex(0, element); handleShowScriptEditor(); }; @@ -305,10 +310,6 @@ export default function ProcessModelEditDiagram() { const handleEditorScriptChange = (value: any) => { setScriptText(value); - // (scriptModeling as any).updateProperties(scriptElement, { - // scriptFormat: 'python', - // script: value, - // }); }; const handleEditorScriptTestUnitInputChange = (value: any) => {