Skip to content

Commit 8c19b7f

Browse files
authored
[INFRA] Update demo from 0.9.0 to 0.10.0 (#128)
1 parent 6a04b8a commit 8c19b7f

3 files changed

Lines changed: 116 additions & 1 deletion

File tree

demo/elements-identification.html

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>BPMN Visualization Non Regression</title>
6+
<link rel="shortcut icon" href="./static/img/favicon.ico">
7+
<style>
8+
#main-container {
9+
top: 140px;
10+
bottom: 10px;
11+
left: 10px;
12+
right: 10px;
13+
position: absolute;
14+
}
15+
#bpmn-container {
16+
top: 0;
17+
bottom: 0;
18+
left: 0;
19+
right: 0;
20+
21+
border-style: solid;
22+
border-color: #B0B0B0;
23+
border-width: 1px;
24+
25+
position: absolute;
26+
overflow: hidden;
27+
}
28+
29+
textarea {
30+
resize: none;
31+
height: 100px;
32+
right: 10px;
33+
position: absolute;
34+
width: 70%;
35+
}
36+
</style>
37+
</head>
38+
<body>
39+
<div id="controls">
40+
<label for="bpmn-kinds-select">Select by Kinds:</label><select id="bpmn-kinds-select">
41+
<option value="task">Abstract Task</option>
42+
<option value="userTask">User Task</option>
43+
<option value="scriptTask">Script Task</option>
44+
<option value="serviceTask">Service Task</option>
45+
<option value="startEvent">Start Event</option>
46+
<option value="endEvent">End Event</option>
47+
<option value="intermediateCatchEvent">Catch Event</option>
48+
<option value="intermediateThrowEvent">Throw Event</option>
49+
<option value="lane">Lane</option>
50+
</select>
51+
<button id="bpmn-kinds-textarea-clean-btn">Clear</button>
52+
<textarea id="elements-result"></textarea>
53+
</div>
54+
55+
<div id="main-container">
56+
<div id="bpmn-container"></div>
57+
</div>
58+
59+
<!-- load global settings -->
60+
<script src="./static/js/configureMxGraphGlobals.js"></script>
61+
<!-- load mxGraph client library -->
62+
<script src="./static/js/mxClient.min.js"></script>
63+
<!-- load app -->
64+
<script src="./static/js/elements-identification.js" type="module"></script>
65+
</body>
66+
</html>

demo/index.es.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* Copyright 2020 Bonitasoft S.A.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import { documentReady, FitType, getElementsByKinds, log, startBpmnVisualization, updateLoadOptions } from '../../index.es.js';
17+
18+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
19+
function configureControls() {
20+
const textArea = document.getElementById('elements-result');
21+
22+
document.getElementById('bpmn-kinds-select').onchange = function (ev) {
23+
const bpmnKind = ev.target.value;
24+
log(`Searching for Bpmn elements of '${bpmnKind}' kind`);
25+
const elementsByKinds = getElementsByKinds(bpmnKind);
26+
27+
const textHeader = `Found ${elementsByKinds.length} ${bpmnKind}(s)`;
28+
log(textHeader);
29+
const lines = elementsByKinds.map(elt => ` - ${elt.bpmnSemantic.id}: '${elt.bpmnSemantic.name}'`).join('\n');
30+
31+
textArea.value += [textHeader, lines].join('\n') + '\n';
32+
textArea.scrollTop = textArea.scrollHeight;
33+
};
34+
35+
document.getElementById('bpmn-kinds-textarea-clean-btn').onclick = function () {
36+
textArea.value = '';
37+
};
38+
}
39+
40+
documentReady(() => {
41+
startBpmnVisualization({
42+
container: 'bpmn-container',
43+
globalOptions: {
44+
mouseNavigationSupport: true,
45+
},
46+
});
47+
updateLoadOptions({ type: FitType.Center, margin: 20 });
48+
configureControls();
49+
});

0 commit comments

Comments
 (0)