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

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