@truedat/dd 7.0.0 → 7.0.2

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 (37) hide show
  1. package/package.json +6 -6
  2. package/src/components/CatalogViewConfigs.js +62 -57
  3. package/src/components/GrantApprovalRules.js +15 -12
  4. package/src/components/GrantsTable.js +7 -1
  5. package/src/components/PendingStructureNoteRow.js +2 -10
  6. package/src/components/PendingStructureNotesTable.js +1 -1
  7. package/src/components/StructureGrantCartUserSelector.js +14 -22
  8. package/src/components/StructureRow.js +0 -1
  9. package/src/components/StructureSelector.js +5 -1
  10. package/src/components/StructuresGrantRequestView.js +0 -1
  11. package/src/components/StructuresSearchResults.js +3 -0
  12. package/src/components/StructuresTable.js +2 -1
  13. package/src/components/StructuresView.js +3 -8
  14. package/src/components/__tests__/CatalogViewConfigs.spec.js +1 -11
  15. package/src/components/__tests__/GrantApprovalRules.spec.js +4 -17
  16. package/src/components/__tests__/GrantsTable.spec.js +6 -7
  17. package/src/components/__tests__/PendingStructureNoteRow.spec.js +4 -5
  18. package/src/components/__tests__/PendingStructureNotesTable.spec.js +2 -4
  19. package/src/components/__tests__/StructureStructureForm.spec.js +2 -1
  20. package/src/components/__tests__/StructuresView.spec.js +1 -0
  21. package/src/components/__tests__/__snapshots__/GrantApprovalRules.spec.js.snap +13 -3
  22. package/src/components/__tests__/__snapshots__/GrantsTable.spec.js.snap +17 -41
  23. package/src/components/__tests__/__snapshots__/PendingStructureNoteRow.spec.js.snap +6 -2
  24. package/src/components/__tests__/__snapshots__/PendingStructureNotes.spec.js.snap +13 -5
  25. package/src/components/__tests__/__snapshots__/PendingStructureNotesTable.spec.js.snap +13 -5
  26. package/src/components/__tests__/__snapshots__/StructureRow.spec.js.snap +0 -1
  27. package/src/components/__tests__/__snapshots__/StructureSelector.spec.js.snap +12 -4
  28. package/src/components/__tests__/__snapshots__/StructuresGrantRequestView.spec.js.snap +19 -7
  29. package/src/components/__tests__/__snapshots__/StructuresSearchResults.spec.js.snap +1 -4
  30. package/src/components/__tests__/__snapshots__/StructuresTable.spec.js.snap +3 -12
  31. package/src/selectors/__tests__/__snapshots__/getGrantsColumns.spec.js.snap +0 -10
  32. package/src/selectors/__tests__/getGrantsColumns.spec.js +0 -9
  33. package/src/selectors/getGrantRequestsColumns.js +21 -2
  34. package/src/selectors/getGrantRequestsSearchColumns.js +20 -3
  35. package/src/selectors/getGrantsColumns.js +14 -30
  36. package/src/selectors/structureColumnsSelector.js +11 -0
  37. package/src/selectors/structureNotesColumnsSelector.js +11 -0
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { waitFor } from "@testing-library/react";
3
3
  import { render } from "@truedat/test/render";
4
4
  import SearchContext from "@truedat/core/search/SearchContext";
5
+ import { getColumns } from "../../selectors/structureNotesColumnsSelector";
5
6
  import PendingStructureNotesTable from "../PendingStructureNotesTable";
6
7
 
