@reltio/components 1.4.2201 → 1.4.2202
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/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +36 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.d.ts +1 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +15 -6
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.d.ts +4 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.js +2 -28
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.d.ts +4 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.js +11 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +5 -5
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +2 -28
- package/cjs/features/workflow/ChangeRequestEditor/context/index.d.ts +20 -0
- package/cjs/features/workflow/ChangeRequestEditor/context/index.js +76 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helper.test.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helper.test.js +237 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +4 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.js +105 -0
- package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +3 -1
- package/cjs/features/workflow/helpers/attributes.js +14 -3
- package/cjs/features/workflow/helpers/attributes.test.js +29 -7
- package/cjs/features/workflow/helpers/merge.d.ts +3 -2
- package/cjs/features/workflow/helpers/merge.js +62 -18
- package/cjs/features/workflow/helpers/merge.test.js +56 -2
- package/cjs/features/workflow/hooks/useChangesList.d.ts +2 -2
- package/cjs/features/workflow/types.d.ts +4 -3
- package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +13 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.d.ts +1 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +15 -6
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.d.ts +4 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.js +2 -5
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.d.ts +4 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.js +13 -5
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +6 -6
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +2 -2
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +2 -5
- package/features/workflow/ChangeRequestEditor/context/index.d.ts +20 -0
- package/features/workflow/ChangeRequestEditor/context/index.js +49 -0
- package/features/workflow/ChangeRequestEditor/helpers/helper.test.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/helpers/helper.test.js +235 -0
- package/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +4 -0
- package/features/workflow/ChangeRequestEditor/helpers/helpers.js +100 -0
- package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +3 -1
- package/features/workflow/helpers/attributes.js +14 -3
- package/features/workflow/helpers/attributes.test.js +29 -7
- package/features/workflow/helpers/merge.d.ts +3 -2
- package/features/workflow/helpers/merge.js +60 -17
- package/features/workflow/helpers/merge.test.js +56 -2
- package/features/workflow/hooks/useChangesList.d.ts +2 -2
- package/features/workflow/types.d.ts +4 -3
- package/package.json +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/helpers.d.ts +0 -3
- package/cjs/features/workflow/ChangeRequestEditor/helpers.js +0 -16
- package/features/workflow/ChangeRequestEditor/helpers.d.ts +0 -3
- package/features/workflow/ChangeRequestEditor/helpers.js +0 -12
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { DCRTypes } from '@reltio/mdm-sdk';
|
|
2
|
+
import { addLineIdToValue } from './helpers';
|
|
3
|
+
describe('addLineIdToValue', function () {
|
|
4
|
+
it('should add lineIds for a simple attribute', function () {
|
|
5
|
+
var changes = {
|
|
6
|
+
'entities/0FaSodQ': [
|
|
7
|
+
{
|
|
8
|
+
id: '4pomtm9',
|
|
9
|
+
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
10
|
+
newValue: { value: '434' }
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
};
|
|
14
|
+
var result = addLineIdToValue(changes);
|
|
15
|
+
expect(result).toEqual({
|
|
16
|
+
'entities/0FaSodQ': [
|
|
17
|
+
{
|
|
18
|
+
id: '4pomtm9',
|
|
19
|
+
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
20
|
+
newValue: {
|
|
21
|
+
value: '434',
|
|
22
|
+
lineIds: ['0FaSodQ/4pomtm9/newValue']
|
|
23
|
+
},
|
|
24
|
+
lineIds: ['0FaSodQ/4pomtm9']
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it('should add lineIds to the newValue of a UPDATE_TAGS change', function () {
|
|
30
|
+
var changes = {
|
|
31
|
+
'entities/0FaSodQ': [
|
|
32
|
+
{
|
|
33
|
+
id: '0OSJEYr',
|
|
34
|
+
type: DCRTypes.UPDATE_TAGS,
|
|
35
|
+
newValue: ['www', 'qqq', 'sss'],
|
|
36
|
+
oldValue: ['aaa', 'bbb', 'ccc']
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
var result = addLineIdToValue(changes);
|
|
41
|
+
expect(result).toEqual({
|
|
42
|
+
'entities/0FaSodQ': [
|
|
43
|
+
{
|
|
44
|
+
id: '0OSJEYr',
|
|
45
|
+
type: DCRTypes.UPDATE_TAGS,
|
|
46
|
+
newValue: {
|
|
47
|
+
value: ['www', 'qqq', 'sss'],
|
|
48
|
+
lineIds: ['0FaSodQ/0OSJEYr/newValue']
|
|
49
|
+
},
|
|
50
|
+
oldValue: {
|
|
51
|
+
value: ['aaa', 'bbb', 'ccc'],
|
|
52
|
+
lineIds: ['0FaSodQ/0OSJEYr/oldValue']
|
|
53
|
+
},
|
|
54
|
+
lineIds: ['0FaSodQ/0OSJEYr']
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
it('should recursively add lineIds to nested attribute values', function () {
|
|
60
|
+
var changes = {
|
|
61
|
+
'entities/0FaSodQ': [
|
|
62
|
+
{
|
|
63
|
+
id: '4ponaOj',
|
|
64
|
+
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
65
|
+
newValue: {
|
|
66
|
+
value: {
|
|
67
|
+
TextField: [{ value: 'Test' }],
|
|
68
|
+
Int: [{ value: '42' }]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
};
|
|
74
|
+
var result = addLineIdToValue(changes);
|
|
75
|
+
expect(result).toEqual({
|
|
76
|
+
'entities/0FaSodQ': [
|
|
77
|
+
{
|
|
78
|
+
id: '4ponaOj',
|
|
79
|
+
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
80
|
+
newValue: {
|
|
81
|
+
value: {
|
|
82
|
+
TextField: [
|
|
83
|
+
{
|
|
84
|
+
value: 'Test',
|
|
85
|
+
lineIds: ['0FaSodQ/4ponaOj/newValue/value/TextField/0']
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
Int: [
|
|
89
|
+
{
|
|
90
|
+
value: '42',
|
|
91
|
+
lineIds: ['0FaSodQ/4ponaOj/newValue/value/Int/0']
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
lineIds: ['0FaSodQ/4ponaOj/newValue']
|
|
96
|
+
},
|
|
97
|
+
lineIds: ['0FaSodQ/4ponaOj']
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
it('should add lineIds to all attributes of CREATE_ENTITY changes', function () {
|
|
103
|
+
var changes = {
|
|
104
|
+
'entities/1PMfzz2w': [
|
|
105
|
+
{
|
|
106
|
+
id: '36a3GSVm',
|
|
107
|
+
type: DCRTypes.CREATE_ENTITY,
|
|
108
|
+
objectType: 'configuration/entityTypes/Location',
|
|
109
|
+
newValue: {
|
|
110
|
+
attributes: {
|
|
111
|
+
AddressLine1: [{ value: 'www' }],
|
|
112
|
+
CityTierName: [{ value: 'ALBY' }]
|
|
113
|
+
},
|
|
114
|
+
type: 'configuration/entityTypes/Location',
|
|
115
|
+
uri: 'entities/0T5H79G'
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
};
|
|
120
|
+
var result = addLineIdToValue(changes);
|
|
121
|
+
expect(result).toEqual({
|
|
122
|
+
'entities/1PMfzz2w': [
|
|
123
|
+
{
|
|
124
|
+
id: '36a3GSVm',
|
|
125
|
+
type: DCRTypes.CREATE_ENTITY,
|
|
126
|
+
objectType: 'configuration/entityTypes/Location',
|
|
127
|
+
newValue: {
|
|
128
|
+
attributes: {
|
|
129
|
+
AddressLine1: [
|
|
130
|
+
{
|
|
131
|
+
value: 'www',
|
|
132
|
+
lineIds: ['1PMfzz2w/36a3GSVm/newValue/attributes/AddressLine1/0']
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
CityTierName: [
|
|
136
|
+
{
|
|
137
|
+
value: 'ALBY',
|
|
138
|
+
lineIds: ['1PMfzz2w/36a3GSVm/newValue/attributes/CityTierName/0']
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
type: 'configuration/entityTypes/Location',
|
|
143
|
+
uri: 'entities/0T5H79G',
|
|
144
|
+
lineIds: ['1PMfzz2w/36a3GSVm/newValue']
|
|
145
|
+
},
|
|
146
|
+
lineIds: ['1PMfzz2w/36a3GSVm']
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
it('should add lineIds to all attributes of CREATE_RELATIONSHIP changes', function () {
|
|
152
|
+
var changes = {
|
|
153
|
+
'relations/0lVSmtX': [
|
|
154
|
+
{
|
|
155
|
+
id: '0G7u0JP',
|
|
156
|
+
type: DCRTypes.CREATE_RELATIONSHIP,
|
|
157
|
+
newValue: {
|
|
158
|
+
attributes: {
|
|
159
|
+
PrefOrActive: [{ value: 'yfhgvm' }],
|
|
160
|
+
AffiliationStatus: [{ value: 'Status 1' }],
|
|
161
|
+
PrimaryAffiliationIndicator: [{ value: 'true' }]
|
|
162
|
+
},
|
|
163
|
+
type: 'configuration/relationTypes/DirPharmacy',
|
|
164
|
+
uri: 'relations/0Mj0zAI'
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
};
|
|
169
|
+
var result = addLineIdToValue(changes);
|
|
170
|
+
expect(result).toEqual({
|
|
171
|
+
'relations/0lVSmtX': [
|
|
172
|
+
{
|
|
173
|
+
id: '0G7u0JP',
|
|
174
|
+
type: DCRTypes.CREATE_RELATIONSHIP,
|
|
175
|
+
newValue: {
|
|
176
|
+
attributes: {
|
|
177
|
+
PrefOrActive: [
|
|
178
|
+
{
|
|
179
|
+
value: 'yfhgvm',
|
|
180
|
+
lineIds: ['0lVSmtX/0G7u0JP/newValue/attributes/PrefOrActive/0']
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
AffiliationStatus: [
|
|
184
|
+
{
|
|
185
|
+
value: 'Status 1',
|
|
186
|
+
lineIds: ['0lVSmtX/0G7u0JP/newValue/attributes/AffiliationStatus/0']
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
PrimaryAffiliationIndicator: [
|
|
190
|
+
{
|
|
191
|
+
value: 'true',
|
|
192
|
+
lineIds: ['0lVSmtX/0G7u0JP/newValue/attributes/PrimaryAffiliationIndicator/0']
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
type: 'configuration/relationTypes/DirPharmacy',
|
|
197
|
+
uri: 'relations/0Mj0zAI',
|
|
198
|
+
lineIds: ['0lVSmtX/0G7u0JP/newValue']
|
|
199
|
+
},
|
|
200
|
+
lineIds: ['0lVSmtX/0G7u0JP']
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
it('should add lineIds to both oldValue and newValue for UPDATE_ATTRIBUTE changes', function () {
|
|
206
|
+
var changes = {
|
|
207
|
+
'entities/0FaSodQ': [
|
|
208
|
+
{
|
|
209
|
+
id: '4pomtm9',
|
|
210
|
+
type: DCRTypes.UPDATE_ATTRIBUTE,
|
|
211
|
+
oldValue: { value: 'old' },
|
|
212
|
+
newValue: { value: 'new' }
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
};
|
|
216
|
+
var result = addLineIdToValue(changes);
|
|
217
|
+
expect(result).toEqual({
|
|
218
|
+
'entities/0FaSodQ': [
|
|
219
|
+
{
|
|
220
|
+
id: '4pomtm9',
|
|
221
|
+
type: DCRTypes.UPDATE_ATTRIBUTE,
|
|
222
|
+
oldValue: {
|
|
223
|
+
value: 'old',
|
|
224
|
+
lineIds: ['0FaSodQ/4pomtm9/oldValue']
|
|
225
|
+
},
|
|
226
|
+
newValue: {
|
|
227
|
+
value: 'new',
|
|
228
|
+
lineIds: ['0FaSodQ/4pomtm9/newValue']
|
|
229
|
+
},
|
|
230
|
+
lineIds: ['0FaSodQ/4pomtm9']
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DCRChanges, GroupedObjectsInfo, EnrichedDCRChanges } from '@reltio/mdm-sdk';
|
|
2
|
+
import { Diff } from '../../types';
|
|
3
|
+
export declare const isEditableChange: (change: Diff, entityInfo: GroupedObjectsInfo["entity"]) => boolean;
|
|
4
|
+
export declare const addLineIdToValue: (data: DCRChanges) => EnrichedDCRChanges;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { clone, isNil } from 'ramda';
|
|
13
|
+
import { DCROperationTypes, DCRTypes, isRelationTypeUri } from '@reltio/mdm-sdk';
|
|
14
|
+
export var isEditableChange = function (change, entityInfo) {
|
|
15
|
+
var _a;
|
|
16
|
+
var currentAttributeTypeUri = (_a = change.attributeType) === null || _a === void 0 ? void 0 : _a.uri;
|
|
17
|
+
var isExistingReferenceEntityChange = entityInfo.isExist &&
|
|
18
|
+
currentAttributeTypeUri &&
|
|
19
|
+
change.isReferenceSubAttribute &&
|
|
20
|
+
change.operation === DCROperationTypes.ADDED &&
|
|
21
|
+
!isRelationTypeUri(currentAttributeTypeUri);
|
|
22
|
+
return !!currentAttributeTypeUri && !isExistingReferenceEntityChange && !isNil(change.newValue);
|
|
23
|
+
};
|
|
24
|
+
var isPrimitiveValue = function (value) {
|
|
25
|
+
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';
|
|
26
|
+
};
|
|
27
|
+
var addLineIdRecursively = function (value, basePath) {
|
|
28
|
+
if (value == null)
|
|
29
|
+
return value;
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
return value.map(function (entry, index) {
|
|
32
|
+
if (entry && typeof entry === 'object') {
|
|
33
|
+
var entryPath = "".concat(basePath, "/").concat(index);
|
|
34
|
+
var newEntry = clone(entry);
|
|
35
|
+
newEntry.lineIds = [entryPath];
|
|
36
|
+
var v = newEntry.value;
|
|
37
|
+
if (typeof v === 'object' && v !== null) {
|
|
38
|
+
newEntry.value = addLineIdRecursively(v, "".concat(entryPath, "/value"));
|
|
39
|
+
}
|
|
40
|
+
return newEntry;
|
|
41
|
+
}
|
|
42
|
+
return entry;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (typeof value === 'object') {
|
|
46
|
+
var result = {};
|
|
47
|
+
for (var _i = 0, _a = Object.entries(value); _i < _a.length; _i++) {
|
|
48
|
+
var _b = _a[_i], key = _b[0], val = _b[1];
|
|
49
|
+
var childPath = "".concat(basePath, "/").concat(key);
|
|
50
|
+
result[key] = addLineIdRecursively(val, childPath);
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
};
|
|
56
|
+
var addLineIdToChangeValue = function (container, basePath, type) {
|
|
57
|
+
if (container == null)
|
|
58
|
+
return container;
|
|
59
|
+
if ([DCRTypes.CREATE_ENTITY, DCRTypes.CREATE_RELATIONSHIP].includes(type)) {
|
|
60
|
+
var attributes = void 0;
|
|
61
|
+
if ('attributes' in container && typeof container.attributes === 'object') {
|
|
62
|
+
attributes = addLineIdRecursively(container.attributes, "".concat(basePath, "/attributes"));
|
|
63
|
+
}
|
|
64
|
+
return __assign(__assign({}, container), { attributes: attributes, lineIds: [basePath] });
|
|
65
|
+
}
|
|
66
|
+
if (Array.isArray(container)) {
|
|
67
|
+
return { value: container, lineIds: [basePath] };
|
|
68
|
+
}
|
|
69
|
+
if (typeof container === 'object' && 'value' in container) {
|
|
70
|
+
var containerValue = container.value;
|
|
71
|
+
return __assign(__assign({}, container), { lineIds: [basePath], value: isPrimitiveValue(containerValue)
|
|
72
|
+
? containerValue
|
|
73
|
+
: addLineIdRecursively(containerValue, "".concat(basePath, "/value")) });
|
|
74
|
+
}
|
|
75
|
+
return container;
|
|
76
|
+
};
|
|
77
|
+
export var addLineIdToValue = function (data) {
|
|
78
|
+
var enrichedData = clone(data);
|
|
79
|
+
for (var entityOrRelationKey in enrichedData) {
|
|
80
|
+
var entityOrRelationId = entityOrRelationKey.split('/')[1];
|
|
81
|
+
var changeList = enrichedData[entityOrRelationKey];
|
|
82
|
+
if (!Array.isArray(changeList))
|
|
83
|
+
continue;
|
|
84
|
+
for (var _i = 0, changeList_1 = changeList; _i < changeList_1.length; _i++) {
|
|
85
|
+
var change = changeList_1[_i];
|
|
86
|
+
var changeId = change.id;
|
|
87
|
+
var type = change.type;
|
|
88
|
+
if (change.newValue != null) {
|
|
89
|
+
var root = "".concat(entityOrRelationId, "/").concat(changeId, "/newValue");
|
|
90
|
+
change.newValue = addLineIdToChangeValue(change.newValue, root, type);
|
|
91
|
+
}
|
|
92
|
+
if (change.oldValue != null) {
|
|
93
|
+
var root = "".concat(entityOrRelationId, "/").concat(changeId, "/oldValue");
|
|
94
|
+
change.oldValue = addLineIdToChangeValue(change.oldValue, root, type);
|
|
95
|
+
}
|
|
96
|
+
change.lineIds = ["".concat(entityOrRelationId, "/").concat(changeId)];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return enrichedData;
|
|
100
|
+
};
|
|
@@ -9,6 +9,7 @@ import i18n from 'ui-i18n';
|
|
|
9
9
|
import { useWorkflowCheckPermission } from '../hooks/useWorkflowCheckPermission';
|
|
10
10
|
import { useWorkflowActions } from '../hooks/useWorkflowActions';
|
|
11
11
|
import { useMdmEntity } from '../../../contexts/MdmModuleContext';
|
|
12
|
+
import { ChangeRequestEditorProvider } from '../ChangeRequestEditor/context';
|
|
12
13
|
import { ProfileBand } from '../../../ProfileBand';
|
|
13
14
|
import { DueDateField } from '../DueDateField';
|
|
14
15
|
import { PrioritySelector } from '../PrioritySelector';
|
|
@@ -48,7 +49,8 @@ export var ReviewDCRDialog = function (_a) {
|
|
|
48
49
|
React.createElement("div", { className: styles.editableItem },
|
|
49
50
|
React.createElement(AssigneeSelector, { taskId: task.taskId, assignee: task.assignee, isTaskOpen: task.isOpen })))),
|
|
50
51
|
React.createElement("div", { className: styles.changesSection },
|
|
51
|
-
React.createElement(
|
|
52
|
+
React.createElement(ChangeRequestEditorProvider, null,
|
|
53
|
+
React.createElement(ChangeRequestEditor, { dcr: dcr, task: task, groupedObjects: groupedObjects })))),
|
|
52
54
|
canViewComments && (React.createElement(WorkflowComments, { workflowActions: workflowActions, actionRequestIsInProgress: actionRequestIsInProgress, preferredAction: task.preferredAction, taskId: task.taskId, processInstanceComments: task.processInstanceComments, isTaskOpen: task.isOpen, showActionButtons: false, alwaysExpanded: true, classes: {
|
|
53
55
|
container: styles.commentsRootContainer,
|
|
54
56
|
commentsContainer: styles.commentsContainer
|
|
@@ -61,19 +61,30 @@ var dcrAttributesFactory = function (metadata, attributeType, attributeValue, le
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
+
var extractLineIds = function (attributeValue) {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
return typeof attributeValue.value === 'object' &&
|
|
67
|
+
'newValue' in attributeValue.value &&
|
|
68
|
+
'lineIds' in attributeValue.value.newValue &&
|
|
69
|
+
Array.isArray(attributeValue.value.newValue.lineIds)
|
|
70
|
+
? (_b = (_a = attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value) === null || _a === void 0 ? void 0 : _a.newValue) === null || _b === void 0 ? void 0 : _b.lineIds
|
|
71
|
+
: attributeValue.lineIds;
|
|
72
|
+
};
|
|
64
73
|
var getNestedAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
65
74
|
var attributeTypeList = getAttributeTypeSubAttributes({}, attributeType);
|
|
66
75
|
var label = getLabel((attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name));
|
|
76
|
+
var lineIds = extractLineIds(attributeValue);
|
|
67
77
|
return [
|
|
68
|
-
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue },
|
|
78
|
+
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds },
|
|
69
79
|
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1)
|
|
70
80
|
];
|
|
71
81
|
};
|
|
72
82
|
var getReferenceAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
73
83
|
var attributeTypeList = getAttributeTypeSubAttributes(metadata, attributeType);
|
|
74
84
|
var label = (attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name);
|
|
85
|
+
var lineIds = extractLineIds(attributeValue);
|
|
75
86
|
return [
|
|
76
|
-
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue },
|
|
87
|
+
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds },
|
|
77
88
|
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1, true)
|
|
78
89
|
];
|
|
79
90
|
};
|
|
@@ -111,7 +122,7 @@ export var getRelationChanges = curry(function (metadata, relationInfo, changes,
|
|
|
111
122
|
var relationType = getRelationType(metadata, relationInfo.type);
|
|
112
123
|
var attrTypes = getRelationAttributesList(metadata, relationInfo.type);
|
|
113
124
|
return flatten([
|
|
114
|
-
__assign({ level: 1, label: propOr('', 'label', relationType), attributeType: null, relationType: relationType, attributeValue: __assign(__assign({}, relationInfo), changes) }, addRelationOperationIfNeeded(changes, changeType)),
|
|
125
|
+
__assign({ level: 1, label: propOr('', 'label', relationType), attributeType: null, relationType: relationType, attributeValue: __assign(__assign({}, relationInfo), changes), lineIds: changes === null || changes === void 0 ? void 0 : changes.lineIds }, addRelationOperationIfNeeded(changes, changeType)),
|
|
115
126
|
getAttributesList(metadata, attrTypes, changes, 2)
|
|
116
127
|
]);
|
|
117
128
|
});
|
|
@@ -30,8 +30,20 @@ describe('attributes helpers tests', function () {
|
|
|
30
30
|
attributeType: 'configuration/entityTypes/HCA/attributes/CountryCode',
|
|
31
31
|
id: '41cb3gGy',
|
|
32
32
|
newPinOrIgnoreValue: true,
|
|
33
|
-
newValue: {
|
|
34
|
-
|
|
33
|
+
newValue: {
|
|
34
|
+
value: 'Chile',
|
|
35
|
+
lookupCode: 'CL',
|
|
36
|
+
lookupRawValue: 'Chile',
|
|
37
|
+
pin: true,
|
|
38
|
+
lineIds: ['3AqlrpfGa/value/newValue']
|
|
39
|
+
},
|
|
40
|
+
oldValue: {
|
|
41
|
+
value: 'Chile',
|
|
42
|
+
lookupCode: 'CL',
|
|
43
|
+
lookupRawValue: 'Chile',
|
|
44
|
+
pin: true,
|
|
45
|
+
lineIds: ['3AqlrpfGa/value/oldValue']
|
|
46
|
+
},
|
|
35
47
|
type: DCRTypes.IGNORE_ATTRIBUTE
|
|
36
48
|
}
|
|
37
49
|
},
|
|
@@ -42,7 +54,12 @@ describe('attributes helpers tests', function () {
|
|
|
42
54
|
attributeType: 'configuration/entityTypes/HCA/attributes/CountryCode',
|
|
43
55
|
id: '41cb3c0i',
|
|
44
56
|
newPinOrIgnoreValue: false,
|
|
45
|
-
newValue: {
|
|
57
|
+
newValue: {
|
|
58
|
+
value: 'Bahamas',
|
|
59
|
+
lookupCode: 'BS',
|
|
60
|
+
lookupRawValue: 'BS',
|
|
61
|
+
lineIds: ['uri$$1643545710682']
|
|
62
|
+
},
|
|
46
63
|
type: DCRTypes.INSERT_ATTRIBUTE
|
|
47
64
|
}
|
|
48
65
|
}
|
|
@@ -74,7 +91,7 @@ describe('attributes helpers tests', function () {
|
|
|
74
91
|
attributeType: metadata.entityTypes[0].attributes[1],
|
|
75
92
|
label: 'Country Code',
|
|
76
93
|
level: 0,
|
|
77
|
-
newValue: changes.CountryCode[0].value.newValue,
|
|
94
|
+
newValue: __assign(__assign({}, changes.CountryCode[0].value.newValue), { lineIds: ['3AqlrpfGa/value/oldValue'] }),
|
|
78
95
|
operation: 'ignored',
|
|
79
96
|
isReferenceSubAttribute: false
|
|
80
97
|
},
|
|
@@ -114,7 +131,12 @@ describe('attributes helpers tests', function () {
|
|
|
114
131
|
};
|
|
115
132
|
var changes = {
|
|
116
133
|
TestAttribute: [{ value: { newValue: '123', type: DCRTypes.INSERT_ATTRIBUTE } }],
|
|
117
|
-
'activeness.startDate': [
|
|
134
|
+
'activeness.startDate': [
|
|
135
|
+
{
|
|
136
|
+
newValue: { value: 1644001200000, lineIds: ['relations/t58vHMD/activeness/startDate/newValue'] },
|
|
137
|
+
type: DCRTypes.INSERT_ATTRIBUTE
|
|
138
|
+
}
|
|
139
|
+
]
|
|
118
140
|
};
|
|
119
141
|
it('should not show operation for relation title', function () {
|
|
120
142
|
expect(getRelationChanges(metadata, relationInfo, changes, DCRTypes.INSERT_ATTRIBUTE)).toEqual([
|
|
@@ -129,7 +151,7 @@ describe('attributes helpers tests', function () {
|
|
|
129
151
|
attributeType: EntityAttrTypes.startDate,
|
|
130
152
|
label: EntityAttrTypes.startDate.label,
|
|
131
153
|
level: 2,
|
|
132
|
-
newValue: { value: 1644001200000 },
|
|
154
|
+
newValue: { value: 1644001200000, lineIds: ['relations/t58vHMD/activeness/startDate/newValue'] },
|
|
133
155
|
operation: DCROperationTypes.ADDED,
|
|
134
156
|
isReferenceSubAttribute: false
|
|
135
157
|
},
|
|
@@ -157,7 +179,7 @@ describe('attributes helpers tests', function () {
|
|
|
157
179
|
attributeType: EntityAttrTypes.startDate,
|
|
158
180
|
label: EntityAttrTypes.startDate.label,
|
|
159
181
|
level: 2,
|
|
160
|
-
newValue: { value: 1644001200000 },
|
|
182
|
+
newValue: { value: 1644001200000, lineIds: ['relations/t58vHMD/activeness/startDate/newValue'] },
|
|
161
183
|
operation: DCROperationTypes.ADDED,
|
|
162
184
|
isReferenceSubAttribute: false
|
|
163
185
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GroupedObjectsInfo, Metadata, EnrichedDCRChanges, EnrichedChangeValue, ChangeValue, DCRChanges } from '@reltio/mdm-sdk';
|
|
2
2
|
import { Diff } from '../types';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const extractLineIds: (value: ChangeValue | EnrichedChangeValue) => string[] | undefined;
|
|
4
|
+
export declare const mergeChanges: (metadata: Metadata, changes: EnrichedDCRChanges | DCRChanges, entityInfo: GroupedObjectsInfo["entity"], relationsInfo: GroupedObjectsInfo["relations"]) => [Diff[], Diff[]];
|
|
@@ -20,18 +20,29 @@ var SPECIAL_ATTRIBUTES_NAMES = [
|
|
|
20
20
|
EntityAttrTypes.startDate.name,
|
|
21
21
|
EntityAttrTypes.endDate.name
|
|
22
22
|
];
|
|
23
|
+
export var extractLineIds = function (value) {
|
|
24
|
+
return typeof value === 'object' && 'lineIds' in value ? value.lineIds : undefined;
|
|
25
|
+
};
|
|
23
26
|
var prepareStartOrEndDate = function (_a) {
|
|
24
27
|
var newValue = _a.newValue, oldValue = _a.oldValue;
|
|
28
|
+
var actualNewValue = newValue && 'value' in newValue ? newValue.value : newValue;
|
|
29
|
+
var actualOldValue = oldValue && 'value' in oldValue ? oldValue.value : oldValue;
|
|
25
30
|
var parseValue = function (value) { return (isNaN(value) || isEmptyValue(value) ? value : parseInt(value)); };
|
|
26
31
|
var isExistedValue = function (value) { return (value === null || value === void 0 ? void 0 : value.length) && !isEmptyValue(value) && !isEmptyValue(value[0]); };
|
|
27
|
-
var isExistNewValue = isExistedValue(
|
|
28
|
-
var isExistOldValue = isExistedValue(
|
|
32
|
+
var isExistNewValue = isExistedValue(actualNewValue);
|
|
33
|
+
var isExistOldValue = isExistedValue(actualOldValue);
|
|
29
34
|
if (isExistNewValue && isExistOldValue) {
|
|
30
35
|
return [
|
|
31
36
|
{
|
|
32
37
|
type: DCRTypes.UPDATE_ATTRIBUTE,
|
|
33
|
-
oldValue: {
|
|
34
|
-
|
|
38
|
+
oldValue: {
|
|
39
|
+
value: parseValue(actualOldValue[0]),
|
|
40
|
+
lineIds: extractLineIds(oldValue)
|
|
41
|
+
},
|
|
42
|
+
newValue: {
|
|
43
|
+
value: parseValue(actualNewValue[0]),
|
|
44
|
+
lineIds: extractLineIds(newValue)
|
|
45
|
+
}
|
|
35
46
|
}
|
|
36
47
|
];
|
|
37
48
|
}
|
|
@@ -39,7 +50,10 @@ var prepareStartOrEndDate = function (_a) {
|
|
|
39
50
|
return [
|
|
40
51
|
{
|
|
41
52
|
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
42
|
-
newValue: {
|
|
53
|
+
newValue: {
|
|
54
|
+
value: parseValue(actualNewValue[0]),
|
|
55
|
+
lineIds: extractLineIds(newValue)
|
|
56
|
+
}
|
|
43
57
|
}
|
|
44
58
|
];
|
|
45
59
|
}
|
|
@@ -47,26 +61,31 @@ var prepareStartOrEndDate = function (_a) {
|
|
|
47
61
|
return [
|
|
48
62
|
{
|
|
49
63
|
type: DCRTypes.DELETE_ATTRIBUTE,
|
|
50
|
-
oldValue: {
|
|
64
|
+
oldValue: {
|
|
65
|
+
value: parseValue(actualOldValue[0]),
|
|
66
|
+
lineIds: extractLineIds(oldValue)
|
|
67
|
+
}
|
|
51
68
|
}
|
|
52
69
|
];
|
|
53
70
|
}
|
|
54
71
|
};
|
|
55
72
|
var prepareRolesOrTags = function (metadata, change) {
|
|
56
73
|
var _a = change.newValue, newValue = _a === void 0 ? [] : _a, _b = change.oldValue, oldValue = _b === void 0 ? [] : _b;
|
|
57
|
-
var
|
|
58
|
-
var
|
|
74
|
+
var preparedNewValue = 'value' in newValue ? newValue.value : newValue;
|
|
75
|
+
var preparedOldValue = 'value' in oldValue ? oldValue.value : oldValue;
|
|
76
|
+
var diffNewValue = difference(preparedNewValue, preparedOldValue);
|
|
77
|
+
var diffOldValue = difference(preparedOldValue, preparedNewValue);
|
|
59
78
|
var items = [];
|
|
60
79
|
if (diffNewValue.length) {
|
|
61
80
|
items.push({
|
|
62
81
|
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
63
|
-
newValue: { value: diffNewValue }
|
|
82
|
+
newValue: { value: diffNewValue, lineIds: extractLineIds(newValue) }
|
|
64
83
|
});
|
|
65
84
|
}
|
|
66
85
|
if (diffOldValue.length) {
|
|
67
86
|
items.push({
|
|
68
87
|
type: DCRTypes.DELETE_ATTRIBUTE,
|
|
69
|
-
oldValue: { value: diffOldValue }
|
|
88
|
+
oldValue: { value: diffOldValue, lineIds: extractLineIds(oldValue) }
|
|
70
89
|
});
|
|
71
90
|
}
|
|
72
91
|
return items;
|
|
@@ -82,7 +101,7 @@ var getPath = function (change) {
|
|
|
82
101
|
return path;
|
|
83
102
|
};
|
|
84
103
|
var prepareAttribute = function (container, change) {
|
|
85
|
-
var _a;
|
|
104
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
86
105
|
var changePath = getPath(change);
|
|
87
106
|
var pathArray = changePath.split(ATTRIBUTE_DELIMITER);
|
|
88
107
|
var holder = container;
|
|
@@ -90,9 +109,20 @@ var prepareAttribute = function (container, change) {
|
|
|
90
109
|
var key = pathArray[i];
|
|
91
110
|
var id = pathArray[i + 1];
|
|
92
111
|
var currentValue = (holder[key] || []).find(propEq('id', id));
|
|
112
|
+
if (!isNil(currentValue)) {
|
|
113
|
+
var newLineIds = extractLineIds(change.newValue);
|
|
114
|
+
var oldLineIds = extractLineIds(change.oldValue);
|
|
115
|
+
var currentLineId = ((_b = (_a = currentValue.value) === null || _a === void 0 ? void 0 : _a.newValue) === null || _b === void 0 ? void 0 : _b.lineIds) || ((_d = (_c = currentValue.value) === null || _c === void 0 ? void 0 : _c.oldValue) === null || _d === void 0 ? void 0 : _d.lineIds);
|
|
116
|
+
if (((_f = (_e = currentValue.value) === null || _e === void 0 ? void 0 : _e.newValue) === null || _f === void 0 ? void 0 : _f.lineIds) && newLineIds) {
|
|
117
|
+
currentValue.value.newValue.lineIds = currentLineId.concat(newLineIds);
|
|
118
|
+
}
|
|
119
|
+
if (((_h = (_g = currentValue.value) === null || _g === void 0 ? void 0 : _g.oldValue) === null || _h === void 0 ? void 0 : _h.lineIds) && oldLineIds) {
|
|
120
|
+
currentValue.value.oldValue.lineIds = currentLineId.concat(oldLineIds);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
93
123
|
var newValue = pathArray.length === i + 2 ? change : {};
|
|
94
124
|
var value = currentValue ? currentValue : { id: id, value: newValue };
|
|
95
|
-
var refObjectURI = ((
|
|
125
|
+
var refObjectURI = ((_j = change.refObjectURI) === null || _j === void 0 ? void 0 : _j.indexOf(id)) >= 0 && change.refObjectURI;
|
|
96
126
|
if (refObjectURI) {
|
|
97
127
|
value.refObjectURI = refObjectURI;
|
|
98
128
|
}
|
|
@@ -104,7 +134,7 @@ var prepareAttribute = function (container, change) {
|
|
|
104
134
|
return container;
|
|
105
135
|
};
|
|
106
136
|
var createEntityOrRelation = function (metadata, value) {
|
|
107
|
-
var _a = value.attributes, attributes = _a === void 0 ? {} : _a, startDate = value.startDate, endDate = value.endDate;
|
|
137
|
+
var _a = value.attributes, attributes = _a === void 0 ? {} : _a, startDate = value.startDate, endDate = value.endDate, lineIds = value.lineIds;
|
|
108
138
|
var _b = value, roles = _b.roles, tags = _b.tags, defaultProfilePicValue = _b.defaultProfilePicValue;
|
|
109
139
|
var newObject = __assign({}, attributes);
|
|
110
140
|
if (defaultProfilePicValue) {
|
|
@@ -114,7 +144,10 @@ var createEntityOrRelation = function (metadata, value) {
|
|
|
114
144
|
newObject[EntityAttrTypes.roles.name] = [
|
|
115
145
|
{
|
|
116
146
|
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
117
|
-
newValue: {
|
|
147
|
+
newValue: {
|
|
148
|
+
value: roles.map(getRoleLabel(metadata)).join(', '),
|
|
149
|
+
lineIds: lineIds && ["".concat(lineIds[0], "/").concat(EntityAttrTypes.roles.name)]
|
|
150
|
+
}
|
|
118
151
|
}
|
|
119
152
|
];
|
|
120
153
|
}
|
|
@@ -122,7 +155,10 @@ var createEntityOrRelation = function (metadata, value) {
|
|
|
122
155
|
newObject[EntityAttrTypes.tags.name] = [
|
|
123
156
|
{
|
|
124
157
|
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
125
|
-
newValue: {
|
|
158
|
+
newValue: {
|
|
159
|
+
value: tags.join(', '),
|
|
160
|
+
lineIds: lineIds && ["".concat(lineIds[0], "/").concat(EntityAttrTypes.tags.name)]
|
|
161
|
+
}
|
|
126
162
|
}
|
|
127
163
|
];
|
|
128
164
|
}
|
|
@@ -130,7 +166,10 @@ var createEntityOrRelation = function (metadata, value) {
|
|
|
130
166
|
newObject[EntityAttrTypes.startDate.name] = [
|
|
131
167
|
{
|
|
132
168
|
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
133
|
-
newValue: {
|
|
169
|
+
newValue: {
|
|
170
|
+
value: startDate,
|
|
171
|
+
lineIds: lineIds && ["".concat(lineIds[0], "/").concat(EntityAttrTypes.startDate.name)]
|
|
172
|
+
}
|
|
134
173
|
}
|
|
135
174
|
];
|
|
136
175
|
}
|
|
@@ -138,10 +177,14 @@ var createEntityOrRelation = function (metadata, value) {
|
|
|
138
177
|
newObject[EntityAttrTypes.endDate.name] = [
|
|
139
178
|
{
|
|
140
179
|
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
141
|
-
newValue: {
|
|
180
|
+
newValue: {
|
|
181
|
+
value: endDate,
|
|
182
|
+
lineIds: lineIds && ["".concat(lineIds[0], "/").concat(EntityAttrTypes.endDate.name)]
|
|
183
|
+
}
|
|
142
184
|
}
|
|
143
185
|
];
|
|
144
186
|
}
|
|
187
|
+
newObject['lineIds'] = lineIds;
|
|
145
188
|
return newObject;
|
|
146
189
|
};
|
|
147
190
|
var mergeAttributesInChange = function (metadata, objectInfo, change, container) {
|