@reltio/sources 1.4.1584 → 1.4.1586-mui5

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.
Files changed (94) hide show
  1. package/index.ts +1 -0
  2. package/package.json +38 -21
  3. package/public/bundle.js +205 -0
  4. package/public/bundle.js.LICENSE.txt +79 -0
  5. package/public/package.json +22 -0
  6. package/scripts/build/index.js +20 -0
  7. package/src/components/CrosswalkTreeView/CrosswalkTreeView.tsx +47 -0
  8. package/src/components/CrosswalkTreeView/__tests__/CrosswalkTreeView.spec.tsx +72 -0
  9. package/src/components/CrosswalkTreeView/__tests__/helpers.spec.ts +961 -0
  10. package/src/components/CrosswalkTreeView/helpers.ts +91 -0
  11. package/src/components/CrosswalkTreeView/styles.ts +10 -0
  12. package/src/components/EmptyState/EmptyState.tsx +20 -0
  13. package/src/components/EmptyState/__tests__/EmptyState.test.tsx +13 -0
  14. package/src/components/EmptyState/icons/EmptySources.svg +43 -0
  15. package/src/components/EmptyState/styles.ts +19 -0
  16. package/src/components/LegendTable/LegendTable.tsx +124 -0
  17. package/src/components/LegendTable/LegendTableRow/ContributorRow/ContributorRow.tsx +46 -0
  18. package/src/components/LegendTable/LegendTableRow/ContributorRow/__tests__/ContributorRow.test.tsx +103 -0
  19. package/src/components/LegendTable/LegendTableRow/ContributorRow/styles.ts +31 -0
  20. package/src/components/LegendTable/LegendTableRow/LegendTableRow.tsx +179 -0
  21. package/src/components/LegendTable/LegendTableRow/__tests__/LegendTableRow.test.tsx +371 -0
  22. package/src/components/LegendTable/LegendTableRow/styles.ts +31 -0
  23. package/src/components/LegendTable/__tests__/LegendTable.test.tsx +273 -0
  24. package/src/components/LegendTable/__tests__/helpers.test.ts +541 -0
  25. package/src/components/LegendTable/helpers.ts +64 -0
  26. package/src/components/LegendTable/styles.ts +17 -0
  27. package/src/components/LegendView/LegendView.tsx +201 -0
  28. package/src/components/LegendView/__tests__/LegendView.test.tsx +307 -0
  29. package/src/components/LegendView/styles.ts +51 -0
  30. package/src/components/RightSidePanel/RightSidePanel.tsx +25 -0
  31. package/src/components/RightSidePanel/__tests__/RightSidePanel.test.tsx +28 -0
  32. package/src/components/RightSidePanel/styles.ts +14 -0
  33. package/src/components/RulesestsSelector/RulesestsSelector.tsx +31 -0
  34. package/src/components/RulesestsSelector/RulesetOption/RulesetOption.tsx +25 -0
  35. package/src/components/RulesestsSelector/RulesetOption/__tests__/RulesetOption.test.tsx +25 -0
  36. package/src/components/RulesestsSelector/RulesetOption/styles.ts +27 -0
  37. package/src/components/RulesestsSelector/RulesetsMenuList/RulesetsMenuList.tsx +14 -0
  38. package/src/components/RulesestsSelector/__tests__/RulesetsSelector.test.tsx +91 -0
  39. package/src/components/RulesestsSelector/styles.ts +7 -0
  40. package/src/components/SankeyChart/Link.tsx +31 -0
  41. package/src/components/SankeyChart/MergeTooltip.tsx +37 -0
  42. package/src/components/SankeyChart/Node.tsx +137 -0
  43. package/src/components/SankeyChart/SankeyChart.tsx +103 -0
  44. package/src/components/SankeyChart/__tests__/Link.spec.tsx +127 -0
  45. package/src/components/SankeyChart/__tests__/MergeTooltip.spec.tsx +22 -0
  46. package/src/components/SankeyChart/__tests__/Node.spec.tsx +248 -0
  47. package/src/components/SankeyChart/__tests__/SankeyChart.spec.tsx +161 -0
  48. package/src/components/SankeyChart/__tests__/__snapshots__/SankeyChart.spec.tsx.snap +183 -0
  49. package/src/components/SankeyChart/sankey.ts +322 -0
  50. package/src/components/SankeyChart/styles.ts +41 -0
  51. package/src/components/SankeyChart/useSankey.tsx +44 -0
  52. package/src/components/SelectableTree/SelectableTree.tsx +46 -0
  53. package/src/components/SelectableTree/__tests__/SelectableTree.test.tsx +28 -0
  54. package/src/components/SelectableTree/__tests__/__snapshots__/SelectableTree.test.tsx.snap +59 -0
  55. package/src/components/SelectableTree/styles.ts +42 -0
  56. package/src/components/SourcesView/SourcesView.tsx +318 -0
  57. package/src/components/SourcesView/__tests__/IntegrationSourcesView.spec.tsx +199 -0
  58. package/src/components/SourcesView/__tests__/SourcesView.spec.tsx +903 -0
  59. package/src/components/SourcesView/__tests__/data/metadata.data.ts +27 -0
  60. package/src/components/SourcesView/__tests__/data/store.data.ts +65 -0
  61. package/src/components/SourcesView/icons/LegendIcon.svg +8 -0
  62. package/src/components/SourcesView/index.tsx +57 -0
  63. package/src/components/SourcesView/styles.ts +44 -0
  64. package/src/components/TreeActionSnackbar/TreeActionSnackbar.tsx +38 -0
  65. package/src/components/TreeActionSnackbar/__tests__/TreeActionSnackbar.test.tsx +38 -0
  66. package/src/components/TreeActionSnackbar/styles.ts +11 -0
  67. package/src/components/UnmergeDialog/UnmergeDialog.tsx +78 -0
  68. package/src/components/UnmergeDialog/__tests__/UnmergeDialog.test.tsx +124 -0
  69. package/src/components/UnmergeDialog/__tests__/testData.data.ts +271 -0
  70. package/src/components/UnmergeDialog/styles.ts +34 -0
  71. package/src/components/UnsubscribeDialog/UnsubscribeDialog.tsx +64 -0
  72. package/src/components/UnsubscribeDialog/__tests__/UnsubscribeDialog.test.tsx +59 -0
  73. package/src/components/UnsubscribeDialog/styles.ts +31 -0
  74. package/src/hooks/__tests__/useCrosswalkTree.specs.tsx +68 -0
  75. package/src/hooks/__tests__/useCrosswalkTreeActions.specs.ts +110 -0
  76. package/src/hooks/__tests__/useCrosswalksDisplay.specs.tsx +213 -0
  77. package/src/hooks/__tests__/useEntityWithSurvivorshipGroups.specs.ts +160 -0
  78. package/src/hooks/useCrosswalkTree.ts +38 -0
  79. package/src/hooks/useCrosswalkTreeActions.ts +83 -0
  80. package/src/hooks/useCrosswalksDisplay.ts +110 -0
  81. package/src/hooks/useEntityWithSurvivorshipGroups.tsx +51 -0
  82. package/src/icons/notMatch.svg +14 -0
  83. package/src/index.ts +1 -0
  84. package/src/services/errors.ts +11 -0
  85. package/src/types/LegendMode.ts +5 -0
  86. package/src/types/SankeyChartData.ts +31 -0
  87. package/src/types/SourcesSavedState.ts +3 -0
  88. package/src/types/UnmergeContributorEvent.ts +7 -0
  89. package/src/types/UnsubscribeContributorEvent.ts +6 -0
  90. package/src/types/index.ts +4 -0
  91. package/tsconfig.json +4 -0
  92. package/webpack.config.js +10 -0
  93. package/bundle.js +0 -2
  94. package/bundle.js.LICENSE.txt +0 -42
