@valtimo/analyse 4.15.3-next-main.16 → 4.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,383 +1,417 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@valtimo/security'), require('@valtimo/contract'), require('@valtimo/process'), require('@valtimo/components'), require('bpmn-js/dist/bpmn-navigated-viewer.production.min.js'), require('heatmap.js-fixed/build/heatmap.js')) :
3
- typeof define === 'function' && define.amd ? define('@valtimo/analyse', ['exports', '@angular/core', '@angular/common', '@angular/router', '@valtimo/security', '@valtimo/contract', '@valtimo/process', '@valtimo/components', 'bpmn-js/dist/bpmn-navigated-viewer.production.min.js', 'heatmap.js-fixed/build/heatmap.js'], factory) :
4
- (global = global || self, factory((global.valtimo = global.valtimo || {}, global.valtimo.analyse = {}), global.ng.core, global.ng.common, global.ng.router, global.security, global.contract, global.process, global.components, global.BpmnJS, global.heatmap));
5
- }(this, (function (exports, core, common, router, security, contract, process, components, BpmnJS, heatmap) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@valtimo/security'), require('@valtimo/config'), require('@valtimo/process'), require('@valtimo/components'), require('bpmn-js/dist/bpmn-navigated-viewer.production.min.js'), require('heatmap.js-fixed/build/heatmap.js')) :
3
+ typeof define === 'function' && define.amd ? define('@valtimo/analyse', ['exports', '@angular/core', '@angular/common', '@angular/router', '@valtimo/security', '@valtimo/config', '@valtimo/process', '@valtimo/components', 'bpmn-js/dist/bpmn-navigated-viewer.production.min.js', 'heatmap.js-fixed/build/heatmap.js'], factory) :
4
+ (global = global || self, factory((global.valtimo = global.valtimo || {}, global.valtimo.analyse = {}), global.ng.core, global.ng.common, global.ng.router, global.security, global.config, global.process, global.components, global.BpmnJS, global.heatmap));
5
+ }(this, (function (exports, core, common, router, security, config, process, components, BpmnJS, heatmap) { 'use strict';
6
6
 
7
- /*
8
- * Copyright 2015-2020 Ritense BV, the Netherlands.
9
- *
10
- * Licensed under EUPL, Version 1.2 (the "License");
11
- * you may not use this file except in compliance with the License.
12
- * You may obtain a copy of the License at
13
- *
14
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" basis,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- var AnalyseComponent = /** @class */ (function () {
23
- function AnalyseComponent() {
24
- }
25
- AnalyseComponent.prototype.ngOnInit = function () { };
26
- return AnalyseComponent;
27
- }());
28
- AnalyseComponent.decorators = [
29
- { type: core.Component, args: [{
30
- selector: 'valtimo-analyse',
31
- template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content\">\n <div class=\"container-fluid\">\n <valtimo-analyse-process-diagram></valtimo-analyse-process-diagram>\n </div>\n</div>\n",
32
- styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"]
33
- },] }
34
- ];
7
+ /*
8
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
9
+ *
10
+ * Licensed under EUPL, Version 1.2 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" basis,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ var AnalyseComponent = /** @class */ (function () {
23
+ function AnalyseComponent() {
24
+ }
25
+ AnalyseComponent.prototype.ngOnInit = function () { };
26
+ return AnalyseComponent;
27
+ }());
28
+ AnalyseComponent.decorators = [
29
+ { type: core.Component, args: [{
30
+ selector: 'valtimo-analyse',
31
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content\">\n <div class=\"container-fluid\">\n <valtimo-analyse-process-diagram></valtimo-analyse-process-diagram>\n </div>\n</div>\n",
32
+ styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"]
33
+ },] }
34
+ ];
35
35
  AnalyseComponent.ctorParameters = function () { return []; };
36
36
 
37
- /*
38
- * Copyright 2015-2020 Ritense BV, the Netherlands.
39
- *
40
- * Licensed under EUPL, Version 1.2 (the "License");
41
- * you may not use this file except in compliance with the License.
42
- * You may obtain a copy of the License at
43
- *
44
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
45
- *
46
- * Unless required by applicable law or agreed to in writing, software
47
- * distributed under the License is distributed on an "AS IS" basis,
48
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
49
- * See the License for the specific language governing permissions and
50
- * limitations under the License.
51
- */
52
- var ɵ0 = { title: 'Analysis', roles: [contract.ROLE_USER] };
53
- var routes = [
54
- {
55
- path: 'analysis',
56
- component: AnalyseComponent,
57
- canActivate: [security.AuthGuardService],
58
- data: ɵ0,
59
- },
60
- ];
61
- var AnalyseRoutingModule = /** @class */ (function () {
62
- function AnalyseRoutingModule() {
63
- }
64
- return AnalyseRoutingModule;
65
- }());
66
- AnalyseRoutingModule.decorators = [
67
- { type: core.NgModule, args: [{
68
- declarations: [],
69
- imports: [common.CommonModule, router.RouterModule.forChild(routes)],
70
- exports: [router.RouterModule],
71
- },] }
37
+ /*
38
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
39
+ *
40
+ * Licensed under EUPL, Version 1.2 (the "License");
41
+ * you may not use this file except in compliance with the License.
42
+ * You may obtain a copy of the License at
43
+ *
44
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
45
+ *
46
+ * Unless required by applicable law or agreed to in writing, software
47
+ * distributed under the License is distributed on an "AS IS" basis,
48
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
49
+ * See the License for the specific language governing permissions and
50
+ * limitations under the License.
51
+ */
52
+ var ɵ0 = { title: 'Analysis', roles: [config.ROLE_USER] };
53
+ var routes = [
54
+ {
55
+ path: 'analysis',
56
+ component: AnalyseComponent,
57
+ canActivate: [security.AuthGuardService],
58
+ data: ɵ0,
59
+ },
60
+ ];
61
+ var AnalyseRoutingModule = /** @class */ (function () {
62
+ function AnalyseRoutingModule() {
63
+ }
64
+ return AnalyseRoutingModule;
65
+ }());
66
+ AnalyseRoutingModule.decorators = [
67
+ { type: core.NgModule, args: [{
68
+ declarations: [],
69
+ imports: [common.CommonModule, router.RouterModule.forChild(routes)],
70
+ exports: [router.RouterModule],
71
+ },] }
72
72
  ];
73
73
 
74
- /*
75
- * Copyright 2015-2020 Ritense BV, the Netherlands.
76
- *
77
- * Licensed under EUPL, Version 1.2 (the "License");
78
- * you may not use this file except in compliance with the License.
79
- * You may obtain a copy of the License at
80
- *
81
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
82
- *
83
- * Unless required by applicable law or agreed to in writing, software
84
- * distributed under the License is distributed on an "AS IS" basis,
85
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
86
- * See the License for the specific language governing permissions and
87
- * limitations under the License.
88
- */
89
- var AnalyseProcessDiagramComponent = /** @class */ (function () {
90
- function AnalyseProcessDiagramComponent(processService) {
91
- this.processService = processService;
92
- this.importDone = new core.EventEmitter();
93
- this.enumHeatmapOptions = ['count', 'duration'];
94
- this.initialized = false;
95
- }
96
- AnalyseProcessDiagramComponent.prototype.ngOnInit = function () {
97
- var _this = this;
98
- this.processService
99
- .getProcessDefinitions()
100
- .subscribe(function (processDefinitions) {
101
- _this.processDefinitions = processDefinitions;
102
- if (!_this.processDefinitionKey && processDefinitions.length !== 0) {
103
- _this.processDefinitionKey = processDefinitions[0].key;
104
- _this.loadProcessDefinitionFromKey(_this.processDefinitionKey);
105
- }
106
- });
107
- this.createBpmnViewerInstance();
108
- };
109
- AnalyseProcessDiagramComponent.prototype.createBpmnViewerInstance = function () {
110
- var _this = this;
111
- this.bpmnJS = new BpmnJS();
112
- this.bpmnJS.on('import.done', function (_a) {
113
- var error = _a.error;
114
- if (!error && !_this.initialized) {
115
- var canvas_1 = _this.bpmnJS.get('canvas'), eventBus = _this.bpmnJS.get('eventBus');
116
- if (_this.processDiagram.historicActivityInstances) {
117
- _this.processDiagram.historicActivityInstances.forEach(function (instance) {
118
- if (instance.activityType !== 'multiInstanceBody') {
119
- canvas_1.addMarker(instance.activityId, instance.endTime ? 'highlight-overlay-past' : 'highlight-overlay-current');
120
- }
121
- });
122
- }
123
- canvas_1.zoom('fit-viewport', 'auto');
124
- if (_this.processDefinitionVersions) {
125
- eventBus.on('canvas.init', function () {
126
- if (_this.showHeatmap) {
127
- _this.clearHeatmap();
128
- }
129
- _this.loadHeatmapData();
130
- });
131
- eventBus.on('canvas.viewbox.changing', function () {
132
- if (_this.showHeatmap) {
133
- _this.clearHeatmap();
134
- }
135
- });
136
- eventBus.on('canvas.viewbox.changed', function () {
137
- _this.loadHeatmapData();
138
- });
139
- }
140
- _this.initialized = true;
141
- }
142
- _this.clearHeatmap();
143
- if (_this.showHeatmap) {
144
- _this.loadHeatmapData();
145
- }
146
- });
147
- };
148
- AnalyseProcessDiagramComponent.prototype.ngOnDestroy = function () {
149
- if (this.bpmnJS) {
150
- this.bpmnJS.destroy();
151
- }
152
- };
153
- AnalyseProcessDiagramComponent.prototype.loadProcessDefinition = function (processDefinitionKey) {
154
- var _this = this;
155
- this.processService
156
- .getProcessDefinition(processDefinitionKey)
157
- .subscribe(function (processDefinition) {
158
- _this.heatmapOption = _this.enumHeatmapOptions[0];
159
- _this.version = processDefinition.version;
160
- _this.loadProcessDefinitionXml(processDefinition.id);
161
- });
162
- };
163
- AnalyseProcessDiagramComponent.prototype.loadProcessDefinitionVersions = function (processDefinitionKey) {
164
- var _this = this;
165
- this.processService
166
- .getProcessDefinitionVersions(processDefinitionKey)
167
- .subscribe(function (processDefinitionVersions) {
168
- _this.processDefinitionVersions = processDefinitionVersions;
169
- });
170
- };
171
- AnalyseProcessDiagramComponent.prototype.loadProcessDefinitionFromKey = function (processDefinitionKey) {
172
- this.loadProcessDefinitionVersions(processDefinitionKey);
173
- this.loadProcessDefinition(processDefinitionKey);
174
- };
175
- AnalyseProcessDiagramComponent.prototype.loadProcessDefinitionXml = function (processDefinitionId) {
176
- var _this = this;
177
- this.processService.getProcessDefinitionXml(processDefinitionId).subscribe(function (response) {
178
- _this.processDiagram = response;
179
- _this.bpmnJS.importXML(_this.processDiagram.bpmn20Xml);
180
- _this.bpmnJS.attachTo(_this.el.nativeElement);
181
- });
182
- };
183
- AnalyseProcessDiagramComponent.prototype.loadProcessDefinitionHeatmapCount = function (processDefinition) {
184
- var _this = this;
185
- this.processService.getProcessHeatmapCount(processDefinition).subscribe(function (response) {
186
- _this.inputData = response;
187
- _this.valueKey = 'totalCount';
188
- _this.heatPoints = { data: [] };
189
- _this.min = 0;
190
- _this.max = 0;
191
- Object.keys(_this.inputData).forEach(function (key) {
192
- var diagramContainer = _this.el.nativeElement.querySelector('svg').getBoundingClientRect(), diagramElm = _this.el.nativeElement
193
- .querySelector("g[data-element-id=" + key + "]")
194
- .getBoundingClientRect();
195
- _this.setMax(key);
196
- _this.heatPoints.data.push({
197
- x: Math.round(diagramElm.x - diagramContainer.x + diagramElm.width / 2),
198
- y: Math.round(diagramElm.y - diagramContainer.y + diagramElm.height / 2),
199
- value: _this.inputData[key][_this.valueKey],
200
- radius: diagramElm.width / 2,
201
- });
202
- _this.addCounterActiveOverlays(key, _this.inputData);
203
- });
204
- _this.clearHeatmap();
205
- if (_this.showHeatmap) {
206
- _this.loadHeatmap();
207
- }
208
- });
209
- };
210
- AnalyseProcessDiagramComponent.prototype.onWindowResize = function () {
211
- var oldCanvas = this.el.nativeElement.querySelector('canvas[class=heatmap-canvas]');
212
- if (oldCanvas) {
213
- oldCanvas.remove();
214
- this.heatMapInstance = null;
215
- }
216
- if (this.showHeatmap) {
217
- this.loadHeatmap();
218
- }
219
- };
220
- AnalyseProcessDiagramComponent.prototype.loadProcessDefinitionHeatmapDuration = function (processDefinition) {
221
- var _this = this;
222
- this.processService.getProcessHeatmapDuration(processDefinition).subscribe(function (response) {
223
- _this.inputData = response;
224
- _this.valueKey = 'averageDurationInMilliseconds';
225
- _this.heatPoints = { data: [] };
226
- _this.min = 0;
227
- _this.max = 0;
228
- Object.keys(_this.inputData).forEach(function (key) {
229
- var diagramContainer = _this.el.nativeElement.querySelector('svg').getBoundingClientRect(), diagramElm = _this.el.nativeElement
230
- .querySelector("g[data-element-id=" + key + "]")
231
- .getBoundingClientRect();
232
- _this.setMax(key);
233
- _this.heatPoints.data.push({
234
- x: Math.round(diagramElm.x - diagramContainer.x + diagramElm.width / 2),
235
- y: Math.round(diagramElm.y - diagramContainer.y + diagramElm.height / 2),
236
- value: _this.inputData[key][_this.valueKey],
237
- radius: diagramElm.width / 2,
238
- });
239
- _this.addCounterActiveOverlays(key, _this.inputData);
240
- });
241
- _this.clearHeatmap();
242
- if (_this.showHeatmap) {
243
- _this.loadHeatmap();
244
- }
245
- });
246
- };
247
- AnalyseProcessDiagramComponent.prototype.setProcessDefinitionKey = function (processDefinitionKey) {
248
- this.processDefinitionKey = processDefinitionKey;
249
- this.loadProcessDefinitionFromKey(this.processDefinitionKey);
250
- };
251
- AnalyseProcessDiagramComponent.prototype.setProcessDefinitionVersion = function (version) {
252
- this.version = +version;
253
- this.loadHeatmapData();
254
- };
255
- AnalyseProcessDiagramComponent.prototype.setHeatmapOption = function (heatmapOption) {
256
- this.heatmapOption = heatmapOption;
257
- this.loadHeatmapData();
258
- };
259
- AnalyseProcessDiagramComponent.prototype.toggleShowHeatmap = function () {
260
- this.showHeatmap = !this.showHeatmap;
261
- this.loadHeatmapData();
262
- };
263
- AnalyseProcessDiagramComponent.prototype.loadHeatmap = function () {
264
- if (!this.heatMapInstance) {
265
- this.heatMapInstance = heatmap.create({
266
- radius: 54,
267
- blur: 0.7,
268
- maxOpacity: 0.4,
269
- minOpacity: 0,
270
- container: this.el.nativeElement,
271
- });
272
- var heatmapCanvas = this.el.nativeElement.querySelector('canvas[class=heatmap-canvas]');
273
- heatmapCanvas.style.zIndex = 1;
274
- }
275
- this.heatMapInstance.setData({
276
- min: this.min,
277
- max: this.max,
278
- data: this.heatPoints.data,
279
- });
280
- };
281
- AnalyseProcessDiagramComponent.prototype.clearHeatmap = function () {
282
- if (this.heatMapInstance) {
283
- this.heatMapInstance.setData({ data: [] });
284
- }
285
- };
286
- AnalyseProcessDiagramComponent.prototype.loadHeatmapData = function () {
287
- var _this = this;
288
- this.processDefinition = this.processDefinitionVersions.find(function (definition) { return definition.version === _this.version; });
289
- if (this.heatmapOption === 'count') {
290
- this.loadProcessDefinitionHeatmapCount(this.processDefinition);
291
- }
292
- if (this.heatmapOption === 'duration') {
293
- this.loadProcessDefinitionHeatmapDuration(this.processDefinition);
294
- }
295
- };
296
- AnalyseProcessDiagramComponent.prototype.setMax = function (key) {
297
- if (this.valueKey === 'averageDurationInMilliseconds') {
298
- this.max = Math.max(this.inputData[key].averageDurationInMilliseconds, this.max);
299
- }
300
- else if (this.valueKey === 'totalCount') {
301
- this.max = Math.max(this.inputData[key].totalCount + this.inputData[key].count, this.max);
302
- }
303
- };
304
- AnalyseProcessDiagramComponent.prototype.addCounterActiveOverlays = function (key, inputData) {
305
- var overlays = this.bpmnJS.get('overlays');
306
- overlays.add(key, {
307
- position: {
308
- bottom: 13,
309
- left: -12,
310
- },
311
- show: {
312
- minZoom: 0,
313
- maxZoom: 5.0,
314
- },
315
- html: "<span class=\"badge badge-pill badge-primary\">" + inputData[key].count + "</span>",
316
- });
317
- };
318
- return AnalyseProcessDiagramComponent;
319
- }());
320
- AnalyseProcessDiagramComponent.decorators = [
321
- { type: core.Component, args: [{
322
- selector: 'valtimo-analyse-process-diagram',
323
- template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"container-fluid\">\n <div class=\"row p-4 bg-light options\">\n <div class=\"col-sm-3\">\n <label><strong>Process</strong></label\n ><br />\n <select class=\"form-control\" (change)=\"setProcessDefinitionKey($event.target.value)\">\n <option\n *ngFor=\"let processDefinition of processDefinitions\"\n [value]=\"processDefinition.key\"\n [selected]=\"processDefinitionKey === processDefinition.key\"\n >\n {{ processDefinition.name }}\n </option>\n </select>\n </div>\n <div class=\"col-sm-1\">\n <label><strong>Version</strong></label\n ><br />\n <select class=\"form-control\" (change)=\"setProcessDefinitionVersion($event.target.value)\">\n <option\n *ngFor=\"let processDefinitionVersion of processDefinitionVersions\"\n [value]=\"processDefinitionVersion.version\"\n [selected]=\"processDefinitionVersion.version === version\"\n >\n {{ processDefinitionVersion.version }}\n </option>\n </select>\n </div>\n <div class=\"col-sm-3\" *ngIf=\"showHeatmap\">\n <label><strong>Heatmap type</strong></label\n ><br />\n <select class=\"form-control w-sm-50\" (change)=\"setHeatmapOption($event.target.value)\">\n <option\n *ngFor=\"let option of enumHeatmapOptions\"\n [value]=\"option\"\n [selected]=\"option === heatmapOption\"\n >\n {{ option | titlecase }}\n </option>\n </select>\n </div>\n <div\n class=\"text-sm-right col-sm-3\"\n [ngClass]=\"{'offset-sm-2': showHeatmap, 'offset-sm-5': !showHeatmap}\"\n >\n <label><strong>Show heatmap</strong></label\n ><br />\n <div class=\"text-left switch-button switch-button-sm switch-button-success\">\n <input\n type=\"checkbox\"\n id=\"toggleHeatmap\"\n [checked]=\"showHeatmap\"\n (click)=\"toggleShowHeatmap()\"\n /><span> <label for=\"toggleHeatmap\"></label></span>\n </div>\n </div>\n </div>\n <div class=\"row p-4 bg-white\">\n <div class=\"col\">\n <div #ref (window:resize)=\"onWindowResize()\" class=\"diagram-container\"></div>\n </div>\n </div>\n</div>\n\n<div class=\"p-4 text-center legenda-holder\">\n <span\n ><span class=\"badge badge-pill badge-primary\">N</span>&nbsp;&nbsp;Amount of currently active\n instances of this task.</span\n >\n <span\n >&nbsp;&nbsp;|&nbsp;&nbsp;Red/yellow/green orbs: The amount of times the task is executed in\n comparison to the other tasks.</span\n >\n</div>\n",
324
- styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.diagram-container-switch-holder{width:100%;z-index:1000}.diagram-container{height:58vh}.container-fluid{border:1px solid #dee2e6}.options{border-bottom:1px solid #dee2e6}"]
325
- },] }
326
- ];
327
- AnalyseProcessDiagramComponent.ctorParameters = function () { return [
328
- { type: process.ProcessService }
329
- ]; };
330
- AnalyseProcessDiagramComponent.propDecorators = {
331
- el: [{ type: core.ViewChild, args: ['ref',] }],
332
- importDone: [{ type: core.Output }]
74
+ /*
75
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
76
+ *
77
+ * Licensed under EUPL, Version 1.2 (the "License");
78
+ * you may not use this file except in compliance with the License.
79
+ * You may obtain a copy of the License at
80
+ *
81
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
82
+ *
83
+ * Unless required by applicable law or agreed to in writing, software
84
+ * distributed under the License is distributed on an "AS IS" basis,
85
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
86
+ * See the License for the specific language governing permissions and
87
+ * limitations under the License.
88
+ */
89
+ var AnalyseProcessDiagramComponent = /** @class */ (function () {
90
+ function AnalyseProcessDiagramComponent(processService) {
91
+ this.processService = processService;
92
+ this.importDone = new core.EventEmitter();
93
+ this.enumHeatmapOptions = ['count', 'duration'];
94
+ this.initialized = false;
95
+ }
96
+ AnalyseProcessDiagramComponent.prototype.ngOnInit = function () {
97
+ var _this = this;
98
+ this.processService
99
+ .getProcessDefinitions()
100
+ .subscribe(function (processDefinitions) {
101
+ _this.processDefinitions = processDefinitions;
102
+ if (!_this.processDefinitionKey && processDefinitions.length !== 0) {
103
+ _this.processDefinitionKey = processDefinitions[0].key;
104
+ _this.loadProcessDefinitionFromKey(_this.processDefinitionKey);
105
+ }
106
+ });
107
+ this.createBpmnViewerInstance();
108
+ };
109
+ AnalyseProcessDiagramComponent.prototype.createBpmnViewerInstance = function () {
110
+ var _this = this;
111
+ this.bpmnJS = new BpmnJS();
112
+ this.bpmnJS.on('import.done', function (_a) {
113
+ var error = _a.error;
114
+ if (!error && !_this.initialized) {
115
+ var canvas_1 = _this.bpmnJS.get('canvas'), eventBus = _this.bpmnJS.get('eventBus');
116
+ if (_this.processDiagram.historicActivityInstances) {
117
+ _this.processDiagram.historicActivityInstances.forEach(function (instance) {
118
+ if (instance.activityType !== 'multiInstanceBody') {
119
+ canvas_1.addMarker(instance.activityId, instance.endTime ? 'highlight-overlay-past' : 'highlight-overlay-current');
120
+ }
121
+ });
122
+ }
123
+ canvas_1.zoom('fit-viewport', 'auto');
124
+ if (_this.processDefinitionVersions) {
125
+ eventBus.on('canvas.init', function () {
126
+ if (_this.showHeatmap) {
127
+ _this.clearHeatmap();
128
+ }
129
+ _this.loadHeatmapData();
130
+ });
131
+ eventBus.on('canvas.viewbox.changing', function () {
132
+ if (_this.showHeatmap) {
133
+ _this.clearHeatmap();
134
+ }
135
+ });
136
+ eventBus.on('canvas.viewbox.changed', function () {
137
+ _this.loadHeatmapData();
138
+ });
139
+ }
140
+ _this.initialized = true;
141
+ }
142
+ _this.clearHeatmap();
143
+ if (_this.showHeatmap) {
144
+ _this.loadHeatmapData();
145
+ }
146
+ });
147
+ };
148
+ AnalyseProcessDiagramComponent.prototype.ngOnDestroy = function () {
149
+ if (this.bpmnJS) {
150
+ this.bpmnJS.destroy();
151
+ }
152
+ };
153
+ AnalyseProcessDiagramComponent.prototype.loadProcessDefinition = function (processDefinitionKey) {
154
+ var _this = this;
155
+ this.processService
156
+ .getProcessDefinition(processDefinitionKey)
157
+ .subscribe(function (processDefinition) {
158
+ _this.heatmapOption = _this.enumHeatmapOptions[0];
159
+ _this.version = processDefinition.version;
160
+ _this.loadProcessDefinitionXml(processDefinition.id);
161
+ });
162
+ };
163
+ AnalyseProcessDiagramComponent.prototype.loadProcessDefinitionVersions = function (processDefinitionKey) {
164
+ var _this = this;
165
+ this.processService
166
+ .getProcessDefinitionVersions(processDefinitionKey)
167
+ .subscribe(function (processDefinitionVersions) {
168
+ _this.processDefinitionVersions = processDefinitionVersions;
169
+ });
170
+ };
171
+ AnalyseProcessDiagramComponent.prototype.loadProcessDefinitionFromKey = function (processDefinitionKey) {
172
+ this.loadProcessDefinitionVersions(processDefinitionKey);
173
+ this.loadProcessDefinition(processDefinitionKey);
174
+ };
175
+ AnalyseProcessDiagramComponent.prototype.loadProcessDefinitionXml = function (processDefinitionId) {
176
+ var _this = this;
177
+ this.processService.getProcessDefinitionXml(processDefinitionId).subscribe(function (response) {
178
+ _this.processDiagram = response;
179
+ _this.bpmnJS.importXML(_this.processDiagram.bpmn20Xml);
180
+ _this.bpmnJS.attachTo(_this.el.nativeElement);
181
+ });
182
+ };
183
+ AnalyseProcessDiagramComponent.prototype.loadProcessDefinitionHeatmapCount = function (processDefinition) {
184
+ var _this = this;
185
+ this.processService.getProcessHeatmapCount(processDefinition).subscribe(function (response) {
186
+ _this.inputData = response;
187
+ _this.valueKey = 'totalCount';
188
+ _this.heatPoints = { data: [] };
189
+ _this.min = 0;
190
+ _this.max = 0;
191
+ Object.keys(_this.inputData).forEach(function (key) {
192
+ var diagramContainer = _this.el.nativeElement.querySelector('svg').getBoundingClientRect(), diagramElm = _this.el.nativeElement
193
+ .querySelector("g[data-element-id=" + key + "]")
194
+ .getBoundingClientRect();
195
+ _this.setMax(key);
196
+ _this.heatPoints.data.push({
197
+ x: Math.round(diagramElm.x - diagramContainer.x + diagramElm.width / 2),
198
+ y: Math.round(diagramElm.y - diagramContainer.y + diagramElm.height / 2),
199
+ value: _this.inputData[key][_this.valueKey],
200
+ radius: diagramElm.width / 2,
201
+ });
202
+ _this.addCounterActiveOverlays(key, _this.inputData);
203
+ });
204
+ _this.clearHeatmap();
205
+ if (_this.showHeatmap) {
206
+ _this.loadHeatmap();
207
+ }
208
+ });
209
+ };
210
+ AnalyseProcessDiagramComponent.prototype.onWindowResize = function () {
211
+ var oldCanvas = this.el.nativeElement.querySelector('canvas[class=heatmap-canvas]');
212
+ if (oldCanvas) {
213
+ oldCanvas.remove();
214
+ this.heatMapInstance = null;
215
+ }
216
+ if (this.showHeatmap) {
217
+ this.loadHeatmap();
218
+ }
219
+ };
220
+ AnalyseProcessDiagramComponent.prototype.loadProcessDefinitionHeatmapDuration = function (processDefinition) {
221
+ var _this = this;
222
+ this.processService.getProcessHeatmapDuration(processDefinition).subscribe(function (response) {
223
+ _this.inputData = response;
224
+ _this.valueKey = 'averageDurationInMilliseconds';
225
+ _this.heatPoints = { data: [] };
226
+ _this.min = 0;
227
+ _this.max = 0;
228
+ Object.keys(_this.inputData).forEach(function (key) {
229
+ var diagramContainer = _this.el.nativeElement.querySelector('svg').getBoundingClientRect(), diagramElm = _this.el.nativeElement
230
+ .querySelector("g[data-element-id=" + key + "]")
231
+ .getBoundingClientRect();
232
+ _this.setMax(key);
233
+ _this.heatPoints.data.push({
234
+ x: Math.round(diagramElm.x - diagramContainer.x + diagramElm.width / 2),
235
+ y: Math.round(diagramElm.y - diagramContainer.y + diagramElm.height / 2),
236
+ value: _this.inputData[key][_this.valueKey],
237
+ radius: diagramElm.width / 2,
238
+ });
239
+ _this.addCounterActiveOverlays(key, _this.inputData);
240
+ });
241
+ _this.clearHeatmap();
242
+ if (_this.showHeatmap) {
243
+ _this.loadHeatmap();
244
+ }
245
+ });
246
+ };
247
+ AnalyseProcessDiagramComponent.prototype.setProcessDefinitionKey = function (processDefinitionKey) {
248
+ this.processDefinitionKey = processDefinitionKey;
249
+ this.loadProcessDefinitionFromKey(this.processDefinitionKey);
250
+ };
251
+ AnalyseProcessDiagramComponent.prototype.setProcessDefinitionVersion = function (version) {
252
+ this.version = +version;
253
+ this.loadHeatmapData();
254
+ };
255
+ AnalyseProcessDiagramComponent.prototype.setHeatmapOption = function (heatmapOption) {
256
+ this.heatmapOption = heatmapOption;
257
+ this.loadHeatmapData();
258
+ };
259
+ AnalyseProcessDiagramComponent.prototype.toggleShowHeatmap = function () {
260
+ this.showHeatmap = !this.showHeatmap;
261
+ this.loadHeatmapData();
262
+ };
263
+ AnalyseProcessDiagramComponent.prototype.loadHeatmap = function () {
264
+ if (!this.heatMapInstance) {
265
+ this.heatMapInstance = heatmap.create({
266
+ radius: 54,
267
+ blur: 0.7,
268
+ maxOpacity: 0.4,
269
+ minOpacity: 0,
270
+ container: this.el.nativeElement,
271
+ });
272
+ var heatmapCanvas = this.el.nativeElement.querySelector('canvas[class=heatmap-canvas]');
273
+ heatmapCanvas.style.zIndex = 1;
274
+ }
275
+ this.heatMapInstance.setData({
276
+ min: this.min,
277
+ max: this.max,
278
+ data: this.heatPoints.data,
279
+ });
280
+ };
281
+ AnalyseProcessDiagramComponent.prototype.clearHeatmap = function () {
282
+ if (this.heatMapInstance) {
283
+ this.heatMapInstance.setData({ data: [] });
284
+ }
285
+ };
286
+ AnalyseProcessDiagramComponent.prototype.loadHeatmapData = function () {
287
+ var _this = this;
288
+ this.processDefinition = this.processDefinitionVersions.find(function (definition) { return definition.version === _this.version; });
289
+ if (this.heatmapOption === 'count') {
290
+ this.loadProcessDefinitionHeatmapCount(this.processDefinition);
291
+ }
292
+ if (this.heatmapOption === 'duration') {
293
+ this.loadProcessDefinitionHeatmapDuration(this.processDefinition);
294
+ }
295
+ };
296
+ AnalyseProcessDiagramComponent.prototype.setMax = function (key) {
297
+ if (this.valueKey === 'averageDurationInMilliseconds') {
298
+ this.max = Math.max(this.inputData[key].averageDurationInMilliseconds, this.max);
299
+ }
300
+ else if (this.valueKey === 'totalCount') {
301
+ this.max = Math.max(this.inputData[key].totalCount + this.inputData[key].count, this.max);
302
+ }
303
+ };
304
+ AnalyseProcessDiagramComponent.prototype.addCounterActiveOverlays = function (key, inputData) {
305
+ var overlays = this.bpmnJS.get('overlays');
306
+ overlays.add(key, {
307
+ position: {
308
+ bottom: 13,
309
+ left: -12,
310
+ },
311
+ show: {
312
+ minZoom: 0,
313
+ maxZoom: 5.0,
314
+ },
315
+ html: "<span class=\"badge badge-pill badge-primary\">" + inputData[key].count + "</span>",
316
+ });
317
+ };
318
+ return AnalyseProcessDiagramComponent;
319
+ }());
320
+ AnalyseProcessDiagramComponent.decorators = [
321
+ { type: core.Component, args: [{
322
+ selector: 'valtimo-analyse-process-diagram',
323
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"container-fluid\">\n <div class=\"row p-4 bg-light options\">\n <div class=\"col-sm-3\">\n <label><strong>Process</strong></label\n ><br />\n <select class=\"form-control\" (change)=\"setProcessDefinitionKey($event.target.value)\">\n <option\n *ngFor=\"let processDefinition of processDefinitions\"\n [value]=\"processDefinition.key\"\n [selected]=\"processDefinitionKey === processDefinition.key\"\n >\n {{ processDefinition.name }}\n </option>\n </select>\n </div>\n <div class=\"col-sm-1\">\n <label><strong>Version</strong></label\n ><br />\n <select class=\"form-control\" (change)=\"setProcessDefinitionVersion($event.target.value)\">\n <option\n *ngFor=\"let processDefinitionVersion of processDefinitionVersions\"\n [value]=\"processDefinitionVersion.version\"\n [selected]=\"processDefinitionVersion.version === version\"\n >\n {{ processDefinitionVersion.version }}\n </option>\n </select>\n </div>\n <div class=\"col-sm-3\" *ngIf=\"showHeatmap\">\n <label><strong>Heatmap type</strong></label\n ><br />\n <select class=\"form-control w-sm-50\" (change)=\"setHeatmapOption($event.target.value)\">\n <option\n *ngFor=\"let option of enumHeatmapOptions\"\n [value]=\"option\"\n [selected]=\"option === heatmapOption\"\n >\n {{ option | titlecase }}\n </option>\n </select>\n </div>\n <div\n class=\"text-sm-right col-sm-3\"\n [ngClass]=\"{'offset-sm-2': showHeatmap, 'offset-sm-5': !showHeatmap}\"\n >\n <label><strong>Show heatmap</strong></label\n ><br />\n <div class=\"text-left switch-button switch-button-sm switch-button-success\">\n <input\n type=\"checkbox\"\n id=\"toggleHeatmap\"\n [checked]=\"showHeatmap\"\n (click)=\"toggleShowHeatmap()\"\n /><span> <label for=\"toggleHeatmap\"></label></span>\n </div>\n </div>\n </div>\n <div class=\"row p-4 bg-white\">\n <div class=\"col\">\n <div #ref (window:resize)=\"onWindowResize()\" class=\"diagram-container\"></div>\n </div>\n </div>\n</div>\n\n<div class=\"p-4 text-center legenda-holder\">\n <span\n ><span class=\"badge badge-pill badge-primary\">N</span>&nbsp;&nbsp;Amount of currently active\n instances of this task.</span\n >\n <span\n >&nbsp;&nbsp;|&nbsp;&nbsp;Red/yellow/green orbs: The amount of times the task is executed in\n comparison to the other tasks.</span\n >\n</div>\n",
324
+ styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.diagram-container-switch-holder{width:100%;z-index:1000}.diagram-container{height:58vh}.container-fluid{border:1px solid #dee2e6}.options{border-bottom:1px solid #dee2e6}"]
325
+ },] }
326
+ ];
327
+ AnalyseProcessDiagramComponent.ctorParameters = function () { return [
328
+ { type: process.ProcessService }
329
+ ]; };
330
+ AnalyseProcessDiagramComponent.propDecorators = {
331
+ el: [{ type: core.ViewChild, args: ['ref',] }],
332
+ importDone: [{ type: core.Output }]
333
333
  };
334
334
 
335
- /*
336
- * Copyright 2015-2020 Ritense BV, the Netherlands.
337
- *
338
- * Licensed under EUPL, Version 1.2 (the "License");
339
- * you may not use this file except in compliance with the License.
340
- * You may obtain a copy of the License at
341
- *
342
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
343
- *
344
- * Unless required by applicable law or agreed to in writing, software
345
- * distributed under the License is distributed on an "AS IS" basis,
346
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
347
- * See the License for the specific language governing permissions and
348
- * limitations under the License.
349
- */
350
- var AnalyseModule = /** @class */ (function () {
351
- function AnalyseModule() {
352
- }
353
- return AnalyseModule;
354
- }());
355
- AnalyseModule.decorators = [
356
- { type: core.NgModule, args: [{
357
- declarations: [AnalyseComponent, AnalyseProcessDiagramComponent],
358
- imports: [common.CommonModule, AnalyseRoutingModule, process.ProcessModule, components.WidgetModule],
359
- exports: [AnalyseComponent],
360
- },] }
335
+ /*
336
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
337
+ *
338
+ * Licensed under EUPL, Version 1.2 (the "License");
339
+ * you may not use this file except in compliance with the License.
340
+ * You may obtain a copy of the License at
341
+ *
342
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
343
+ *
344
+ * Unless required by applicable law or agreed to in writing, software
345
+ * distributed under the License is distributed on an "AS IS" basis,
346
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
347
+ * See the License for the specific language governing permissions and
348
+ * limitations under the License.
349
+ */
350
+ var AnalyseModule = /** @class */ (function () {
351
+ function AnalyseModule() {
352
+ }
353
+ return AnalyseModule;
354
+ }());
355
+ AnalyseModule.decorators = [
356
+ { type: core.NgModule, args: [{
357
+ declarations: [AnalyseComponent, AnalyseProcessDiagramComponent],
358
+ imports: [common.CommonModule, AnalyseRoutingModule, process.ProcessModule, components.WidgetModule],
359
+ exports: [AnalyseComponent],
360
+ },] }
361
361
  ];
362
362
 
363
- /*
364
- * Copyright 2015-2020 Ritense BV, the Netherlands.
365
- *
366
- * Licensed under EUPL, Version 1.2 (the "License");
367
- * you may not use this file except in compliance with the License.
368
- * You may obtain a copy of the License at
369
- *
370
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
371
- *
372
- * Unless required by applicable law or agreed to in writing, software
373
- * distributed under the License is distributed on an "AS IS" basis,
374
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
375
- * See the License for the specific language governing permissions and
376
- * limitations under the License.
363
+ /*
364
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
365
+ *
366
+ * Licensed under EUPL, Version 1.2 (the "License");
367
+ * you may not use this file except in compliance with the License.
368
+ * You may obtain a copy of the License at
369
+ *
370
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
371
+ *
372
+ * Unless required by applicable law or agreed to in writing, software
373
+ * distributed under the License is distributed on an "AS IS" basis,
374
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
375
+ * See the License for the specific language governing permissions and
376
+ * limitations under the License.
377
+ */
378
+
379
+ /*
380
+ *
381
+ * * Copyright 2015-2020 Ritense BV, the Netherlands.
382
+ * *
383
+ * * Licensed under EUPL, Version 1.2 (the "License");
384
+ * * you may not use this file except in compliance with the License.
385
+ * * You may obtain a copy of the License at
386
+ * *
387
+ * * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
388
+ * *
389
+ * * Unless required by applicable law or agreed to in writing, software
390
+ * * distributed under the License is distributed on an "AS IS" basis,
391
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
392
+ * * See the License for the specific language governing permissions and
393
+ * * limitations under the License.
394
+ *
395
+ */
396
+
397
+ /*
398
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
399
+ *
400
+ * Licensed under EUPL, Version 1.2 (the "License");
401
+ * you may not use this file except in compliance with the License.
402
+ * You may obtain a copy of the License at
403
+ *
404
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
405
+ *
406
+ * Unless required by applicable law or agreed to in writing, software
407
+ * distributed under the License is distributed on an "AS IS" basis,
408
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
409
+ * See the License for the specific language governing permissions and
410
+ * limitations under the License.
377
411
  */
378
412
 
379
- /**
380
- * Generated bundle index. Do not edit.
413
+ /**
414
+ * Generated bundle index. Do not edit.
381
415
  */
382
416
 
383
417
  exports.AnalyseComponent = AnalyseComponent;