Giter VIP home page Giter VIP logo

execution-platform's Introduction

As of v0.3.0, this package has been renamed from @bpmn-io/execution-platform to @camunda/execution-platform. Read more on the changes in the issue.

@camunda/execution-platform

CI

Set executionPlatform and executionPlatformVersion in your BPMN and DMN diagrams.

Usage

bpmn-js

import BpmnModeler from 'bpmn-js/lib/Modeler';

import ExecutionPlatformModule from '@camunda/execution-platform';
import ModelerModdleExtension from 'modeler-moddle/resources/modeler.json';


// extend the BPMN editor with the module and moddle extension
var modeler = new BpmnModeler({
  additionalModules: [
    ExecutionPlatformModule
  ],
  moddleExtensions: {
    modeler: ModelerModdleExtension
  }
});

var executionPlatformHelper = modeler.get('executionPlatform');

executionPlatformHelper.setExecutionPlatform({ name: 'Camunda Cloud', version: '1.3.0' });

var executionPlatform = executionPlatformHelper.getExecutionPlatform();

// { name: 'Camunda Cloud', version: '1.3.0' }
console.log(executionPlatform);

// see the meta-data appear on save
modeler.saveXML(function(err, xml) {

  xml; // ... <bpmn:Definitions ... modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="1.3.0">...
});

You can also configure the extension so that the execution platform details are set imperatively each time you save the diagram:

import BpmnModeler from 'bpmn-js/lib/Modeler';

import ExecutionPlatformModule from '@camunda/execution-platform';
import ModelerModdleExtension from 'modeler-moddle/resources/modeler.json';

// extend the BPMN editor with the module and moddle extension together with configuration
var modeler = new BpmnModeler({
  additionalModules: [
    ExecutionPlatformModule
  ],
  moddleExtensions: {
    modeler: ModelerModdleExtension
  },
  executionPlatform: {
    name: 'Camunda Cloud',
    version: '1.3.0'
  }
});

// see the meta-data appear on save
modeler.saveXML(function(err, xml) {

  xml; // ... <bpmn:Definitions ... modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="1.3.0">...
});

dmn-js

import DmnModeler from 'dmn-js/lib/Modeler';

import ExecutionPlatformModule from '@camunda/execution-platform';
import ModelerModdleExtension from 'modeler-moddle/resources/dmn-modeler.json';


// extend the DMN editor with the module and moddle extension
var modeler = new DmnModeler({
  drd: {
    additionalModules: [
      ExecutionPlatformModule
    ]
  },
  decisionTable: {
    additionalModules: [
      ExecutionPlatformModule
    ]
  },
  literalExpression: {
    additionalModules: [
      ExecutionPlatformModule
    ]
  },
  moddleExtensions: {
    modeler: ModelerModdleExtension
  }
});

var executionPlatformHelper = modeler.getActiveViewer().get('executionPlatform');

executionPlatformHelper.setExecutionPlatform({ name: 'Camunda Cloud', version: '1.3.0' });

var executionPlatform = executionPlatformHelper.getExecutionPlatform();

// { name: 'Camunda Cloud', version: '1.3.0' }
console.log(executionPlatform);

// see the meta-data appear on save
modeler.saveXML(function(err, xml) {

  xml; // ... <dmn:Definitions ... modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="1.3.0">...
});

You can also configure the extension so that the execution platform details are set imperatively each time you save the diagram:

import DmnModeler from 'dmn-js/lib/Modeler';

import ExecutionPlatformModule from '@camunda/execution-platform';
import ModelerModdleExtension from 'modeler-moddle/resources/dmn-modeler.json';

// extend the DMN editor with the module and moddle extension together with configuration
var modeler = new DmnModeler({
  drd: {
    additionalModules: [
      ExecutionPlatformModule
    ]
  },
  decisionTable: {
    additionalModules: [
      ExecutionPlatformModule
    ]
  },
  literalExpression: {
    additionalModules: [
      ExecutionPlatformModule
    ]
  },
  moddleExtensions: {
    modeler: ModelerModdleExtension
  },
  executionPlatform: {
    name: 'Camunda Cloud',
    version: '1.3.0'
  }
});

// see the meta-data appear on save
modeler.saveXML(function(err, xml) {

  xml; // ... <dmn:Definitions ... modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="1.3.0">...
});

License

MIT

execution-platform's People

Contributors

barmac avatar nithinssabu avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

execution-platform's Issues

Move to camunda org

What should we do?

  • Move package to camunda GitHub organization
  • Move npm package under @camunda scope

Why should we do it?

Execution platform is strictly Camunda-related.

Module crashes in production

Result after clicking on the create C7/C8 DMN button from welcome tab:

Screen Shot 2022-03-31 at 18 16 54

Log message

[diagram_1.dmn] No provider for "e"! (Resolving: executionPlatform -> updateExecutionPlatformCommand -> e)
    at a (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:112:11)
    at error (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:98:14)
    at get (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:152:18)
    at file:///Applications/Camunda%20Modeler%20DMN%20Version%20Select.app/Contents/Resources/app.asar/public/3.3.js:1:38603
    at Array.map (<anonymous>)
    at map (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:170:30)
    at fnDef (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:185:14)
    at providers (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:146:43)
    at file:///Applications/Camunda%20Modeler%20DMN%20Version%20Select.app/Contents/Resources/app.asar/public/3.3.js:1:56365
    at Array.forEach (<anonymous>) [ error ]
This error may be the result of a plug-in compatibility issue. [ info ]
[Disable plug-ins (restarts the app)](https://github.com/camunda/camunda-modeler/pull/2877#) [ info ]
[diagram_1.dmn] No provider for "e"! (Resolving: executionPlatform -> updateExecutionPlatformCommand -> e)
    at a (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:112:11)
    at error (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:98:14)
    at get (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:152:18)
    at file:///Applications/Camunda%20Modeler%20DMN%20Version%20Select.app/Contents/Resources/app.asar/public/3.3.js:1:38603
    at Array.map (<anonymous>)
    at map (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:170:30)
    at fnDef (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:185:14)
    at providers (webpack:///node_modules/diagram-js/node_modules/didi/dist/index.esm.js:146:43)
    at file:///Applications/Camunda%20Modeler%20DMN%20Version%20Select.app/Contents/Resources/app.asar/public/3.3.js:1:56365
    at Array.forEach (<anonymous>) [ error ]
This error may be the result of a plug-in compatibility issue. [ info ]
[Disable plug-ins (restarts the app)](https://github.com/camunda/camunda-modeler/pull/2877#) [ info ]

Originally posted by @andreasgeier in camunda/camunda-modeler#2877 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.