@truedat/dd 8.6.1 → 8.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "8.6.1",
3
+ "version": "8.6.3",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "module": "src/index.js",
@@ -51,7 +51,7 @@
51
51
  "@testing-library/jest-dom": "^6.6.3",
52
52
  "@testing-library/react": "^16.3.0",
53
53
  "@testing-library/user-event": "^14.6.1",
54
- "@truedat/test": "8.6.1",
54
+ "@truedat/test": "8.6.3",
55
55
  "identity-obj-proxy": "^3.0.0",
56
56
  "jest": "^29.7.0",
57
57
  "redux-saga-test-plan": "^4.0.6"
@@ -86,5 +86,5 @@
86
86
  "svg-pan-zoom": "^3.6.2",
87
87
  "swr": "^2.3.3"
88
88
  },
89
- "gitHead": "932eb0895ec71961f52a09309b99ae017977a899"
89
+ "gitHead": "3a4e629e4c63fdec993dfe357f9b11fdf7a62e8b"
90
90
  }
@@ -243,6 +243,7 @@ export const LEGACY_DATA_STRUCTURE_VERSION_QUERY = gql`
243
243
  $dataStructureId: ID!
244
244
  $version: String!
245
245
  $note_fields: [String]
246
+ $withoutGrants: Boolean!
246
247
  ) {
247
248
  dataStructureVersion(dataStructureId: $dataStructureId, version: $version) {
248
249
  id
@@ -324,7 +325,7 @@ export const LEGACY_DATA_STRUCTURE_VERSION_QUERY = gql`
324
325
  }
325
326
  ancestry
326
327
 
