@truedat/dd 8.12.1 → 8.12.4

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 (82) hide show
  1. package/package.json +3 -3
  2. package/src/api/__tests__/queries.spec.js +55 -0
  3. package/src/api/queries.js +31 -0
  4. package/src/components/Grant.js +106 -16
  5. package/src/components/GrantRequest.js +2 -2
  6. package/src/components/GrantRequestBulkApprovalPopup.js +0 -1
  7. package/src/components/GrantRequestTemplateForm.js +76 -0
  8. package/src/components/GrantsDownloadButton.js +9 -1
  9. package/src/components/GrantsTable.js +4 -1
  10. package/src/components/StructureFields.js +7 -4
  11. package/src/components/StructureGrantCartCheckout.js +122 -59
  12. package/src/components/StructureGrantCartInformation.js +38 -9
  13. package/src/components/StructureGrantCartUserSelector.js +29 -4
  14. package/src/components/StructureGrantDropdown.js +7 -1
  15. package/src/components/StructureGrants.js +4 -1
  16. package/src/components/StructuresUpdateOption.js +2 -2
  17. package/src/components/SystemStructures.js +3 -3
  18. package/src/components/__tests__/CatalogViewConfigForm.spec.js +2 -0
  19. package/src/components/__tests__/EditDomainForm.spec.js +3 -1
  20. package/src/components/__tests__/Grant.spec.js +171 -0
  21. package/src/components/__tests__/GrantApprovalRuleForm.spec.js +2 -0
  22. package/src/components/__tests__/GrantApprovalRuleNew.spec.js +8 -0
  23. package/src/components/__tests__/GrantApprovalRules.spec.js +4 -0
  24. package/src/components/__tests__/GrantRequest.spec.js +4 -4
  25. package/src/components/__tests__/GrantRequestBulkActions.spec.js +1 -4
  26. package/src/components/__tests__/GrantRequestsSearchResults.spec.js +2 -0
  27. package/src/components/__tests__/GrantsDownloadButton.spec.js +58 -2
  28. package/src/components/__tests__/GrantsTable.spec.js +22 -2
  29. package/src/components/__tests__/LineageDefs.spec.js +6 -1
  30. package/src/components/__tests__/LineageForm.spec.js +1 -0
  31. package/src/components/__tests__/LineageGraphToolbar.spec.js +19 -17
  32. package/src/components/__tests__/LineageInspectorPanel.spec.js +17 -9
  33. package/src/components/__tests__/ProfileGroup.spec.js +7 -1
  34. package/src/components/__tests__/ReferenceDatasetForm.spec.js +2 -0
  35. package/src/components/__tests__/ReferenceDatasetRoutes.spec.js +9 -0
  36. package/src/components/__tests__/StructureGrantCartCheckout.grouping.spec.js +95 -0
  37. package/src/components/__tests__/StructureGrantCartCheckout.selection.spec.js +416 -0
  38. package/src/components/__tests__/StructureGrantCartCheckout.spec.js +216 -4
  39. package/src/components/__tests__/StructureGrantCartInformation.spec.js +5 -2
  40. package/src/components/__tests__/StructureGrantCartUserSelector.spec.js +128 -0
  41. package/src/components/__tests__/StructureGrantDropdown.spec.js +92 -0
  42. package/src/components/__tests__/StructureGrantListButton.spec.js +70 -0
  43. package/src/components/__tests__/StructureGrantSummaryButton.spec.js +36 -1
  44. package/src/components/__tests__/StructureGrants.spec.js +12 -0
  45. package/src/components/__tests__/StructureRelationRow.spec.js +72 -4
  46. package/src/components/__tests__/StructureRelations.spec.js +18 -0
  47. package/src/components/__tests__/StructureRoles.spec.js +9 -0
  48. package/src/components/__tests__/StructureRow.spec.js +13 -4
  49. package/src/components/__tests__/StructureSelector.spec.js +2 -0
  50. package/src/components/__tests__/StructureTag.spec.js +2 -0
  51. package/src/components/__tests__/StructureTagForm.spec.js +2 -0
  52. package/src/components/__tests__/StructureType.spec.js +3 -1
  53. package/src/components/__tests__/StructureTypeForm.spec.js +3 -1
  54. package/src/components/__tests__/StructureView.spec.js +17 -1
  55. package/src/components/__tests__/StructuresGrantRequestView.spec.js +2 -0
  56. package/src/components/__tests__/StructuresView.spec.js +2 -1
  57. package/src/components/__tests__/Tag.spec.js +4 -1
  58. package/src/components/__tests__/Tags.spec.js +7 -1
  59. package/src/components/__tests__/__snapshots__/GrantsTable.spec.js.snap +34 -2
  60. package/src/components/__tests__/__snapshots__/LineageDefs.spec.js.snap +32 -30
  61. package/src/components/__tests__/__snapshots__/StructureFields.spec.js.snap +1 -16
  62. package/src/components/__tests__/__snapshots__/StructureGrantCartCheckout.spec.js.snap +217 -1
  63. package/src/components/__tests__/__snapshots__/StructureGrantCartInformation.spec.js.snap +54 -0
  64. package/src/components/__tests__/__snapshots__/StructureRelationRow.spec.js.snap +23 -19
  65. package/src/components/__tests__/__snapshots__/StructureRow.spec.js.snap +28 -24
  66. package/src/components/__tests__/__snapshots__/StructuresUpdateOption.spec.js.snap +7 -3
  67. package/src/messages/en.js +2 -2
  68. package/src/messages/es.js +2 -2
  69. package/src/reducers/__tests__/grantRequestsCart.spec.js +86 -0
  70. package/src/reducers/__tests__/structureRelations.spec.js +28 -0
  71. package/src/reducers/grantRequestsCart.js +20 -2
  72. package/src/selectors/__tests__/__snapshots__/getGrantsColumns.spec.js.snap +1 -9
  73. package/src/selectors/__tests__/getGrantRequestsSearchColumns.spec.js +11 -4
  74. package/src/selectors/__tests__/getGrantsColumns.spec.js +295 -0
  75. package/src/selectors/getBusinessConceptsLinksToStructuresColumnsSelector.js +3 -5
  76. package/src/selectors/getGrantRequestsSearchColumns.js +3 -5
  77. package/src/selectors/getGrantsColumns.js +85 -11
  78. package/src/selectors/getLinkedImplementationsToStructuresColumns.js +3 -7
  79. package/src/selectors/getStructureFieldColumns.js +7 -6
  80. package/src/selectors/getStructureProperties.js +2 -5
  81. package/src/selectors/getStructuresUploadEventColumns.js +2 -7
  82. package/src/selectors/structureColumnsSelector.js +13 -16
