@truedat/dd 4.48.7 → 4.48.10

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 (30) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +5 -5
  3. package/src/components/StructureChildrenRelations.js +6 -14
  4. package/src/components/StructureCrumbs.js +43 -25
  5. package/src/components/StructureFieldRow.js +12 -10
  6. package/src/components/StructureFields.js +7 -7
  7. package/src/components/StructureItem.js +2 -2
  8. package/src/components/StructureSummary.js +4 -6
  9. package/src/components/StructuresSearchResults.js +34 -29
  10. package/src/components/StructuresView.js +36 -14
  11. package/src/components/__tests__/StructureFieldRow.spec.js +37 -33
  12. package/src/components/__tests__/StructureFields.spec.js +26 -27
  13. package/src/components/__tests__/StructureItem.spec.js +1 -1
  14. package/src/components/__tests__/StructureItems.spec.js +1 -3
  15. package/src/components/__tests__/StructureSummary.spec.js +1 -4
  16. package/src/components/__tests__/__snapshots__/StructureFieldRow.spec.js.snap +71 -74
  17. package/src/components/__tests__/__snapshots__/StructureFields.spec.js.snap +132 -160
  18. package/src/components/__tests__/__snapshots__/StructuresSearchResults.spec.js.snap +7 -7
  19. package/src/components/__tests__/__snapshots__/StructuresView.spec.js.snap +37 -6
  20. package/src/messages/en.js +7 -6
  21. package/src/messages/es.js +7 -6
  22. package/src/reducers/structure.js +5 -5
  23. package/src/reducers/structures.js +2 -2
  24. package/src/reducers/structuresLoading.js +1 -3
  25. package/src/selectors/__tests__/getSortedFields.spec.js +11 -11
  26. package/src/selectors/__tests__/getStructureParent.spec.js +10 -10
  27. package/src/selectors/getStructureFieldColumns.js +29 -39
  28. package/src/selectors/getStructureParent.js +2 -7
  29. package/src/selectors/getStructureSortingCriteria.js +7 -5
  30. package/src/selectors/structureColumnsSelector.js +2 -6
@@ -1,42 +1,41 @@
1
- import _ from "lodash/fp";
2
1
  import React from "react";
3
- import { shallow } from "enzyme";
4
- import { StructureFields } from "../StructureFields";
2
+ import { render } from "@truedat/test/render";
3
+ import StructureFields from "../StructureFields";
5
4
 
