@truedat/dd 5.12.2 → 5.12.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 +2 -2
- package/src/api/queries.js +2 -0
- package/src/components/StructureFields.js +14 -8
- package/src/components/__tests__/StructureFieldRow.spec.js +11 -3
- package/src/components/__tests__/__snapshots__/StructureFieldRow.spec.js.snap +9 -0
- package/src/messages/en.js +3 -0
- package/src/messages/es.js +3 -0
- package/src/selectors/getStructureFieldColumns.js +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.3",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"react-dom": ">= 16.8.6 < 17",
|
|
116
116
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "51a25377a535c088db6127141f83ecf5b0269a0c"
|
|
119
119
|
}
|
package/src/api/queries.js
CHANGED
|
@@ -280,6 +280,7 @@ export const DATA_STRUCTURE_VERSION_QUERY = gql`
|
|
|
280
280
|
metadata
|
|
281
281
|
name
|
|
282
282
|
type
|
|
283
|
+
note
|
|
283
284
|
}
|
|
284
285
|
children {
|
|
285
286
|
alias
|
|
@@ -290,6 +291,7 @@ export const DATA_STRUCTURE_VERSION_QUERY = gql`
|
|
|
290
291
|
metadata
|
|
291
292
|
name
|
|
292
293
|
type
|
|
294
|
+
note
|
|
293
295
|
}
|
|
294
296
|
siblings {
|
|
295
297
|
alias
|
|
@@ -41,14 +41,20 @@ StructureFields.propTypes = {
|
|
|
41
41
|
version: PropTypes.string,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
const mapStateToProps = (state, ownProps) =>
|
|
45
|
-
structureId
|
|
46
|
-
version
|
|
47
|
-
fields
|
|
48
|
-
columns
|
|
49
|
-
_.propOr(getStructureFieldColumns(
|
|
44
|
+
const mapStateToProps = (state, ownProps) => {
|
|
45
|
+
const structureId = _.path("structure.id")(state);
|
|
46
|
+
const version = state.structureVersion;
|
|
47
|
+
const fields = getSortedFields(state);
|
|
48
|
+
const columns = getColumns(
|
|
49
|
+
_.propOr(getStructureFieldColumns(fields), "columns")(ownProps),
|
|
50
50
|
state.structureFields
|
|
51
|
-
)
|
|
52
|
-
|
|
51
|
+
);
|
|
52
|
+
return {
|
|
53
|
+
structureId,
|
|
54
|
+
version,
|
|
55
|
+
fields,
|
|
56
|
+
columns,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
53
59
|
|
|
54
60
|
export default connect(mapStateToProps)(StructureFields);
|
|
@@ -51,9 +51,15 @@ describe("<StructureFieldRow />", () => {
|
|
|
51
51
|
precision: "22",
|
|
52
52
|
type: "tp",
|
|
53
53
|
},
|
|
54
|
+
note: {
|
|
55
|
+
field_1: "data_1",
|
|
56
|
+
field_2: "data_2",
|
|
57
|
+
field_3: "data_3",
|
|
58
|
+
field_4: "data_4",
|
|
59
|
+
},
|
|
54
60
|
};
|
|
55
61
|
|
|
56
|
-
const { getAllByRole, getByText } = render(
|
|
62
|
+
const { getAllByRole, getByText, container } = render(
|
|
57
63
|
<table>
|
|
58
64
|
<tbody>
|
|
59
65
|
<StructureFieldRow
|
|
@@ -63,9 +69,11 @@ describe("<StructureFieldRow />", () => {
|
|
|
63
69
|
</tbody>
|
|
64
70
|
</table>
|
|
65
71
|
);
|
|
66
|
-
|
|
67
|
-
expect(getAllByRole("cell")).toHaveLength(7);
|
|
72
|
+
expect(getAllByRole("cell")).toHaveLength(8);
|
|
68
73
|
expect(getByText("f1")).toBeDefined();
|
|
69
74
|
expect(getAllByRole("link")).toHaveLength(3);
|
|
75
|
+
expect(
|
|
76
|
+
container.getElementsByClassName("structure.field.hasnote.true").length
|
|
77
|
+
).toBe(1);
|
|
70
78
|
});
|
|
71
79
|
});
|
package/src/messages/en.js
CHANGED
|
@@ -290,9 +290,12 @@ export default {
|
|
|
290
290
|
"structure.field.graph.percentage": "Percentage: ",
|
|
291
291
|
"structure.field.graph.title": "Frequency chart",
|
|
292
292
|
"structure.field.graph.value": "Value: ",
|
|
293
|
+
"structure.field.hasnote.true": "Yes",
|
|
294
|
+
"structure.field.hasnote.false": "No",
|
|
293
295
|
"structure.field.links": "Concepts",
|
|
294
296
|
"structure.field.menu.link": "Link to Concept",
|
|
295
297
|
"structure.field.name": "Field",
|
|
298
|
+
"structure.field.note": "Has note?",
|
|
296
299
|
"structure.field.metadata.nullable": "Nullable",
|
|
297
300
|
"structure.field.metadata.nullable.false": "No",
|
|
298
301
|
"structure.field.metadata.nullable.true": "Yes",
|
package/src/messages/es.js
CHANGED
|
@@ -298,6 +298,8 @@ export default {
|
|
|
298
298
|
"structure.field.graph.percentage": "Porcentaje: ",
|
|
299
299
|
"structure.field.graph.title": "Gráfico de frecuencias",
|
|
300
300
|
"structure.field.graph.value": "Valor: ",
|
|
301
|
+
"structure.field.hasnote.true": "Sí",
|
|
302
|
+
"structure.field.hasnote.false": "No",
|
|
301
303
|
"structure.field.links": "Términos",
|
|
302
304
|
"structure.field.menu.link": "Vincular a concepto",
|
|
303
305
|
"structure.field.metadata.nullable": "Opcional",
|
|
@@ -307,6 +309,7 @@ export default {
|
|
|
307
309
|
"structure.field.metadata.precision": "Precisión",
|
|
308
310
|
"structure.field.metadata.type": "Tipo",
|
|
309
311
|
"structure.field.name": "Campo",
|
|
312
|
+
"structure.field.note": "¿Tiene nota?",
|
|
310
313
|
"structure.field.patterns.count": "Conteo",
|
|
311
314
|
"structure.field.patterns.frecuency": "Patrones más frecuentes",
|
|
312
315
|
"structure.field.patterns.percentage": "Porcentaje",
|
|
@@ -20,6 +20,19 @@ const linkToStructureDecorator = ({ data_structure_id: id, alias, name }) => (
|
|
|
20
20
|
<Link to={linkTo.STRUCTURE({ id })}>{_.defaultTo(name)(alias)}</Link>
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
+
const hasNoteDecorator = ({ note }) =>
|
|
24
|
+
_.isNull(note) ||
|
|
25
|
+
_.isEmpty(note) ||
|
|
26
|
+
(note.hasOwnProperty("has_note") && !note.has_note) ? (
|
|
27
|
+
<span className="structure.field.hasnote.false">
|
|
28
|
+
{translateDecorator("structure.field.hasnote.false")}
|
|
29
|
+
</span>
|
|
30
|
+
) : (
|
|
31
|
+
<span className="structure.field.hasnote.true">
|
|
32
|
+
{translateDecorator("structure.field.hasnote.true")}
|
|
33
|
+
</span>
|
|
34
|
+
);
|
|
35
|
+
|
|
23
36
|
const nullableDecorator = (field) =>
|
|
24
37
|
field
|
|
25
38
|
? translateDecorator("structure.field.metadata.nullable.true")
|
|
@@ -78,6 +91,11 @@ export const defaultStructureFieldColumns = [
|
|
|
78
91
|
name: "links",
|
|
79
92
|
fieldDecorator: linksDecorator,
|
|
80
93
|
},
|
|
94
|
+
{
|
|
95
|
+
name: "note",
|
|
96
|
+
fieldSelector: _.pick(["note"]),
|
|
97
|
+
fieldDecorator: hasNoteDecorator,
|
|
98
|
+
},
|
|
81
99
|
];
|
|
82
100
|
|
|
83
101
|
export const getStructureFieldColumns = createSelector(
|