@reltio/components 1.4.2253 → 1.4.2255
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/ActivenessDateControl/ActivenessDateControl.d.ts +3 -1
- package/ActivenessDateControl/ActivenessDateControl.js +2 -2
- package/ConfigureColumnsPopup/ConfigureColumnsPopup.d.ts +3 -3
- package/ConfigureColumnsPopup/ConfigureColumnsPopup.js +5 -5
- package/SelectionPopup/SelectionPopup.d.ts +4 -4
- package/SelectionPopup/SelectionPopup.js +4 -3
- package/SelectionPopup/SelectionPopup.spec.js +2 -2
- package/cjs/ActivenessDateControl/ActivenessDateControl.d.ts +3 -1
- package/cjs/ActivenessDateControl/ActivenessDateControl.js +2 -2
- package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.d.ts +3 -3
- package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.js +5 -5
- package/cjs/SelectionPopup/SelectionPopup.d.ts +4 -4
- package/cjs/SelectionPopup/SelectionPopup.js +4 -3
- package/cjs/SelectionPopup/SelectionPopup.spec.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +22 -6
- package/cjs/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +5 -2
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.js +29 -13
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.d.ts +41 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.js +161 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +52 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.js +2 -4
- package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.d.ts +2 -1
- package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +37 -3
- package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +2 -2
- package/cjs/features/workflow/contexts/AddedAttributesContext/index.d.ts +1 -0
- package/cjs/features/workflow/contexts/AddedAttributesContext/index.js +8 -3
- package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +1 -0
- package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.js +8 -2
- package/cjs/features/workflow/helpers/attributes.js +5 -4
- package/cjs/features/workflow/helpers/attributes.test.js +55 -0
- package/cjs/features/workflow/helpers/common.d.ts +2 -1
- package/cjs/features/workflow/helpers/common.js +5 -1
- package/cjs/features/workflow/helpers/dcr.js +2 -1
- package/cjs/features/workflow/helpers/dcr.test.js +47 -0
- package/cjs/features/workflow/helpers/merge.js +1 -1
- package/cjs/features/workflow/helpers/merge.test.js +34 -0
- package/cjs/features/workflow/helpers/metadata.test-data.js +9 -0
- package/cjs/features/workflow/helpers/validation.js +3 -2
- package/cjs/features/workflow/helpers/validation.test-data.d.ts +1 -0
- package/cjs/features/workflow/helpers/validation.test-data.js +34 -1
- package/cjs/features/workflow/helpers/validation.test.js +10 -0
- package/cjs/features/workflow/hooks/useChangeRequest.d.ts +1 -0
- package/cjs/features/workflow/hooks/useChangeRequest.js +8 -5
- package/cjs/features/workflow/hooks/useChangeRequest.test.js +11 -5
- package/cjs/features/workflow/hooks/useWorkflowActions.d.ts +2 -1
- package/cjs/features/workflow/hooks/useWorkflowActions.js +8 -3
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +23 -7
- package/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +5 -2
- package/features/workflow/ChangeRequestEditor/helpers/changesList.js +29 -13
- package/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.d.ts +41 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.js +153 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +52 -0
- package/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/helpers/helpers.js +1 -3
- package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.d.ts +2 -1
- package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +14 -3
- package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +2 -2
- package/features/workflow/contexts/AddedAttributesContext/index.d.ts +1 -0
- package/features/workflow/contexts/AddedAttributesContext/index.js +8 -3
- package/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +1 -0
- package/features/workflow/contexts/ChangeRequestEditorContext/index.js +8 -2
- package/features/workflow/helpers/attributes.js +5 -4
- package/features/workflow/helpers/attributes.test.js +55 -0
- package/features/workflow/helpers/common.d.ts +2 -1
- package/features/workflow/helpers/common.js +3 -0
- package/features/workflow/helpers/dcr.js +2 -1
- package/features/workflow/helpers/dcr.test.js +47 -0
- package/features/workflow/helpers/merge.js +2 -2
- package/features/workflow/helpers/merge.test.js +34 -0
- package/features/workflow/helpers/metadata.test-data.js +9 -0
- package/features/workflow/helpers/validation.js +3 -2
- package/features/workflow/helpers/validation.test-data.d.ts +1 -0
- package/features/workflow/helpers/validation.test-data.js +32 -0
- package/features/workflow/helpers/validation.test.js +11 -1
- package/features/workflow/hooks/useChangeRequest.d.ts +1 -0
- package/features/workflow/hooks/useChangeRequest.js +8 -5
- package/features/workflow/hooks/useChangeRequest.test.js +11 -5
- package/features/workflow/hooks/useWorkflowActions.d.ts +2 -1
- package/features/workflow/hooks/useWorkflowActions.js +8 -3
- package/package.json +2 -2
|
@@ -391,4 +391,38 @@ describe('mergeChanges tests', function () {
|
|
|
391
391
|
var mergedChanges = (0, merge_1.mergeChanges)(metadata, changes, objectInfo, [])[0];
|
|
392
392
|
expect((_c = (_b = mergedChanges[0]) === null || _b === void 0 ? void 0 : _b.newValue) === null || _c === void 0 ? void 0 : _c.lineIds).toEqual(['line-2', 'line-4']);
|
|
393
393
|
});
|
|
394
|
+
it('should keep role URIs in CREATE_ENTITY changes without mapping to labels', function () {
|
|
395
|
+
var _a;
|
|
396
|
+
var _b;
|
|
397
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
398
|
+
var roleUris = [
|
|
399
|
+
'configuration/roles/DirectorofNursing',
|
|
400
|
+
'configuration/roles/MedicalAssistant',
|
|
401
|
+
'configuration/roles/LabDirectors'
|
|
402
|
+
];
|
|
403
|
+
var changes = (_a = {},
|
|
404
|
+
_a[entityUri] = [
|
|
405
|
+
{
|
|
406
|
+
id: 'create1',
|
|
407
|
+
type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
|
|
408
|
+
objectType: 'configuration/entityTypes/HCA',
|
|
409
|
+
newValue: {
|
|
410
|
+
uri: entityUri,
|
|
411
|
+
type: 'configuration/entityTypes/HCA',
|
|
412
|
+
attributes: {
|
|
413
|
+
ActivationDate: [{ value: '2024-01-01' }]
|
|
414
|
+
},
|
|
415
|
+
roles: roleUris,
|
|
416
|
+
crosswalks: [{ type: 'configuration/sources/Reltio', value: '1hRTSKE5', dataProvider: true }],
|
|
417
|
+
analyticsAttributes: {}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
],
|
|
421
|
+
_a);
|
|
422
|
+
var entityChanges = (0, merge_1.mergeChanges)(metadata, changes, objectInfo, [])[0];
|
|
423
|
+
var rolesDiff = entityChanges.find(function (d) { var _a; return ((_a = d.attributeType) === null || _a === void 0 ? void 0 : _a.uri) === mdm_sdk_1.EntityAttrTypes.roles.uri; });
|
|
424
|
+
expect(rolesDiff).toBeDefined();
|
|
425
|
+
var rolesNewValue = (_b = rolesDiff.newValue) === null || _b === void 0 ? void 0 : _b.value;
|
|
426
|
+
expect(rolesNewValue).toEqual(roleUris);
|
|
427
|
+
});
|
|
394
428
|
});
|
|
@@ -264,6 +264,15 @@ var getMetadata = function () { return ({
|
|
|
264
264
|
}
|
|
265
265
|
]
|
|
266
266
|
}
|
|
267
|
+
],
|
|
268
|
+
roles: [
|
|
269
|
+
{
|
|
270
|
+
uri: 'configuration/roles/DirectorofNursing',
|
|
271
|
+
label: 'Director of Nursing',
|
|
272
|
+
description: 'Director of Nursing'
|
|
273
|
+
},
|
|
274
|
+
{ uri: 'configuration/roles/MedicalAssistant', label: 'Medical Assistant', description: 'Medical Assistant' },
|
|
275
|
+
{ uri: 'configuration/roles/LabDirectors', label: 'Lab Directors', description: 'Lab Directors' }
|
|
267
276
|
]
|
|
268
277
|
}); };
|
|
269
278
|
exports.getMetadata = getMetadata;
|
|
@@ -27,6 +27,7 @@ exports.getValidationErrors = void 0;
|
|
|
27
27
|
var ramda_1 = require("ramda");
|
|
28
28
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
29
29
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
30
|
+
var common_1 = require("./common");
|
|
30
31
|
var ALLOWED_CHANGE_TYPES = [
|
|
31
32
|
mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
|
|
32
33
|
mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
|
|
@@ -263,7 +264,7 @@ var validateRequiredComplexAttributes = function (_a) {
|
|
|
263
264
|
return [];
|
|
264
265
|
}
|
|
265
266
|
var valueHolder = change.type === mdm_sdk_1.DCRTypes.CREATE_ENTITY || change.type === mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP ? 'attributes' : 'value';
|
|
266
|
-
var rootAttributeTypeUri = change.
|
|
267
|
+
var rootAttributeTypeUri = change.attributeType || change.refAttributeType || change.objectType;
|
|
267
268
|
if (!rootAttributeTypeUri) {
|
|
268
269
|
return [];
|
|
269
270
|
}
|
|
@@ -293,7 +294,7 @@ var validateRequiredComplexAttributes = function (_a) {
|
|
|
293
294
|
var errors = [];
|
|
294
295
|
var visitValue = function (value, path) {
|
|
295
296
|
var isRejected = checkIsChangeRejected(path.slice(0, -1).join('/'));
|
|
296
|
-
if (
|
|
297
|
+
if ((0, common_1.isPrimitiveValue)(value)) {
|
|
297
298
|
return !isRejected;
|
|
298
299
|
}
|
|
299
300
|
if (isRejected) {
|
|
@@ -10,5 +10,6 @@ export declare const getUserChanges: () => UserChange[];
|
|
|
10
10
|
export declare const getUserChangesRejectSubnestedAttributes: () => UserChange[];
|
|
11
11
|
export declare const getUserChangesRejectSubnestedRelationAttributes: () => UserChange[];
|
|
12
12
|
export declare const getUserChangesSubnestedEmpty: () => UserChange[];
|
|
13
|
+
export declare const getChangesWithBooleanPrimitiveValue: () => DCRChanges;
|
|
13
14
|
export declare const getUserChangesNewEntity: () => UserChange[];
|
|
14
15
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUserChangesNewEntity = exports.getUserChangesSubnestedEmpty = exports.getUserChangesRejectSubnestedRelationAttributes = exports.getUserChangesRejectSubnestedAttributes = exports.getUserChanges = exports.getEntitiesOrRelations = exports.getChanges = void 0;
|
|
3
|
+
exports.getUserChangesNewEntity = exports.getChangesWithBooleanPrimitiveValue = exports.getUserChangesSubnestedEmpty = exports.getUserChangesRejectSubnestedRelationAttributes = exports.getUserChangesRejectSubnestedAttributes = exports.getUserChanges = exports.getEntitiesOrRelations = exports.getChanges = void 0;
|
|
4
4
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
5
5
|
var getChanges = function () { return ({
|
|
6
6
|
'entities/entityUri1': [
|
|
@@ -487,6 +487,39 @@ var getUserChangesSubnestedEmpty = function () { return [
|
|
|
487
487
|
}
|
|
488
488
|
]; };
|
|
489
489
|
exports.getUserChangesSubnestedEmpty = getUserChangesSubnestedEmpty;
|
|
490
|
+
var getChangesWithBooleanPrimitiveValue = function () { return ({
|
|
491
|
+
'entities/entityUri1': [
|
|
492
|
+
{
|
|
493
|
+
id: '0SBn7Oa',
|
|
494
|
+
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
|
|
495
|
+
createdTime: 1761922840650,
|
|
496
|
+
createdBy: 'ivan.kositsin',
|
|
497
|
+
objectType: 'configuration/entityTypes/HCP',
|
|
498
|
+
attributePath: 'Specialities',
|
|
499
|
+
newValue: {
|
|
500
|
+
value: {
|
|
501
|
+
SpecialityStatus: [
|
|
502
|
+
{
|
|
503
|
+
value: 'ACTIVE'
|
|
504
|
+
}
|
|
505
|
+
],
|
|
506
|
+
PrimarySpecialityInd: [
|
|
507
|
+
{
|
|
508
|
+
value: false
|
|
509
|
+
}
|
|
510
|
+
]
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
crosswalk: {
|
|
514
|
+
type: 'configuration/sources/Reltio',
|
|
515
|
+
value: 'entityUri1'
|
|
516
|
+
},
|
|
517
|
+
newPinOrIgnoreValue: false,
|
|
518
|
+
attributeType: 'configuration/entityTypes/HCP/attributes/Specialities'
|
|
519
|
+
}
|
|
520
|
+
]
|
|
521
|
+
}); };
|
|
522
|
+
exports.getChangesWithBooleanPrimitiveValue = getChangesWithBooleanPrimitiveValue;
|
|
490
523
|
var getUserChangesNewEntity = function () { return [
|
|
491
524
|
{
|
|
492
525
|
lineId: 'entityUri2/0IEiwoe/newValue/attributes/Name/0',
|
|
@@ -215,6 +215,16 @@ describe('getValidationErrors', function () {
|
|
|
215
215
|
}
|
|
216
216
|
]);
|
|
217
217
|
});
|
|
218
|
+
it('should not report a missing required boolean attribute when its value is primitive false', function () {
|
|
219
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
220
|
+
var result = (0, validation_1.getValidationErrors)({
|
|
221
|
+
changes: (0, validation_test_data_1.getChangesWithBooleanPrimitiveValue)(),
|
|
222
|
+
userChanges: [],
|
|
223
|
+
entitiesOrRelations: (0, validation_test_data_1.getEntitiesOrRelations)(),
|
|
224
|
+
metadata: metadata
|
|
225
|
+
});
|
|
226
|
+
expect(result).toEqual([]);
|
|
227
|
+
});
|
|
218
228
|
it('should validate required attributes in new entity', function () {
|
|
219
229
|
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
220
230
|
var result = (0, validation_1.getValidationErrors)({
|
|
@@ -28,8 +28,8 @@ var useChangeRequest = function (dcrUri) {
|
|
|
28
28
|
}
|
|
29
29
|
return safePromise((0, mdm_sdk_1.getEntitiesByUris)(entityUris, { searchOptions: 'ovOnly', defaultMaxValues: 1 }));
|
|
30
30
|
}, []); // eslint-disable-line
|
|
31
|
-
(0, react_1.
|
|
32
|
-
(0, mdm_sdk_1.getDataChangeRequest)(dcrUri)
|
|
31
|
+
var loadDcr = (0, react_1.useCallback)(function () {
|
|
32
|
+
safePromise((0, mdm_sdk_1.getDataChangeRequest)(dcrUri))
|
|
33
33
|
.then(function (dcr) {
|
|
34
34
|
var changes = dcr.changes, objectsInfo = dcr.objectsInfo;
|
|
35
35
|
var objectsWithChanges = (0, dcr_1.extractObjectsFromChangeRequest)(changes, objectsInfo);
|
|
@@ -40,7 +40,7 @@ var useChangeRequest = function (dcrUri) {
|
|
|
40
40
|
requestEntities(entityUris)
|
|
41
41
|
.then(function (entities) {
|
|
42
42
|
var relationsObjectsWithRequestedEntities = relationsObjectsWithoutEntity.map(function (relationsObject, index) {
|
|
43
|
-
return __assign(__assign({}, relationsObject), { entity: entities[index] });
|
|
43
|
+
return __assign(__assign({}, relationsObject), { entity: __assign(__assign({}, entities[index]), { isExist: true }) });
|
|
44
44
|
});
|
|
45
45
|
(0, ramda_1.pipe)(ramda_1.flatten, (0, ramda_1.reduce)(dcr_1.concatEntityRelationsObjects, {}), ramda_1.values, setGroupedObjects)([
|
|
46
46
|
entityObjectsWithRelations,
|
|
@@ -52,7 +52,10 @@ var useChangeRequest = function (dcrUri) {
|
|
|
52
52
|
setDcr(dcr);
|
|
53
53
|
})
|
|
54
54
|
.catch(errors_1.showErrorMessage);
|
|
55
|
-
}, [dcrUri, requestEntities]);
|
|
56
|
-
|
|
55
|
+
}, [dcrUri, requestEntities, safePromise]);
|
|
56
|
+
(0, react_1.useEffect)(function () {
|
|
57
|
+
loadDcr();
|
|
58
|
+
}, [loadDcr]);
|
|
59
|
+
return { dcr: dcr, groupedObjects: groupedObjects, reloadDcr: loadDcr };
|
|
57
60
|
};
|
|
58
61
|
exports.useChangeRequest = useChangeRequest;
|
|
@@ -129,7 +129,8 @@ describe('useChangeRequest tests', function () {
|
|
|
129
129
|
expect(mdm_sdk_1.getEntitiesByUris).not.toHaveBeenCalled();
|
|
130
130
|
expect(result.current).toEqual({
|
|
131
131
|
dcr: null,
|
|
132
|
-
groupedObjects: []
|
|
132
|
+
groupedObjects: [],
|
|
133
|
+
reloadDcr: expect.any(Function)
|
|
133
134
|
});
|
|
134
135
|
});
|
|
135
136
|
it('should return empty parameters if dcrUri is undefined', function () {
|
|
@@ -138,7 +139,8 @@ describe('useChangeRequest tests', function () {
|
|
|
138
139
|
expect(mdm_sdk_1.getEntitiesByUris).not.toHaveBeenCalled();
|
|
139
140
|
expect(result.current).toEqual({
|
|
140
141
|
dcr: null,
|
|
141
|
-
groupedObjects: []
|
|
142
|
+
groupedObjects: [],
|
|
143
|
+
reloadDcr: expect.any(Function)
|
|
142
144
|
});
|
|
143
145
|
});
|
|
144
146
|
it('should go to error message in case of getDataChangeRequest error', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -161,7 +163,8 @@ describe('useChangeRequest tests', function () {
|
|
|
161
163
|
});
|
|
162
164
|
expect(result.current).toEqual({
|
|
163
165
|
dcr: null,
|
|
164
|
-
groupedObjects: []
|
|
166
|
+
groupedObjects: [],
|
|
167
|
+
reloadDcr: expect.any(Function)
|
|
165
168
|
});
|
|
166
169
|
return [2 /*return*/];
|
|
167
170
|
}
|
|
@@ -200,7 +203,8 @@ describe('useChangeRequest tests', function () {
|
|
|
200
203
|
});
|
|
201
204
|
expect(result.current).toEqual({
|
|
202
205
|
dcr: dcr,
|
|
203
|
-
groupedObjects: []
|
|
206
|
+
groupedObjects: [],
|
|
207
|
+
reloadDcr: expect.any(Function)
|
|
204
208
|
});
|
|
205
209
|
return [2 /*return*/];
|
|
206
210
|
}
|
|
@@ -236,6 +240,7 @@ describe('useChangeRequest tests', function () {
|
|
|
236
240
|
expect(ErrorPopup_1.ErrorPopup.addError).not.toHaveBeenCalled();
|
|
237
241
|
expect(result.current).toEqual({
|
|
238
242
|
dcr: dcr,
|
|
243
|
+
reloadDcr: expect.any(Function),
|
|
239
244
|
groupedObjects: [
|
|
240
245
|
{
|
|
241
246
|
entity: {
|
|
@@ -269,7 +274,8 @@ describe('useChangeRequest tests', function () {
|
|
|
269
274
|
},
|
|
270
275
|
{
|
|
271
276
|
entity: {
|
|
272
|
-
uri: 'entities/151gdPs5'
|
|
277
|
+
uri: 'entities/151gdPs5',
|
|
278
|
+
isExist: true
|
|
273
279
|
},
|
|
274
280
|
relations: [
|
|
275
281
|
{
|
|
@@ -4,9 +4,10 @@ type Task = Partial<Pick<WorkflowTaskData, 'taskId' | 'possibleActions' | 'assig
|
|
|
4
4
|
type Props = {
|
|
5
5
|
task: Task;
|
|
6
6
|
onActionSuccess?: (action: string) => void;
|
|
7
|
+
onError?: () => void;
|
|
7
8
|
beforeAction?: () => Promise<BeforeActionOutcome>;
|
|
8
9
|
};
|
|
9
|
-
export declare const useWorkflowActions: ({ task, onActionSuccess, beforeAction }: Props) => {
|
|
10
|
+
export declare const useWorkflowActions: ({ task, onActionSuccess, onError, beforeAction }: Props) => {
|
|
10
11
|
actions: TaskAction[];
|
|
11
12
|
actionRequestIsInProgress: boolean;
|
|
12
13
|
};
|
|
@@ -46,7 +46,7 @@ var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
|
46
46
|
var CommentDialogContext_1 = require("../../../contexts/CommentDialogContext");
|
|
47
47
|
var errors_2 = require("../../../helpers/errors");
|
|
48
48
|
var useWorkflowActions = function (_a) {
|
|
49
|
-
var task = _a.task, onActionSuccess = _a.onActionSuccess, beforeAction = _a.beforeAction;
|
|
49
|
+
var task = _a.task, onActionSuccess = _a.onActionSuccess, onError = _a.onError, beforeAction = _a.beforeAction;
|
|
50
50
|
var _b = task !== null && task !== void 0 ? task : {}, possibleActions = _b.possibleActions, assignee = _b.assignee, taskId = _b.taskId, isOpen = _b.isOpen;
|
|
51
51
|
var workflowTasks = (0, react_1.useContext)(WorkflowTasksContext_1.WorkflowTasksContext);
|
|
52
52
|
var workflowPath = (0, MdmModuleContext_1.useMdmWorkflowPath)();
|
|
@@ -85,6 +85,7 @@ var useWorkflowActions = function (_a) {
|
|
|
85
85
|
if (!outcome.proceed) {
|
|
86
86
|
if (outcome.error) {
|
|
87
87
|
(0, errors_2.showDefaultErrorMessage)(outcome.error);
|
|
88
|
+
onError === null || onError === void 0 ? void 0 : onError();
|
|
88
89
|
}
|
|
89
90
|
setActionRequestIsInProgress(false);
|
|
90
91
|
return [2 /*return*/];
|
|
@@ -93,6 +94,7 @@ var useWorkflowActions = function (_a) {
|
|
|
93
94
|
case 5:
|
|
94
95
|
error_1 = _a.sent();
|
|
95
96
|
(0, errors_2.showDefaultErrorMessage)(error_1);
|
|
97
|
+
onError === null || onError === void 0 ? void 0 : onError();
|
|
96
98
|
setActionRequestIsInProgress(false);
|
|
97
99
|
return [2 /*return*/];
|
|
98
100
|
case 6:
|
|
@@ -107,7 +109,10 @@ var useWorkflowActions = function (_a) {
|
|
|
107
109
|
.then(function () {
|
|
108
110
|
handleActionSuccess === null || handleActionSuccess === void 0 ? void 0 : handleActionSuccess(action);
|
|
109
111
|
})
|
|
110
|
-
.catch(
|
|
112
|
+
.catch(function (error) {
|
|
113
|
+
(0, errors_1.showWorkflowError)(error);
|
|
114
|
+
onError === null || onError === void 0 ? void 0 : onError();
|
|
115
|
+
})
|
|
111
116
|
.finally(function () {
|
|
112
117
|
setActionRequestIsInProgress(false);
|
|
113
118
|
});
|
|
@@ -116,7 +121,7 @@ var useWorkflowActions = function (_a) {
|
|
|
116
121
|
}
|
|
117
122
|
});
|
|
118
123
|
}); };
|
|
119
|
-
}, [workflowPath, taskId, environment, tenant, handleActionSuccess, showCommentDialog, beforeAction]);
|
|
124
|
+
}, [workflowPath, taskId, environment, tenant, handleActionSuccess, showCommentDialog, beforeAction, onError]);
|
|
120
125
|
var actions = (0, react_1.useMemo)(function () {
|
|
121
126
|
return username === assignee && (0, common_1.isOpenTask)(isOpen)
|
|
122
127
|
? (possibleActions || []).map(function (_a) {
|
package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js
CHANGED
|
@@ -16,7 +16,7 @@ import { getDCRUri } from '../../../helpers/common';
|
|
|
16
16
|
import { getAvailableAttributeTypesForEntity, getAvailableAttributeTypesForRelation, getAvailableSubAttributesForNestedOrReference } from '../../../helpers/moreAttributesScope';
|
|
17
17
|
import { isDiffChange, isRelationRow, isNestedOrReferenceParent } from '../../helpers/helpers';
|
|
18
18
|
import { prepareChangesList } from '../../helpers/changesList';
|
|
19
|
-
import { extractChangeOverrides, getAddedId,
|
|
19
|
+
import { extractChangeOverrides, getAddedId, getParentAddedId, getParentChangeOverrides, getParentLineId, isRootAddedAttribute } from '../../helpers/addedAttributes';
|
|
20
20
|
import { extractLineIds } from '../../../helpers/merge';
|
|
21
21
|
import { useDcrReviewAllowAddAttributes } from '../../hooks/useDcrReviewAllowAddAttributes';
|
|
22
22
|
import { MoreAttributesEditor } from '../editors';
|
|
@@ -35,6 +35,22 @@ export var EntityChangesGroup = function (_a) {
|
|
|
35
35
|
relationsInfo: relationsInfo
|
|
36
36
|
});
|
|
37
37
|
var changesList = useMemo(function () { return prepareChangesList(rawChangesList); }, [rawChangesList]);
|
|
38
|
+
var objectUriByChangeIndex = useMemo(function () {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
var result = [];
|
|
41
|
+
var currentObjectUri = entityInfo.uri;
|
|
42
|
+
for (var _i = 0, changesList_1 = changesList; _i < changesList_1.length; _i++) {
|
|
43
|
+
var item = changesList_1[_i];
|
|
44
|
+
if (!isDiffChange(item)) {
|
|
45
|
+
currentObjectUri = entityInfo.uri;
|
|
46
|
+
}
|
|
47
|
+
else if (isRelationRow(item)) {
|
|
48
|
+
currentObjectUri = (_b = (_a = item.attributeValue) === null || _a === void 0 ? void 0 : _a.uri) !== null && _b !== void 0 ? _b : entityInfo.uri;
|
|
49
|
+
}
|
|
50
|
+
result.push(currentObjectUri);
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}, [changesList, entityInfo.uri]);
|
|
38
54
|
var entityAttributeTypes = useMemo(function () {
|
|
39
55
|
if (!isNil(entityInfo.isExist)) {
|
|
40
56
|
return getAvailableAttributeTypesForEntity(metadata, entityInfo.type);
|
|
@@ -64,7 +80,7 @@ export var EntityChangesGroup = function (_a) {
|
|
|
64
80
|
highlight(addedIds);
|
|
65
81
|
};
|
|
66
82
|
}, [addAddedAttributes, highlight]);
|
|
67
|
-
var handleAddNestedAttributes = useCallback(function (change) { return function (attributeTypes) {
|
|
83
|
+
var handleAddNestedAttributes = useCallback(function (change, objectUri) { return function (attributeTypes) {
|
|
68
84
|
var _a, _b, _c, _d, _e;
|
|
69
85
|
var parentUri = (_a = change.attributeType) === null || _a === void 0 ? void 0 : _a.uri;
|
|
70
86
|
var parentAttrs = attributeTypes.filter(function (attr) { return attr.uri === parentUri; });
|
|
@@ -76,7 +92,7 @@ export var EntityChangesGroup = function (_a) {
|
|
|
76
92
|
var addedId = getAddedId(change);
|
|
77
93
|
if (lineId && isRootAddedAttribute(lineId)) {
|
|
78
94
|
handleAddAttributes({
|
|
79
|
-
objectUri:
|
|
95
|
+
objectUri: objectUri,
|
|
80
96
|
changeOverrides: siblingOverrides
|
|
81
97
|
})(parentAttrs);
|
|
82
98
|
}
|
|
@@ -89,7 +105,7 @@ export var EntityChangesGroup = function (_a) {
|
|
|
89
105
|
}
|
|
90
106
|
else {
|
|
91
107
|
handleAddAttributes({
|
|
92
|
-
objectUri:
|
|
108
|
+
objectUri: objectUri,
|
|
93
109
|
changeOverrides: siblingOverrides
|
|
94
110
|
})(parentAttrs);
|
|
95
111
|
}
|
|
@@ -102,12 +118,12 @@ export var EntityChangesGroup = function (_a) {
|
|
|
102
118
|
}
|
|
103
119
|
else {
|
|
104
120
|
handleAddAttributes({
|
|
105
|
-
objectUri:
|
|
121
|
+
objectUri: objectUri,
|
|
106
122
|
changeOverrides: childOverrides
|
|
107
123
|
})(subAttrs);
|
|
108
124
|
}
|
|
109
125
|
}
|
|
110
|
-
}; }, [handleAddAttributes
|
|
126
|
+
}; }, [handleAddAttributes]);
|
|
111
127
|
return (React.createElement(AttributesChangesContext.Provider, { value: objectsInfo },
|
|
112
128
|
React.createElement(Accordion, { className: styles.entityGroup, defaultExpanded: true, "data-reltio-id": "entity-changes-group" },
|
|
113
129
|
React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, null), className: styles.entityHeader, classes: {
|
|
@@ -134,6 +150,6 @@ export var EntityChangesGroup = function (_a) {
|
|
|
134
150
|
objectUri: (_e = item === null || item === void 0 ? void 0 : item.attributeValue) === null || _e === void 0 ? void 0 : _e.uri,
|
|
135
151
|
parentLineId: (_f = item.lineIds) === null || _f === void 0 ? void 0 : _f[0]
|
|
136
152
|
}) })),
|
|
137
|
-
allowAddAttributes && isNestedOrReferenceParent(item) && (React.createElement(MoreAttributesEditor, { data: nestedAttrs, change: item, parent: item.attributeType, onApply: handleAddNestedAttributes(item) }))));
|
|
153
|
+
allowAddAttributes && isNestedOrReferenceParent(item) && (React.createElement(MoreAttributesEditor, { data: nestedAttrs, change: item, parent: item.attributeType, onApply: handleAddNestedAttributes(item, objectUriByChangeIndex[index]) }))));
|
|
138
154
|
})))));
|
|
139
155
|
};
|
|
@@ -52,10 +52,13 @@ export var getParentChangeOverrides = function (change) {
|
|
|
52
52
|
if (change.refAttributeType) {
|
|
53
53
|
var parts = change.refAttributeType.split('/');
|
|
54
54
|
if (parts.length > 2) {
|
|
55
|
-
|
|
55
|
+
var parentRefAttributeType = parts.slice(0, -2).join('/');
|
|
56
|
+
if (parentRefAttributeType.includes('/attributes/')) {
|
|
57
|
+
result.refAttributeType = parentRefAttributeType;
|
|
58
|
+
}
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
|
-
if (change.refObjectURI) {
|
|
61
|
+
if (result.refAttributeType && change.refObjectURI) {
|
|
59
62
|
result.refObjectURI = change.refObjectURI;
|
|
60
63
|
}
|
|
61
64
|
return Object.keys(result).length > 0 ? result : undefined;
|
|
@@ -9,6 +9,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
12
21
|
import { DCROperationTypes, isComplexAttribute, isImage, isRoleAttrType, isTagAttrType } from '@reltio/mdm-sdk';
|
|
13
22
|
import { getOperationType } from '../../helpers/common';
|
|
14
23
|
import { isDiffChange } from './helpers';
|
|
@@ -127,23 +136,30 @@ var extractPathFromInnerChange = function (attributeValue) {
|
|
|
127
136
|
return __assign(__assign({ attributePath: inner.attributePath }, (inner.refAttributeType && { refAttributeType: inner.refAttributeType })), (inner.refObjectURI && { refObjectURI: inner.refObjectURI }));
|
|
128
137
|
};
|
|
129
138
|
var fillParentPaths = function (items) {
|
|
130
|
-
|
|
131
|
-
|
|
139
|
+
var _a, _b;
|
|
140
|
+
var result = __spreadArray([], items, true);
|
|
141
|
+
for (var index = result.length - 1; index >= 0; index--) {
|
|
142
|
+
var item = result[index];
|
|
132
143
|
if (!isDiffChange(item) || !isComplexAttribute(item.attributeType) || item.attributePath)
|
|
133
|
-
|
|
144
|
+
continue;
|
|
134
145
|
var innerPath = extractPathFromInnerChange(item.attributeValue);
|
|
135
|
-
if (innerPath)
|
|
136
|
-
|
|
137
|
-
|
|
146
|
+
if (innerPath) {
|
|
147
|
+
result[index] = __assign(__assign({}, item), innerPath);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
var name_1 = (_a = item.attributeType) === null || _a === void 0 ? void 0 : _a.name;
|
|
138
151
|
var instanceId = (_b = item.attributeValue) === null || _b === void 0 ? void 0 : _b.id;
|
|
139
|
-
if (!
|
|
140
|
-
|
|
141
|
-
var descendant = findDescendantWithPath(
|
|
152
|
+
if (!name_1 || !instanceId)
|
|
153
|
+
continue;
|
|
154
|
+
var descendant = findDescendantWithPath(result, index, item.level);
|
|
142
155
|
if (!descendant)
|
|
143
|
-
|
|
144
|
-
var parentPath = deriveParentPath(descendant,
|
|
145
|
-
|
|
146
|
-
|
|
156
|
+
continue;
|
|
157
|
+
var parentPath = deriveParentPath(descendant, name_1, instanceId);
|
|
158
|
+
if (parentPath) {
|
|
159
|
+
result[index] = __assign(__assign({}, item), parentPath);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
147
163
|
};
|
|
148
164
|
export var prepareChangesList = function (rawChangesList) {
|
|
149
165
|
var withPaths = fillParentPaths(rawChangesList);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DCRTypes, type AttributeType } from '@reltio/mdm-sdk';
|
|
2
|
+
import type { Diff } from '../../types';
|
|
3
|
+
export declare const referenceAttributeType: AttributeType;
|
|
4
|
+
export declare const referenceAttributeValue: {
|
|
5
|
+
id: string;
|
|
6
|
+
value: {
|
|
7
|
+
RefFirstLevelNested: {
|
|
8
|
+
id: string;
|
|
9
|
+
value: {
|
|
10
|
+
FirstLevelNestedSub2: {
|
|
11
|
+
id: string;
|
|
12
|
+
value: {
|
|
13
|
+
id: string;
|
|
14
|
+
refObjectURI: string;
|
|
15
|
+
type: DCRTypes;
|
|
16
|
+
objectType: string;
|
|
17
|
+
attributePath: string;
|
|
18
|
+
oldValue: {
|
|
19
|
+
value: string;
|
|
20
|
+
lineIds: string[];
|
|
21
|
+
};
|
|
22
|
+
newValue: {
|
|
23
|
+
value: string;
|
|
24
|
+
lineIds: string[];
|
|
25
|
+
};
|
|
26
|
+
attributeType: string;
|
|
27
|
+
refAttributeType: string;
|
|
28
|
+
lineIds: string[];
|
|
29
|
+
};
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
34
|
+
refObjectURI: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const affiliationsChangeRow: Diff;
|
|
37
|
+
export declare const deepNestedParentFromChildChanges: () => Diff[];
|
|
38
|
+
export declare const deepNestedInnerChangeRow: () => Diff[];
|
|
39
|
+
export declare const addressDeepNestedThreeLevelChanges: () => Diff[];
|
|
40
|
+
export declare const addressDeepNestedRefPropagationChanges: () => Diff[];
|
|
41
|
+
export declare const deepNestedRowWithExistingPath: () => Diff[];
|