@valtimo/migration 4.15.2-next-main.14 → 4.15.3-next-main.15

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.
@@ -10,353 +10,353 @@ import { ROLE_ADMIN } from '@valtimo/contract';
10
10
  import { ReactiveFormsModule, FormsModule } from '@angular/forms';
11
11
  import { TranslateModule } from '@ngx-translate/core';
12
12
 
13
- /*
14
- * Copyright 2015-2020 Ritense BV, the Netherlands.
15
- *
16
- * Licensed under EUPL, Version 1.2 (the "License");
17
- * you may not use this file except in compliance with the License.
18
- * You may obtain a copy of the License at
19
- *
20
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
21
- *
22
- * Unless required by applicable law or agreed to in writing, software
23
- * distributed under the License is distributed on an "AS IS" basis,
24
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
- * See the License for the specific language governing permissions and
26
- * limitations under the License.
27
- */
28
- class MigrationService {
29
- constructor() {
30
- }
31
- }
32
- MigrationService.ɵprov = ɵɵdefineInjectable({ factory: function MigrationService_Factory() { return new MigrationService(); }, token: MigrationService, providedIn: "root" });
33
- MigrationService.decorators = [
34
- { type: Injectable, args: [{
35
- providedIn: 'root'
36
- },] }
37
- ];
13
+ /*
14
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
15
+ *
16
+ * Licensed under EUPL, Version 1.2 (the "License");
17
+ * you may not use this file except in compliance with the License.
18
+ * You may obtain a copy of the License at
19
+ *
20
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
21
+ *
22
+ * Unless required by applicable law or agreed to in writing, software
23
+ * distributed under the License is distributed on an "AS IS" basis,
24
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
+ * See the License for the specific language governing permissions and
26
+ * limitations under the License.
27
+ */
28
+ class MigrationService {
29
+ constructor() {
30
+ }
31
+ }
32
+ MigrationService.ɵprov = ɵɵdefineInjectable({ factory: function MigrationService_Factory() { return new MigrationService(); }, token: MigrationService, providedIn: "root" });
33
+ MigrationService.decorators = [
34
+ { type: Injectable, args: [{
35
+ providedIn: 'root'
36
+ },] }
37
+ ];
38
38
  MigrationService.ctorParameters = () => [];
39
39
 
