using new bpmn-js-spiffworkflow for python scripts w/ burnettk danfunk
This commit is contained in:
parent
ed55a2ccca
commit
37fbb1c6f0
|
@ -177,11 +177,16 @@ export default function ReactDiagramEditor({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleLaunchScriptEditor(element: any) {
|
function handleLaunchScriptEditor(
|
||||||
|
element: any,
|
||||||
|
script: string,
|
||||||
|
scriptType: string,
|
||||||
|
eventBus: any
|
||||||
|
) {
|
||||||
if (onLaunchScriptEditor) {
|
if (onLaunchScriptEditor) {
|
||||||
setPerformingXmlUpdates(true);
|
setPerformingXmlUpdates(true);
|
||||||
const modeling = diagramModeler.get('modeling');
|
// const modeling = diagramModeler.get('modeling');
|
||||||
onLaunchScriptEditor(element, modeling);
|
onLaunchScriptEditor(element, script, scriptType, eventBus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,12 +204,12 @@ export default function ReactDiagramEditor({
|
||||||
|
|
||||||
setDiagramModelerState(diagramModeler);
|
setDiagramModelerState(diagramModeler);
|
||||||
|
|
||||||
diagramModeler.on('launch.script.editor', (event: any) => {
|
diagramModeler.on('script.editor.launch', (event: any) => {
|
||||||
const { error, element } = event;
|
const { error, element, scriptType, script, eventBus } = event;
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
handleLaunchScriptEditor(element);
|
handleLaunchScriptEditor(element, script, scriptType, eventBus);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 'element.hover',
|
// 'element.hover',
|
||||||
|
|
|
@ -18,7 +18,9 @@ export default function ProcessModelEditDiagram() {
|
||||||
const [showFileNameEditor, setShowFileNameEditor] = useState(false);
|
const [showFileNameEditor, setShowFileNameEditor] = useState(false);
|
||||||
const handleShowFileNameEditor = () => setShowFileNameEditor(true);
|
const handleShowFileNameEditor = () => setShowFileNameEditor(true);
|
||||||
|
|
||||||
const [scriptText, setScriptText] = useState('');
|
const [scriptText, setScriptText] = useState<string>('');
|
||||||
|
const [scriptType, setScriptType] = useState<string>('');
|
||||||
|
const [scriptEventBus, setScriptEventBus] = useState<any>(null);
|
||||||
const [scriptModeling, setScriptModeling] = useState(null);
|
const [scriptModeling, setScriptModeling] = useState(null);
|
||||||
const [scriptElement, setScriptElement] = useState(null);
|
const [scriptElement, setScriptElement] = useState(null);
|
||||||
const [showScriptEditor, setShowScriptEditor] = useState(false);
|
const [showScriptEditor, setShowScriptEditor] = useState(false);
|
||||||
|
@ -275,25 +277,38 @@ export default function ProcessModelEditDiagram() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onLaunchScriptEditor = (element: any, modeling: any) => {
|
const onLaunchScriptEditor = (
|
||||||
setScriptText(element.businessObject.script || '');
|
element: any,
|
||||||
setScriptModeling(modeling);
|
script: string,
|
||||||
|
scriptType: string,
|
||||||
|
eventBus: any
|
||||||
|
) => {
|
||||||
|
setScriptText(script || '');
|
||||||
|
setScriptType(scriptType);
|
||||||
|
setScriptEventBus(eventBus);
|
||||||
|
// setScriptModeling(modeling);
|
||||||
setScriptElement(element);
|
setScriptElement(element);
|
||||||
setScriptUnitTestElementWithIndex(0, element);
|
// setScriptUnitTestElementWithIndex(0, element);
|
||||||
handleShowScriptEditor();
|
handleShowScriptEditor();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleScriptEditorClose = () => {
|
const handleScriptEditorClose = () => {
|
||||||
|
scriptEventBus.fire('script.editor.update', {
|
||||||
|
scriptType,
|
||||||
|
script: scriptText,
|
||||||
|
element: scriptElement,
|
||||||
|
});
|
||||||
|
|
||||||
resetUnitTextResult();
|
resetUnitTextResult();
|
||||||
setShowScriptEditor(false);
|
setShowScriptEditor(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEditorScriptChange = (value: any) => {
|
const handleEditorScriptChange = (value: any) => {
|
||||||
setScriptText(value);
|
setScriptText(value);
|
||||||
(scriptModeling as any).updateProperties(scriptElement, {
|
// (scriptModeling as any).updateProperties(scriptElement, {
|
||||||
scriptFormat: 'python',
|
// scriptFormat: 'python',
|
||||||
script: value,
|
// script: value,
|
||||||
});
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEditorScriptTestUnitInputChange = (value: any) => {
|
const handleEditorScriptTestUnitInputChange = (value: any) => {
|
||||||
|
|
|
@ -144,7 +144,7 @@ export default function TaskShow() {
|
||||||
|
|
||||||
const instructionsElement = (taskToUse: any) => {
|
const instructionsElement = (taskToUse: any) => {
|
||||||
let instructions = '';
|
let instructions = '';
|
||||||
if (taskToUse.type === 'Manual Task') {
|
if (taskToUse.properties.instructionsForEndUser) {
|
||||||
instructions = taskToUse.properties.instructionsForEndUser;
|
instructions = taskToUse.properties.instructionsForEndUser;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue