@truedat/dd 4.47.6 → 4.47.9

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 (29) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/package.json +6 -6
  3. package/src/api/fragments.js +1 -0
  4. package/src/api/queries.js +10 -0
  5. package/src/components/LinkStructureTagForm.js +14 -11
  6. package/src/components/LinkedStructureTag.js +43 -8
  7. package/src/components/ReferenceDatasetSelectorInputField.js +107 -0
  8. package/src/components/StructureFieldsDropdown.js +30 -12
  9. package/src/components/StructureSelectorInputField.js +0 -1
  10. package/src/components/StructureSelectorInputFieldJoin.js +15 -15
  11. package/src/components/StructureTagForm.js +23 -1
  12. package/src/components/StructureTagsCards.js +3 -0
  13. package/src/components/ValueConditionStructure.js +1 -7
  14. package/src/components/__tests__/LinkStructureTagForm.spec.js +80 -26
  15. package/src/components/__tests__/LinkedStructureTag.spec.js +133 -0
  16. package/src/components/__tests__/StructureTagForm.spec.js +6 -1
  17. package/src/components/__tests__/StructureTagsCards.spec.js +2 -0
  18. package/src/components/__tests__/__snapshots__/LinkStructureTagForm.spec.js.snap +267 -17
  19. package/src/components/__tests__/__snapshots__/LinkedStructureTag.spec.js.snap +16 -0
  20. package/src/components/__tests__/__snapshots__/StructureSelectorInputFieldJoin.spec.js.snap +30 -5
  21. package/src/components/__tests__/__snapshots__/StructureTagForm.spec.js.snap +20 -0
  22. package/src/components/__tests__/__snapshots__/StructureTagsCards.spec.js.snap +10 -0
  23. package/src/index.js +2 -1
  24. package/src/messages/en.js +4 -2
  25. package/src/messages/es.js +4 -2
  26. package/src/reducers/__tests__/linkedStructureTags.spec.js +1 -1
  27. package/src/sagas/requestGrantRemoval.js +0 -1
  28. package/src/selectors/getStructureFieldOptionValue.js +8 -0
  29. package/src/selectors/getStructuresFields.js +24 -10
@@ -1,10 +1,9 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`<LinkStructureTagForm /> matches the latest snapshot create 1`] = `
3
+ exports[`<LinkStructureTagForm /> create button enabled if there is only one tag available 1`] = `
4
4
  <div>
5
5
  <div
6
- class="ui container"
7
- style="width: 300px;"
6
+ class="ui container link-structure-tag-form"
8
7
  >
9
8
  <form
10
9
  class="ui form"
@@ -36,7 +35,7 @@ exports[`<LinkStructureTagForm /> matches the latest snapshot create 1`] = `
36
35
  class="divider text"
37
36
  role="alert"
38
37
  >
39
- bar
38
+ Tag2
40
39
  </div>
41
40
  <i
42
41
  aria-hidden="true"
@@ -53,10 +52,127 @@ exports[`<LinkStructureTagForm /> matches the latest snapshot create 1`] = `
53
52
  role="option"
54
53
  style="pointer-events: all;"
55
54
  >