40
- /*
41
- * Copyright 2015-2020 Ritense BV, the Netherlands.
42
- *
43
- * Licensed under EUPL, Version 1.2 (the "License");
44
- * you may not use this file except in compliance with the License.
45
- * You may obtain a copy of the License at
46
- *
47
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
48
- *
49
- * Unless required by applicable law or agreed to in writing, software
50
- * distributed under the License is distributed on an "AS IS" basis,
51
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52
- * See the License for the specific language governing permissions and
53
- * limitations under the License.
54
- */
55
- class MigrationProcessDiagramComponent {
56
- constructor(logger) {
57
- this.logger = logger;
58
- this.flowNodeMap = null;
59
- this.loaded = new EventEmitter();
60
- }
61
- ngOnInit() {
62
- this.bpmnJS = new BpmnJS();
63
- this.bpmnJS.on('import.done', ({ error }) => {
64
- if (!error) {
65
- const canvas = this.bpmnJS.get('canvas');
66
- canvas.zoom('fit-viewport', 'auto');
67
- }
68
- });
69
- }
70
- ngOnDestroy() {
71
- if (this.bpmnJS) {
72
- this.bpmnJS.destroy();
73
- }
74
- }
75
- clear() {
76
- this.bpmnJS.clear();
77
- }
78
- loadXml(xml) {
79
- this.bpmnJS.attachTo(this.el.nativeElement);
80
- this.bpmnJS.importXML(xml, (err) => {
81
- this.logger.debug(err);
82
- const processElements = this.bpmnJS.getDefinitions().rootElements.filter(function (element) {
83
- return element.isExecutable;
84
- });
85
- this.flowNodeMap = processElements[0].flowElements.filter(function (element) {
86
- if (element.name === null || element.name === '') {
87
- element.name = element.id;
88
- }
89
- return element.$type !== 'bpmn:SequenceFlow';
90
- });
91
- this.loaded.emit(this.name);
92
- });
93
- }
94
- }
95
- MigrationProcessDiagramComponent.decorators = [
96
- { type: Component, args: [{
97
- selector: 'valtimo-migration-process-diagram',
98
- 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 #ref class=\"diagram-container\"></div>\n",
99
- 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:48vh}"]
100
- },] }
101
- ];
102
- MigrationProcessDiagramComponent.ctorParameters = () => [
103
- { type: NGXLogger }
104
- ];
105
- MigrationProcessDiagramComponent.propDecorators = {
106
- el: [{ type: ViewChild, args: ['ref',] }],
107
- name: [{ type: Input }],
108
- loaded: [{ type: Output }]
40
+ /*
41
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
42
+ *
43
+ * Licensed under EUPL, Version 1.2 (the "License");
44
+ * you may not use this file except in compliance with the License.
45
+ * You may obtain a copy of the License at
46
+ *
47
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
48
+ *
49
+ * Unless required by applicable law or agreed to in writing, software
50
+ * distributed under the License is distributed on an "AS IS" basis,
51
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52
+ * See the License for the specific language governing permissions and
53
+ * limitations under the License.
54
+ */
55
+ class MigrationProcessDiagramComponent {
56
+ constructor(logger) {
57
+ this.logger = logger;
58
+ this.flowNodeMap = null;
59
+ this.loaded = new EventEmitter();
60
+ }
61
+ ngOnInit() {
62
+ this.bpmnJS = new BpmnJS();
63
+ this.bpmnJS.on('import.done', ({ error }) => {
64
+ if (!error) {
65
+ const canvas = this.bpmnJS.get('canvas');
66
+ canvas.zoom('fit-viewport', 'auto');
67
+ }
68
+ });
69
+ }
70
+ ngOnDestroy() {
71
+ if (this.bpmnJS) {
72
+ this.bpmnJS.destroy();
73
+ }
74
+ }
75
+ clear() {
76
+ this.bpmnJS.clear();
77
+ }
78
+ loadXml(xml) {
79
+ this.bpmnJS.attachTo(this.el.nativeElement);
80
+ this.bpmnJS.importXML(xml, (err) => {
81
+ this.logger.debug(err);
82
+ const processElements = this.bpmnJS.getDefinitions().rootElements.filter(function (element) {
83
+ return element.isExecutable;
84
+ });
85
+ this.flowNodeMap = processElements[0].flowElements.filter(function (element) {
86
+ if (element.name === null || element.name === '') {
87
+ element.name = element.id;
88
+ }
89
+ return element.$type !== 'bpmn:SequenceFlow';
90
+ });
91
+ this.loaded.emit(this.name);
92
+ });
93
+ }
94
+ }
95
+ MigrationProcessDiagramComponent.decorators = [
96
+ { type: Component, args: [{
97
+ selector: 'valtimo-migration-process-diagram',
98
+ 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 #ref class=\"diagram-container\"></div>\n",
99
+ 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:48vh}"]
100
+ },] }
101
+ ];
102
+ MigrationProcessDiagramComponent.ctorParameters = () => [
103
+ { type: NGXLogger }
104
+ ];
105
+ MigrationProcessDiagramComponent.propDecorators = {
106
+ el: [{ type: ViewChild, args: ['ref',] }],
107
+ name: [{ type: Input }],
108
+ loaded: [{ type: Output }]
109
109
  };
110
110
 