@@ -0,0 +1,541 @@
1
+ import {omit} from 'ramda';
2
+ import {buildTableRowsData, collectVisibleCrosswalks} from '../helpers';
3
+
4
+ describe('helpers tests', () => {
5
+ describe('buildTableRowsData', () => {
6
+ const entity = {
7
+ uri: 'entities/1TVQXTdB',
8
+ type: 'configuration/entityTypes/Product',
9
+ attributes: {
10
+ String: [
11
+ {
12
+ type: 'configuration/entityTypes/Product/attributes/String',
13
+ ov: true,
14
+ value: 'Ref Rel 2',
15
+ uri: 'entities/1TVQXTdB/attributes/String/2xWVNXzlB'
16
+ }
17
+ ],
18
+ NestedTest: [
19
+ {
20
+ label: '',
21
+ value: {
22
+ Int: [
23
+ {
24
+ type: 'configuration/entityTypes/Product/attributes/NestedTest/attributes/Int',
25
+ ov: true,
26
+ value: '2',
27
+ uri: 'entities/1TVQXTdB/attributes/NestedTest/2xWVNY41R/Int/2xWVNY8Hh'
28
+ }
29
+ ]
30
+ },
31
+ ov: true,
32
+ uri: 'entities/1TVQXTdB/attributes/NestedTest/2xWVNY41R'
33
+ }
34
+ ],
35
+ Country: [
36
+ {
37
+ label: 'Two',
38
+ relationshipLabel: 'Two',
39
+ value: {
40
+ Name: [
41
+ {
42
+ type: 'configuration/entityTypes/Country/attributes/Name',
43
+ ov: true,
44
+ value: ' Two',
45
+ uri: 'entities/1TVQXTdB/attributes/Country/12IUIG8f/Name/2xWVNYtAX'
46
+ }
47
+ ],
48
+ RefEnumeration: [
49
+ {
50
+ type: 'configuration/relationTypes/ProductToCountry/attributes/RefEnumeration',
51
+ ov: true,
52
+ value: 'Test2',
53
+ uri: 'entities/1TVQXTdB/attributes/Country/12IUIG8f/RefEnumeration/2xWVNYxQn'
54
+ }
55
+ ]
56
+ },
57
+ ov: true,
58
+ uri: 'entities/1TVQXTdB/attributes/Country/12IUIG8f',
59
+ refEntity: {
60
+ type: 'configuration/entityTypes/Country',
61
+ crosswalks: [
62
+ {
63
+ uri: 'entities/1TVQXTdB/crosswalks/1TVQXc9h.2xWVNZ1h3',
64
+ type: 'configuration/sources/IPM',
65
+ value: 'refEntity-ipm-two-2',
66
+ createDate: '2021-08-15T11:32:49.533Z',
67
+ updateDate: '2021-08-15T11:32:49.533Z',
68
+ attributeURIs: [
69
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f/Name/2xWVNYtAX',
70
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f'
71
+ ]
72
+ }
73
+ ],
74
+ objectURI: 'entities/1TVQXc9h'
75
+ },
76
+ refRelation: {
77
+ type: 'configuration/relationTypes/ProductToCountry',
78
+ crosswalks: [
79
+ {
80
+ uri: 'entities/1TVQXTdB/crosswalks/12IUIG8f.2xWVNZ5xJ',
81
+ type: 'configuration/sources/BRM',
82
+ value: 'refRelation-brm-two-2',
83
+ createDate: '2021-08-15T11:32:49.533Z',
84
+ updateDate: '2021-08-15T11:32:49.533Z',
85
+ attributeURIs: [
86
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f/RefEnumeration/2xWVNYxQn',
87
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f'
88
+ ]
89
+ }
90
+ ],
91
+ startRefPinned: false,
92
+ endRefPinned: false,
93
+ startRefIgnored: false,
94
+ endRefIgnored: false,
95
+ objectURI: 'relations/12IUIG8f'
96
+ },
97
+ startObjectCrosswalks: [
98
+ {
99
+ type: 'configuration/sources/SAP',
100
+ value: 'entity-sap-refrel-2'
101
+ }
102
+ ]
103
+ },
104
+ {
105
+ label: 'One',
106
+ relationshipLabel: 'One',
107
+ value: {
108
+ Name: [
109
+ {
110
+ type: 'configuration/entityTypes/Country/attributes/Name',
111
+ ov: true,
112
+ value: 'One',
113
+ uri: 'entities/1TVQXTdB/attributes/Country/12IUIBsP/Name/2xWVNYPKj'
114
+ }
115
+ ],
116
+ RefEnumeration: [
117
+ {
118
+ type: 'configuration/relationTypes/ProductToCountry/attributes/RefEnumeration',
119
+ ov: true,
120
+ value: 'Test1',
121
+ uri: 'entities/1TVQXTdB/attributes/Country/12IUIBsP/RefEnumeration/2xWVNYTaz'
122
+ }
123
+ ]
124
+ },
125
+ ov: true,
126
+ uri: 'entities/1TVQXTdB/attributes/Country/12IUIBsP',
127
+ refEntity: {
128
+ type: 'configuration/entityTypes/Country',
129
+ crosswalks: [
130
+ {
131
+ uri: 'entities/1TVQXTdB/crosswalks/1TVQXXtR.2xWVNYXrF',
132
+ type: 'configuration/sources/MPM',
133
+ value: 'refEntity-MPM-one-2',
134
+ createDate: '2021-08-15T11:32:49.533Z',
135
+ updateDate: '2021-08-15T11:32:49.533Z',
136
+ attributeURIs: [
137
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP',
138
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP/Name/2xWVNYPKj'
139
+ ]
140
+ }
141
+ ],
142
+ objectURI: 'entities/1TVQXXtR'
143
+ },
144
+ refRelation: {
145
+ type: 'configuration/relationTypes/ProductToCountry',
146
+ crosswalks: [
147
+ {
148
+ uri: 'entities/1TVQXTdB/crosswalks/12IUIBsP.2xWVNYc7V',
149
+ type: 'configuration/sources/MSB',
150
+ value: 'refRelation-MSB-one-2',
151
+ createDate: '2021-08-15T11:32:49.533Z',
152
+ updateDate: '2021-08-15T11:32:49.533Z',
153
+ attributeURIs: [
154
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP',
155
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP/RefEnumeration/2xWVNYTaz'
156
+ ]
157
+ }
158
+ ],
159
+ startRefPinned: false,
160
+ endRefPinned: false,
161
+ startRefIgnored: false,
162
+ endRefIgnored: false,
163
+ objectURI: 'relations/12IUIBsP'
164
+ },
165
+ startObjectCrosswalks: [
166
+ {
167
+ type: 'configuration/sources/SAP',
168
+ value: 'entity-sap-refrel-2'
169
+ }
170
+ ]
171
+ }
172
+ ]
173
+ },
174
+ crosswalks: [
175
+ {
176
+ uri: 'entities/1TVQXTdB/crosswalks/2xWVNZADZ',
177
+ type: 'configuration/sources/SAP',
178
+ value: 'entity-sap-refrel-2',
179
+ reltioLoadDate: '2021-08-15T11:32:49.533Z',
180
+ createDate: '2021-08-15T11:32:49.533Z',
181
+ updateDate: '2021-08-15T11:32:49.533Z',
182
+ attributes: [
183
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP',
184
+ 'entities/1TVQXTdB/attributes/NestedTest/2xWVNY41R/Int/2xWVNY8Hh',
185
+ 'entities/1TVQXTdB/attributes/NestedTest/2xWVNY41R',
186
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f',
187
+ 'entities/1TVQXTdB/attributes/String/2xWVNXzlB'
188
+ ],
189
+ singleAttributeUpdateDates: {}
190
+ }
191
+ ],
192
+ label: 'Ref Rel 2'
193
+ };
194
+ const contributors = [
195
+ {
196
+ uri: 'entities/1TVQXTdB',
197
+ crosswalks: [
198
+ {
199
+ uri: 'entities/1TVQXTdB/crosswalks/2xWVNZADZ',
200
+ type: 'configuration/sources/SAP',
201
+ ownerType: 'entity',
202
+ value: 'entity-sap-refrel-2'
203
+ },
204
+ {
205
+ uri: 'relations/12IUIBsP/crosswalks/2xWVNYc7V',
206
+ type: 'configuration/sources/MSB',
207
+ ownerType: 'relation',
208
+ value: 'refRelation-MSB-one-2'
209
+ },
210
+ {
211
+ uri: 'relations/12IUIG8f/crosswalks/2xWVNZ5xJ',
212
+ type: 'configuration/sources/BRM',
213
+ ownerType: 'relation',
214
+ value: 'refRelation-brm-two-2'
215
+ },
216
+ {
217
+ uri: 'relations/17kKRfCS/crosswalks/3zGQZipVo',
218
+ type: 'configuration/sources/BRM',
219
+ ownerType: 'relation',
220
+ value: 'brm_Sudan'
221
+ }
222
+ ]
223
+ },
224
+ {
225
+ uri: 'entities/1iLUtbCC'
226
+ },
227
+ {
228
+ uri: 'entities/1cKFWZEn',
229
+ crosswalks: [
230
+ {
231
+ uri: 'entities/1cKFWZEn/crosswalks/4kcrq8gfR',
232
+ type: 'configuration/sources/MSB',
233
+ value: 'MSB0.03738339974066107',
234
+ attributes: ['entities/1cKFWZEn/attributes/FirstName/4kcrq8Y8v']
235
+ },
236
+ {
237
+ uri: 'entities/1cKFWZEn/crosswalks/4kcrq8cPB',
238
+ type: 'configuration/sources/GATOR',
239
+ value: 'GATOR0.9166192530049697',
240
+ attributes: ['entities/1cKFWZEn/attributes/FirstName/4kcrq8Y8v']
241
+ }
242
+ ]
243
+ }
244
+ ];
245
+ const selectedAttributeTypes = [
246
+ {
247
+ label: 'String',
248
+ name: 'String',
249
+ type: 'String',
250
+ uri: 'configuration/entityTypes/Product/attributes/String'
251
+ },
252
+ {
253
+ label: 'Date',
254
+ name: 'Date',
255
+ type: 'Date',
256
+ uri: 'configuration/entityTypes/Product/attributes/Date'
257
+ },
258
+ {
259
+ label: 'Int',
260
+ name: 'Int',
261
+ type: 'Int',
262
+ uri: 'configuration/entityTypes/Product/attributes/Int'
263
+ },
264
+ {
265
+ label: 'Nested Test',
266
+ name: 'NestedTest',
267
+ type: 'Nested',
268
+ uri: 'configuration/entityTypes/Product/attributes/NestedTest',
269
+ dataLabelPattern: '{String} {Number}',
270
+ attributes: [
271
+ {
272
+ label: 'Int',
273
+ name: 'Int',
274
+ type: 'Int',
275
+ uri: 'configuration/entityTypes/Product/attributes/NestedTest/attributes/Int'
276
+ }
277
+ ]
278
+ },
279
+ {
280
+ label: 'Country',
281
+ name: 'Country',
282
+ type: 'Reference',
283
+ uri: 'configuration/entityTypes/Product/attributes/Country',
284
+ referencedAttributeURIs: [
285
+ 'configuration/entityTypes/Country/attributes/Name',
286
+ 'configuration/entityTypes/Country/attributes/String',
287
+ 'configuration/entityTypes/Country/attributes/Int',
288
+ 'configuration/entityTypes/Country/attributes/Long',
289
+ 'configuration/entityTypes/Country/attributes/Number'
290
+ ],
291
+ referencedEntityTypeURI: 'configuration/entityTypes/Country',
292
+ relationshipTypeURI: 'configuration/relationTypes/ProductToCountry'
293
+ }
294
+ ];
295
+
296
+ it('should work correctly', () => {
297
+ expect(buildTableRowsData(entity, contributors, selectedAttributeTypes)).toEqual([
298
+ {
299
+ contributorUri: 'entities/1TVQXTdB',
300
+ crosswalksBySources: [
301
+ {
302
+ crosswalksByTypes: {
303
+ dependent: [],
304
+ empty: [],
305
+ simple: [
306
+ {
307
+ attributes: [
308
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP',
309
+ 'entities/1TVQXTdB/attributes/NestedTest/2xWVNY41R/Int/2xWVNY8Hh',
310
+ 'entities/1TVQXTdB/attributes/NestedTest/2xWVNY41R',
311
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f',
312
+ 'entities/1TVQXTdB/attributes/String/2xWVNXzlB'
313
+ ],
314
+ createDate: '2021-08-15T11:32:49.533Z',
315
+ ownerType: 'entity',
316
+ reltioLoadDate: '2021-08-15T11:32:49.533Z',
317
+ singleAttributeUpdateDates: {},
318
+ type: 'configuration/sources/SAP',
319
+ updateDate: '2021-08-15T11:32:49.533Z',
320
+ uri: 'entities/1TVQXTdB/crosswalks/2xWVNZADZ',
321
+ value: 'entity-sap-refrel-2'
322
+ }
323
+ ]
324
+ },
325
+ source: 'configuration/sources/SAP'
326
+ },
327
+ {
328
+ crosswalksByTypes: {
329
+ dependent: [
330
+ {
331
+ attributeURIs: [
332
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f/RefEnumeration/2xWVNYxQn',
333
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f'
334
+ ],
335
+ createDate: '2021-08-15T11:32:49.533Z',
336
+ ownerType: 'relation',
337
+ type: 'configuration/sources/BRM',
338
+ updateDate: '2021-08-15T11:32:49.533Z',
339
+ uri: 'entities/1TVQXTdB/crosswalks/12IUIG8f.2xWVNZ5xJ',
340
+ value: 'refRelation-brm-two-2'
341
+ }
342
+ ],
343
+ empty: [],
344
+ simple: []
345
+ },
346
+ source: 'configuration/sources/BRM'
347
+ },
348
+ {
349
+ crosswalksByTypes: {
350
+ dependent: [
351
+ {
352
+ attributeURIs: [
353
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP',
354
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP/RefEnumeration/2xWVNYTaz'
355
+ ],
356
+ createDate: '2021-08-15T11:32:49.533Z',
357
+ ownerType: 'relation',
358
+ type: 'configuration/sources/MSB',
359
+ updateDate: '2021-08-15T11:32:49.533Z',
360
+ uri: 'entities/1TVQXTdB/crosswalks/12IUIBsP.2xWVNYc7V',
361
+ value: 'refRelation-MSB-one-2'
362
+ }
363
+ ],
364
+ empty: [],
365
+ simple: []
366
+ },
367
+ source: 'configuration/sources/MSB'
368
+ }
369
+ ]
370
+ }
371
+ ]);
372
+ });
373
+
374
+ it('should work correctly if entity does not have crosswalks field', () => {
375
+ const entityWithoutCrosswalks = omit(['crosswalks'], entity);
376
+ expect(buildTableRowsData(entityWithoutCrosswalks, contributors, selectedAttributeTypes)).toEqual([
377
+ {
378
+ contributorUri: 'entities/1TVQXTdB',
379
+ crosswalksBySources: [
380
+ {
381
+ crosswalksByTypes: {
382
+ dependent: [
383
+ {
384
+ attributeURIs: [
385
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f/RefEnumeration/2xWVNYxQn',
386
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f'
387
+ ],
388
+ createDate: '2021-08-15T11:32:49.533Z',
389
+ ownerType: 'relation',
390
+ type: 'configuration/sources/BRM',
391
+ updateDate: '2021-08-15T11:32:49.533Z',
392
+ uri: 'entities/1TVQXTdB/crosswalks/12IUIG8f.2xWVNZ5xJ',
393
+ value: 'refRelation-brm-two-2'
394
+ }
395
+ ],
396
+ empty: [],
397
+ simple: []
398
+ },
399
+ source: 'configuration/sources/BRM'
400
+ },
401
+ {
402
+ crosswalksByTypes: {
403
+ dependent: [
404
+ {
405
+ attributeURIs: [
406
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP',
407
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP/RefEnumeration/2xWVNYTaz'
408
+ ],
409
+ createDate: '2021-08-15T11:32:49.533Z',
410
+ ownerType: 'relation',
411
+ type: 'configuration/sources/MSB',
412
+ updateDate: '2021-08-15T11:32:49.533Z',
413
+ uri: 'entities/1TVQXTdB/crosswalks/12IUIBsP.2xWVNYc7V',
414
+ value: 'refRelation-MSB-one-2'
415
+ }
416
+ ],
417
+ empty: [],
418
+ simple: []
419
+ },
420
+ source: 'configuration/sources/MSB'
421
+ }
422
+ ]
423
+ }
424
+ ]);
425
+ });
426
+ });
427
+
428
+ describe('collectVisibleCrosswalks', () => {
429
+ it('should work correctly', () => {
430
+ const rowsData = [
431
+ {
432
+ contributorUri: 'entities/1TVQXTdB',
433
+ crosswalksBySources: [
434
+ {
435
+ crosswalksByTypes: {
436
+ dependent: [],
437
+ empty: [],
438
+ simple: [
439
+ {
440
+ attributes: [
441
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP',
442
+ 'entities/1TVQXTdB/attributes/NestedTest/2xWVNY41R/Int/2xWVNY8Hh',
443
+ 'entities/1TVQXTdB/attributes/NestedTest/2xWVNY41R',
444
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f',
445
+ 'entities/1TVQXTdB/attributes/String/2xWVNXzlB'
446
+ ],
447
+ createDate: '2021-08-15T11:32:49.533Z',
448
+ ownerType: 'entity',
449
+ reltioLoadDate: '2021-08-15T11:32:49.533Z',
450
+ singleAttributeUpdateDates: {},
451
+ type: 'configuration/sources/SAP',
452
+ updateDate: '2021-08-15T11:32:49.533Z',
453
+ uri: 'entities/1TVQXTdB/crosswalks/2xWVNZADZ',
454
+ value: 'entity-sap-refrel-2'
455
+ }
456
+ ]
457
+ },
458
+ source: 'configuration/sources/SAP'
459
+ },
460
+ {
461
+ crosswalksByTypes: {
462
+ dependent: [
463
+ {
464
+ attributeURIs: [
465
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f/RefEnumeration/2xWVNYxQn',
466
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f'
467
+ ],
468
+ createDate: '2021-08-15T11:32:49.533Z',
469
+ ownerType: 'relation',
470
+ type: 'configuration/sources/BRM',
471
+ updateDate: '2021-08-15T11:32:49.533Z',
472
+ uri: 'entities/1TVQXTdB/crosswalks/12IUIG8f.2xWVNZ5xJ',
473
+ value: 'refRelation-brm-two-2'
474
+ }
475
+ ],
476
+ empty: [],
477
+ simple: []
478
+ },
479
+ source: 'configuration/sources/BRM'
480
+ },
481
+ {
482
+ crosswalksByTypes: {
483
+ dependent: [
484
+ {
485
+ attributeURIs: [
486
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP',
487
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP/RefEnumeration/2xWVNYTaz'
488
+ ],
489
+ createDate: '2021-08-15T11:32:49.533Z',
490
+ ownerType: 'relation',
491
+ type: 'configuration/sources/MSB',
492
+ updateDate: '2021-08-15T11:32:49.533Z',
493
+ uri: 'entities/1TVQXTdB/crosswalks/12IUIBsP.2xWVNYc7V',
494
+ value: 'refRelation-MSB-one-2'
495
+ }
496
+ ],
497
+ empty: [],
498
+ simple: []
499
+ },
500
+ source: 'configuration/sources/MSB'
501
+ }
502
+ ]
503
+ }
504
+ ];
505
+ const expandedByContributor = {
506
+ 'entities/1TVQXTdB': ['configuration/sources/MSB']
507
+ };
508
+ expect(collectVisibleCrosswalks(rowsData, expandedByContributor)).toEqual([
509
+ {
510
+ attributes: [
511
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP',
512
+ 'entities/1TVQXTdB/attributes/NestedTest/2xWVNY41R/Int/2xWVNY8Hh',
513
+ 'entities/1TVQXTdB/attributes/NestedTest/2xWVNY41R',
514
+ 'entities/1TVQXTdB/attributes/Country/12IUIG8f',
515
+ 'entities/1TVQXTdB/attributes/String/2xWVNXzlB'
516
+ ],
517
+ createDate: '2021-08-15T11:32:49.533Z',
518
+ ownerType: 'entity',
519
+ reltioLoadDate: '2021-08-15T11:32:49.533Z',
520
+ singleAttributeUpdateDates: {},
521
+ type: 'configuration/sources/SAP',
522
+ updateDate: '2021-08-15T11:32:49.533Z',
523
+ uri: 'entities/1TVQXTdB/crosswalks/2xWVNZADZ',
524
+ value: 'entity-sap-refrel-2'
525
+ },
526
+ {
527
+ attributeURIs: [
528
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP',
529
+ 'entities/1TVQXTdB/attributes/Country/12IUIBsP/RefEnumeration/2xWVNYTaz'
530
+ ],
531
+ createDate: '2021-08-15T11:32:49.533Z',
532
+ ownerType: 'relation',
533
+ type: 'configuration/sources/MSB',
534
+ updateDate: '2021-08-15T11:32:49.533Z',
535
+ uri: 'entities/1TVQXTdB/crosswalks/12IUIBsP.2xWVNYc7V',
536
+ value: 'refRelation-MSB-one-2'
537
+ }
538
+ ]);
539
+ });
540
+ });
541
+ });
@@ -0,0 +1,64 @@
1
+ import {
2
+ AttributeType,
3
+ Contributor,
4
+ Crosswalk,
5
+ Entity,
6
+ eqCrosswalks,
7
+ getRelationCrosswalks,
8
+ isEmptyValue,
9
+ RelationCrosswalk
10
+ } from '@reltio/mdm-sdk';
11
+ import {chain, filter, map, pipe} from 'ramda';
12
+ import {CrosswalksByTypes, CrosswalkType, groupCrosswalksByTypesAndSources} from '@reltio/components';
13
+
14
+ type TableRow = {
15
+ contributorUri: string;
16
+ crosswalksBySources: {
17
+ source: string;
18
+ crosswalksByTypes: CrosswalksByTypes;
19
+ }[];
20
+ };
21
+
22
+ export const buildTableRowsData = (
23
+ entity: Entity,
24
+ contributors: Contributor[],
25
+ selectedAttributeTypes: AttributeType[] = []
26
+ ): TableRow[] => {
27
+ const entityCrosswalks: Crosswalk[] = entity.crosswalks || [];
28
+ const relationCrosswalks: RelationCrosswalk[] = getRelationCrosswalks(entity);
29
+ return contributors
30
+ .filter((contributor) => !isEmptyValue(contributor.crosswalks))
31
+ .map(({uri, crosswalks}) => {
32
+ const crosswalksBySources = pipe(
33
+ map((crosswalk) => {
34
+ if (crosswalk.ownerType === 'relation') {
35
+ const relationCrosswalk = relationCrosswalks.find(eqCrosswalks(crosswalk));
36
+ return relationCrosswalk && {ownerType: 'relation', ...relationCrosswalk};
37
+ } else {
38
+ const entityCrosswalk = entityCrosswalks.find(eqCrosswalks(crosswalk));
39
+ return entityCrosswalk && {ownerType: 'entity', ...entityCrosswalk};
40
+ }
41
+ }),
42
+ filter((crosswalk) => !!crosswalk),
43
+ groupCrosswalksByTypesAndSources(entity.type, selectedAttributeTypes)
44
+ )(crosswalks);
45
+
46
+ return {contributorUri: uri, crosswalksBySources};
47
+ })
48
+ .filter(({crosswalksBySources}) => crosswalksBySources.length > 0);
49
+ };
50
+
51
+ export const collectVisibleCrosswalks = (
52
+ rowsData: TableRow[],
53
+ expandedByContributor: {[contributorUri: string]: string[]}
54
+ ) => {
55
+ return rowsData.reduce((acc, {contributorUri, crosswalksBySources}) => {
56
+ const visibleCrosswalks = chain(({source, crosswalksByTypes}) => {
57
+ const isExpandedSource = expandedByContributor[contributorUri]?.includes(source);
58
+ return crosswalksByTypes[CrosswalkType.Simple]
59
+ .concat(crosswalksByTypes[CrosswalkType.Empty])
60
+ .concat(isExpandedSource ? crosswalksByTypes[CrosswalkType.Dependent] : []);
61
+ }, crosswalksBySources);
62
+ return acc.concat(visibleCrosswalks);
63
+ }, []);
64
+ };
@@ -0,0 +1,17 @@
1
+ import {makeStyles} from '@mui/styles';
2
+
3
+ export const useStyles = makeStyles(() => ({
4
+ table: {
5
+ overflowY: 'auto',
6
+ overflowX: 'hidden',
7
+ paddingLeft: '16px',
8
+ paddingRight: '6px'
9
+ },
10
+ tableRow: {
11
+ '& + &': {
12
+ marginTop: '10px'
13
+ },
14
+ margin: 'auto',
15
+ maxWidth: '448px'
16
+ }
17
+ }));