process-analytics / bpmn-visualization-js

A TypeScript library for visualizing process execution data on BPMN diagrams
https://process-analytics.github.io/bpmn-visualization-js/
Apache License 2.0
224 stars 31 forks source link

[FEAT] When the bpmn file contains more than one diagram, allow to choose the diagram to be loaded #729

Open NathalieC opened 4 years ago

NathalieC commented 4 years ago

In bpmn-visualization@0.6.0, the library displays the first BPMN Diagram found in the BPMN input source (see #510). There is currently no way to choose a specific one when the source contains several diagrams.

By configuration, the developer integrating the library (Fred) could have a possibility to identify them with information used as parameters.

In the implementation example, we should be able to show that using a BPMN file with more than 2 diagrams, Fred could use a way to identify the diagrams, pass that information to the library, and display the specific diagram. Linked to #592

API proposal: see https://github.com/process-analytics/bpmn-visualization-js/issues/729#issuecomment-1242768071

tbouffard commented 2 years ago

In https://github.com/process-analytics/bpmn-visualization-js/issues/592#issuecomment-1156515207, we proposed to use the modelFilteroption to select the diagram

bpmnVisualization.load(diagram, {
  modelFilter: {
    diagram: {
      index: 0,
      // or one of the following option
      // id: 'id1',
    },
    pools: [
      {id: 'id1'},
      {name: 'name2',},
      {id: 'id2'},
    ],
  },
});