55
+ <span
56
+ class="description"
57
+ >
58
+ large desclarge desclarge desclarge desclarge desc
59
+ </span>
60
+ <span
61
+ class="text"
62
+ >
63
+ Tag2
64
+ </span>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ <div
70
+ class="field"
71
+ >
72
+ <label>
73
+ structure.tag.textArea.label
74
+ </label>
75
+ <textarea
76
+ data-testid="comment-id"
77
+ name="comment"
78
+ placeholder="structure.tag.textArea.placeholder"
79
+ rows="3"
80
+ />
81
+ </div>
82
+ <div
83
+ class="actions"
84
+ >
85
+ <button
86
+ class="ui primary button"
87
+ type="submit"
88
+ >
89
+ structure.tag.add
90
+ </button>
91
+ </div>
92
+ </form>
93
+ </div>
94
+ </div>
95
+ `;
96
+
97
+ exports[`<LinkStructureTagForm /> matches the latest snapshot create 1`] = `
98
+ <div>
99
+ <div
100
+ class="ui container link-structure-tag-form"
101
+ >
102
+ <form
103
+ class="ui form"
104
+ >
105
+ <div
106
+ class="field"
107
+ >
108
+ <label>
109
+ structure.tag.dropdown.label
110
+ </label>
111
+ <div
112
+ aria-disabled="false"
113
+ aria-expanded="false"
114
+ class="ui search selection dropdown"
115
+ name="tag"
116
+ role="combobox"
117
+ >
118
+ <input
119
+ aria-autocomplete="list"
120
+ autocomplete="off"
121
+ class="search"
122
+ tabindex="0"
123
+ type="text"
124
+ value=""
125
+ />
126
+ <div
127
+ aria-atomic="true"
128
+ aria-live="polite"
129
+ class="divider default text"
130
+ role="alert"
131
+ >
132
+ structure.tag.dropdown.placeholder
133
+ </div>
134
+ <i
135
+ aria-hidden="true"
136
+ class="dropdown icon"
137
+ />
138
+ <div
139
+ class="menu transition"
140
+ role="listbox"
141
+ >
142
+ <div
143
+ aria-checked="false"
144
+ aria-selected="true"
145
+ class="selected item"
146
+ role="option"
147
+ style="pointer-events: all;"
148
+ >
149
+ <span
150
+ class="description"
151
+ >
152
+ description test
153
+ </span>
154
+ <span
155
+ class="text"
156
+ >
157
+ Tag1
158
+ </span>
159
+ </div>
160
+ <div
161
+ aria-checked="false"
162
+ aria-selected="false"
163
+ class="item"
164
+ role="option"
165
+ style="pointer-events: all;"
166
+ >
167
+ <span
168
+ class="description"
169
+ >
170
+ large desclarge desclarge desclarge desclarge desc
171
+ </span>
56
172
  <span
57
173
  class="text"
58
174
  >
59
- bar
175
+ Tag2
60
176
  </span>
61
177
  </div>
62
178
  </div>
@@ -69,8 +185,8 @@ exports[`<LinkStructureTagForm /> matches the latest snapshot create 1`] = `
69
185
  structure.tag.textArea.label
70
186
  </label>
71
187
  <textarea
72
- data-testid="description-id"
73
- name="description"
188
+ data-testid="comment-id"
189
+ name="comment"
74
190
  placeholder="structure.tag.textArea.placeholder"
75
191
  rows="3"
76
192
  />
@@ -92,11 +208,122 @@ exports[`<LinkStructureTagForm /> matches the latest snapshot create 1`] = `
92
208
  </div>
93
209
  `;
94
210
 
211
+ exports[`<LinkStructureTagForm /> matches the latest snapshot create without comment 1`] = `
212
+ <div>
213
+ <div
214
+ class="ui container link-structure-tag-form"
215
+ >
216
+ <form
217
+ class="ui form"
218
+ >
219
+ <div
220
+ class="field"
221
+ >
222
+ <label>
223
+ structure.tag.dropdown.label
224
+ </label>
225
+ <div
226
+ aria-disabled="false"
227
+ aria-expanded="true"
228
+ class="ui active visible search selection dropdown"
229
+ name="tag"
230
+ role="combobox"
231
+ >
232
+ <input
233
+ aria-autocomplete="list"
234
+ autocomplete="off"
235
+ class="search"
236
+ tabindex="0"
237
+ type="text"
238
+ value=""
239
+ />
240
+ <div
241
+ aria-atomic="true"
242
+ aria-live="polite"
243
+ class="divider text"
244
+ role="alert"
245
+ >
246
+ Tag2
247
+ </div>
248
+ <i
249
+ aria-hidden="true"
250
+ class="dropdown icon clear"
251
+ />
252
+ <div
253
+ class="visible menu transition"
254
+ role="listbox"
255
+ >
256
+ <div
257
+ aria-checked="false"
258
+ aria-selected="false"
259
+ class="item"
260
+ role="option"
261
+ style="pointer-events: all;"
262
+ >
263
+ <span
264
+ class="description"
265
+ >
266
+ description test
267
+ </span>
268
+ <span
269
+ class="text"
270
+ >
271
+ Tag1
272
+ </span>
273
+ </div>
274
+ <div
275
+ aria-checked="true"
276
+ aria-selected="true"
277
+ class="active selected item"
278
+ role="option"
279
+ style="pointer-events: all;"
280
+ >
281
+ <span
282
+ class="description"
283
+ >
284
+ large desclarge desclarge desclarge desclarge desc
285
+ </span>
286
+ <span
287
+ class="text"
288
+ >
289
+ Tag2
290
+ </span>
291
+ </div>
292
+ </div>
293
+ </div>
294
+ </div>
295
+ <div
296
+ class="field"
297
+ >
298
+ <label>
299
+ structure.tag.textArea.label
300
+ </label>
301
+ <textarea
302
+ data-testid="comment-id"
303
+ name="comment"
304
+ placeholder="structure.tag.textArea.placeholder"
305
+ rows="3"
306
+ />
307
+ </div>
308
+ <div
309
+ class="actions"
310
+ >
311
+ <button
312
+ class="ui primary button"
313
+ type="submit"
314
+ >
315
+ structure.tag.add
316
+ </button>
317
+ </div>
318
+ </form>
319
+ </div>
320
+ </div>
321
+ `;
322
+
95
323
  exports[`<LinkStructureTagForm /> matches the latest snapshot edit 1`] = `