327
- grants {
328
+ grants @skip(if: $withoutGrants) {
328
329
  data_structure {
329
330
  external_id
330
331
  id
@@ -355,7 +356,7 @@ export const LEGACY_DATA_STRUCTURE_VERSION_QUERY = gql`
355
356
  }
356
357
  user_id
357
358
  }
358
- grant {
359
+ grant @skip(if: $withoutGrants) {
359
360
  data_structure {
360
361
  external_id
361
362
  id
@@ -30,7 +30,13 @@ export default function GrantApprovalRuleConditions({
30
30
  id: "grantApprovalRule.conditions.field_prefix",
31
31
  })}
32
32
  selection
33
- options={["request", "note", "metadata"].map((o) => ({
33
+ options={[
34
+ "request",
35
+ "note",
36
+ "metadata",
37
+ "user",
38
+ "created_by",
39
+ ].map((o) => ({
34
40
  key: o,
35
41
  value: o,
36
42
  text: formatMessage({
@@ -14,7 +14,7 @@ export const ImplementationStructuresLoader = ({
14
14
  const structures = _.flow(
15
15
  _.concat(structuresFields),
16
16
  _.map(_.toInteger),
17
- _.uniq
17
+ _.uniq,
18
18
  )(structuresSiblings);
19
19
  const [structureIndex, setStructureIndex] = useState(0);
20
20
  const [requestedStructures, setRequestedStructures] = useState([]);
@@ -23,7 +23,7 @@ export const ImplementationStructuresLoader = ({
23
23
  // check structure_ids, will be undefined if structureIds is an empty Array
24
24
  if (structure_id && !_.includes(structure_id)(structures)) {
25
25
  if (!_.includes(structure_id)(requestedStructures)) {
26
- legacyFetchStructure({ id: structure_id });
26
+ legacyFetchStructure({ id: structure_id, withoutGrants: true });
27
27
  setRequestedStructures([...requestedStructures, structure_id]);
28
28
  }
29
29
  } else if (structureIndex + 1 < _.size(structureIds)) {
@@ -57,6 +57,7 @@ export const mapStateToProps = ({ structuresFields, structuresSiblings }) => ({
57
57
  structuresSiblings: _.keys(structuresSiblings),
58
58
  });
59
59
 
60
- export default connect(mapStateToProps, { legacyFetchStructure, clearStructure })(
61
- ImplementationStructuresLoader
62
- );
60
+ export default connect(mapStateToProps, {
61
+ legacyFetchStructure,
62
+ clearStructure,
63
+ })(ImplementationStructuresLoader);
@@ -25,7 +25,8 @@ export const StructureSelectorInputField = ({
25
25
  }) => {
26
26
  const { formatMessage } = useIntl();
27
27
  const handleSelectStructure = (value) => {
28
- value && legacyFetchStructure({ id: _.prop("id")(value) });
28
+ value &&
29
+ legacyFetchStructure({ id: _.prop("id")(value), withoutGrants: true });
29
30
  value && onChange(value);
30
31
  };
31
32
 
@@ -40,7 +41,7 @@ export const StructureSelectorInputField = ({
40
41
  const aliasIsNeeded =
41
42
  _.flow(
42
43
  _.map(_.path("structure.id")),
43
- _.filter((s) => s === selectedStructure?.structure?.id)
44
+ _.filter((s) => s === selectedStructure?.structure?.id),
44
45
  )(structures).length > 1;
45
46
 
46
47
  return (
@@ -140,5 +141,5 @@ StructureSelectorInputField.propTypes = {
140
141
  };
141
142
 
142
143
  export default connect(null, { legacyFetchStructure })(
143
- StructureSelectorInputField
144
+ StructureSelectorInputField,
144
145
  );
@@ -28,6 +28,8 @@ jest.mock("@truedat/core/components/SystemsLoader", () => () => (
28
28
  jest.mock("@truedat/core/components/TemplatesLoader", () => () => (
29
29
  <div>TemplatesLoader</div>
30
30
  ));
31
+ jest.mock("@truedat/core/components/UploadJobs", () => () => <div>UploadJobs</div>);
32
+ jest.mock("@truedat/core/components/UploadJob", () => () => <div>UploadJob</div>);
31
33
 
32
34
  jest.mock("../CatalogViewConfigs", () => () => <div>CatalogViewConfigs</div>);
33
35
  jest.mock("../CatalogViewConfigForm", () => ({
@@ -11,7 +11,10 @@ describe("<ImplementationStructuresLoader/>", () => {
11
11
  const { unmount } = render(<ImplementationStructuresLoader {...props} />);
12
12
  expect(props.clearStructure).toHaveBeenCalledTimes(0);
13
13
  expect(props.legacyFetchStructure).toHaveBeenCalledTimes(1);
14
- expect(props.legacyFetchStructure).toHaveBeenCalledWith({ id: 42 });
14
+ expect(props.legacyFetchStructure).toHaveBeenCalledWith({
15
+ id: 42,
16
+ withoutGrants: true,
17
+ });
15
18
 
16
19
  unmount();
17
20
  expect(props.clearStructure).toHaveBeenCalledTimes(1);
@@ -120,45 +120,8 @@ exports[`<DictionaryRoutes /> renders correctly with structures route 1`] = `
120
120
 
121
121
  exports[`<DictionaryRoutes /> renders correctly with structures upload events route 1`] = `
122
122
  <div>
123
- <div
124
- class="ui breadcrumb"
125
- >
126
- <a
127
- class="section"
128
- data-discover="true"
129
- href="/structureNotes/uploadJobs"
130
- >
131
- uploadJobs.notes.header
132
- </a>
133
- </div>
134
- <div
135
- class="ui segment"
136
- >
137
- <h2
138
- class="ui header"
139
- >
140
- <i
141
- aria-hidden="true"
142
- class="cogs circular icon"
143
- />
144
- <div
145
- class="content"
146
- >
147
- uploadJobs.notes.header
148
- <div
149
- class="sub header"
150
- >
151
- uploadJobs.subheader
152
- </div>
153
- </div>
154
- </h2>
155
- <div
156
- class="dimmable"
157
- >
158
- <div
159
- class="ui bottom attached segment"
160
- />
161
- </div>
123
+ <div>
124
+ UploadJobs
162
125
  </div>
163
126
  </div>
164
127
  `;
@@ -81,6 +81,32 @@ exports[`<GrantApprovalRuleConditions /> matches the last snapshot disable 1`] =
81
81
  Structure metadata
82
82
  </span>
83
83
  </div>
84
+ <div
85
+ aria-checked="false"
86
+ aria-selected="false"
87
+ class="item"
88
+ role="option"
89
+ style="pointer-events: all;"
90
+ >
91
+ <span
92
+ class="text"
93
+ >
94
+ Requester
95
+ </span>
96
+ </div>
97
+ <div
98
+ aria-checked="false"
99
+ aria-selected="false"
100
+ class="item"
101
+ role="option"
102
+ style="pointer-events: all;"
103
+ >
104
+ <span
105
+ class="text"
106
+ >
107
+ Creator
108
+ </span>
109
+ </div>
84
110
  </div>
85
111
  </div>
86
112
  </div>
@@ -320,6 +346,32 @@ exports[`<GrantApprovalRuleConditions /> matches the last snapshot with empty va
320
346
  Structure metadata
321
347
  </span>
322
348
  </div>
349
+ <div
350
+ aria-checked="false"
351
+ aria-selected="false"
352
+ class="item"
353
+ role="option"
354
+ style="pointer-events: all;"
355
+ >
356
+ <span
357
+ class="text"
358
+ >
359
+ Requester
360
+ </span>
361
+ </div>
362
+ <div
363
+ aria-checked="false"
364
+ aria-selected="false"
365
+ class="item"
366
+ role="option"
367
+ style="pointer-events: all;"
368
+ >
369
+ <span
370
+ class="text"
371
+ >
372
+ Creator
373
+ </span>
374
+ </div>
323
375
  </div>
324
376
  </div>
325
377
  </div>
@@ -581,6 +633,32 @@ exports[`<GrantApprovalRuleConditions /> matches the last snapshot with values 1
581
633
  Structure metadata
582
634
  </span>
583
635
  </div>
636
+ <div
637
+ aria-checked="false"
638
+ aria-selected="false"
639
+ class="item"
640
+ role="option"
641
+ style="pointer-events: all;"
642
+ >
643
+ <span
644
+ class="text"
645
+ >
646
+ Requester
647
+ </span>
648
+ </div>
649
+ <div
650
+ aria-checked="false"
651
+ aria-selected="false"
652
+ class="item"
653
+ role="option"
654
+ style="pointer-events: all;"
655
+ >
656
+ <span
657
+ class="text"
658
+ >
659
+ Creator
660
+ </span>
661
+ </div>
584
662
  </div>
585
663
  </div>
586
664
  </div>
@@ -817,6 +895,32 @@ exports[`<GrantApprovalRuleConditions /> matches the last snapshot with values 1
817
895
  Structure metadata
818
896
  </span>
819
897
  </div>
898
+ <div
899
+ aria-checked="false"
900
+ aria-selected="false"
901
+ class="item"
902
+ role="option"
903
+ style="pointer-events: all;"
904
+ >
905
+ <span
906
+ class="text"
907
+ >
908
+ Requester
909
+ </span>
910
+ </div>
911
+ <div
912
+ aria-checked="false"
913
+ aria-selected="false"
914
+ class="item"
915
+ role="option"
916
+ style="pointer-events: all;"
917
+ >
918
+ <span
919
+ class="text"
920
+ >
921
+ Creator
922
+ </span>
923
+ </div>
820
924
  </div>
821
925
  </div>
822
926
  </div>
@@ -352,6 +352,32 @@ exports[`<GrantApprovalRuleEdit /> matches the last snapshot 1`] = `
352
352
  grantApprovalRule.conditions.field_prefix.metadata
353
353
  </span>
354
354
  </div>
355
+ <div
356
+ aria-checked="false"
357
+ aria-selected="false"
358
+ class="item"
359
+ role="option"
360
+ style="pointer-events: all;"
361
+ >
362
+ <span
363
+ class="text"
364
+ >
365
+ grantApprovalRule.conditions.field_prefix.user
366
+ </span>
367
+ </div>
368
+ <div
369
+ aria-checked="false"
370
+ aria-selected="false"
371
+ class="item"
372
+ role="option"
373
+ style="pointer-events: all;"
374
+ >
375
+ <span
376
+ class="text"
377
+ >
378
+ grantApprovalRule.conditions.field_prefix.created_by
379
+ </span>
380
+ </div>
355
381
  </div>
356
382
  </div>
357
383
  </div>
@@ -352,6 +352,32 @@ exports[`<GrantApprovalRuleForm /> matches the last snapshot 1`] = `
352
352
  grantApprovalRule.conditions.field_prefix.metadata
353
353
  </span>
354
354
  </div>
355
+ <div
356
+ aria-checked="false"
357
+ aria-selected="false"
358
+ class="item"
359
+ role="option"
360
+ style="pointer-events: all;"
361
+ >
362
+ <span
363
+ class="text"
364
+ >
365
+ grantApprovalRule.conditions.field_prefix.user
366
+ </span>
367
+ </div>
368
+ <div
369
+ aria-checked="false"
370
+ aria-selected="false"
371
+ class="item"
372
+ role="option"
373
+ style="pointer-events: all;"
374
+ >
375
+ <span
376
+ class="text"
377
+ >
378
+ grantApprovalRule.conditions.field_prefix.created_by
379
+ </span>
380
+ </div>
355
381
  </div>
356
382
  </div>
357
383
  </div>
@@ -591,6 +617,32 @@ exports[`<GrantApprovalRuleForm /> matches the last snapshot 1`] = `
591
617
  grantApprovalRule.conditions.field_prefix.metadata
592
618
  </span>
593
619
  </div>
620
+ <div
621
+ aria-checked="false"
622
+ aria-selected="false"
623
+ class="item"
624
+ role="option"
625
+ style="pointer-events: all;"
626
+ >
627
+ <span
628
+ class="text"
629
+ >
630
+ grantApprovalRule.conditions.field_prefix.user
631
+ </span>
632
+ </div>
633
+ <div
634
+ aria-checked="false"
635
+ aria-selected="false"
636
+ class="item"
637
+ role="option"
638
+ style="pointer-events: all;"
639
+ >
640
+ <span
641
+ class="text"
642
+ >
643
+ grantApprovalRule.conditions.field_prefix.created_by
644
+ </span>
645
+ </div>
594
646
  </div>
595
647
  </div>
596
648
  </div>
@@ -1146,6 +1198,32 @@ exports[`<GrantApprovalRuleForm /> matches the last snapshot for new rule 1`] =
1146
1198
  grantApprovalRule.conditions.field_prefix.metadata
1147
1199
  </span>
1148
1200
  </div>
1201
+ <div
1202
+ aria-checked="false"
1203
+ aria-selected="false"
1204
+ class="item"
1205
+ role="option"
1206
+ style="pointer-events: all;"
1207
+ >
1208
+ <span
1209
+ class="text"
1210
+ >
1211
+ grantApprovalRule.conditions.field_prefix.user
1212
+ </span>
1213
+ </div>
1214
+ <div
1215
+ aria-checked="false"
1216
+ aria-selected="false"
1217
+ class="item"
1218
+ role="option"
1219
+ style="pointer-events: all;"
1220
+ >
1221
+ <span
1222
+ class="text"
1223
+ >
1224
+ grantApprovalRule.conditions.field_prefix.created_by
1225
+ </span>
1226
+ </div>
1149
1227
  </div>
1150
1228
  </div>
1151
1229
  </div>
@@ -327,6 +327,32 @@ exports[`<GrantApprovalRuleNew /> matches the last snapshot 1`] = `
327
327
  grantApprovalRule.conditions.field_prefix.metadata
328
328
  </span>
329
329
  </div>
330
+ <div
331
+ aria-checked="false"
332
+ aria-selected="false"
333
+ class="item"
334
+ role="option"
335
+ style="pointer-events: all;"
336
+ >
337
+ <span
338
+ class="text"
339
+ >
340
+ grantApprovalRule.conditions.field_prefix.user
341
+ </span>
342
+ </div>
343
+ <div
344
+ aria-checked="false"
345
+ aria-selected="false"
346
+ class="item"
347
+ role="option"
348
+ style="pointer-events: all;"
349
+ >
350
+ <span
351
+ class="text"
352
+ >
353
+ grantApprovalRule.conditions.field_prefix.created_by
354
+ </span>
355
+ </div>
330
356
  </div>
331
357
  </div>
332
358
  </div>
@@ -93,6 +93,8 @@ export default {
93
93
  "grantApprovalRule.conditions.field_prefix.note": "Structure note",
94
94
  "grantApprovalRule.conditions.field_prefix.null": "-",
95
95
  "grantApprovalRule.conditions.field_prefix.metadata": "Structure metadata",
96
+ "grantApprovalRule.conditions.field_prefix.user": "Requester",
97
+ "grantApprovalRule.conditions.field_prefix.created_by": "Creator",
96
98
  "grantApprovalRule.conditions.field_prefix.placeholder": "Context",
97
99
  "grantApprovalRule.domain": "Domain",
98
100
  "grantApprovalRule.subheader": "Grant approval rule",
@@ -101,6 +101,8 @@ export default {
101
101
  "grantApprovalRule.conditions.field_prefix.null": "-",
102
102
  "grantApprovalRule.conditions.field_prefix.metadata":
103
103
  "Metadata de la estructura",
104
+ "grantApprovalRule.conditions.field_prefix.user": "Solicitante",
105
+ "grantApprovalRule.conditions.field_prefix.created_by": "Creador",
104
106
  "grantApprovalRule.conditions.field_prefix.placeholder": "Contexto",
105
107
  "grantApprovalRule.name": "Nombre",
106
108
  "grantApprovalRule.name.placeholder": "Nombre",
@@ -37,6 +37,7 @@ describe("sagas: legacyFetchStructureSaga", () => {
37
37
  dataStructureId: id,
38
38
  version,
39
39
  note_fields: ["note_field"],
40
+ withoutGrants: false,
40
41
  };
41
42
 
42
43
  const structureFieldColumns = [{ name: "id" }, { name: "note.note_field" }];
@@ -94,6 +95,41 @@ describe("sagas: legacyFetchStructureSaga", () => {
94
95
  dataStructureId: id,
95
96
  version,
96
97
  note_fields: ["note_field"],
98
+ withoutGrants: false,
99
+ };
100
+
101
+ expect(() => {
102
+ testSaga(legacyFetchStructureSaga, { payload })
103
+ .next()
104
+ .select(getStructureFieldColumns)
105
+ .next(structureFieldColumns)
106
+ .getContext("client")
107
+ .next(client)
108
+ .put(legacyFetchStructure.request())
109
+ .next()
110
+ .call(client.query, {
111
+ fetchPolicy: "network-only",
112
+ query: LEGACY_DATA_STRUCTURE_VERSION_QUERY,
113
+ variables,
114
+ })
115
+ .next({ data: { dataStructureVersion } })
116
+ .put({ meta, ...legacyFetchStructure.success(data) })
117
+ .next()
118
+ .put(legacyFetchStructure.fulfill())
119
+ .next()
120
+ .isDone();
121
+ }).not.toThrow();
122
+ });
123
+
124
+ it("should forward withoutGrants when set in payload", () => {
125
+ const payload = { id, withoutGrants: true };
126
+ const meta = { version };
127
+
128
+ const variables = {
129
+ dataStructureId: id,
130
+ version,
131
+ note_fields: ["note_field"],
132
+ withoutGrants: true,
97
133
  };
98
134
 
99
135
  expect(() => {
@@ -9,14 +9,14 @@ export function* legacyFetchStructureSaga({ payload }) {
9
9
  const structureFieldColumns = yield select(getStructureFieldColumns);
10
10
  const note_fields = _.flow(
11
11
  _.filter(({ name }) => name.startsWith("note.")),
12
- _.map(({ name }) => name.split(".")[1])
12
+ _.map(({ name }) => name.split(".")[1]),
13
13
  )(structureFieldColumns);
14
14
 
15
15
  const client = yield getContext("client");
16
16
 
17
17
  yield put(legacyFetchStructure.request());
18
18
 
19
- const { id, version = "latest" } = payload;
19
+ const { id, version = "latest", withoutGrants = false } = payload;
20
20
  const {
21
21
  data: { dataStructureVersion },
22
22
  } = yield call(client.query, {
@@ -26,6 +26,7 @@ export function* legacyFetchStructureSaga({ payload }) {
26
26
  dataStructureId: id,
27
27
  version,
28
28
  note_fields,
29
+ withoutGrants,
29
30
  },
30
31
  });
31
32