111
- /*
112
- * Copyright 2015-2020 Ritense BV, the Netherlands.
113
- *
114
- * Licensed under EUPL, Version 1.2 (the "License");
115
- * you may not use this file except in compliance with the License.
116
- * You may obtain a copy of the License at
117
- *
118
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
119
- *
120
- * Unless required by applicable law or agreed to in writing, software
121
- * distributed under the License is distributed on an "AS IS" basis,
122
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
123
- * See the License for the specific language governing permissions and
124
- * limitations under the License.
125
- */
126
- class MigrationComponent {
127
- constructor(processService, logger, alertService) {
128
- this.processService = processService;
129
- this.logger = logger;
130
- this.alertService = alertService;
131
- this.processDefinitions = [];
132
- this.selectedVersions = {
133
- source: [],
134
- target: []
135
- };
136
- this.selectedId = {
137
- source: null,
138
- target: null
139
- };
140
- this.loaded = {
141
- source: false,
142
- target: false
143
- };
144
- this.fields = {
145
- source: {
146
- definition: null,
147
- version: null
148
- },
149
- target: {
150
- definition: null,
151
- version: null
152
- }
153
- };
154
- this.processCount = null;
155
- this.uniqueFlowNodeMap = [];
156
- this.taskMapping = {};
157
- this.diagram = null;
158
- }
159
- ngOnInit() {
160
- this.loadProcessDefinitions();
161
- }
162
- ngAfterViewInit() {
163
- this.diagram = {
164
- source: this.sourceDiagram,
165
- target: this.targetDiagram
166
- };
167
- }
168
- get taskMappingLength() {
169
- return Object.keys(this.taskMapping).length;
170
- }
171
- loadProcessDefinitions() {
172
- this.processService.getProcessDefinitions().subscribe((processDefinitions) => {
173
- this.processDefinitions = processDefinitions;
174
- });
175
- }
176
- loadProcessDefinitionVersions(key, type) {
177
- this.fields[type].definition = key;
178
- this.selectedVersions[type] = [];
179
- this.clearProcess(type);
180
- if (key) {
181
- this.processService.getProcessDefinitionVersions(key).subscribe((processDefinitionVersions) => {
182
- this.selectedVersions[type] = processDefinitionVersions;
183
- });
184
- }
185
- }
186
- loadProcess(id, type) {
187
- this.fields[type].version = id;
188
- this.clearProcess(type);
189
- if (id) {
190
- this.loadProcessDefinitionXML(id, type);
191
- if (type === 'source') {
192
- this.loadProcessCount(id);
193
- }
194
- }
195
- }
196
- clearProcess(type) {
197
- this.loaded[type] = false;
198
- this.selectedId[type] = null;
199
- this.diagram[type].clear();
200
- if (type === 'source') {
201
- this.processCount = null;
202
- }
203
- }
204
- loadProcessDefinitionXML(id, type) {
205
- this.processService.getProcessDefinitionXml(id).subscribe(xml => {
206
- this.diagram[type].loadXml(xml['bpmn20Xml']);
207
- this.selectedId[type] = id;
208
- });
209
- }
210
- loadProcessCount(id) {
211
- this.processService.getProcessCount(id).subscribe(response => {
212
- this.processCount = response.count;
213
- });
214
- }
215
- setUniqueFlowNodeMap() {
216
- this.uniqueFlowNodeMap = [];
217
- const sourceFlowNodeMap = this.sourceDiagram.flowNodeMap;
218
- const targetFlowNodeMap = this.targetDiagram.flowNodeMap;
219
- if (sourceFlowNodeMap != null && targetFlowNodeMap != null) {
220
- this.uniqueFlowNodeMap = sourceFlowNodeMap.filter(sourceFlowNode => !targetFlowNodeMap.some(targetFlowNode => sourceFlowNode.id === targetFlowNode.id && sourceFlowNode.$type === targetFlowNode.$type));
221
- }
222
- }
223
- getFilteredTargetFlowNodeMap(flowNodeType) {
224
- const targetFlowNodeMap = this.targetDiagram.flowNodeMap;
225
- return targetFlowNodeMap.filter(function (flowNode) {
226
- return flowNode.$type === flowNodeType;
227
- });
228
- }
229
- diagramLoaded(diagramName) {
230
- this.loaded[diagramName] = true;
231
- if (this.loaded.source && this.loaded.target) {
232
- this.taskMapping = {};
233
- this.setUniqueFlowNodeMap();
234
- }
235
- }
236
- migrateProcess() {
237
- this.processService.migrateProcess(this.selectedId.source, this.selectedId.target, this.taskMapping).subscribe((res) => {
238
- this.alertService.success('Process successfully migrated!');
239
- this.clearProcess('source');
240
- this.clearProcess('target');
241
- this.fields = {
242
- source: {
243
- definition: null,
244
- version: null
245
- },
246
- target: {
247
- definition: null,
248
- version: null
249
- }
250
- };
251
- }, err => {
252
- this.alertService.error('Process migration failed!');
253
- this.logger.debug(err);
254
- });
255
- }
256
- }
257
- MigrationComponent.decorators = [
258
- { type: Component, args: [{
259
- selector: 'valtimo-migration',
260
- 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 <div class=\"row mb-5\">\n <div class=\"col-12\">\n <div class=\"alert alert-warning pl-2 plr-2\" role=\"alert\">\n <div class=\"icon\"><span class=\"mdi mdi-alert-triangle\"></span></div>\n <div class=\"message\" [innerHTML]=\"'Process migration warning' | translate\">\n </div>\n </div>\n </div>\n </div>\n <div class=\"row mb-5\">\n <div class=\"col-4\">\n <label for=\"sourceDef\">Source Definition</label>\n <select class=\"form-control\" id=\"sourceDef\"\n [ngModel]=\"fields.source.definition\" (ngModelChange)=\"loadProcessDefinitionVersions($event, 'source')\">\n <option [ngValue]=\"null\" selected>- Source Definition -</option>\n <option *ngFor=\"let processDef of processDefinitions\" [ngValue]=\"processDef.key\">{{processDef.name}}</option>\n </select>\n </div>\n <div class=\"col-2\">\n <label for=\"sourceVer\">Source Version</label>\n <select class=\"form-control\" id=\"sourceVer\" [ngModel]=\"fields.source.version\"\n (ngModelChange)=\"loadProcess($event, 'source')\">\n <option [ngValue]=\"null\" selected>- Source Version -</option>\n <option *ngFor=\"let processVer of selectedVersions.source\"\n [ngValue]=\"processVer.id\">{{processVer.version}}</option>\n </select>\n </div>\n <div class=\"col-4\">\n <label for=\"targetDef\">Target Definition</label>\n <select class=\"form-control\" id=\"targetDef\" [ngModel]=\"fields.target.definition\"\n (ngModelChange)=\"loadProcessDefinitionVersions($event, 'target')\">\n <option [ngValue]=\"null\" selected>- Target Definition -</option>\n <option *ngFor=\"let processDef of processDefinitions\" [ngValue]=\"processDef.key\">{{processDef.name}}</option>\n </select>\n </div>\n <div class=\"col-2\">\n <label for=\"targetVer\">Target Version</label>\n <select class=\"form-control\" id=\"targetVer\" [ngModel]=\"fields.target.version\"\n (ngModelChange)=\"loadProcess($event, 'target')\">\n <option [ngValue]=\"null\" selected>- Target Version -</option>\n <option *ngFor=\"let processVer of selectedVersions.target\"\n [ngValue]=\"processVer.id\">{{processVer.version}}</option>\n </select>\n </div>\n </div>\n\n <div class=\"row mb-5\">\n <div class=\"col-6\">\n <valtimo-migration-process-diagram name=\"source\" (loaded)=\"diagramLoaded($event)\"\n #sourceDiagram></valtimo-migration-process-diagram>\n </div>\n <div class=\"col-6\">\n <valtimo-migration-process-diagram name=\"target\" (loaded)=\"diagramLoaded($event)\"\n #targetDiagram></valtimo-migration-process-diagram>\n </div>\n </div>\n <table class=\"table table-striped mb-5\" *ngIf=\"selectedId.source && selectedId.target\">\n <tr *ngFor=\"let node of uniqueFlowNodeMap\">\n <td>{{node.name ? node.name : node.id}}</td>\n <td>\n <select class=\"form-control\" (change)=\"taskMapping[node.id]=$event.target.value\">\n <option [value]=\"null\" disabled selected>- Choose Target -</option>\n <option *ngFor=\"let targetFlowNode of getFilteredTargetFlowNodeMap(node.$type)\"\n [value]=\"targetFlowNode.id\">{{targetFlowNode.name ? targetFlowNode.name : targetFlowNode.id}}</option>\n </select>\n </td>\n </tr>\n </table>\n <hr>\n <div class=\"btn-group mb-5\">\n <button [disabled]=\"(uniqueFlowNodeMap.length !== taskMappingLength && uniqueFlowNodeMap.length > 0) || !loaded.source || !loaded.target\"\n (click)=\"migrateProcess()\"\n class=\"btn btn-primary\">Migrate <span *ngIf=\"processCount !== null\"\n class=\"badge badge-pill badge-secondary\">{{processCount}}</span>\n </button>\n </div>\n </div>\n</div>\n",
261
- 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 */"]
262
- },] }
263
- ];
264
- MigrationComponent.ctorParameters = () => [
265
- { type: ProcessService },
266
- { type: NGXLogger },
267
- { type: AlertService }
268
- ];
269
- MigrationComponent.propDecorators = {
270
- sourceDiagram: [{ type: ViewChild, args: ['sourceDiagram',] }],
271
- targetDiagram: [{ type: ViewChild, args: ['targetDiagram',] }]
111
+ /*
112
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
113
+ *
114
+ * Licensed under EUPL, Version 1.2 (the "License");
115
+ * you may not use this file except in compliance with the License.
116
+ * You may obtain a copy of the License at
117
+ *
118
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
119
+ *
120
+ * Unless required by applicable law or agreed to in writing, software
121
+ * distributed under the License is distributed on an "AS IS" basis,
122
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
123
+ * See the License for the specific language governing permissions and
124
+ * limitations under the License.
125
+ */
126
+ class MigrationComponent {
127
+ constructor(processService, logger, alertService) {
128
+ this.processService = processService;
129
+ this.logger = logger;
130
+ this.alertService = alertService;
131
+ this.processDefinitions = [];
132
+ this.selectedVersions = {
133
+ source: [],
134
+ target: []
135
+ };
136
+ this.selectedId = {
137
+ source: null,
138
+ target: null
139
+ };
140
+ this.loaded = {
141
+ source: false,
142
+ target: false
143
+ };
144
+ this.fields = {
145
+ source: {
146
+ definition: null,
147
+ version: null
148
+ },
149
+ target: {
150
+ definition: null,
151
+ version: null
152
+ }
153
+ };
154
+ this.processCount = null;
155
+ this.uniqueFlowNodeMap = [];
156
+ this.taskMapping = {};
157
+ this.diagram = null;
158
+ }
159
+ ngOnInit() {
160
+ this.loadProcessDefinitions();
161
+ }
162
+ ngAfterViewInit() {
163
+ this.diagram = {
164
+ source: this.sourceDiagram,
165
+ target: this.targetDiagram
166
+ };
167
+ }
168
+ get taskMappingLength() {
169
+ return Object.keys(this.taskMapping).length;
170
+ }
171
+ loadProcessDefinitions() {
172
+ this.processService.getProcessDefinitions().subscribe((processDefinitions) => {
173
+ this.processDefinitions = processDefinitions;
174
+ });
175
+ }
176
+ loadProcessDefinitionVersions(key, type) {
177
+ this.fields[type].definition = key;
178
+ this.selectedVersions[type] = [];
179
+ this.clearProcess(type);
180
+ if (key) {
181
+ this.processService.getProcessDefinitionVersions(key).subscribe((processDefinitionVersions) => {
182
+ this.selectedVersions[type] = processDefinitionVersions;
183
+ });
184
+ }
185
+ }
186
+ loadProcess(id, type) {
187
+ this.fields[type].version = id;
188
+ this.clearProcess(type);
189
+ if (id) {
190
+ this.loadProcessDefinitionXML(id, type);
191
+ if (type === 'source') {
192
+ this.loadProcessCount(id);
193
+ }
194
+ }
195
+ }
196
+ clearProcess(type) {
197
+ this.loaded[type] = false;
198
+ this.selectedId[type] = null;
199
+ this.diagram[type].clear();
200
+ if (type === 'source') {
201
+ this.processCount = null;
202
+ }
203
+ }
204
+ loadProcessDefinitionXML(id, type) {
205
+ this.processService.getProcessDefinitionXml(id).subscribe(xml => {
206
+ this.diagram[type].loadXml(xml['bpmn20Xml']);
207
+ this.selectedId[type] = id;
208
+ });
209
+ }
210
+ loadProcessCount(id) {
211
+ this.processService.getProcessCount(id).subscribe(response => {
212
+ this.processCount = response.count;
213
+ });
214
+ }
215
+ setUniqueFlowNodeMap() {
216
+ this.uniqueFlowNodeMap = [];
217
+ const sourceFlowNodeMap = this.sourceDiagram.flowNodeMap;
218
+ const targetFlowNodeMap = this.targetDiagram.flowNodeMap;
219
+ if (sourceFlowNodeMap != null && targetFlowNodeMap != null) {
220
+ this.uniqueFlowNodeMap = sourceFlowNodeMap.filter(sourceFlowNode => !targetFlowNodeMap.some(targetFlowNode => sourceFlowNode.id === targetFlowNode.id && sourceFlowNode.$type === targetFlowNode.$type));
221
+ }
222
+ }
223
+ getFilteredTargetFlowNodeMap(flowNodeType) {
224
+ const targetFlowNodeMap = this.targetDiagram.flowNodeMap;
225
+ return targetFlowNodeMap.filter(function (flowNode) {
226
+ return flowNode.$type === flowNodeType;
227
+ });
228
+ }
229
+ diagramLoaded(diagramName) {
230
+ this.loaded[diagramName] = true;
231
+ if (this.loaded.source && this.loaded.target) {
232
+ this.taskMapping = {};
233
+ this.setUniqueFlowNodeMap();
234
+ }
235
+ }
236
+ migrateProcess() {
237
+ this.processService.migrateProcess(this.selectedId.source, this.selectedId.target, this.taskMapping).subscribe((res) => {
238
+ this.alertService.success('Process successfully migrated!');
239
+ this.clearProcess('source');
240
+ this.clearProcess('target');
241
+ this.fields = {
242
+ source: {
243
+ definition: null,
244
+ version: null
245
+ },
246
+ target: {
247
+ definition: null,
248
+ version: null
249
+ }
250
+ };
251
+ }, err => {
252
+ this.alertService.error('Process migration failed!');
253
+ this.logger.debug(err);
254
+ });
255
+ }
256
+ }
257
+ MigrationComponent.decorators = [
258
+ { type: Component, args: [{
259
+ selector: 'valtimo-migration',
260
+ 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 <div class=\"row mb-5\">\n <div class=\"col-12\">\n <div class=\"alert alert-warning pl-2 plr-2\" role=\"alert\">\n <div class=\"icon\"><span class=\"mdi mdi-alert-triangle\"></span></div>\n <div class=\"message\" [innerHTML]=\"'Process migration warning' | translate\">\n </div>\n </div>\n </div>\n </div>\n <div class=\"row mb-5\">\n <div class=\"col-4\">\n <label for=\"sourceDef\">Source Definition</label>\n <select class=\"form-control\" id=\"sourceDef\"\n [ngModel]=\"fields.source.definition\" (ngModelChange)=\"loadProcessDefinitionVersions($event, 'source')\">\n <option [ngValue]=\"null\" selected>- Source Definition -</option>\n <option *ngFor=\"let processDef of processDefinitions\" [ngValue]=\"processDef.key\">{{processDef.name}}</option>\n </select>\n </div>\n <div class=\"col-2\">\n <label for=\"sourceVer\">Source Version</label>\n <select class=\"form-control\" id=\"sourceVer\" [ngModel]=\"fields.source.version\"\n (ngModelChange)=\"loadProcess($event, 'source')\">\n <option [ngValue]=\"null\" selected>- Source Version -</option>\n <option *ngFor=\"let processVer of selectedVersions.source\"\n [ngValue]=\"processVer.id\">{{processVer.version}}</option>\n </select>\n </div>\n <div class=\"col-4\">\n <label for=\"targetDef\">Target Definition</label>\n <select class=\"form-control\" id=\"targetDef\" [ngModel]=\"fields.target.definition\"\n (ngModelChange)=\"loadProcessDefinitionVersions($event, 'target')\">\n <option [ngValue]=\"null\" selected>- Target Definition -</option>\n <option *ngFor=\"let processDef of processDefinitions\" [ngValue]=\"processDef.key\">{{processDef.name}}</option>\n </select>\n </div>\n <div class=\"col-2\">\n <label for=\"targetVer\">Target Version</label>\n <select class=\"form-control\" id=\"targetVer\" [ngModel]=\"fields.target.version\"\n (ngModelChange)=\"loadProcess($event, 'target')\">\n <option [ngValue]=\"null\" selected>- Target Version -</option>\n <option *ngFor=\"let processVer of selectedVersions.target\"\n [ngValue]=\"processVer.id\">{{processVer.version}}</option>\n </select>\n </div>\n </div>\n\n <div class=\"row mb-5\">\n <div class=\"col-6\">\n <valtimo-migration-process-diagram name=\"source\" (loaded)=\"diagramLoaded($event)\"\n #sourceDiagram></valtimo-migration-process-diagram>\n </div>\n <div class=\"col-6\">\n <valtimo-migration-process-diagram name=\"target\" (loaded)=\"diagramLoaded($event)\"\n #targetDiagram></valtimo-migration-process-diagram>\n </div>\n </div>\n <table class=\"table table-striped mb-5\" *ngIf=\"selectedId.source && selectedId.target\">\n <tr *ngFor=\"let node of uniqueFlowNodeMap\">\n <td>{{node.name ? node.name : node.id}}</td>\n <td>\n <select class=\"form-control\" (change)=\"taskMapping[node.id]=$event.target.value\">\n <option [value]=\"null\" disabled selected>- Choose Target -</option>\n <option *ngFor=\"let targetFlowNode of getFilteredTargetFlowNodeMap(node.$type)\"\n [value]=\"targetFlowNode.id\">{{targetFlowNode.name ? targetFlowNode.name : targetFlowNode.id}}</option>\n </select>\n </td>\n </tr>\n </table>\n <hr>\n <div class=\"btn-group mb-5\">\n <button [disabled]=\"(uniqueFlowNodeMap.length !== taskMappingLength && uniqueFlowNodeMap.length > 0) || !loaded.source || !loaded.target\"\n (click)=\"migrateProcess()\"\n class=\"btn btn-primary\">Migrate <span *ngIf=\"processCount !== null\"\n class=\"badge badge-pill badge-secondary\">{{processCount}}</span>\n </button>\n </div>\n </div>\n</div>\n",
261
+ 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 */"]
262
+ },] }
263
+ ];
264
+ MigrationComponent.ctorParameters = () => [
265
+ { type: ProcessService },
266
+ { type: NGXLogger },
267
+ { type: AlertService }
268
+ ];
269
+ MigrationComponent.propDecorators = {
270
+ sourceDiagram: [{ type: ViewChild, args: ['sourceDiagram',] }],
271
+ targetDiagram: [{ type: ViewChild, args: ['targetDiagram',] }]
272
272
  };
273
273
 
274
- /*
275
- * Copyright 2015-2020 Ritense BV, the Netherlands.
276
- *
277
- * Licensed under EUPL, Version 1.2 (the "License");
278
- * you may not use this file except in compliance with the License.
279
- * You may obtain a copy of the License at
280
- *
281
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
282
- *
283
- * Unless required by applicable law or agreed to in writing, software
284
- * distributed under the License is distributed on an "AS IS" basis,
285
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286
- * See the License for the specific language governing permissions and
287
- * limitations under the License.
288
- */
289
- const ɵ0 = { title: 'Process migration', roles: [ROLE_ADMIN] };
290
- const routes = [
291
- {
292
- path: 'process-migration',
293
- component: MigrationComponent,
294
- canActivate: [AuthGuardService],
295
- data: ɵ0,
296
- },
297
- ];
298
- class MigrationRoutingModule {
299
- }
300
- MigrationRoutingModule.decorators = [
301
- { type: NgModule, args: [{
302
- imports: [
303
- CommonModule,
304
- RouterModule.forChild(routes),
305
- ],
306
- exports: [RouterModule]
307
- },] }
274
+ /*
275
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
276
+ *
277
+ * Licensed under EUPL, Version 1.2 (the "License");
278
+ * you may not use this file except in compliance with the License.
279
+ * You may obtain a copy of the License at
280
+ *
281
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
282
+ *
283
+ * Unless required by applicable law or agreed to in writing, software
284
+ * distributed under the License is distributed on an "AS IS" basis,
285
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286
+ * See the License for the specific language governing permissions and
287
+ * limitations under the License.
288
+ */
289
+ const ɵ0 = { title: 'Process migration', roles: [ROLE_ADMIN] };
290
+ const routes = [
291
+ {
292
+ path: 'process-migration',
293
+ component: MigrationComponent,
294
+ canActivate: [AuthGuardService],
295
+ data: ɵ0,
296
+ },
297
+ ];
298
+ class MigrationRoutingModule {
299
+ }
300
+ MigrationRoutingModule.decorators = [
301
+ { type: NgModule, args: [{
302
+ imports: [
303
+ CommonModule,
304
+ RouterModule.forChild(routes),
305
+ ],
306
+ exports: [RouterModule]
307
+ },] }
308
308
  ];
309
309
 
310
- /*
311
- * Copyright 2015-2020 Ritense BV, the Netherlands.
312
- *
313
- * Licensed under EUPL, Version 1.2 (the "License");
314
- * you may not use this file except in compliance with the License.
315
- * You may obtain a copy of the License at
316
- *
317
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
318
- *
319
- * Unless required by applicable law or agreed to in writing, software
320
- * distributed under the License is distributed on an "AS IS" basis,
321
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
322
- * See the License for the specific language governing permissions and
323
- * limitations under the License.
324
- */
325
- class MigrationModule {
326
- }
327
- MigrationModule.decorators = [
328
- { type: NgModule, args: [{
329
- declarations: [MigrationComponent, MigrationProcessDiagramComponent],
330
- imports: [
331
- CommonModule,
332
- MigrationRoutingModule,
333
- ReactiveFormsModule,
334
- WidgetModule,
335
- FormsModule,
336
- TranslateModule
337
- ],
338
- exports: [MigrationComponent]
339
- },] }
310
+ /*
311
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
312
+ *
313
+ * Licensed under EUPL, Version 1.2 (the "License");
314
+ * you may not use this file except in compliance with the License.
315
+ * You may obtain a copy of the License at
316
+ *
317
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
318
+ *
319
+ * Unless required by applicable law or agreed to in writing, software
320
+ * distributed under the License is distributed on an "AS IS" basis,
321
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
322
+ * See the License for the specific language governing permissions and
323
+ * limitations under the License.
324
+ */
325
+ class MigrationModule {
326
+ }
327
+ MigrationModule.decorators = [
328
+ { type: NgModule, args: [{
329
+ declarations: [MigrationComponent, MigrationProcessDiagramComponent],
330
+ imports: [
331
+ CommonModule,
332
+ MigrationRoutingModule,
333
+ ReactiveFormsModule,
334
+ WidgetModule,
335
+ FormsModule,
336
+ TranslateModule
337
+ ],
338
+ exports: [MigrationComponent]
339
+ },] }
340
340
  ];
341
341
 
342
- /*
343
- * Copyright 2015-2020 Ritense BV, the Netherlands.
344
- *
345
- * Licensed under EUPL, Version 1.2 (the "License");
346
- * you may not use this file except in compliance with the License.
347
- * You may obtain a copy of the License at
348
- *
349
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
350
- *
351
- * Unless required by applicable law or agreed to in writing, software
352
- * distributed under the License is distributed on an "AS IS" basis,
353
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
354
- * See the License for the specific language governing permissions and
355
- * limitations under the License.
342
+ /*
343
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
344
+ *
345
+ * Licensed under EUPL, Version 1.2 (the "License");
346
+ * you may not use this file except in compliance with the License.
347
+ * You may obtain a copy of the License at
348
+ *
349
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
350
+ *
351
+ * Unless required by applicable law or agreed to in writing, software
352
+ * distributed under the License is distributed on an "AS IS" basis,
353
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
354
+ * See the License for the specific language governing permissions and
355
+ * limitations under the License.
356
356
  */
357
357
 
358
- /**
359
- * Generated bundle index. Do not edit.
358
+ /**
359
+ * Generated bundle index. Do not edit.
360
360
  */
361
361
 
362
362
  export { MigrationComponent, MigrationModule, MigrationService, MigrationProcessDiagramComponent as ɵa, MigrationRoutingModule as ɵb };