96
324
  <div>
97
325
  <div
98
- class="ui container"
99
- style="width: 300px;"
326
+ class="ui container link-structure-tag-form"
100
327
  >
101
328
  <form
102
329
  class="ui form"
@@ -128,7 +355,7 @@ exports[`<LinkStructureTagForm /> matches the latest snapshot edit 1`] = `
128
355
  class="divider text"
129
356
  role="alert"
130
357
  >
131
- foo
358
+ Tag without description
132
359
  </div>
133
360
  <i
134
361
  aria-hidden="true"
@@ -138,6 +365,19 @@ exports[`<LinkStructureTagForm /> matches the latest snapshot edit 1`] = `
138
365
  class="menu transition"
139
366
  role="listbox"
140
367
  >
368
+ <div
369
+ aria-checked="true"
370
+ aria-selected="true"
371
+ class="active selected item"
372
+ role="option"
373
+ style="pointer-events: all;"
374
+ >
375
+ <span
376
+ class="text"
377
+ >
378
+ Tag without description
379
+ </span>
380
+ </div>
141
381
  <div
142
382
  aria-checked="false"
143
383
  aria-selected="false"
@@ -145,23 +385,33 @@ exports[`<LinkStructureTagForm /> matches the latest snapshot edit 1`] = `
145
385
  role="option"
146
386
  style="pointer-events: all;"
147
387
  >
388
+ <span
389
+ class="description"
390
+ >
391
+ description test
392
+ </span>
148
393
  <span
149
394
  class="text"
150
395
  >
151
- bar
396
+ Tag1
152
397
  </span>
153
398
  </div>
154
399
  <div
155
- aria-checked="true"
156
- aria-selected="true"
157
- class="active selected item"
400
+ aria-checked="false"
401
+ aria-selected="false"
402
+ class="item"
158
403
  role="option"
159
404
  style="pointer-events: all;"
160
405
  >
406
+ <span
407
+ class="description"
408
+ >
409
+ large desclarge desclarge desclarge desclarge desc
410
+ </span>
161
411
  <span
162
412
  class="text"
163
413
  >
164
- foo
414
+ Tag2
165
415
  </span>
166
416
  </div>
167
417
  </div>
@@ -174,8 +424,8 @@ exports[`<LinkStructureTagForm /> matches the latest snapshot edit 1`] = `
174
424
  structure.tag.textArea.label
175
425
  </label>
176
426
  <textarea
177
- data-testid="description-id"
178
- name="description"
427
+ data-testid="comment-id"
428
+ name="comment"
179
429
  placeholder="structure.tag.textArea.placeholder"
180
430
  rows="3"
181
431
  >
@@ -0,0 +1,16 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<LinkedStructureTag /> matches the latest snapshot 1`] = `
4
+ <div>
5
+ <div
6
+ class="ui tag label"
7
+ style="margin-left: 1.5em;"
8
+ >
9
+ <i
10
+ aria-hidden="true"
11
+ class="edit link icon"
12
+ />
13
+ Tag without description
14
+ </div>
15
+ </div>
16
+ `;
@@ -1,7 +1,14 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<StructureSelectorInputFieldJoin /> matches the latest JoinClause snapshot 1`] = `
4
- <Grid>
4
+ <Grid
5
+ style={
6
+ Object {
7
+ "alignItems": "center",
8
+ "display": "flex",
9
+ }
10
+ }
11
+ >
5
12
  <GridColumn
6
13
  width={4}
7
14
  >
@@ -19,6 +26,12 @@ exports[`<StructureSelectorInputFieldJoin /> matches the latest JoinClause snaps
19
26
  />
20
27
  </GridColumn>
21
28
  <GridColumn
29
+ style={
30
+ Object {
31
+ "fontSize": "x-large",
32
+ "textAlign": "center",
33
+ }
34
+ }
22
35
  width={1}
23
36
  >
24
37
  =
