@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
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { DCROperationTypes, DCRTypes } from '@reltio/mdm-sdk';
|
|
2
|
+
export var referenceAttributeType = {
|
|
3
|
+
uri: 'configuration/entityTypes/HCP/attributes/Affiliations',
|
|
4
|
+
name: 'Affiliations',
|
|
5
|
+
label: 'HCP to HCA Affiliations',
|
|
6
|
+
type: 'Reference',
|
|
7
|
+
referencedEntityTypeURI: 'configuration/entityTypes/HCA',
|
|
8
|
+
relationshipTypeURI: 'configuration/relationTypes/HCPtoHCA'
|
|
9
|
+
};
|
|
10
|
+
export var referenceAttributeValue = {
|
|
11
|
+
id: '0HocGCj',
|
|
12
|
+
value: {
|
|
13
|
+
RefFirstLevelNested: [
|
|
14
|
+
{
|
|
15
|
+
id: '2Cf73Q29',
|
|
16
|
+
value: {
|
|
17
|
+
FirstLevelNestedSub2: [
|
|
18
|
+
{
|
|
19
|
+
id: '2ph3wL7h',
|
|
20
|
+
value: {
|
|
21
|
+
id: '0aDhfxd',
|
|
22
|
+
refObjectURI: 'relations/0HocGCj',
|
|
23
|
+
type: DCRTypes.UPDATE_ATTRIBUTE,
|
|
24
|
+
objectType: 'configuration/entityTypes/HCP',
|
|
25
|
+
attributePath: 'RefFirstLevelNested/2Cf73Q29/FirstLevelNestedSub2/2ph3wL7h',
|
|
26
|
+
oldValue: { value: '555756', lineIds: ['BAliEK2/0aDhfxd/oldValue'] },
|
|
27
|
+
newValue: { value: '5557563462', lineIds: ['BAliEK2/0aDhfxd/newValue'] },
|
|
28
|
+
attributeType: 'configuration/relationTypes/HCPtoHCA/attributes/RefFirstLevelNested/attributes/FirstLevelNestedSub2',
|
|
29
|
+
refAttributeType: 'configuration/entityTypes/HCP/attributes/Affiliations/attributes/RefFirstLevelNested/attributes/FirstLevelNestedSub2',
|
|
30
|
+
lineIds: ['BAliEK2/0aDhfxd']
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
refObjectURI: 'relations/0HocGCj'
|
|
39
|
+
};
|
|
40
|
+
export var affiliationsChangeRow = {
|
|
41
|
+
level: 0,
|
|
42
|
+
label: 'HCP to HCA Affiliations',
|
|
43
|
+
attributeType: referenceAttributeType,
|
|
44
|
+
attributeValue: referenceAttributeValue,
|
|
45
|
+
operation: DCROperationTypes.EDITED,
|
|
46
|
+
isReferenceSubAttribute: false
|
|
47
|
+
};
|
|
48
|
+
var nestedAttributeType = function (name) {
|
|
49
|
+
return ({
|
|
50
|
+
uri: "configuration/entityTypes/HCP/attributes/".concat(name),
|
|
51
|
+
name: name,
|
|
52
|
+
label: name,
|
|
53
|
+
type: 'Nested'
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var firstLevelNestedSub2FloatType = {
|
|
57
|
+
uri: 'configuration/relationTypes/HCPtoHCA/attributes/RefFirstLevelNested/attributes/FirstLevelNestedSub2',
|
|
58
|
+
name: 'FirstLevelNestedSub2',
|
|
59
|
+
label: 'float',
|
|
60
|
+
type: 'Float'
|
|
61
|
+
};
|
|
62
|
+
export var deepNestedParentFromChildChanges = function () { return [
|
|
63
|
+
{
|
|
64
|
+
level: 1,
|
|
65
|
+
label: 'DeepNested',
|
|
66
|
+
attributeType: nestedAttributeType('DeepNested'),
|
|
67
|
+
attributeValue: { id: '2ph3uHFx', value: { FirstLevelNestedSub2: [] } },
|
|
68
|
+
operation: DCROperationTypes.EDITED,
|
|
69
|
+
isReferenceSubAttribute: false
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
level: 2,
|
|
73
|
+
label: 'FirstLevelNestedSub2',
|
|
74
|
+
attributeType: firstLevelNestedSub2FloatType,
|
|
75
|
+
attributePath: 'DeepNested/2ph3uHFx/FirstLevelNestedSub2/2ph3uPmT',
|
|
76
|
+
operation: DCROperationTypes.EDITED,
|
|
77
|
+
isReferenceSubAttribute: false
|
|
78
|
+
}
|
|
79
|
+
]; };
|
|
80
|
+
export var deepNestedInnerChangeRow = function () { return [
|
|
81
|
+
{
|
|
82
|
+
level: 1,
|
|
83
|
+
label: 'DeepNested',
|
|
84
|
+
attributeType: nestedAttributeType('DeepNested'),
|
|
85
|
+
attributeValue: {
|
|
86
|
+
id: '4FcgXO5o',
|
|
87
|
+
value: {
|
|
88
|
+
attributePath: 'DeepNested/4FcgXO5o/SecondLevelNested',
|
|
89
|
+
refAttributeType: 'configuration/entityTypes/HCP/attributes/Address/attributes/DeepNested/attributes/SecondLevelNested',
|
|
90
|
+
refObjectURI: 'relations/0LbuUWU'
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
operation: DCROperationTypes.EDITED,
|
|
94
|
+
isReferenceSubAttribute: false
|
|
95
|
+
}
|
|
96
|
+
]; };
|
|
97
|
+
export var addressDeepNestedThreeLevelChanges = function () { return [
|
|
98
|
+
{
|
|
99
|
+
level: 1,
|
|
100
|
+
label: 'DeepNested',
|
|
101
|
+
attributeType: nestedAttributeType('DeepNested'),
|
|
102
|
+
attributeValue: { id: '4FcgXO5o', value: { SecondLevelNested: [] } },
|
|
103
|
+
operation: DCROperationTypes.EDITED,
|
|
104
|
+
isReferenceSubAttribute: false
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
level: 2,
|
|
108
|
+
label: 'SecondLevelNested',
|
|
109
|
+
attributeType: nestedAttributeType('SecondLevelNested'),
|
|
110
|
+
attributeValue: { id: '2v13QcOX', value: { FirstLevelNestedSubatr3: [] } },
|
|
111
|
+
operation: DCROperationTypes.EDITED,
|
|
112
|
+
isReferenceSubAttribute: false
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
level: 3,
|
|
116
|
+
label: 'FirstLevelNestedSubatr3',
|
|
117
|
+
attributeType: nestedAttributeType('FirstLevelNestedSubatr3'),
|
|
118
|
+
attributePath: 'DeepNested/4FcgXO5o/SecondLevelNested/2v13QcOX/FirstLevelNestedSubatr3/2v13Qgen',
|
|
119
|
+
operation: DCROperationTypes.EDITED,
|
|
120
|
+
isReferenceSubAttribute: false
|
|
121
|
+
}
|
|
122
|
+
]; };
|
|
123
|
+
export var addressDeepNestedRefPropagationChanges = function () { return [
|
|
124
|
+
{
|
|
125
|
+
level: 1,
|
|
126
|
+
label: 'DeepNested',
|
|
127
|
+
attributeType: nestedAttributeType('DeepNested'),
|
|
128
|
+
attributeValue: { id: '2ph3uHFx', value: { FirstLevelNestedSub2: [] } },
|
|
129
|
+
operation: DCROperationTypes.EDITED,
|
|
130
|
+
isReferenceSubAttribute: false
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
level: 2,
|
|
134
|
+
label: 'FirstLevelNestedSub2',
|
|
135
|
+
attributeType: firstLevelNestedSub2FloatType,
|
|
136
|
+
attributePath: 'DeepNested/2ph3uHFx/FirstLevelNestedSub2/2ph3uPmT',
|
|
137
|
+
refAttributeType: 'configuration/entityTypes/HCP/attributes/Address/attributes/DeepNested/attributes/FirstLevelNestedSub2',
|
|
138
|
+
refObjectURI: 'relations/0LbuUWU',
|
|
139
|
+
operation: DCROperationTypes.EDITED,
|
|
140
|
+
isReferenceSubAttribute: false
|
|
141
|
+
}
|
|
142
|
+
]; };
|
|
143
|
+
export var deepNestedRowWithExistingPath = function () { return [
|
|
144
|
+
{
|
|
145
|
+
level: 1,
|
|
146
|
+
label: 'DeepNested',
|
|
147
|
+
attributeType: nestedAttributeType('DeepNested'),
|
|
148
|
+
attributeValue: { id: '2ph3uHFx', value: { FirstLevelNestedSub2: [] } },
|
|
149
|
+
attributePath: 'DeepNested/2ph3uHFx',
|
|
150
|
+
operation: DCROperationTypes.EDITED,
|
|
151
|
+
isReferenceSubAttribute: false
|
|
152
|
+
}
|
|
153
|
+
]; };
|
|
@@ -9,8 +9,18 @@ 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 { DataTypes, DCROperationTypes } from '@reltio/mdm-sdk';
|
|
13
22
|
import { prepareChangesList } from './changesList';
|
|
23
|
+
import { addressDeepNestedRefPropagationChanges, addressDeepNestedThreeLevelChanges, affiliationsChangeRow, deepNestedInnerChangeRow, deepNestedParentFromChildChanges, deepNestedRowWithExistingPath } from './changesList.test-data';
|
|
14
24
|
var createDiff = function (overrides) {
|
|
15
25
|
if (overrides === void 0) { overrides = {}; }
|
|
16
26
|
return (__assign({ level: 0, label: 'Test', attributeType: {
|
|
@@ -198,4 +208,46 @@ describe('prepareChangesList', function () {
|
|
|
198
208
|
expect((_b = result[1].displayOptions) === null || _b === void 0 ? void 0 : _b.hasSameAttributeSiblings).toBe(false);
|
|
199
209
|
});
|
|
200
210
|
});
|
|
211
|
+
describe('fillParentPaths', function () {
|
|
212
|
+
it('fills parent without attributePath from descendant when value is not inner DCR change', function () {
|
|
213
|
+
var result = prepareChangesList(deepNestedParentFromChildChanges());
|
|
214
|
+
expect(result[0].attributePath).toBe('DeepNested/2ph3uHFx');
|
|
215
|
+
});
|
|
216
|
+
it('fills nested-in-nested parents without paths when only leaf has attributePath (reverse pass)', function () {
|
|
217
|
+
var result = prepareChangesList(addressDeepNestedThreeLevelChanges());
|
|
218
|
+
expect(result[0].attributePath).toBe('DeepNested/4FcgXO5o');
|
|
219
|
+
expect(result[1].attributePath).toBe('DeepNested/4FcgXO5o/SecondLevelNested/2v13QcOX');
|
|
220
|
+
});
|
|
221
|
+
it('fills path from attributeValue.value when inner change carries attributePath', function () {
|
|
222
|
+
var result = prepareChangesList(deepNestedInnerChangeRow());
|
|
223
|
+
expect(result[0].attributePath).toBe('DeepNested/4FcgXO5o/SecondLevelNested');
|
|
224
|
+
expect(result[0].refAttributeType).toBe('configuration/entityTypes/HCP/attributes/Address/attributes/DeepNested/attributes/SecondLevelNested');
|
|
225
|
+
expect(result[0].refObjectURI).toBe('relations/0LbuUWU');
|
|
226
|
+
});
|
|
227
|
+
it('fills parent path and ref fields via descendant when inner change path is absent', function () {
|
|
228
|
+
var result = prepareChangesList(addressDeepNestedRefPropagationChanges());
|
|
229
|
+
expect(result[0].attributePath).toBe('DeepNested/2ph3uHFx');
|
|
230
|
+
expect(result[0].refAttributeType).toBe('configuration/entityTypes/HCP/attributes/Address/attributes/DeepNested');
|
|
231
|
+
expect(result[0].refObjectURI).toBe('relations/0LbuUWU');
|
|
232
|
+
});
|
|
233
|
+
it('does not change attributePath when already set on complex row', function () {
|
|
234
|
+
var result = prepareChangesList(deepNestedRowWithExistingPath());
|
|
235
|
+
expect(result[0].attributePath).toBe('DeepNested/2ph3uHFx');
|
|
236
|
+
});
|
|
237
|
+
it('leaves reference row paths unset and still fills following nested rows', function () {
|
|
238
|
+
var _a, _b, _c;
|
|
239
|
+
var affOnly = prepareChangesList([affiliationsChangeRow]);
|
|
240
|
+
expect(affOnly).toHaveLength(1);
|
|
241
|
+
var aff = affOnly[0];
|
|
242
|
+
expect(aff.attributePath).toBeUndefined();
|
|
243
|
+
expect((_a = aff.displayOptions) === null || _a === void 0 ? void 0 : _a.showLabel).toBe(false);
|
|
244
|
+
expect((_b = aff.displayOptions) === null || _b === void 0 ? void 0 : _b.showAddButton).toBe(false);
|
|
245
|
+
expect((_c = aff.displayOptions) === null || _c === void 0 ? void 0 : _c.hasSameAttributeSiblings).toBe(false);
|
|
246
|
+
var combined = prepareChangesList(__spreadArray([affiliationsChangeRow], deepNestedParentFromChildChanges(), true));
|
|
247
|
+
expect(combined).toHaveLength(3);
|
|
248
|
+
expect(combined[0].attributePath).toBeUndefined();
|
|
249
|
+
expect(combined[1].attributePath).toBe('DeepNested/2ph3uHFx');
|
|
250
|
+
expect(combined[0].operation).toBe(DCROperationTypes.EDITED);
|
|
251
|
+
});
|
|
252
|
+
});
|
|
201
253
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DCRChanges, type EnrichedDCRChanges, type GroupedObjectsInfo, type Metadata, type SimpleAttributeValue, type TEntityType } from '@reltio/mdm-sdk';
|
|
2
|
-
export declare const isSimpleAttributeValue: (value: unknown) => value is SimpleAttributeValue;
|
|
3
2
|
import type { Diff, Title } from '../../types';
|
|
3
|
+
export declare const isSimpleAttributeValue: (value: unknown) => value is SimpleAttributeValue;
|
|
4
4
|
export declare const isEditableChange: (change: Diff, entityInfo: GroupedObjectsInfo["entity"]) => boolean;
|
|
5
5
|
export declare const addLineIdToValue: (data: DCRChanges | EnrichedDCRChanges) => EnrichedDCRChanges;
|
|
6
6
|
export declare const isDiffChange: (change: Diff | Title) => change is Diff;
|
|
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { clone, has, isNil } from 'ramda';
|
|
13
13
|
import { DCROperationTypes, DCRTypes, isComplexAttribute, isImage, isRelationTypeUri, MetadataPermissions, checkMetadataPermission, isRoleAttrType, isTagAttrType, checkSubAttributesPermissions } from '@reltio/mdm-sdk';
|
|
14
|
+
import { isPrimitiveValue } from '../../helpers/common';
|
|
14
15
|
export var isSimpleAttributeValue = function (value) {
|
|
15
16
|
return value !== null && typeof value === 'object' && 'value' in value;
|
|
16
17
|
};
|
|
@@ -24,9 +25,6 @@ export var isEditableChange = function (change, entityInfo) {
|
|
|
24
25
|
!isRelationTypeUri(currentAttributeTypeUri);
|
|
25
26
|
return !!currentAttributeTypeUri && !isExistingReferenceEntityChange && !isNil(change.newValue);
|
|
26
27
|
};
|
|
27
|
-
var isPrimitiveValue = function (value) {
|
|
28
|
-
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';
|
|
29
|
-
};
|
|
30
28
|
var addLineIdRecursively = function (value, basePath) {
|
|
31
29
|
if (value == null)
|
|
32
30
|
return value;
|
|
@@ -6,6 +6,7 @@ type Props = {
|
|
|
6
6
|
dcr: ChangeRequest;
|
|
7
7
|
task: WorkflowTaskData;
|
|
8
8
|
groupedObjects: GroupedObjectsInfo[];
|
|
9
|
+
onReloadDcr?: () => void;
|
|
9
10
|
};
|
|
10
|
-
export declare const ReviewDCRDialog: ({ open, onClose, dcr, task, groupedObjects }: Props) => React.JSX.Element;
|
|
11
|
+
export declare const ReviewDCRDialog: ({ open, onClose, dcr, task, groupedObjects, onReloadDcr }: Props) => React.JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import Dialog from '@mui/material/Dialog';
|
|
3
3
|
import DialogTitle from '@mui/material/DialogTitle';
|
|
4
4
|
import DialogContent from '@mui/material/DialogContent';
|
|
5
5
|
import Typography from '@mui/material/Typography';
|
|
6
|
+
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
6
7
|
import { SmallIconButtonWithTooltip } from '../../../SmallIconButton';
|
|
7
8
|
import CloseIcon from '@mui/icons-material/Close';
|
|
8
9
|
import i18n from 'ui-i18n';
|
|
@@ -19,13 +20,22 @@ import { DCRSummaryInfo } from './components/DCRSummaryInfo/DCRSummaryInfo';
|
|
|
19
20
|
import { ChangeRequestEditor } from '../ChangeRequestEditor';
|
|
20
21
|
import { useApplyDcrChanges } from '../hooks/useApplyDcrChanges';
|
|
21
22
|
import { DCRErrorsPanel } from './DCRErrorsPanel/DCRErrorsPanel';
|
|
23
|
+
import { AddedAttributesContext } from '../contexts/AddedAttributesContext';
|
|
24
|
+
import { ChangeRequestEditorContext } from '../contexts/ChangeRequestEditorContext';
|
|
22
25
|
import styles from './ReviewDCRDialog.module.css';
|
|
23
26
|
export var ReviewDCRDialog = function (_a) {
|
|
24
|
-
var open = _a.open, onClose = _a.onClose, dcr = _a.dcr, task = _a.task, groupedObjects = _a.groupedObjects;
|
|
27
|
+
var open = _a.open, onClose = _a.onClose, dcr = _a.dcr, task = _a.task, groupedObjects = _a.groupedObjects, onReloadDcr = _a.onReloadDcr;
|
|
25
28
|
var entity = useMdmEntity();
|
|
26
29
|
var checkWorkflowPermission = useWorkflowCheckPermission();
|
|
27
30
|
var canViewComments = checkWorkflowPermission('VIEW_PROCESS_INSTANCE_COMMENTS');
|
|
28
31
|
var applyDcrChanges = useApplyDcrChanges(dcr);
|
|
32
|
+
var resetAddedAttributes = useContextSelector(AddedAttributesContext, function (ctx) { return ctx.resetState; });
|
|
33
|
+
var resetEditorState = useContextSelector(ChangeRequestEditorContext, function (ctx) { return ctx.resetState; });
|
|
34
|
+
var handleError = useCallback(function () {
|
|
35
|
+
resetAddedAttributes();
|
|
36
|
+
resetEditorState();
|
|
37
|
+
onReloadDcr === null || onReloadDcr === void 0 ? void 0 : onReloadDcr();
|
|
38
|
+
}, [resetAddedAttributes, resetEditorState, onReloadDcr]);
|
|
29
39
|
var _b = useWorkflowActions({
|
|
30
40
|
task: {
|
|
31
41
|
taskId: task.taskId,
|
|
@@ -33,7 +43,8 @@ export var ReviewDCRDialog = function (_a) {
|
|
|
33
43
|
assignee: task.assignee,
|
|
34
44
|
isOpen: task.isOpen
|
|
35
45
|
},
|
|
36
|
-
beforeAction: applyDcrChanges
|
|
46
|
+
beforeAction: applyDcrChanges,
|
|
47
|
+
onError: handleError
|
|
37
48
|
}), workflowActions = _b.actions, actionRequestIsInProgress = _b.actionRequestIsInProgress;
|
|
38
49
|
return (React.createElement(Dialog, { open: open, onClose: onClose, fullScreen: true },
|
|
39
50
|
React.createElement(DialogTitle, { className: styles.dialogTitle },
|
|
@@ -26,7 +26,7 @@ export var DataChangeRequestTaskCard = function (_a) {
|
|
|
26
26
|
var _b = useState(false), isReviewDCRDialogOpen = _b[0], setIsReviewDCRDialogOpen = _b[1];
|
|
27
27
|
var objectURIs = task.objectURIs, assignee = task.assignee;
|
|
28
28
|
var dcrUri = getDCRUri(objectURIs);
|
|
29
|
-
var _c = useChangeRequest(dcrUri), dcr = _c.dcr, groupedObjects = _c.groupedObjects;
|
|
29
|
+
var _c = useChangeRequest(dcrUri), dcr = _c.dcr, groupedObjects = _c.groupedObjects, reloadDcr = _c.reloadDcr;
|
|
30
30
|
var handleReviewDCR = useCallback(function () {
|
|
31
31
|
setIsReviewDCRDialogOpen(true);
|
|
32
32
|
}, []);
|
|
@@ -44,5 +44,5 @@ export var DataChangeRequestTaskCard = function (_a) {
|
|
|
44
44
|
React.createElement(ChangeRequestEditorProvider, null,
|
|
45
45
|
React.createElement(ScrollToElementProvider, null,
|
|
46
46
|
React.createElement(ScrollToAddedAttributeProvider, null,
|
|
47
|
-
React.createElement(ReviewDCRDialog, { open: isReviewDCRDialogOpen, onClose: handleCloseReviewDCRDialog, dcr: dcr, groupedObjects: groupedObjects, task: task }))))))));
|
|
47
|
+
React.createElement(ReviewDCRDialog, { open: isReviewDCRDialogOpen, onClose: handleCloseReviewDCRDialog, dcr: dcr, groupedObjects: groupedObjects, task: task, onReloadDcr: reloadDcr }))))))));
|
|
48
48
|
};
|
|
@@ -32,6 +32,7 @@ export type AddedAttributesContextType = {
|
|
|
32
32
|
}) => string[];
|
|
33
33
|
removeAddedAttribute: (id: string) => void;
|
|
34
34
|
updateAddedAttributeRefEntity: (id: string, refEntity: ConnectionEntity) => void;
|
|
35
|
+
resetState: () => void;
|
|
35
36
|
};
|
|
36
37
|
export declare const AddedAttributesContext: import("@fluentui/react-context-selector").Context<AddedAttributesContextType>;
|
|
37
38
|
export declare const AddedAttributesProvider: ({ children }: {
|
|
@@ -30,7 +30,8 @@ export var AddedAttributesContext = createContext({
|
|
|
30
30
|
getAddedAttributes: undefined,
|
|
31
31
|
addAddedAttributes: undefined,
|
|
32
32
|
removeAddedAttribute: undefined,
|
|
33
|
-
updateAddedAttributeRefEntity: undefined
|
|
33
|
+
updateAddedAttributeRefEntity: undefined,
|
|
34
|
+
resetState: undefined
|
|
34
35
|
});
|
|
35
36
|
var getInitialAttributeValue = function (attrType) {
|
|
36
37
|
if (isComplexAttribute(attrType) || isImage(attrType))
|
|
@@ -115,11 +116,15 @@ export var AddedAttributesProvider = function (_a) {
|
|
|
115
116
|
var updateAddedAttributeRefEntity = useCallback(function (id, refEntity) {
|
|
116
117
|
setState(function (prev) { return prev.map(function (attr) { return (attr.id === id ? __assign(__assign({}, attr), { refEntity: refEntity }) : attr); }); });
|
|
117
118
|
}, []);
|
|
119
|
+
var resetState = useCallback(function () {
|
|
120
|
+
setState([]);
|
|
121
|
+
}, []);
|
|
118
122
|
var value = useMemo(function () { return ({
|
|
119
123
|
getAddedAttributes: getAddedAttributes,
|
|
120
124
|
addAddedAttributes: addAddedAttributes,
|
|
121
125
|
removeAddedAttribute: removeAddedAttribute,
|
|
122
|
-
updateAddedAttributeRefEntity: updateAddedAttributeRefEntity
|
|
123
|
-
|
|
126
|
+
updateAddedAttributeRefEntity: updateAddedAttributeRefEntity,
|
|
127
|
+
resetState: resetState
|
|
128
|
+
}); }, [getAddedAttributes, addAddedAttributes, removeAddedAttribute, updateAddedAttributeRefEntity, resetState]);
|
|
124
129
|
return React.createElement(AddedAttributesContext.Provider, { value: value }, children);
|
|
125
130
|
};
|
|
@@ -27,6 +27,7 @@ export type ChangeRequestEditorContextType = {
|
|
|
27
27
|
error: AttributeError;
|
|
28
28
|
lineIds: string[];
|
|
29
29
|
}[];
|
|
30
|
+
resetState: () => void;
|
|
30
31
|
};
|
|
31
32
|
export declare const ChangeRequestEditorContext: import("@fluentui/react-context-selector").Context<ChangeRequestEditorContextType>;
|
|
32
33
|
export declare const ChangeRequestEditorProvider: ({ children }: {
|
|
@@ -14,7 +14,8 @@ export var ChangeRequestEditorContext = createContext({
|
|
|
14
14
|
getAllChanges: undefined,
|
|
15
15
|
setErrors: undefined,
|
|
16
16
|
getErrorByLineId: undefined,
|
|
17
|
-
getErrors: undefined
|
|
17
|
+
getErrors: undefined,
|
|
18
|
+
resetState: undefined
|
|
18
19
|
});
|
|
19
20
|
var emptyArray = [];
|
|
20
21
|
var removeLineDataFromMap = function (map, lineIds) {
|
|
@@ -134,6 +135,10 @@ export var ChangeRequestEditorProvider = function (_a) {
|
|
|
134
135
|
var getErrors = useCallback(function () {
|
|
135
136
|
return errors;
|
|
136
137
|
}, [errors]);
|
|
138
|
+
var resetState = useCallback(function () {
|
|
139
|
+
setLineDataMap(new Map());
|
|
140
|
+
setErrors([]);
|
|
141
|
+
}, []);
|
|
137
142
|
var contextValue = {
|
|
138
143
|
updateChange: updateChange,
|
|
139
144
|
getLineData: getLineData,
|
|
@@ -147,7 +152,8 @@ export var ChangeRequestEditorProvider = function (_a) {
|
|
|
147
152
|
getAllChanges: getAllChanges,
|
|
148
153
|
setErrors: setErrors,
|
|
149
154
|
getErrorByLineId: getErrorByLineId,
|
|
150
|
-
getErrors: getErrors
|
|
155
|
+
getErrors: getErrors,
|
|
156
|
+
resetState: resetState
|
|
151
157
|
};
|
|
152
158
|
return React.createElement(ChangeRequestEditorContext.Provider, { value: contextValue }, children);
|
|
153
159
|
};
|
|
@@ -54,7 +54,7 @@ var dcrAttributesFactory = function (metadata, attributeType, attributeValue, le
|
|
|
54
54
|
switch (attributeType.type) {
|
|
55
55
|
case DataTypes.TYPE_NESTED:
|
|
56
56
|
case DataTypes.TYPE_IMAGE:
|
|
57
|
-
return getNestedAttributeChange(metadata, attributeType, attributeValue, level);
|
|
57
|
+
return getNestedAttributeChange(metadata, attributeType, attributeValue, level, isReferenceSubAttribute);
|
|
58
58
|
case DataTypes.TYPE_REFERENCE:
|
|
59
59
|
return getReferenceAttributeChange(metadata, attributeType, attributeValue, level);
|
|
60
60
|
default: {
|
|
@@ -74,14 +74,15 @@ var extractAddedId = function (attributeValue) {
|
|
|
74
74
|
var innerChange = attributeValue.value;
|
|
75
75
|
return ((_d = (_b = (_a = innerChange === null || innerChange === void 0 ? void 0 : innerChange.newValue) === null || _a === void 0 ? void 0 : _a.addedId) !== null && _b !== void 0 ? _b : (_c = attributeValue.newValue) === null || _c === void 0 ? void 0 : _c.addedId) !== null && _d !== void 0 ? _d : attributeValue.addedId);
|
|
76
76
|
};
|
|
77
|
-
var getNestedAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
77
|
+
var getNestedAttributeChange = function (metadata, attributeType, attributeValue, level, isReferenceSubAttribute) {
|
|
78
|
+
if (isReferenceSubAttribute === void 0) { isReferenceSubAttribute = false; }
|
|
78
79
|
var attributeTypeList = getAttributeTypeSubAttributes({}, attributeType);
|
|
79
80
|
var label = getLabel((attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name));
|
|
80
81
|
var lineIds = extractLineIds(attributeValue);
|
|
81
82
|
var addedId = extractAddedId(attributeValue);
|
|
82
83
|
return [
|
|
83
|
-
__assign({ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds }, (addedId && { addedId: addedId })),
|
|
84
|
-
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1)
|
|
84
|
+
__assign(__assign({ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds }, (isReferenceSubAttribute && { isReferenceSubAttribute: isReferenceSubAttribute })), (addedId && { addedId: addedId })),
|
|
85
|
+
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1, isReferenceSubAttribute)
|
|
85
86
|
];
|
|
86
87
|
};
|
|
87
88
|
var getReferenceAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
@@ -123,6 +123,61 @@ describe('attributes helpers tests', function () {
|
|
|
123
123
|
}
|
|
124
124
|
]);
|
|
125
125
|
});
|
|
126
|
+
it('should mark a nested attribute and its sub-attributes inside a reference attribute as isReferenceSubAttribute=true', function () {
|
|
127
|
+
var metadata = getMetadata();
|
|
128
|
+
var objectInfo = {
|
|
129
|
+
isExist: true,
|
|
130
|
+
label: 'HCA',
|
|
131
|
+
secondaryLabel: '',
|
|
132
|
+
type: 'configuration/entityTypes/HCA',
|
|
133
|
+
uri: 'entities/1hRTSKE5'
|
|
134
|
+
};
|
|
135
|
+
var changes = {
|
|
136
|
+
Address: [
|
|
137
|
+
{
|
|
138
|
+
value: {
|
|
139
|
+
AdditionalAttributes: [
|
|
140
|
+
{
|
|
141
|
+
value: {
|
|
142
|
+
AttributeType: [
|
|
143
|
+
{
|
|
144
|
+
value: {
|
|
145
|
+
newValue: { value: 'TypeA' },
|
|
146
|
+
type: DCRTypes.INSERT_ATTRIBUTE
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
};
|
|
157
|
+
expect(getEntityChanges(metadata, objectInfo, changes)).toEqual([
|
|
158
|
+
{
|
|
159
|
+
attributeType: metadata.entityTypes[0].attributes[4],
|
|
160
|
+
attributeValue: changes.Address[0],
|
|
161
|
+
label: 'Address',
|
|
162
|
+
level: 0
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
attributeType: metadata.relationTypes[0].attributes[0],
|
|
166
|
+
attributeValue: changes.Address[0].value.AdditionalAttributes[0],
|
|
167
|
+
label: 'Additional Attributes',
|
|
168
|
+
level: 1,
|
|
169
|
+
isReferenceSubAttribute: true
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
attributeType: metadata.relationTypes[0].attributes[0].attributes[0],
|
|
173
|
+
label: 'Attribute Type',
|
|
174
|
+
level: 2,
|
|
175
|
+
newValue: changes.Address[0].value.AdditionalAttributes[0].value.AttributeType[0].value.newValue,
|
|
176
|
+
operation: DCROperationTypes.ADDED,
|
|
177
|
+
isReferenceSubAttribute: true
|
|
178
|
+
}
|
|
179
|
+
]);
|
|
180
|
+
});
|
|
126
181
|
describe('getRelationsChanges behaviour', function () {
|
|
127
182
|
var relationInfo = {
|
|
128
183
|
endObjectLabel: '',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AttributeType, DCRAttributeValue, DCRObjectsInfo, DCROperationTypes, DCRValue, Metadata, WorkflowDefinition, WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
1
|
+
import { AttributeType, DCRAttributeValue, DCRObjectsInfo, DCROperationTypes, DCRValue, Metadata, PrimitiveValue, WorkflowDefinition, WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
2
|
+
export declare const isPrimitiveValue: (value: unknown) => value is PrimitiveValue;
|
|
2
3
|
export declare const getOperationType: (type: string, newPinOrIgnoreValue?: boolean) => DCROperationTypes;
|
|
3
4
|
export declare const getOperationLabel: (operation: DCROperationTypes) => string;
|
|
4
5
|
export declare const getAttributeDescription: (attrType: AttributeType, value: DCRAttributeValue, currentEntityUri: string, objectsInfo?: DCRObjectsInfo) => {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { allPass, always, equals, evolve, filter, has, identity, isNil, length, nth, pipe, prop, propEq, split, startsWith, unless, when } from 'ramda';
|
|
2
2
|
import i18n from 'ui-i18n';
|
|
3
3
|
import { DataTypes, DCROperationTypes, DCRTypes, EntityAttrTypes, getAttrDataTypeDefinition, getRoleLabel, isUrl } from '@reltio/mdm-sdk';
|
|
4
|
+
export var isPrimitiveValue = function (value) {
|
|
5
|
+
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';
|
|
6
|
+
};
|
|
4
7
|
export var getOperationType = function (type, newPinOrIgnoreValue) {
|
|
5
8
|
switch (type) {
|
|
6
9
|
case DCRTypes.CREATE_RELATIONSHIP:
|
|
@@ -21,6 +21,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
21
21
|
import { createEntryDeleteAttribute, DCRTypes, EventType, findAttributeTypeByUri, getReferencedEntityTypeUriFromAttrType, isEmptyValue, isEntityUri, isNested, isRelationTypeUri, isRelationUri } from '@reltio/mdm-sdk';
|
|
22
22
|
import { allPass, append, assocPath, concat, curry, dissocPath, equals, filter, flatten, fromPairs, groupBy, has, hasPath, isEmpty, isNil, keys, map, partition, path, pathOr, pipe, pluck, prop, propOr, toPairs, values, uniq, uniqBy, when } from 'ramda';
|
|
23
23
|
import { ADDED_CHANGE_ID_PREFIX } from '../contexts/AddedAttributesContext';
|
|
24
|
+
import { isPrimitiveValue } from './common';
|
|
24
25
|
var isAddedChange = function (changeId) { return changeId === null || changeId === void 0 ? void 0 : changeId.startsWith(ADDED_CHANGE_ID_PREFIX); };
|
|
25
26
|
var normalizeReferenceValueForApi = function (val, change, metadata) {
|
|
26
27
|
var attrType = findAttributeTypeByUri(metadata, change.attributeType);
|
|
@@ -101,7 +102,7 @@ export var isCreateEntityOperation = function (dcr) {
|
|
|
101
102
|
return dcr.type === DCRTypes.CREATE_ENTITY;
|
|
102
103
|
};
|
|
103
104
|
var cleanValueRecursively = function (value) {
|
|
104
|
-
if (isNil(value) ||
|
|
105
|
+
if (isNil(value) || isPrimitiveValue(value) || isEmpty(value)) {
|
|
105
106
|
return value;
|
|
106
107
|
}
|
|
107
108
|
var cleanedProperties = map(function (propertyValues) {
|
|
@@ -280,6 +280,53 @@ describe('dcr helpers tests', function () {
|
|
|
280
280
|
]
|
|
281
281
|
} }));
|
|
282
282
|
});
|
|
283
|
+
it('should preserve primitive boolean defaultValue for added attribute when no lineData exists', function () {
|
|
284
|
+
var changes = {
|
|
285
|
+
'entities/456': [
|
|
286
|
+
{
|
|
287
|
+
id: 'added|bool1',
|
|
288
|
+
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
289
|
+
attributePath: 'PrimaryAffiliationIndicator',
|
|
290
|
+
attributeType: 'configuration/entityTypes/HCP/attributes/PrimaryAffiliationIndicator',
|
|
291
|
+
newValue: { value: false }
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
};
|
|
295
|
+
var result = buildDCRSavePlan(changes, noLineData, emptyMetadata);
|
|
296
|
+
expect(result).toEqual(__assign(__assign({}, emptyPlan), { insertEntityAttributes: {
|
|
297
|
+
'entities/456': [
|
|
298
|
+
{
|
|
299
|
+
type: 'INSERT_ATTRIBUTE',
|
|
300
|
+
uri: 'entities/456/attributes/PrimaryAffiliationIndicator',
|
|
301
|
+
newValue: [{ value: false }]
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
} }));
|
|
305
|
+
});
|
|
306
|
+
it('should send user-edited boolean value for added attribute', function () {
|
|
307
|
+
var changes = {
|
|
308
|
+
'entities/456': [
|
|
309
|
+
{
|
|
310
|
+
id: 'added|bool2',
|
|
311
|
+
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
312
|
+
attributePath: 'PrimaryAffiliationIndicator',
|
|
313
|
+
attributeType: 'configuration/entityTypes/HCP/attributes/PrimaryAffiliationIndicator',
|
|
314
|
+
newValue: { value: false }
|
|
315
|
+
}
|
|
316
|
+
]
|
|
317
|
+
};
|
|
318
|
+
var lineData = [['456/added|bool2/newValue', { value: { value: 'true' } }]];
|
|
319
|
+
var result = buildDCRSavePlan(changes, function (changeId) { return (changeId === 'added|bool2' ? lineData : []); }, emptyMetadata);
|
|
320
|
+
expect(result).toEqual(__assign(__assign({}, emptyPlan), { insertEntityAttributes: {
|
|
321
|
+
'entities/456': [
|
|
322
|
+
{
|
|
323
|
+
type: 'INSERT_ATTRIBUTE',
|
|
324
|
+
uri: 'entities/456/attributes/PrimaryAffiliationIndicator',
|
|
325
|
+
newValue: [{ value: 'true' }]
|
|
326
|
+
}
|
|
327
|
+
]
|
|
328
|
+
} }));
|
|
329
|
+
});
|
|
283
330
|
it('should preserve lookup sub-attribute with lookupCode inside nested parent', function () {
|
|
284
331
|
var metadata = {
|
|
285
332
|
entityTypes: [
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { both, concat, curry, difference, flatten, isNil, omit, path, pathEq, pick, pipe, propEq, propOr, reduce } from 'ramda';
|
|
13
|
-
import { DCRTypes, EntityAttrTypes, generateTempUri,
|
|
13
|
+
import { DCRTypes, EntityAttrTypes, generateTempUri, isEmptyValue } from '@reltio/mdm-sdk';
|
|
14
14
|
import { getEntityChanges, getRelationChanges } from './attributes';
|
|
15
15
|
var ATTRIBUTE_DELIMITER = '/';
|
|
16
16
|
var SPECIAL_ATTRIBUTES_NAMES = [
|
|
@@ -166,7 +166,7 @@ var createEntityOrRelation = function (metadata, value) {
|
|
|
166
166
|
newObject[EntityAttrTypes.roles.name] = [
|
|
167
167
|
{
|
|
168
168
|
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
169
|
-
newValue: __assign({ value: addedId ? [] : roles
|
|
169
|
+
newValue: __assign({ value: addedId ? [] : roles, lineIds: lineIds && ["".concat(lineIds[0], "/").concat(EntityAttrTypes.roles.name)] }, (addedId && { addedId: addedId }))
|
|
170
170
|
}
|
|
171
171
|
];
|
|
172
172
|
}
|
|
@@ -389,4 +389,38 @@ describe('mergeChanges tests', function () {
|
|
|
389
389
|
var mergedChanges = mergeChanges(metadata, changes, objectInfo, [])[0];
|
|
390
390
|
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']);
|
|
391
391
|
});
|
|
392
|
+
it('should keep role URIs in CREATE_ENTITY changes without mapping to labels', function () {
|
|
393
|
+
var _a;
|
|
394
|
+
var _b;
|
|
395
|
+
var metadata = getMetadata();
|
|
396
|
+
var roleUris = [
|
|
397
|
+
'configuration/roles/DirectorofNursing',
|
|
398
|
+
'configuration/roles/MedicalAssistant',
|
|
399
|
+
'configuration/roles/LabDirectors'
|
|
400
|
+
];
|
|
401
|
+
var changes = (_a = {},
|
|
402
|
+
_a[entityUri] = [
|
|
403
|
+
{
|
|
404
|
+
id: 'create1',
|
|
405
|
+
type: DCRTypes.CREATE_ENTITY,
|
|
406
|
+
objectType: 'configuration/entityTypes/HCA',
|
|
407
|
+
newValue: {
|
|
408
|
+
uri: entityUri,
|
|
409
|
+
type: 'configuration/entityTypes/HCA',
|
|
410
|
+
attributes: {
|
|
411
|
+
ActivationDate: [{ value: '2024-01-01' }]
|
|
412
|
+
},
|
|
413
|
+
roles: roleUris,
|
|
414
|
+
crosswalks: [{ type: 'configuration/sources/Reltio', value: '1hRTSKE5', dataProvider: true }],
|
|
415
|
+
analyticsAttributes: {}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
],
|
|
419
|
+
_a);
|
|
420
|
+
var entityChanges = mergeChanges(metadata, changes, objectInfo, [])[0];
|
|
421
|
+
var rolesDiff = entityChanges.find(function (d) { var _a; return ((_a = d.attributeType) === null || _a === void 0 ? void 0 : _a.uri) === EntityAttrTypes.roles.uri; });
|
|
422
|
+
expect(rolesDiff).toBeDefined();
|
|
423
|
+
var rolesNewValue = (_b = rolesDiff.newValue) === null || _b === void 0 ? void 0 : _b.value;
|
|
424
|
+
expect(rolesNewValue).toEqual(roleUris);
|
|
425
|
+
});
|
|
392
426
|
});
|