@@ -62,6 +62,60 @@ exports[`StructureGrantCartCheckout matches snapshot when modification grant (si
62
62
  >
63
63
  structure.grant.cart.template
64
64
  </div>
65
+ <div
66
+ class="required field"
67
+ >
68
+ <div
69
+ class="field"
70
+ >
71
+ <div
72
+ aria-busy="false"
73
+ aria-expanded="false"
74
+ class="ui search selection dropdown"
75
+ name="template"
76
+ role="combobox"
77
+ >
78
+ <input
79
+ aria-autocomplete="list"
80
+ autocomplete="off"
81
+ class="search"
82
+ tabindex="0"
83
+ type="text"
84
+ value=""
85
+ />
86
+ <div
87
+ aria-atomic="true"
88
+ aria-live="polite"
89
+ class="divider default text"
90
+ role="alert"
91
+ >
92
+ structure.grant.cart.template.placeholder
93
+ </div>
94
+ <i
95
+ aria-hidden="true"
96
+ class="dropdown icon"
97
+ />
98
+ <div
99
+ class="menu transition"
100
+ role="listbox"
101
+ >
102
+ <div
103
+ aria-checked="false"
104
+ aria-selected="true"
105
+ class="selected item"
106
+ role="option"
107
+ style="pointer-events: all;"
108
+ >
109
+ <span
110
+ class="text"
111
+ >
112
+ template1
113
+ </span>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ </div>
118
+ </div>
65
119
  </form>
66
120
  </div>
67
121
  </div>
@@ -221,6 +275,60 @@ exports[`StructureGrantCartCheckout matches snapshot when multi-system (gr scope
221
275
  >
222
276
  structure.grant.cart.template
223
277
  </div>
278
+ <div
279
+ class="required field"
280
+ >
281
+ <div
282
+ class="field"
283
+ >
284
+ <div
285
+ aria-busy="false"
286
+ aria-expanded="false"
287
+ class="ui search selection dropdown"
288
+ name="template"
289
+ role="combobox"
290
+ >
291
+ <input
292
+ aria-autocomplete="list"
293
+ autocomplete="off"
294
+ class="search"
295
+ tabindex="0"
296
+ type="text"
297
+ value=""
298
+ />
299
+ <div
300
+ aria-atomic="true"
301
+ aria-live="polite"
302
+ class="divider default text"
303
+ role="alert"
304
+ >
305
+ structure.grant.cart.template.placeholder
306
+ </div>
307
+ <i
308
+ aria-hidden="true"
309
+ class="dropdown icon"
310
+ />
311
+ <div
312
+ class="menu transition"
313
+ role="listbox"
314
+ >
315
+ <div
316
+ aria-checked="false"
317
+ aria-selected="true"
318
+ class="selected item"
319
+ role="option"
320
+ style="pointer-events: all;"
321
+ >
322
+ <span
323
+ class="text"
324
+ >
325
+ template1
326
+ </span>
327
+ </div>
328
+ </div>
329
+ </div>
330
+ </div>
331
+ </div>
224
332
  </form>
225
333
  </div>
226
334
  </div>
@@ -293,6 +401,60 @@ exports[`StructureGrantCartCheckout matches snapshot when single flow without mo
293
401
  >
294
402
  structure.grant.cart.template
295
403
  </div>
404
+ <div
405
+ class="required field"
406
+ >
407
+ <div
408
+ class="field"
409
+ >
410
+ <div
411
+ aria-busy="false"
412
+ aria-expanded="false"
413
+ class="ui search selection dropdown"
414
+ name="template"
415
+ role="combobox"
416
+ >
417
+ <input
418
+ aria-autocomplete="list"
419
+ autocomplete="off"
420
+ class="search"
421
+ tabindex="0"
422
+ type="text"
423
+ value=""
424
+ />
425
+ <div
426
+ aria-atomic="true"
427
+ aria-live="polite"
428
+ class="divider default text"
429
+ role="alert"
430
+ >
431
+ structure.grant.cart.template.placeholder
432
+ </div>
433
+ <i
434
+ aria-hidden="true"
435
+ class="dropdown icon"
436
+ />
437
+ <div
438
+ class="menu transition"
439
+ role="listbox"
440
+ >
441
+ <div
442
+ aria-checked="false"
443
+ aria-selected="true"
444
+ class="selected item"
445
+ role="option"
446
+ style="pointer-events: all;"
447
+ >
448
+ <span
449
+ class="text"
450
+ >
451
+ template1
452
+ </span>
453
+ </div>
454
+ </div>
455
+ </div>
456
+ </div>
457
+ </div>
296
458
  </form>
297
459
  </div>
298
460
  </div>
@@ -806,7 +968,7 @@ exports[`StructureGrantCartCheckout matches snapshot with group_by_domain enable
806
968
  </div>
807
969
  `;
808
970
 
809
- exports[`StructureGrantCartCheckout matches snapshot with single domain - shows singular domain message 1`] = `
971
+ exports[`StructureGrantCartCheckout matches snapshot with single domain - uses single-group information panel 1`] = `
810
972
  <div>
811
973
  <div
812
974
  class="ui segment structures"
@@ -1112,6 +1274,60 @@ exports[`StructureGrantCartCheckout matches snapshot without gr scope - does not
1112
1274
  >
1113
1275
  structure.grant.cart.template
1114
1276
  </div>
1277
+ <div
1278
+ class="required field"
1279
+ >
1280
+ <div
1281
+ class="field"
1282
+ >
1283
+ <div
1284
+ aria-busy="false"
1285
+ aria-expanded="false"
1286
+ class="ui search selection dropdown"
1287
+ name="template"
1288
+ role="combobox"
1289
+ >
1290
+ <input
1291
+ aria-autocomplete="list"
1292
+ autocomplete="off"
1293
+ class="search"
1294
+ tabindex="0"
1295
+ type="text"
1296
+ value=""
1297
+ />
1298
+ <div
1299
+ aria-atomic="true"
1300
+ aria-live="polite"
1301
+ class="divider default text"
1302
+ role="alert"
1303
+ >
1304
+ structure.grant.cart.template.placeholder
1305
+ </div>
1306
+ <i
1307
+ aria-hidden="true"
1308
+ class="dropdown icon"
1309
+ />
1310
+ <div
1311
+ class="menu transition"
1312
+ role="listbox"
1313
+ >
1314
+ <div
1315
+ aria-checked="false"
1316
+ aria-selected="true"
1317
+ class="selected item"
1318
+ role="option"
1319
+ style="pointer-events: all;"
1320
+ >
1321
+ <span
1322
+ class="text"
1323
+ >
1324
+ template1
1325
+ </span>
1326
+ </div>
1327
+ </div>
1328
+ </div>
1329
+ </div>
1330
+ </div>
1115
1331
  </form>
1116
1332
  </div>
1117
1333
  </div>
@@ -14,6 +14,60 @@ exports[`<StructureGrantCartInformation /> matches the latest snapshot 1`] = `
14
14
  >
15
15
  structure.grant.cart.template
16
16
  </div>
17
+ <div
18
+ class="required field"
19
+ >
20
+ <div
21
+ class="field"
22
+ >
23
+ <div
24
+ aria-busy="false"
25
+ aria-expanded="false"
26
+ class="ui search selection dropdown"
27
+ name="template"
28
+ role="combobox"
29
+ >
30
+ <input
31
+ aria-autocomplete="list"
32
+ autocomplete="off"
33
+ class="search"
34
+ tabindex="0"
35
+ type="text"
36
+ value=""
37
+ />
38
+ <div
39
+ aria-atomic="true"
40
+ aria-live="polite"
41
+ class="divider default text"
42
+ role="alert"
43
+ >
44
+ structure.grant.cart.template.placeholder
45
+ </div>
46
+ <i
47
+ aria-hidden="true"
48
+ class="dropdown icon"
49
+ />
50
+ <div
51
+ class="menu transition"
52
+ role="listbox"
53
+ >
54
+ <div
55
+ aria-checked="false"
56
+ aria-selected="true"
57
+ class="selected item"
58
+ role="option"
59
+ style="pointer-events: all;"
60
+ >
61
+ <span
62
+ class="text"
63
+ >
64
+ template1
65
+ </span>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ </div>
17
71
  </form>
18
72
  </div>
19
73
  </div>
@@ -2,24 +2,28 @@
2
2
 
3
3
  exports[`<StructureRelationRow /> matches the latest snapshot 1`] = `
4
4
  <div>
5
- <tr
6
- class=""
7
- >
8
- <td
9
- class=""
10
- >
11
- Structure 1
12
- </td>
13
- <td
14
- class=""
15
- >
16
- Some Type 1
17
- </td>
18
- <td
19
- class=""
20
- >
21
- used_by
22
- </td>
23
- </tr>
5
+ <table>
6
+ <tbody>
7
+ <tr
8
+ class=""
9
+ >
10
+ <td
11
+ class=""
12
+ >
13
+ Structure 1
14
+ </td>
15
+ <td
16
+ class=""
17
+ >
18
+ Some Type 1
19
+ </td>
20
+ <td
21
+ class=""
22
+ >
23
+ used_by
24
+ </td>
25
+ </tr>
26
+ </tbody>
27
+ </table>
24
28
  </div>
25
29
  `;
@@ -2,29 +2,33 @@
2
2
 
3
3
  exports[`<StructureRow /> matches the latest snapshot 1`] = `
4
4
  <div>
5
- <tr
6
- class=""
7
- >
8
- <td
9
- class="structure-cell-overflow"
10
- >
11
- s1
12
- </td>
13
- <td
14
- class=""
15
- >
16
- org
17
- </td>
18
- <td
19
- class=""
20
- >
21
- sys
22
- </td>
23
- <td
24
- class=""
25
- >
26
- gp
27
- </td>
28
- </tr>
5
+ <table>
6
+ <tbody>
7
+ <tr
8
+ class=""
9
+ >
10
+ <td
11
+ class="structure-cell-overflow"
12
+ >
13
+ s1
14
+ </td>
15
+ <td
16
+ class=""
17
+ >
18
+ org
19
+ </td>
20
+ <td
21
+ class=""
22
+ >
23
+ sys
24
+ </td>
25
+ <td
26
+ class=""
27
+ >
28
+ gp
29
+ </td>
30
+ </tr>
31
+ </tbody>
32
+ </table>
29
33
  </div>
30
34
  `;
@@ -11,9 +11,13 @@ exports[`<StructuresUpdateOption /> matches the latest snapshot 1`] = `
11
11
  aria-hidden="true"
12
12
  class="refresh icon"
13
13
  />
14
- <span>
15
- update
16
- </span>
14
+ <div
15
+ class="text"
16
+ >
17
+ <span>
18
+ update
19
+ </span>
20
+ </div>
17
21
  </div>
18
22
  </div>
19
23
  `;
@@ -132,8 +132,8 @@ export default {
132
132
  "grantRequest.header.updated_at": "Updated",
133
133
  "grantRequest.header.user": "User",
134
134
  "grantRequest.header.group": "User group",
135
- "grantRequest.deleted.user": "Deleted user",
136
- "grantRequest.deleted.group": "Deleted group",
135
+ "deleted.user": "Deleted user",
136
+ "deleted.group": "Deleted group",
137
137
  "grantRequest.header.createdBy": "Created by",
138
138
  "grantRequest.header.create": "Create grant request",
139
139
  "grantRequest.header.type": "Request type",
@@ -135,8 +135,8 @@ export default {
135
135
  "grantRequest.header.updated_at": "Actualizado",
136
136
  "grantRequest.header.user": "Usuario",
137
137
  "grantRequest.header.group": "Grupo de usuarios",
138
- "grantRequest.deleted.user": "Usuario eliminado",
139
- "grantRequest.deleted.group": "Grupo eliminado",
138
+ "deleted.user": "Usuario eliminado",
139
+ "deleted.group": "Grupo eliminado",
140
140
  "grantRequest.header.createdBy": "Creado por",
141
141
  "grantRequest.header.create": "Crear petición de acceso",
142
142
  "grantRequest.header.type": "Tipo de petición",
@@ -132,6 +132,7 @@ describe("reducers: grantRequestsCart", () => {
132
132
  const expectedState = {
133
133
  ...initialState,
134
134
  template,
135
+ validCart: false,
135
136
  };
136
137
  expect(
137
138
  grantRequestsCart(initialState, {
@@ -154,6 +155,7 @@ describe("reducers: grantRequestsCart", () => {
154
155
  ).toEqual({
155
156
  ...initialState,
156
157
  template: "another_template",
158
+ validCart: false,
157
159
  });
158
160
  });
159
161
 
@@ -233,6 +235,31 @@ describe("reducers: grantRequestsCart", () => {
233
235
  ).toEqual(expectedState);
234
236
  });
235
237
 
238
+ it("preserves the draft when reopening the same grant update", () => {
239
+ const previousGrant = { id: 2, detail: { old: "content" } };
240
+ const refreshedGrant = { id: "2", detail: { new: "content" } };
241
+ const structure = { id: 1 };
242
+ const state = {
243
+ ...initialState,
244
+ modificationGrant: previousGrant,
245
+ structures: [{ id: 5 }],
246
+ template: "user selected template",
247
+ templateContent: { reason: { value: "draft", origin: "user" } },
248
+ validCart: true,
249
+ };
250
+
251
+ expect(
252
+ grantRequestsCart(state, {
253
+ type: setGrantChangeRequestCart.TRIGGER,
254
+ payload: { structure, grant: refreshedGrant },
255
+ }),
256
+ ).toEqual({
257
+ ...state,
258
+ modificationGrant: refreshedGrant,
259
+ structures: [structure],
260
+ });
261
+ });
262
+
236
263
  it("on setGrantChangeRequestCart.TRIGGER fill templateContent with grant.detail", () => {
237
264
  const structure = { id: 1 };
238
265
  const grantDetail = {
@@ -388,6 +415,48 @@ describe("reducers: grantRequestsCart", () => {
388
415
  ).toEqual(expectedState);
389
416
  });
390
417
 
418
+ it("preserves content when the selected template is unchanged", () => {
419
+ const state = {
420
+ ...initialState,
421
+ template: "T",
422
+ templateContent: { reason: { value: "draft", origin: "user" } },
423
+ validCart: true,
424
+ };
425
+ expect(
426
+ grantRequestsCart(state, {
427
+ type: selectGrantRequestTemplate.TRIGGER,
428
+ payload: "T",
429
+ }),
430
+ ).toBe(state);
431
+ });
432
+
433
+ it("invalidates and clears only the group whose template changes", () => {
434
+ const draft = {
435
+ template: "Old",
436
+ templateContent: { reason: { value: "draft", origin: "user" } },
437
+ valid: true,
438
+ };
439
+ const state = {
440
+ ...initialState,
441
+ groupTemplates: { first: draft, second: draft },
442
+ };
443
+ expect(
444
+ grantRequestsCart(state, {
445
+ type: selectGrantRequestTemplateForGroup.TRIGGER,
446
+ payload: { key: "first", template: "Old" },
447
+ }),
448
+ ).toBe(state);
449
+ expect(
450
+ grantRequestsCart(state, {
451
+ type: selectGrantRequestTemplateForGroup.TRIGGER,
452
+ payload: { key: "first", template: "New" },
453
+ }).groupTemplates,
454
+ ).toEqual({
455
+ first: { template: "New", templateContent: {}, valid: false },
456
+ second: draft,
457
+ });
458
+ });
459
+
391
460
  it("should handle updateGrantRequestTemplateContentForGroup.TRIGGER", () => {
392
461
  const stateWithGroups = {
393
462
  ...initialState,
@@ -428,4 +497,21 @@ describe("reducers: grantRequestsCart", () => {
428
497
  expect([null, undefined, ""]).toContain(state.user?.id);
429
498
  expect(state.user?.id).not.toBe("group:10");
430
499
  });
500
+
501
+ it("sets user_group_id when setGrantChangeRequestCart.TRIGGER opens a group grant", () => {
502
+ const structure = { id: 1 };
503
+ const grant = {
504
+ id: 2,
505
+ user_id: null,
506
+ user_group_id: 10,
507
+ detail: {},
508
+ };
509
+ const state = grantRequestsCart(initialState, {
510
+ type: setGrantChangeRequestCart.TRIGGER,
511
+ payload: { structure, grant },
512
+ });
513
+
514
+ expect(state.user_group_id).toBe(10);
515
+ expect(state.user?.id ?? null).toBeNull();
516
+ });
431
517
  });
@@ -95,3 +95,31 @@ describe("reducers: parentRelations", () => {
95
95
  expect(parentRelations(fooState, { type: "FOO" })).toBe(fooState);
96
96
  });
97
97
  });
98
+
99
+ describe("reducers: structure relation concept links", () => {
100
+ const links = [{ name: "foo concept", resource_id: "1" }];
101
+ const data = {
102
+ relations: {
103
+ children: [{ id: 1, links }],
104
+ parents: [{ id: 2, links }],
105
+ },
106
+ };
107
+
108
+ it("should keep concept links on children relations", () => {
109
+ expect(
110
+ childrenRelations([], {
111
+ type: fetchStructure.SUCCESS,
112
+ payload: { data },
113
+ }),
114
+ ).toEqual([{ id: 1, links }]);
115
+ });
116
+
117
+ it("should keep concept links on parent relations", () => {
118
+ expect(
119
+ parentRelations([], {
120
+ type: fetchStructure.SUCCESS,
121
+ payload: { data },
122
+ }),
123
+ ).toEqual([{ id: 2, links }]);
124
+ });
125
+ });
@@ -65,10 +65,12 @@ const grantRequestsCart = (state = initialState, { type, payload }) => {
65
65
  )(state),
66
66
  };
67
67
  case selectGrantRequestTemplate.TRIGGER:
68
+ if (state.template === payload) return state;
68
69
  return {
69
70
  ...state,
70
71
  template: payload,
71
72
  templateContent: modificationGrantContent(state.modificationGrant),
73
+ validCart: false,
72
74
  };
73
75
  case updateGrantRequestTemplateContent.TRIGGER:
74
76
  const { content, valid } = payload;
@@ -107,14 +109,29 @@ const grantRequestsCart = (state = initialState, { type, payload }) => {
107
109
  },
108
110
  };
109
111
  }
110
- case setGrantChangeRequestCart.TRIGGER:
112
+ case setGrantChangeRequestCart.TRIGGER: {
111
113
  const { structure, grant } = payload;
114
+ const isSameModification =
115
+ state.modificationGrant?.id != null &&
116
+ grant?.id != null &&
117
+ String(state.modificationGrant.id) === String(grant.id);
118
+ if (isSameModification) {
119
+ return {
120
+ ...state,
121
+ modificationGrant: grant,
122
+ structures: [mapPayload(structure)],
123
+ };
124
+ }
112
125
  return {
113
126
  ...initialState,
114
127
  templateContent: formatLegacyContent(grant.detail),
115
128
  modificationGrant: grant,
116
129
  structures: [mapPayload(structure)],
130
+ ...(_.isNil(grant?.user_group_id)
131
+ ? {}
132
+ : { user_group_id: grant.user_group_id }),
117
133
  };
134
+ }
118
135
  case updateGrantRequestFilter.TRIGGER:
119
136
  const { index, value, structureId } = payload;
120
137
  return {
@@ -140,11 +157,12 @@ const grantRequestsCart = (state = initialState, { type, payload }) => {
140
157
  case selectGrantRequestTemplateForGroup.TRIGGER: {
141
158
  const { key, template } = payload;
142
159
  const groupTemplates = _.getOr({}, "groupTemplates", state);
160
+ if (groupTemplates[key]?.template === template) return state;
143
161
  return {
144
162
  ...state,
145
163
  groupTemplates: {
146
164
  ...groupTemplates,
147
- [key]: { ...groupTemplates[key], template },
165
+ [key]: { template, templateContent: {}, valid: false },
148
166
  },
149
167
  };
150
168
  }
@@ -62,15 +62,7 @@ exports[`GrantUserDecorator matches the latest snapshot 1`] = `
62
62
  <div
63
63
  class="content"
64
64
  >
65
-
66
- <div
67
- class="ui teal small label"
68
- >
69
- Same
70
- </div>
71
- <div
72
- class="sub header"
73
- />
65
+ deleted.user
74
66
  </div>
75
67
  </h4>
76
68
  </div>