@@ -74,7 +87,13 @@ exports[`<StructureSelectorInputFieldJoin /> matches the latest JoinClause snaps
74
87
  `;
75
88
 
76
89
  exports[`<StructureSelectorInputFieldJoin /> matches the latest snapshot 1`] = `
77
- <Fragment>
90
+ <div
91
+ style={
92
+ Object {
93
+ "marginBottom": "1em",
94
+ }
95
+ }
96
+ >
78
97
  <JoinClause
79
98
  createClause={[Function]}
80
99
  deleteClause={[Function]}
@@ -88,11 +107,17 @@ exports[`<StructureSelectorInputFieldJoin /> matches the latest snapshot 1`] = `
88
107
  }
89
108
  }
90
109
  />
91
- </Fragment>
110
+ </div>
92
111
  `;
93
112
 
94
113
  exports[`<StructureSelectorInputFieldJoin /> matches the latest snapshot with various clauses 1`] = `
95
- <Fragment>
114
+ <div
115
+ style={
116
+ Object {
117
+ "marginBottom": "1em",
118
+ }
119
+ }
120
+ >
96
121
  <JoinClause
97
122
  createClause={[Function]}
98
123
  deleteClause={[Function]}
@@ -175,5 +200,5 @@ exports[`<StructureSelectorInputFieldJoin /> matches the latest snapshot with va
175
200
  }
176
201
  }
177
202
  />
178
- </Fragment>
203
+ </div>
179
204
  `;
@@ -26,6 +26,26 @@ exports[`<StructureTagForm /> matches the latest snapshot 1`] = `
26
26
  />
27
27
  </div>
28
28
  </div>
29
+ <div
30
+ class="field"
31
+ >
32
+ <label
33
+ for="description"
34
+ >
35
+ Description
36
+ </label>
37
+ <div
38
+ class="ui input"
39
+ >
40
+ <input
41
+ autocomplete="off"
42
+ id="description"
43
+ placeholder="Description"
44
+ type="text"
45
+ value="bar"
46
+ />
47
+ </div>
48
+ </div>
29
49
  <div
30
50
  class="actions"
31
51
  >
@@ -17,6 +17,11 @@ exports[`<StructureTagsCards /> matches the latest snapshot, renders a link for
17
17
  >
18
18
  tag1
19
19
  </a>
20
+ <div
21
+ class="description"
22
+ >
23
+ tag_desc_1
24
+ </div>
20
25
  </div>
21
26
  <div
22
27
  class="extra content"
@@ -47,6 +52,11 @@ exports[`<StructureTagsCards /> matches the latest snapshot, renders a link for
47
52
  >
48
53
  tag2
49
54
  </a>
55
+ <div
56
+ class="description"
57
+ >
58
+ tag_desc_2
59
+ </div>
50
60
  </div>
51
61
  <div
52
62
  class="extra content"
package/src/index.js CHANGED
@@ -2,6 +2,7 @@ import * as components from "./components";
2
2
  import * as reducers from "./reducers";
3
3
  import * as routines from "./routines";
4
4
  import * as sagas from "./sagas";
5
+ import * as selectors from "./selectors";
5
6
  import * as messages from "./messages";
6
7
 
7
- export { components, reducers, routines, sagas, messages };
8
+ export { components, reducers, routines, sagas, selectors, messages };
@@ -308,8 +308,9 @@ export default {
308
308
  "structure.tag.dropdown.label": "Select tag",
309
309
  "structure.tag.dropdown.placeholder": "Tag name",
310
310
  "structure.tag.edit": "Edit",
311
- "structure.tag.textArea.label": "Tag description",
312
- "structure.tag.textArea.placeholder": "Introduce a description",
311
+ "structure.tag.textArea.label": "Tag comments",
312
+ "structure.tag.textArea.placeholder": "Introduce a comment",
313
+ "structure.tag.tooltip.commentTitle": "Comment",
313
314
  "structure.type": "Type",
314
315
  "structure.type.Attribute": "Attribute",
315
316
  "structure.type.File.icon": "file",
@@ -360,6 +361,7 @@ export default {
360
361
  "structureSelector.union.criteria": "Union criteria",
361
362
  "structureTagForm.props.domains": "Domains",
362
363
  "structureTagForm.props.name": "Name",
364
+ "structureTagForm.props.description": "Description",
363
365
  "structureTags.actions.create": "Create Structure Tag",
364
366
  "structureTags.actions.delete.confirmation.content":
365
367
  "This tag has {count} linked structures. Are you sure that you want to delete this Struture Tag?",
@@ -317,8 +317,9 @@ export default {
317
317
  "structure.tag.dropdown.label": "Seleccionar etiqueta",
318
318
  "structure.tag.dropdown.placeholder": "Clave de etiqueta",
319
319
  "structure.tag.edit": "Editar",
320
- "structure.tag.textArea.label": "Descripción de etiqueta",
321
- "structure.tag.textArea.placeholder": "Introducir una descripción",
320
+ "structure.tag.textArea.label": "Comentarios de etiqueta",
321
+ "structure.tag.textArea.placeholder": "Introducir un comentario",
322
+ "structure.tag.tooltip.commentTitle": "Comentario",
322
323
  "structure.type": "Tipo",
323
324
  "structure.type.Attribute": "Atributo",
324
325
  "structure.type.File.icon": "file",
@@ -369,6 +370,7 @@ export default {
369
370
  "structureSelector.union.criteria": "Criterio de unión",
370
371
  "structureTagForm.props.domains": "Dominios",
371
372
  "structureTagForm.props.name": "Nombre",
373
+ "structureTagForm.props.description": "Descripción",
372
374
  "structureTags.actions.create": "Crear Etiqueta de Estructura",
373
375
  "structureTags.actions.delete.confirmation.content":
374
376
  "Esta etiqueta tiene {count} estructuras asociadas. ¿Desea eliminar la Etiqueta de Estructura {name}?",
@@ -15,7 +15,7 @@ const tags = [
15
15
  updated_at: "foo",
16
16
  _embedded: {
17
17
  data_structure: { id: 1, external_id: "baz" },
18
- data_structure_tag: { id: 1, name: "bar" },
18
+ data_structure_tag: { id: 1, name: "bar", description: "qux" },
19
19
  },
20
20
  },
21
21
  ];
@@ -14,7 +14,6 @@ export function* requestGrantRemovalSaga({ payload }) {
14
14
  yield put(requestGrantRemoval.success(data));
15
15
  yield put(fetchStructure.trigger({ id: data_structure_id, version }));
16
16
  } catch (error) {
17
- console.error("error", error);
18
17
  if (error.response) {
19
18
  const { status, data } = error.response;
20
19
  yield put(requestGrantRemoval.failure({ status, data }));
@@ -0,0 +1,8 @@
1
+ import _ from "lodash/fp";
2
+
3
+ export const getStructureFieldOptionValue = (structure) =>
4
+ _.isNil(_.prop("parent_index")(structure))
5
+ ? _.prop("id")(structure)
6
+ : structure?.type === "reference_dataset_field"
7
+ ? `${_.prop("name")(structure)}/${_.prop("parent_index")(structure)}`
8
+ : `${_.prop("id")(structure)}/${_.prop("parent_index")(structure)}`;
@@ -8,20 +8,34 @@ const withFieldType = (field) => ({
8
8
  });
9
9
 
10
10
  const getFields = (parent, structuresFields) =>
11
- _.flow(
12
- _.propOr([], _.path("id")(parent)),
13
- _.map((sf) => ({
14
- ...sf,
15
- label: _.prop("alias.text")(parent) || _.prop("name")(parent),
16
- parent_index: _.prop("alias.index")(parent),
17
- }))
18
- )(structuresFields);
19
-
11
+ parent?.type !== "reference_dataset"
12
+ ? _.flow(
13
+ _.propOr([], _.path("id")(parent)),
14
+ _.map((sf) => ({
15
+ ...sf,
16
+ label: _.prop("alias.text")(parent) || _.prop("name")(parent),
17
+ parent_index: _.prop("alias.index")(parent),
18
+ }))
19
+ )(structuresFields)
20
+ : _.flow(
21
+ _.get("headers"),
22
+ _.map((name) => ({
23
+ name,
24
+ type: "reference_dataset_field",
25
+ label: _.prop("name")(parent),
26
+ parent_index: _.prop("alias.index")(parent),
27
+ data_type_class: "string",
28
+ }))
29
+ )(parent);
20
30
  const getFieldsFromStructures = (structuresFields, parentStructures) =>
21
31
  _.flow(
22
32
  _.map((parent) => getFields(parent, structuresFields)),
23
33
  _.flatten,
24
- _.uniqBy((s) => `${s.data_structure_id}/${s.parent_index}`),
34
+ _.uniqBy((s) =>
35
+ s?.type === "reference_dataset_field"
36
+ ? `${s.name}/${s.parent_index}`
37
+ : `${s.data_structure_id}/${s.parent_index}`
38
+ ),
25
39
  _.map(withFieldType)
26
40
  )(parentStructures);
27
41