@valtimo/building-block-management 13.25.0 → 13.27.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.
- package/fesm2022/valtimo-building-block-management.mjs +38 -5
- package/fesm2022/valtimo-building-block-management.mjs.map +1 -1
- package/lib/components/building-block-management-process-upload/building-block-management-process-upload.component.d.ts +2 -1
- package/lib/components/building-block-management-process-upload/building-block-management-process-upload.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1191,6 +1191,7 @@ class BuildingBlockManagementProcessUploadComponent {
|
|
|
1191
1191
|
this.modalOpen$ = this.buildingBlockManagementDetailService.showProcessDefinitionUploadModal$;
|
|
1192
1192
|
this.showReplaceConfirmationModal$ = new BehaviorSubject(false);
|
|
1193
1193
|
this.replaceModalContent = '';
|
|
1194
|
+
this._conflictingProcessDefinitionId = null;
|
|
1194
1195
|
this.ACCEPTED_FILES = ['bpmn'];
|
|
1195
1196
|
this.form = this.formBuilder.group({
|
|
1196
1197
|
file: this.formBuilder.control(new Set(), [Validators.required]),
|
|
@@ -1203,12 +1204,12 @@ class BuildingBlockManagementProcessUploadComponent {
|
|
|
1203
1204
|
this.form.reset();
|
|
1204
1205
|
}, CARBON_CONSTANTS.modalAnimationMs);
|
|
1205
1206
|
}
|
|
1206
|
-
uploadProcessBpmn(
|
|
1207
|
+
uploadProcessBpmn() {
|
|
1207
1208
|
const bpmnFile = this.form.value?.file?.values()?.next()?.value?.file;
|
|
1208
1209
|
if (!bpmnFile)
|
|
1209
1210
|
return;
|
|
1210
1211
|
from(bpmnFile.text())
|
|
1211
|
-
.pipe(switchMap(bpmnXml => this.processLinkService.
|
|
1212
|
+
.pipe(switchMap(bpmnXml => this.processLinkService.createProcessDefinitionForBuildingBlock([], `${bpmnXml}`, this.buildingBlockManagementDetailService.buildingBlockDefinitionKey, this.buildingBlockManagementDetailService.buildingBlockDefinitionVersionTag)))
|
|
1212
1213
|
.subscribe({
|
|
1213
1214
|
next: () => {
|
|
1214
1215
|
this.notificationService.showNotification({
|
|
@@ -1219,8 +1220,11 @@ class BuildingBlockManagementProcessUploadComponent {
|
|
|
1219
1220
|
this.buildingBlockManagementDetailService.reloadProcessDefinitions();
|
|
1220
1221
|
},
|
|
1221
1222
|
error: (error) => {
|
|
1222
|
-
const
|
|
1223
|
-
if (
|
|
1223
|
+
const isConflict = error instanceof HttpErrorResponse && error.status === 409;
|
|
1224
|
+
if (isConflict) {
|
|
1225
|
+
const body = error.error;
|
|
1226
|
+
this._conflictingProcessDefinitionId =
|
|
1227
|
+
body?.duplicateProcessDefinitions?.[0]?.processDefinitionId ?? null;
|
|
1224
1228
|
this.replaceModalContent = this.buildReplaceModalContent(error);
|
|
1225
1229
|
this.showReplaceConfirmationModal$.next(true);
|
|
1226
1230
|
return;
|
|
@@ -1233,8 +1237,37 @@ class BuildingBlockManagementProcessUploadComponent {
|
|
|
1233
1237
|
});
|
|
1234
1238
|
}
|
|
1235
1239
|
confirmReplace() {
|
|
1240
|
+
const processDefinitionId = this._conflictingProcessDefinitionId;
|
|
1236
1241
|
this.replaceModalContent = '';
|
|
1237
|
-
this.
|
|
1242
|
+
this._conflictingProcessDefinitionId = null;
|
|
1243
|
+
if (!processDefinitionId) {
|
|
1244
|
+
this.notificationService.showNotification({
|
|
1245
|
+
type: 'error',
|
|
1246
|
+
title: this.translateService.instant('processManagement.upload.failure'),
|
|
1247
|
+
});
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
const bpmnFile = this.form.value?.file?.values()?.next()?.value?.file;
|
|
1251
|
+
if (!bpmnFile)
|
|
1252
|
+
return;
|
|
1253
|
+
from(bpmnFile.text())
|
|
1254
|
+
.pipe(switchMap(bpmnXml => this.processLinkService.updateProcessDefinitionForBuildingBlock([], processDefinitionId, `${bpmnXml}`, this.buildingBlockManagementDetailService.buildingBlockDefinitionKey, this.buildingBlockManagementDetailService.buildingBlockDefinitionVersionTag, true)))
|
|
1255
|
+
.subscribe({
|
|
1256
|
+
next: () => {
|
|
1257
|
+
this.notificationService.showNotification({
|
|
1258
|
+
type: 'success',
|
|
1259
|
+
title: this.translateService.instant('processManagement.upload.success'),
|
|
1260
|
+
});
|
|
1261
|
+
this.closeModal();
|
|
1262
|
+
this.buildingBlockManagementDetailService.reloadProcessDefinitions();
|
|
1263
|
+
},
|
|
1264
|
+
error: () => {
|
|
1265
|
+
this.notificationService.showNotification({
|
|
1266
|
+
type: 'error',
|
|
1267
|
+
title: this.translateService.instant('processManagement.upload.failure'),
|
|
1268
|
+
});
|
|
1269
|
+
},
|
|
1270
|
+
});
|
|
1238
1271
|
}
|
|
1239
1272
|
clearReplaceModal() {
|
|
1240
1273
|
this.replaceModalContent = '';
|