7
8
  const structures = {
@@ -53,10 +54,7 @@ const renderOpts = {
53
54
  };
54
55
 
55
56
  describe("<PendingStructureNotesTable />", () => {
56
- const columns = [
57
- { name: "foo", sort: { name: "name.raw" } },
58
- { name: "bar", sort: { name: "bar.raw" } },
59
- ];
57
+ const columns = getColumns;
60
58
  const props = { columns };
61
59
 
62
60
  it("matches the latest snapshot", async () => {
@@ -94,7 +94,7 @@ const linkLabelsMock = {
94
94
  };
95
95
 
96
96
  describe("<StructureStructureForm />", () => {
97
- it.only("matches the latest snapshot", async () => {
97
+ it("matches the latest snapshot", async () => {
98
98
  const columns = ["name", "system", "group"].map((name) => ({ name }));
99
99
  const structuresRows = [
100
100
  { id: 1, name: 1 },
@@ -129,6 +129,7 @@ describe("<StructureStructureForm />", () => {
129
129
  "structure.name": "name",
130
130
  "structures.retrieved.results": "results",
131
131
  "structures.loading.header": "loading header",
132
+ "structure.last_change_at": "Last changed",
132
133
  },
133
134
  },
134
135
  };
@@ -48,6 +48,7 @@ const messages = {
48
48
  ...en,
49
49
  missingBucket: "_missing",
50
50
  "search.placeholder": "Searching ...",
51
+ "structure.last_change_at": "Last changed",
51
52
  },
52
53
  };
53
54
 
@@ -86,7 +86,7 @@ exports[`<GrantApprovalRules /> matches the last snapshot 1`] = `
86
86
  </a>
87
87
  </div>
88
88
  <table
89
- class="ui selectable table"
89
+ class="ui table"
90
90
  >
91
91
  <thead
92
92
  class=""
@@ -125,7 +125,12 @@ exports[`<GrantApprovalRules /> matches the last snapshot 1`] = `
125
125
  <td
126
126
  class=""
127
127
  >
128
- rule_name
128
+ <a
129
+ href="/grantApproveRules/123"
130
+ title="rule_name"
131
+ >
132
+ rule_name
133
+ </a>
129
134
  </td>
130
135
  <td
131
136
  class=""
@@ -149,7 +154,12 @@ exports[`<GrantApprovalRules /> matches the last snapshot 1`] = `
149
154
  <td
150
155
  class=""
151
156
  >
152
- reject rule
157
+ <a
158
+ href="/grantApproveRules/456"
159
+ title="reject rule"
160
+ >
161
+ reject rule
162
+ </a>
153
163
  </td>
154
164
  <td
155
165
  class=""
@@ -14,19 +14,11 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
14
14
  as="tr"
15
15
  cellAs="td"
16
16
  >
17
- <TableHeaderCell
18
- as="th"
19
- className="disabled"
20
- content="grant.header.id"
21
- key="0"
22
- onClick={[Function]}
23
- sorted={null}
24
- />
25
17
  <TableHeaderCell
26
18
  as="th"
27
19
  className=""
28
20
  content="grant.header.user"
29
- key="1"
21
+ key="0"
30
22
  onClick={[Function]}
31
23
  sorted={null}
32
24
  />
@@ -34,7 +26,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
34
26
  as="th"
35
27
  className=""
36
28
  content="grant.header.data_structure"
37
- key="2"
29
+ key="1"
38
30
  onClick={[Function]}
39
31
  sorted="ascending"
40
32
  />
@@ -42,7 +34,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
42
34
  as="th"
43
35
  className=""
44
36
  content="grant.header.start_date"
45
- key="3"
37
+ key="2"
46
38
  onClick={[Function]}
47
39
  sorted={null}
48
40
  />
@@ -50,7 +42,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
50
42
  as="th"
51
43
  className=""
52
44
  content="grant.header.end_date"
53
- key="4"
45
+ key="3"
54
46
  onClick={[Function]}
55
47
  sorted={null}
56
48
  />
@@ -58,7 +50,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
58
50
  as="th"
59
51
  className="disabled"
60
52
  content="metadata"
61
- key="5"
53
+ key="4"
62
54
  onClick={[Function]}
63
55
  sorted={null}
64
56
  />
@@ -71,16 +63,8 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
71
63
  as="tr"
72
64
  cellAs="td"
73
65
  key="0"
66
+ onClick={[Function]}
74
67
  >
75
- <TableCell
76
- as="td"
77
- content={
78
- <idDecorator
79
- id={6}
80
- />
81
- }
82
- key="0"
83
- />
84
68
  <TableCell
85
69
  as="td"
86
70
  content={
@@ -94,7 +78,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
94
78
  }
95
79
  />
96
80
  }
97
- key="1"
81
+ key="0"
98
82
  />
99
83
  <TableCell
100
84
  as="td"
@@ -119,7 +103,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
119
103
  }
120
104
  />
121
105
  }
122
- key="2"
106
+ key="1"
123
107
  />
124
108
  <TableCell
125
109
  as="td"
@@ -128,7 +112,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
128
112
  start_date="2020-05-17"
129
113
  />
130
114
  }
131
- key="3"
115
+ key="2"
132
116
  />
133
117
  <TableCell
134
118
  as="td"
@@ -137,7 +121,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
137
121
  end_date="2023-05-16"
138
122
  />
139
123
  }
140
- key="4"
124
+ key="3"
141
125
  />
142
126
  <TableCell
143
127
  as="td"
@@ -150,23 +134,15 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
150
134
  }
151
135
  />
152
136
  }
153
- key="5"
137
+ key="4"
154
138
  />
155
139
  </TableRow>
156
140
  <TableRow
157
141
  as="tr"
158
142
  cellAs="td"
159
143
  key="1"
144
+ onClick={[Function]}
160
145
  >
161
- <TableCell
162
- as="td"
163
- content={
164
- <idDecorator
165
- id={8}
166
- />
167
- }
168
- key="0"
169
- />
170
146
  <TableCell
171
147
  as="td"
172
148
  content={
@@ -180,7 +156,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
180
156
  }
181
157
  />
182
158
  }
183
- key="1"
159
+ key="0"
184
160
  />
185
161
  <TableCell
186
162
  as="td"
@@ -211,7 +187,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
211
187
  }
212
188
  />
213
189
  }
214
- key="2"
190
+ key="1"
215
191
  />
216
192
  <TableCell
217
193
  as="td"
@@ -220,7 +196,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
220
196
  start_date="2011-05-17"
221
197
  />
222
198
  }
223
- key="3"
199
+ key="2"
224
200
  />
225
201
  <TableCell
226
202
  as="td"
@@ -229,7 +205,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
229
205
  end_date="2023-05-18"
230
206
  />
231
207
  }
232
- key="4"
208
+ key="3"
233
209
  />
234
210
  <TableCell
235
211
  as="td"
@@ -248,7 +224,7 @@ exports[`<GrantsTable /> matches the latest snapshot 1`] = `
248
224
  }
249
225
  />
250
226
  }
251
- key="5"
227
+ key="4"
252
228
  />
253
229
  </TableRow>
254
230
  </TableBody>
@@ -9,9 +9,13 @@ exports[`<PendingStructureNoteRow /> matches the latest snapshot 1`] = `
9
9
  >
10
10
  <td
11
11
  class="structure-cell-overflow"
12
- title="bar"
13
12
  >
14
- bar
13
+ <a
14
+ href="/structures/7207/notes"
15
+ title="bar_name"
16
+ >
17
+ bar_name
18
+ </a>
15
19
  </td>
16
20
  <td
17
21
  class=""
@@ -93,7 +93,7 @@ exports[`<PendingStructureNotes /> matches the latest snapshot 1`] = `
93
93
  0 structures found
94
94
  </div>
95
95
  <table
96
- class="ui selectable sortable table"
96
+ class="ui sortable table"
97
97
  >
98
98
  <thead
99
99
  class=""
@@ -136,9 +136,13 @@ exports[`<PendingStructureNotes /> matches the latest snapshot 1`] = `
136
136
  >
137
137
  <td
138
138
  class="structure-cell-overflow"
139
- title="bar"
140
139
  >
141
- bar
140
+ <a
141
+ href="/structures/7207/notes"
142
+ title="bar"
143
+ >
144
+ bar
145
+ </a>
142
146
  </td>
143
147
  <td
144
148
  class=""
@@ -170,9 +174,13 @@ exports[`<PendingStructureNotes /> matches the latest snapshot 1`] = `
170
174
  >
171
175
  <td
172
176
  class="structure-cell-overflow"
173
- title="foo"
174
177
  >
175
- foo
178
+ <a
179
+ href="/structures/665214/notes"
180
+ title="foo"
181
+ >
182
+ foo
183
+ </a>
176
184
  </td>
177
185
  <td
178
186
  class=""
@@ -3,7 +3,7 @@
3
3
  exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
4
4
  <div>
5
5
  <table
6
- class="ui selectable sortable table"
6
+ class="ui sortable table"
7
7
  >
8
8
  <thead
9
9
  class=""
@@ -46,9 +46,13 @@ exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
46
46
  >
47
47
  <td
48
48
  class="structure-cell-overflow"
49
- title="bar"
50
49
  >
51
- bar
50
+ <a
51
+ href="/structures/7207/notes"
52
+ title="bar"
53
+ >
54
+ bar
55
+ </a>
52
56
  </td>
53
57
  <td
54
58
  class=""
@@ -80,9 +84,13 @@ exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
80
84
  >
81
85
  <td
82
86
  class="structure-cell-overflow"
83
- title="foo"
84
87
  >
85
- foo
88
+ <a
89
+ href="/structures/665214/notes"
90
+ title="foo"
91
+ >
92
+ foo
93
+ </a>
86
94
  </td>
87
95
  <td
88
96
  class=""
@@ -11,7 +11,6 @@ exports[`<StructureRow /> matches the latest snapshot 1`] = `
11
11
  content="s1"
12
12
  key="0"
13
13
  onClick={[Function]}
14
- title="s1"
15
14
  />
16
15
  <TableCell
17
16
  as="td"
@@ -141,9 +141,13 @@ exports[`<StructureSelector /> matches the latest snapshot 1`] = `
141
141
  >
142
142
  <td
143
143
  class="structure-cell-overflow"
144
- title="1"
145
144
  >
146
- 1
145
+ <a
146
+ href="/structures/1"
147
+ title="1"
148
+ >
149
+ 1
150
+ </a>
147
151
  </td>
148
152
  <td
149
153
  class=""
@@ -174,9 +178,13 @@ exports[`<StructureSelector /> matches the latest snapshot 1`] = `
174
178
  >
175
179
  <td
176
180
  class="structure-cell-overflow"
177
- title="2"
178
181
  >
179
- 2
182
+ <a
183
+ href="/structures/2"
184
+ title="2"
185
+ >
186
+ 2
187
+ </a>
180
188
  </td>
181
189
  <td
182
190
  class=""
@@ -126,7 +126,7 @@ exports[`<StructuresGrantRequestView /> Clicking a grant request button triggers
126
126
  3 structures found
127
127
  </div>
128
128
  <table
129
- class="ui selectable sortable table"
129
+ class="ui sortable table"
130
130
  >
131
131
  <thead
132
132
  class=""
@@ -179,9 +179,13 @@ exports[`<StructuresGrantRequestView /> Clicking a grant request button triggers
179
179
  >
180
180
  <td
181
181
  class="structure-cell-overflow"
182
- title="structure_1"
183
182
  >
184
- structure_1
183
+ <a
184
+ href="/structures/1"
185
+ title="structure_1"
186
+ >
187
+ structure_1
188
+ </a>
185
189
  </td>
186
190
  <td
187
191
  class=""
@@ -224,9 +228,13 @@ exports[`<StructuresGrantRequestView /> Clicking a grant request button triggers
224
228
  >
225
229
  <td
226
230
  class="structure-cell-overflow"
227
- title="structure_2"
228
231
  >
229
- structure_2
232
+ <a
233
+ href="/structures/2"
234
+ title="structure_2"
235
+ >
236
+ structure_2
237
+ </a>
230
238
  </td>
231
239
  <td
232
240
  class=""
@@ -269,9 +277,13 @@ exports[`<StructuresGrantRequestView /> Clicking a grant request button triggers
269
277
  >
270
278
  <td
271
279
  class="structure-cell-overflow"
272
- title="structure_3"
273
280
  >
274
- structure_3
281
+ <a
282
+ href="/structures/3"
283
+ title="structure_3"
284
+ >
285
+ structure_3
286
+ </a>
275
287
  </td>
276
288
  <td
277
289
  class=""
@@ -22,7 +22,7 @@ exports[`<StructuresSearchResults /> matches the latest snapshot 1`] = `
22
22
  Results
23
23
  </div>
24
24
  <table
25
- class="ui selectable sortable table"
25
+ class="ui sortable table"
26
26
  >
27
27
  <thead
28
28
  class=""
@@ -45,7 +45,6 @@ exports[`<StructuresSearchResults /> matches the latest snapshot 1`] = `
45
45
  >
46
46
  <td
47
47
  class="structure-cell-overflow"
48
- title="1"
49
48
  >
50
49
  1
51
50
  </td>
@@ -55,7 +54,6 @@ exports[`<StructuresSearchResults /> matches the latest snapshot 1`] = `
55
54
  >
56
55
  <td
57
56
  class="structure-cell-overflow"
58
- title="2"
59
57
  >
60
58
  2
61
59
  </td>
@@ -65,7 +63,6 @@ exports[`<StructuresSearchResults /> matches the latest snapshot 1`] = `
65
63
  >
66
64
  <td
67
65
  class="structure-cell-overflow"
68
- title="3"
69
66
  >
70
67
  3
71
68
  </td>
@@ -3,7 +3,7 @@
3
3
  exports[`<StructuresTable /> matches the latest snapshot (selected structure active) 1`] = `
4
4
  <div>
5
5
  <table
6
- class="ui small selectable sortable table"
6
+ class="ui small sortable table"
7
7
  >
8
8
  <thead
9
9
  class=""
@@ -31,7 +31,6 @@ exports[`<StructuresTable /> matches the latest snapshot (selected structure act
31
31
  >
32
32
  <td
33
33
  class="structure-cell-overflow"
34
- title="1"
35
34
  >
36
35
  1
37
36
  </td>
@@ -46,7 +45,6 @@ exports[`<StructuresTable /> matches the latest snapshot (selected structure act
46
45
  >
47
46
  <td
48
47
  class="structure-cell-overflow"
49
- title="2"
50
48
  >
51
49
  2
52
50
  </td>
@@ -61,7 +59,6 @@ exports[`<StructuresTable /> matches the latest snapshot (selected structure act
61
59
  >
62
60
  <td
63
61
  class="structure-cell-overflow"
64
- title="3"
65
62
  >
66
63
  3
67
64
  </td>
@@ -79,7 +76,7 @@ exports[`<StructuresTable /> matches the latest snapshot (selected structure act
79
76
  exports[`<StructuresTable /> matches the latest snapshot (selected structure not in structures) 1`] = `
80
77
  <div>
81
78
  <table
82
- class="ui small selectable sortable table"
79
+ class="ui small sortable table"
83
80
  >
84
81
  <thead
85
82
  class=""
@@ -117,7 +114,6 @@ exports[`<StructuresTable /> matches the latest snapshot (selected structure not
117
114
  >
118
115
  <td
119
116
  class="structure-cell-overflow"
120
- title="1"
121
117
  >
122
118
  1
123
119
  </td>
@@ -132,7 +128,6 @@ exports[`<StructuresTable /> matches the latest snapshot (selected structure not
132
128
  >
133
129
  <td
134
130
  class="structure-cell-overflow"
135
- title="2"
136
131
  >
137
132
  2
138
133
  </td>
@@ -147,7 +142,6 @@ exports[`<StructuresTable /> matches the latest snapshot (selected structure not
147
142
  >
148
143
  <td
149
144
  class="structure-cell-overflow"
150
- title="3"
151
145
  >
152
146
  3
153
147
  </td>
@@ -165,7 +159,7 @@ exports[`<StructuresTable /> matches the latest snapshot (selected structure not
165
159
  exports[`<StructuresTable /> matches the latest snapshot 1`] = `
166
160
  <div>
167
161
  <table
168
- class="ui small selectable sortable table"
162
+ class="ui small sortable table"
169
163
  >
170
164
  <thead
171
165
  class=""
@@ -193,7 +187,6 @@ exports[`<StructuresTable /> matches the latest snapshot 1`] = `
193
187
  >
194
188
  <td
195
189
  class="structure-cell-overflow"
196
- title="1"
197
190
  >
198
191
  1
199
192
  </td>
@@ -208,7 +201,6 @@ exports[`<StructuresTable /> matches the latest snapshot 1`] = `
208
201
  >
209
202
  <td
210
203
  class="structure-cell-overflow"
211
- title="2"
212
204
  >
213
205
  2
214
206
  </td>
@@ -223,7 +215,6 @@ exports[`<StructuresTable /> matches the latest snapshot 1`] = `
223
215
  >
224
216
  <td
225
217
  class="structure-cell-overflow"
226
- title="3"
227
218
  >
228
219
  3
229
220
  </td>
@@ -18,16 +18,6 @@ exports[`EndDateDecorator matches the latest snapshot 1`] = `
18
18
  </div>
19
19
  `;
20
20
 
21
- exports[`GrantIdDecorator matches the latest snapshot 1`] = `
22
- <div>
23
- <a
24
- href="/grants/1"
25
- >
26
- 1
27
- </a>
28
- </div>
29
- `;
30
-
31
21
  exports[`GrantStructureDecorator matches the latest snapshot when structure is direct 1`] = `
32
22
  <div>
33
23
  <div
@@ -6,7 +6,6 @@ import {
6
6
  defaultGrantsTableColumns,
7
7
  getGrantsColumns,
8
8
  getGrantsTableColumns,
9
- GrantIdDecorator,
10
9
  GrantUserDecorator,
11
10
  GrantStructureDecorator,
12
11
  GrantTableStructureDecorator,
@@ -81,14 +80,6 @@ describe("selectors: getGrantsTableColumns", () => {
81
80
  });
82
81
  });
83
82
 
84
- describe("GrantIdDecorator", () => {
85
- it("matches the latest snapshot", () => {
86
- const props = { id: 1 };
87
- const { container } = render(<GrantIdDecorator {...props} />, renderOpts);
88
- expect(container).toMatchSnapshot();
89
- });
90
- });
91
-
92
83
  describe("GrantUserDecorator", () => {
93
84
  it("matches the latest snapshot", () => {
94
85
  const props = {
@@ -54,13 +54,32 @@ export const StructureDecorator = ({
54
54
  <Popup
55
55
  content={formatMessage({ id: "request.grantRemoval" })}
56
56
  trigger={
57
- <Link to={linkTo.GRANT({ id: grant.id })}>
57
+ <Link
58
+ to={linkTo.GRANT({ id: grant.id })}
59
+ onClick={(e) => e.stopPropagation()}
60
+ >
58
61
  <Icon name="user delete" style={{ color: "black" }} />{" "}
59
62
  </Link>
60
63
  }
61
64
  />
62
65
  ) : null}
63
- {data_structure?.name || data_structure_version?.name}
66
+ {data_structure?.name ? (
67
+ <Link
68
+ onClick={(e) => e.stopPropagation()}
69
+ to={linkTo.STRUCTURE({ id: data_structure?.id })}
70
+ >
71
+ {data_structure?.name}
72
+ </Link>
73
+ ) : data_structure_version?.name ? (
74
+ <Link
75
+ onClick={(e) => e.stopPropagation()}
76
+ to={linkTo.STRUCTURE({
77
+ id: data_structure_version?.data_structure_id,
78
+ })}
79
+ >
80
+ {data_structure_version?.name}
81
+ </Link>
82
+ ) : null}
64
83
  </>
65
84
  );
66
85
  };