6
- describe("<StructureFields />", () => {
7
- const columns = _.map(name => ({ name }))([
8
- "name",
9
- "type",
10
- "precision",
11
- "nullable",
12
- "description",
13
- "external_id",
14
- "links"
15
- ]);
16
- const fields = [
5
+ const state = {
6
+ structureFields: [
17
7
  {
18
8
  id: 123,
9
+ data_structure_id: 1,
19
10
  name: "field1",
20
11
  description: "desc1",
21
- type: "varchar",
22
- nullable: true,
23
- precision: "22",
24
- links: [{ id: 123 }]
12
+ links: [{ resource_id: 123 }],
13
+ metadata: {
14
+ nullable: true,
15
+ precision: "22",
16
+ type: "varchar",
17
+ },
25
18
  },
26
19
  {
27
20
  id: 122,
21
+ data_structure_id: 2,
28
22
  name: "field2",
29
23
  description: "desc2",
30
- type: "varchar",
31
- nullable: true,
32
- precision: "22",
33
- external_id: "foo"
34
- }
35
- ];
24
+ external_id: "foo",
25
+ metadata: {
26
+ nullable: true,
27
+ precision: "22",
28
+ type: "varchar",
29
+ },
30
+ },
31
+ ],
32
+ };
36
33
 
34
+ const renderOpts = { state };
35
+
36
+ describe("<StructureFields />", () => {
37
37
  it("matches the latest snapshot", () => {
38
- const props = { columns, fields };
39
- const wrapper = shallow(<StructureFields {...props} />);
40
- expect(wrapper).toMatchSnapshot();
38
+ const { container } = render(<StructureFields />, renderOpts);
39
+ expect(container).toMatchSnapshot();
41
40
  });
42
41
  });
@@ -35,7 +35,7 @@ describe("<StructureItem />", () => {
35
35
  });
36
36
 
37
37
  it("matches the latest snapshot with alias", () => {
38
- const props = { id, name, published_note: { alias: "alias" } };
38
+ const props = { id, name, alias: "alias" };
39
39
 
40
40
  const { container } = render(<DefaultStructureItem {...props} />);
41
41
  expect(container).toMatchSnapshot();
@@ -12,9 +12,7 @@ describe("<StructureItems />", () => {
12
12
  });
13
13
 
14
14
  it("matches the latest snapshot with alias", () => {
15
- const structures = [
16
- { id: 1, name: "some structure", published_note: { alias: "alias" } },
17
- ];
15
+ const structures = [{ id: 1, name: "some structure", alias: "alias" }];
18
16
  const props = { structures };
19
17
 
20
18
  const { container } = render(<StructureItems {...props} />);
@@ -36,10 +36,7 @@ describe("<StructureSummary />", () => {
36
36
  });
37
37
 
38
38
  it("matches the latest snapshot with alias", () => {
39
- const customState = _.set("structure.published_note", {
40
- alias: "some alias",
41
- })(state);
42
-
39
+ const customState = _.set("structure.alias", "some alias")(state);
43
40
  const { container } = render(<StructureSummary />, { state: customState });
44
41
  expect(container).toMatchSnapshot();
45
42
  });
@@ -1,81 +1,78 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<StructureFieldRow /> matches the latest snapshot 1`] = `
4
- <TableRow
5
- as="tr"
6
- cellAs="td"
7
- key="1"
8
- >
9
- <TableCell
10
- as="td"
11
- content={
12
- <Link
13
- to="/structures/1"
4
+ <div>
5
+ <table>
6
+ <tbody>
7
+ <tr
8
+ class=""
14
9
  >
15
- f1
16
- </Link>
17
- }
18
- key="0"
19
- />
20
- <TableCell
21
- as="td"
22
- content={
23
- <Memo(MemoizedFormattedMessage)
24
- defaultMessage="tp"
25
- id="structure.type.tp"
26
- />
27
- }
28
- key="1"
29
- />
30
- <TableCell
31
- as="td"
32
- content="22"
33
- key="2"
34
- />
35
- <TableCell
36
- as="td"
37
- content={
38
- <Memo(MemoizedFormattedMessage)
39
- id="structure.field.nullable.true"
40
- />
41
- }
42
- key="3"
43
- />
44
- <TableCell
45
- as="td"
46
- content="dd"
47
- key="4"
48
- />
49
- <TableCell
50
- as="td"
51
- key="5"
52
- />
53
- <TableCell
54
- as="td"
55
- key="6"
56
- textAlign="center"
57
- />
58
- <TableCell
59
- as="td"
60
- content={
61
- <List>
62
- <ListItem>
63
- <Link
64
- to="/concepts/2/versions/current"
10
+ <td
11
+ class=""
12
+ >
13
+ <a
14
+ href="/structures/1"
65
15
  >
66
- Bar
67
- </Link>
68
- </ListItem>
69
- <ListItem>
70
- <Link
71
- to="/concepts/1/versions/current"
16
+ f1
17
+ </a>
18
+ </td>
19
+ <td
20
+ class=""
21
+ >
22
+ tp
23
+ </td>
24
+ <td
25
+ class=""
26
+ >
27
+ 22
28
+ </td>
29
+ <td
30
+ class=""
31
+ >
32
+ Yes
33
+ </td>
34
+ <td
35
+ class=""
36
+ >
37
+ dd
38
+ </td>
39
+ <td
40
+ class=""
41
+ />
42
+ <td
43
+ class="center aligned"
44
+ />
45
+ <td
46
+ class=""
47
+ >
48
+ <div
49
+ class="ui list"
50
+ role="list"
72
51
  >
73
- foo
74
- </Link>
75
- </ListItem>
76
- </List>
77
- }
78
- key="7"
79
- />
80
- </TableRow>
52
+ <div
53
+ class="item"
54
+ role="listitem"
55
+ >
56
+ <a
57
+ href="/concepts/2/versions/current"
58
+ >
59
+ Bar
60
+ </a>
61
+ </div>
62
+ <div
63
+ class="item"
64
+ role="listitem"
65
+ >
66
+ <a
67
+ href="/concepts/1/versions/current"
68
+ >
69
+ foo
70
+ </a>
71
+ </div>
72
+ </div>
73
+ </td>
74
+ </tr>
75
+ </tbody>
76
+ </table>
77
+ </div>
81
78
  `;
@@ -1,166 +1,138 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<StructureFields /> matches the latest snapshot 1`] = `
4
- <Table
5
- as="table"
6
- >
7
- <TableHeader
8
- as="thead"
4
+ <div>
5
+ <table
6
+ class="ui table"
9
7
  >
10
- <TableRow
11
- as="tr"
12
- cellAs="td"
8
+ <thead
9
+ class=""
13
10
  >
14
- <TableHeaderCell
15
- as="th"
16
- content={
17
- <Memo(MemoizedFormattedMessage)
18
- id="structure.field.name"
19
- />
20
- }
21
- key="0"
22
- />
23
- <TableHeaderCell
24
- as="th"
25
- content={
26
- <Memo(MemoizedFormattedMessage)
27
- id="structure.field.type"
28
- />
29
- }
30
- key="1"
31
- />
32
- <TableHeaderCell
33
- as="th"
34
- content={
35
- <Memo(MemoizedFormattedMessage)
36
- id="structure.field.precision"
37
- />
38
- }
39
- key="2"
40
- />
41
- <TableHeaderCell
42
- as="th"
43
- content={
44
- <Memo(MemoizedFormattedMessage)
45
- id="structure.field.nullable"
46
- />
47
- }
48
- key="3"
49
- />
50
- <TableHeaderCell
51
- as="th"
52
- content={
53
- <Memo(MemoizedFormattedMessage)
54
- id="structure.field.description"
55
- />
56
- }
57
- key="4"
58
- />
59
- <TableHeaderCell
60
- as="th"
61
- content={
62
- <Memo(MemoizedFormattedMessage)
63
- id="structure.field.external_id"
64
- />
65
- }
66
- key="5"
67
- />
68
- <TableHeaderCell
69
- as="th"
70
- content={
71
- <Memo(MemoizedFormattedMessage)
72
- id="structure.field.links"
73
- />
74
- }
75
- key="6"
76
- />
77
- </TableRow>
78
- </TableHeader>
79
- <TableBody
80
- as="tbody"
81
- >
82
- <StructureFieldRow
83
- columns={
84
- Array [
85
- Object {
86
- "name": "name",
87
- },
88
- Object {
89
- "name": "type",
90
- },
91
- Object {
92
- "name": "precision",
93
- },
94
- Object {
95
- "name": "nullable",
96
- },
97
- Object {
98
- "name": "description",
99
- },
100
- Object {
101
- "name": "external_id",
102
- },
103
- Object {
104
- "name": "links",
105
- },
106
- ]
107
- }
108
- field={
109
- Object {
110
- "description": "desc1",
111
- "id": 123,
112
- "links": Array [
113
- Object {
114
- "id": 123,
115
- },
116
- ],
117
- "name": "field1",
118
- "nullable": true,
119
- "precision": "22",
120
- "type": "varchar",
121
- }
122
- }
123
- key="0"
124
- />
125
- <StructureFieldRow
126
- columns={
127
- Array [
128
- Object {
129
- "name": "name",
130
- },
131
- Object {
132
- "name": "type",
133
- },
134
- Object {
135
- "name": "precision",
136
- },
137
- Object {
138
- "name": "nullable",
139
- },
140
- Object {
141
- "name": "description",
142
- },
143
- Object {
144
- "name": "external_id",
145
- },
146
- Object {
147
- "name": "links",
148
- },
149
- ]
150
- }
151
- field={
152
- Object {
153
- "description": "desc2",
154
- "external_id": "foo",
155
- "id": 122,
156
- "name": "field2",
157
- "nullable": true,
158
- "precision": "22",
159
- "type": "varchar",
160
- }
161
- }
162
- key="1"
163
- />
164
- </TableBody>
165
- </Table>
11
+ <tr
12
+ class=""
13
+ >
14
+ <th
15
+ class=""
16
+ >
17
+ Field
18
+ </th>
19
+ <th
20
+ class=""
21
+ >
22
+ Type
23
+ </th>
24
+ <th
25
+ class=""
26
+ >
27
+ Precision
28
+ </th>
29
+ <th
30
+ class=""
31
+ >
32
+ Nullable
33
+ </th>
34
+ <th
35
+ class=""
36
+ >
37
+ Description
38
+ </th>
39
+ <th
40
+ class=""
41
+ >
42
+ Concepts
43
+ </th>
44
+ </tr>
45
+ </thead>
46
+ <tbody
47
+ class=""
48
+ >
49
+ <tr
50
+ class=""
51
+ >
52
+ <td
53
+ class=""
54
+ >
55
+ <a
56
+ href="/structures/1"
57
+ >
58
+ field1
59
+ </a>
60
+ </td>
61
+ <td
62
+ class=""
63
+ >
64
+ varchar
65
+ </td>
66
+ <td
67
+ class=""
68
+ >
69
+ 22
70
+ </td>
71
+ <td
72
+ class=""
73
+ >
74
+ Yes
75
+ </td>
76
+ <td
77
+ class=""
78
+ >
79
+ desc1
80
+ </td>
81
+ <td
82
+ class=""
83
+ >
84
+ <div
85
+ class="ui list"
86
+ role="list"
87
+ >
88
+ <div
89
+ class="item"
90
+ role="listitem"
91
+ >
92
+ <a
93
+ href="/concepts/123/versions/current"
94
+ />
95
+ </div>
96
+ </div>
97
+ </td>
98
+ </tr>
99
+ <tr
100
+ class=""
101
+ >
102
+ <td
103
+ class=""
104
+ >
105
+ <a
106
+ href="/structures/2"
107
+ >
108
+ field2
109
+ </a>
110
+ </td>
111
+ <td
112
+ class=""
113
+ >
114
+ varchar
115
+ </td>
116
+ <td
117
+ class=""
118
+ >
119
+ 22
120
+ </td>
121
+ <td
122
+ class=""
123
+ >
124
+ Yes
125
+ </td>
126
+ <td
127
+ class=""
128
+ >
129
+ desc2
130
+ </td>
131
+ <td
132
+ class=""
133
+ />
134
+ </tr>
135
+ </tbody>
136
+ </table>
137
+ </div>
166
138
  `;
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports[`<StructuresSearchResults /> matches the latest snapshot 1`] = `
4
4
  <DimmerDimmable>
5
+ <Dimmer
6
+ inverted={true}
7
+ >
8
+ <Loader
9
+ size="large"
10
+ />
11
+ </Dimmer>
5
12
  <Connect(StructuresLabelResults) />
6
13
  <Connect(StructuresTable)
7
14
  structures={
@@ -19,12 +26,5 @@ exports[`<StructuresSearchResults /> matches the latest snapshot 1`] = `
19
26
  }
20
27
  />
21
28
  <Connect(Pagination) />
22
- <Dimmer
23
- inverted={true}
24
- >
25
- <Loader
26
- size="large"
27
- />
28
- </Dimmer>
29
29
  </DimmerDimmable>
30
30
  `;
@@ -6,13 +6,44 @@ exports[`<StructuresView /> matches the latest snapshot 1`] = `
6
6
  <Divider
7
7
  hidden={true}
8
8
  />
9
- <StructuresOptions
10
- bulkUpdate={Object {}}
9
+ <StructuresViewContent
10
+ actions={
11
+ Object {
12
+ "bulkUpdate": Object {},
13
+ }
14
+ }
15
+ columns={
16
+ Array [
17
+ Object {
18
+ "name": "name",
19
+ },
20
+ Object {
21
+ "fieldSelector": [Function],
22
+ "name": "domain",
23
+ },
24
+ Object {
25
+ "name": "system",
26
+ },
27
+ Object {
28
+ "name": "group",
29
+ },
30
+ ]
31
+ }
32
+ structures={
33
+ Array [
34
+ Object {
35
+ "description": "dd",
36
+ "domain": Object {
37
+ "name": "org",
38
+ },
39
+ "group": "gp",
40
+ "id": 1,
41
+ "name": "s1",
42
+ "system": "sys",
43
+ },
44
+ ]
45
+ }
11
46
  />
12
- <Connect(StructuresSearch) />
13
- <injectIntl(Connect(SelectedFilters)) />
14
- <Connect(StructureDateFilter) />
15
- <Connect(SystemCards) />
16
47
  </Segment>
17
48
  `;
18
49
 
@@ -227,17 +227,17 @@ export default {
227
227
  "structure.field.links": "Concepts",
228
228
  "structure.field.menu.link": "Link to Concept",
229
229
  "structure.field.name": "Field",
230
- "structure.field.nullable": "Nullable",
231
- "structure.field.nullable.false": "No",
232
- "structure.field.nullable.true": "Yes",
233
- "structure.field.optional": "Optional",
230
+ "structure.field.metadata.nullable": "Nullable",
231
+ "structure.field.metadata.nullable.false": "No",
232
+ "structure.field.metadata.nullable.true": "Yes",
233
+ "structure.field.metadata.optional": "Optional",
234
+ "structure.field.metadata.precision": "Precision",
235
+ "structure.field.metadata.type": "Type",
234
236
  "structure.field.patterns.count": "Count",
235
237
  "structure.field.patterns.frecuency": "Frecuency",
236
238
  "structure.field.patterns.percentage": "Percentage",
237
239
  "structure.field.patterns.title": "You are seeing the patterns of the field",
238
- "structure.field.precision": "Precision",
239
240
  "structure.field.required": "Required",
240
- "structure.field.type": "Type",
241
241
  "structure.fields.empty": "No field information available for this structure",
242
242
  "structure.filter.empty": "Empty",
243
243
  "structure.grant.has_grant": "You have granted access on this structure",
@@ -492,6 +492,7 @@ export default {
492
492
  "Only modify fields to be updated",
493
493
  "structures.header.edit.bulk.structures_count":
494
494
  'Selected structures: "{structures_count}"',
495
+ "structures.loading.header": "Loading structures...",
495
496
  "structures.not_found.body":
496
497
  "No structures have been found matching these filters.",
497
498
  "structures.not_found.header": "Nothing found...",