mirror of
https://github.com/sartography/bpmn-js-spiffworkflow.git
synced 2025-02-20 11:38:38 +00:00
A little more clean up of code and examples.
This commit is contained in:
parent
00c9b7638a
commit
a2824cb8ec
40
app/app.js
40
app/app.js
@ -6,13 +6,17 @@ import {
|
||||
import diagramXML from '../test/spec/bpmn/basic_message.bpmn';
|
||||
import spiffworkflow from './spiffworkflow';
|
||||
import setupFileOperations from './fileOperations';
|
||||
|
||||
const modelerEl = document.getElementById('modeler');
|
||||
const panelEl = document.getElementById('panel');
|
||||
const spiffModdleExtension = require('./spiffworkflow/moddle/spiffworkflow.json');
|
||||
|
||||
let bpmnModeler;
|
||||
|
||||
// create modeler
|
||||
/**
|
||||
* This provides an example of how to instantiate a BPMN Modeler configured with
|
||||
* all the extensions and modifications in this application.
|
||||
*/
|
||||
try {
|
||||
bpmnModeler = new BpmnModeler({
|
||||
container: modelerEl,
|
||||
@ -40,4 +44,38 @@ try {
|
||||
// import XML
|
||||
bpmnModeler.importXML(diagramXML).then(() => {});
|
||||
|
||||
/**
|
||||
* It is possible to poplulate certain components using API calls to
|
||||
* a backend. Here we mock out the API call, but this gives you
|
||||
* a sense of how things might work.
|
||||
*
|
||||
*/
|
||||
bpmnModeler.on('spiff.service_tasks.requested', (event) => {
|
||||
event.eventBus.fire('spiff.service_tasks.returned', {
|
||||
serviceTaskOperators: [
|
||||
{
|
||||
id: 'Chuck Norris Fact Service',
|
||||
parameters: [
|
||||
{
|
||||
id: 'category',
|
||||
type: 'string',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'Fact about a Number',
|
||||
parameters: [
|
||||
{
|
||||
id: 'number',
|
||||
type: 'integer',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
// This handles the download and upload buttons - it isn't specific to
|
||||
// the BPMN modeler or these extensions, just a quick way to allow you to
|
||||
// create and save files.
|
||||
setupFileOperations(bpmnModeler);
|
||||
|
@ -7,7 +7,6 @@ import FileSaver from 'file-saver';
|
||||
* easily from the editor for testing purposes.
|
||||
* -----------------------------------------
|
||||
*/
|
||||
|
||||
export default function setupFileOperations(bpmnModeler) {
|
||||
/**
|
||||
* Just a quick bit of code so we can save the XML that is output.
|
||||
@ -15,7 +14,6 @@ export default function setupFileOperations(bpmnModeler) {
|
||||
*/
|
||||
const btn = document.getElementById('downloadButton');
|
||||
btn.addEventListener('click', (_event) => {
|
||||
console.log("Button clicked!")
|
||||
saveXML();
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user