Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
assynour committed Oct 4, 2022
2 parents f2d4da3 + e4a71d1 commit 1b1d641
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
.idea
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# bpmn-visualization 'getting started' tutorial

A getting started demo that uses bpmn-visualization library to visualize runtime monitoring data.

## Content

The following visualization is used:

**Overlays on activities:**
Expand Down Expand Up @@ -48,3 +52,13 @@ means that there are currently running instances.

**Edges width**
shows the frequency of visit according to a predefined frequency indicator of incoming instances per month

## How to Run

Run
```bash
npm install
npm start
```

Open the URL mentioned in the console
18 changes: 9 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BpmnVisualization, ShapeUtil, FlowKind } from "bpmn-visualization";

// BPMN diagram content conveniently retrieved with parcel (as string)
// BPMN diagram content conveniently retrieved with Vite (as string)
// for other load methods, see https://github.com/process-analytics/bpmn-visualization-examples
import diagram from "./diagram.bpmn?raw";
import "./styles.css";
Expand All @@ -15,26 +15,26 @@ const footer = document.querySelector("footer");
const version = bpmnVisualization.getVersion();
footer.innerText = `bpmn-visualization@${version.lib}`;

//load and filter a pool
// load and filter a pool
bpmnVisualization.load(diagram, {
fit: { type: "Center" },
modelFilter: {
pools: [
{
// id of the Participant related to the Pool to display
// name of the Participant related to the Pool to display
name: "Process Engine - Invoice Receipt"
}
]
}
});

//add CSS classes to show running instances
// add CSS classes to show running instances
let activitiesMonitoringData = getActivitiesMonitoringData();
let edgesWaitingInstances = getEdgesWaitingInstances();

// Add Overlay on activities
activitiesMonitoringData.forEach((value, key) => {
//running on time
// running on time
if (value[0] !== 0) {
bpmnVisualization.bpmnElementsRegistry.addOverlays(key, {
position: "top-center",
Expand All @@ -46,7 +46,7 @@ activitiesMonitoringData.forEach((value, key) => {
}
});
}
//running late with risky level
// running late with risky level
if (value[1] !== 0) {
bpmnVisualization.bpmnElementsRegistry.addOverlays(key, {
position: "top-left",
Expand All @@ -58,7 +58,7 @@ activitiesMonitoringData.forEach((value, key) => {
}
});
}
//running late with critical level
// running late with critical level
if (value[2] !== 0) {
bpmnVisualization.bpmnElementsRegistry.addOverlays(key, {
position: "top-right",
Expand Down Expand Up @@ -102,7 +102,7 @@ edgesWaitingInstances.forEach((value, key) => {
});

/**
* @param {Map<String, list>} activitiesMonitoringData
* @returns {Map<string, Array<number>>} key: BPMN element id / value: monitoring data
*/
function getActivitiesMonitoringData() {
let activitiesMonitoringData = new Map();
Expand All @@ -115,7 +115,7 @@ function getActivitiesMonitoringData() {
}

/**
* @param {Map<String, Integer>} edgesWaitingInstances
* @returns {Map<string, number>} key: BPMN element id / value: number of instances
*/
function getEdgesWaitingInstances() {
let edgesWaitingInstances = new Map();
Expand Down

0 comments on commit 1b1d641

Please sign in to comment.