@truedat/dd 6.8.1 → 6.8.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.
Files changed (27) hide show
  1. package/package.json +6 -6
  2. package/src/components/DictionaryRoutes.js +5 -1
  3. package/src/components/GrantRequest.js +6 -3
  4. package/src/components/PendingStructureNoteRow.js +18 -26
  5. package/src/components/PendingStructureNotes.js +58 -111
  6. package/src/components/PendingStructureNotesLabelResults.js +17 -0
  7. package/src/components/PendingStructureNotesPagination.js +16 -0
  8. package/src/components/PendingStructureNotesTable.js +44 -35
  9. package/src/components/StructureNotes.js +1 -1
  10. package/src/components/SystemCards.js +20 -18
  11. package/src/components/SystemView.js +7 -4
  12. package/src/components/__tests__/GrantRequest.spec.js +2 -2
  13. package/src/components/__tests__/PendingStructureNoteRow.spec.js +95 -18
  14. package/src/components/__tests__/PendingStructureNotes.spec.js +57 -44
  15. package/src/components/__tests__/PendingStructureNotesLabelResults.spec.js +44 -0
  16. package/src/components/__tests__/PendingStructureNotesPagination.spec.js +43 -0
  17. package/src/components/__tests__/PendingStructureNotesTable.spec.js +52 -38
  18. package/src/components/__tests__/SystemCards.spec.js +6 -6
  19. package/src/components/__tests__/__snapshots__/PendingStructureNoteRow.spec.js.snap +8 -3
  20. package/src/components/__tests__/__snapshots__/PendingStructureNotes.spec.js.snap +159 -77
  21. package/src/components/__tests__/__snapshots__/PendingStructureNotesLabelResults.spec.js.snap +11 -0
  22. package/src/components/__tests__/__snapshots__/PendingStructureNotesPagination.spec.js.snap +96 -0
  23. package/src/components/__tests__/__snapshots__/PendingStructureNotesTable.spec.js.snap +36 -18
  24. package/src/selectors/__tests__/getSortedStructureNotes.spec.js +4 -4
  25. package/src/selectors/getSortedStructureNotes.js +5 -1
  26. package/src/selectors/index.js +4 -0
  27. package/src/selectors/structureNotesColumnsSelector.js +65 -0
@@ -15,111 +15,193 @@ exports[`<PendingStructureNotes /> matches the latest snapshot 1`] = `
15
15
  <div
16
16
  class="content"
17
17
  >
18
- Pending Notes
18
+ Header
19
19
  <div
20
20
  class="sub header"
21
21
  >
22
- Structure notes pending some action
22
+ Subheader
23
23
  </div>
24
24
  </div>
25
25
  </h2>
26
- <form
27
- class="ui loading form"
26
+ <div
27
+ class="ui action left icon input"
28
28
  >
29
- <h5
30
- class="ui header"
31
- >
32
- Filters
33
- </h5>
29
+ <i
30
+ aria-hidden="true"
31
+ class="search link icon"
32
+ />
33
+ <input
34
+ placeholder="Search..."
35
+ type="text"
36
+ value=""
37
+ />
34
38
  <div
35
- class="field subscriptions-checkbox-filters"
39
+ aria-busy="false"
40
+ aria-disabled="false"
41
+ aria-expanded="false"
42
+ class="ui button floating labeled scrolling dropdown icon"
43
+ role="listbox"
44
+ tabindex="0"
36
45
  >
37
- <label>
38
- Status
39
- </label>
40
46
  <div
41
- class="ui checked checkbox"
47
+ aria-atomic="true"
48
+ aria-live="polite"
49
+ class="divider text"
50
+ role="alert"
42
51
  >
43
- <input
44
- checked=""
45
- class="hidden"
46
- readonly=""
47
- tabindex="0"
48
- type="checkbox"
49
- value=""
50
- />
51
- <label>
52
- Pending approval
53
- </label>
52
+ Filters
54
53
  </div>
54
+ <i
55
+ aria-hidden="true"
56
+ class="filter icon"
57
+ />
55
58
  <div
56
- class="ui checked checkbox"
59
+ class="menu transition"
57
60
  >
58
- <input
59
- checked=""
60
- class="hidden"
61
- readonly=""
62
- tabindex="0"
63
- type="checkbox"
64
- value=""
65
- />
66
- <label>
67
- Draft
68
- </label>
61
+ <div
62
+ class="item"
63
+ role="option"
64
+ >
65
+ <em>
66
+ (reset filters)
67
+ </em>
68
+ </div>
69
69
  </div>
70
+ </div>
71
+ </div>
72
+ <div
73
+ class="selectedFilters"
74
+ />
75
+ <div
76
+ class="dimmable"
77
+ >
78
+ <div
79
+ class="ui inverted dimmer"
80
+ style=""
81
+ >
70
82
  <div
71
- class="ui checked checkbox"
83
+ class="content"
72
84
  >
73
- <input
74
- checked=""
75
- class="hidden"
76
- readonly=""
77
- tabindex="0"
78
- type="checkbox"
79
- value=""
85
+ <div
86
+ class="ui loader"
80
87
  />
81
- <label>
82
- Rejected
83
- </label>
84
88
  </div>
85
89
  </div>
86
90
  <div
87
- class="field"
91
+ class="ui label structures-notes-label-results"
88
92
  >
89
- <label>
90
- System
91
- </label>
92
- <div
93
- aria-expanded="false"
94
- aria-multiselectable="true"
95
- class="ui multiple selection dropdown"
96
- role="listbox"
97
- tabindex="0"
93
+ 0 structures found
94
+ </div>
95
+ <table
96
+ class="ui selectable sortable table"
97
+ >
98
+ <thead
99
+ class=""
98
100
  >
99
- <i
100
- aria-hidden="true"
101
- class="dropdown icon"
102
- />
103
- <div
104
- class="menu transition"
101
+ <tr
102
+ class=""
105
103
  >
106
- <div
107
- aria-checked="false"
108
- aria-selected="true"
109
- class="selected item"
110
- role="option"
111
- style="pointer-events: all;"
104
+ <th
105
+ class="two wide"
106
+ >
107
+ Name
108
+ </th>
109
+ <th
110
+ class="one wide"
111
+ >
112
+ Status
113
+ </th>
114
+ <th
115
+ class="one wide"
116
+ >
117
+ System
118
+ </th>
119
+ <th
120
+ class="one wide disabled"
121
+ >
122
+ Domain
123
+ </th>
124
+ <th
125
+ class="one wide disabled"
126
+ >
127
+ Path
128
+ </th>
129
+ </tr>
130
+ </thead>
131
+ <tbody
132
+ class=""
133
+ >
134
+ <tr
135
+ class=""
136
+ >
137
+ <td
138
+ class="structure-cell-overflow"
139
+ title="bar"
140
+ >
141
+ bar
142
+ </td>
143
+ <td
144
+ class=""
145
+ >
146
+ Draft
147
+ </td>
148
+ <td
149
+ class=""
150
+ >
151
+ bar system
152
+ </td>
153
+ <td
154
+ class=""
155
+ >
156
+ bar domain
157
+ </td>
158
+ <td
159
+ class=""
112
160
  >
113
161
  <span
114
- class="text"
162
+ title="bar rute"
115
163
  >
116
- some system
164
+ bar rute
117
165
  </span>
118
- </div>
119
- </div>
120
- </div>
121
- </div>
122
- </form>
166
+ </td>
167
+ </tr>
168
+ <tr
169
+ class=""
170
+ >
171
+ <td
172
+ class="structure-cell-overflow"
173
+ title="foo"
174
+ >
175
+ foo
176
+ </td>
177
+ <td
178
+ class=""
179
+ >
180
+ Rejected
181
+ </td>
182
+ <td
183
+ class=""
184
+ >
185
+ foo system
186
+ </td>
187
+ <td
188
+ class=""
189
+ >
190
+ foo domain 1, foo domain 2
191
+ </td>
192
+ <td
193
+ class=""
194
+ >
195
+ <span
196
+ title="foo rute › other route"
197
+ >
198
+ foo rute › other route
199
+ </span>
200
+ </td>
201
+ </tr>
202
+ </tbody>
203
+ </table>
204
+ </div>
123
205
  </div>
124
206
  </div>
125
207
  `;
@@ -0,0 +1,11 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<PendingStructureNotesLabelResults /> matches the latest snapshot 1`] = `
4
+ <div>
5
+ <div
6
+ class="ui label structures-notes-label-results"
7
+ >
8
+ 22 structures found
9
+ </div>
10
+ </div>
11
+ `;
@@ -0,0 +1,96 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<PendingStructureNotesPagination /> matches the latest snapshot 1`] = `
4
+ <div>
5
+ <div
6
+ aria-label="Pagination Navigation"
7
+ class="ui pagination menu"
8
+ role="navigation"
9
+ >
10
+ <a
11
+ aria-current="false"
12
+ aria-disabled="false"
13
+ aria-label="First item"
14
+ class="item"
15
+ tabindex="0"
16
+ type="firstItem"
17
+ value="1"
18
+ >
19
+ «
20
+ </a>
21
+ <a
22
+ aria-current="false"
23
+ aria-disabled="false"
24
+ aria-label="Previous item"
25
+ class="item"
26
+ tabindex="0"
27
+ type="prevItem"
28
+ value="1"
29
+ >
30
+
31
+ </a>
32
+ <a
33
+ aria-current="true"
34
+ aria-disabled="false"
35
+ class="active item"
36
+ tabindex="0"
37
+ type="pageItem"
38
+ value="1"
39
+ >
40
+ 1
41
+ </a>
42
+ <a
43
+ aria-current="false"
44
+ aria-disabled="false"
45
+ class="item"
46
+ tabindex="0"
47
+ type="pageItem"
48
+ value="2"
49
+ >
50
+ 2
51
+ </a>
52
+ <a
53
+ aria-current="false"
54
+ aria-disabled="false"
55
+ class="item"
56
+ tabindex="0"
57
+ type="pageItem"
58
+ value="3"
59
+ >
60
+ 3
61
+ </a>
62
+ <a
63
+ aria-current="false"
64
+ aria-disabled="false"
65
+ class="item"
66
+ tabindex="0"
67
+ type="pageItem"
68
+ value="4"
69
+ >
70
+ 4
71
+ </a>
72
+ <a
73
+ aria-current="false"
74
+ aria-disabled="false"
75
+ aria-label="Next item"
76
+ class="item"
77
+ tabindex="0"
78
+ type="nextItem"
79
+ value="2"
80
+ >
81
+
82
+ </a>
83
+ <a
84
+ aria-current="false"
85
+ aria-disabled="false"
86
+ aria-label="Last item"
87
+ class="item"
88
+ tabindex="0"
89
+ type="lastItem"
90
+ value="4"
91
+ >
92
+ »
93
+ </a>
94
+ </div>
95
+ </div>
96
+ `;
@@ -3,7 +3,7 @@
3
3
  exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
4
4
  <div>
5
5
  <table
6
- class="ui selectable table"
6
+ class="ui selectable sortable table"
7
7
  >
8
8
  <thead
9
9
  class=""
@@ -12,27 +12,27 @@ exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
12
12
  class=""
13
13
  >
14
14
  <th
15
- class=""
15
+ class="two wide"
16
16
  >
17
- Structure
17
+ Name
18
18
  </th>
19
19
  <th
20
- class=""
20
+ class="one wide"
21
21
  >
22
22
  Status
23
23
  </th>
24
24
  <th
25
- class=""
25
+ class="one wide"
26
26
  >
27
27
  System
28
28
  </th>
29
29
  <th
30
- class=""
30
+ class="one wide disabled"
31
31
  >
32
- Domains
32
+ Domain
33
33
  </th>
34
34
  <th
35
- class=""
35
+ class="one wide disabled"
36
36
  >
37
37
  Path
38
38
  </th>
@@ -45,8 +45,11 @@ exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
45
45
  class=""
46
46
  >
47
47
  <td
48
- class=""
49
- />
48
+ class="structure-cell-overflow"
49
+ title="bar"
50
+ >
51
+ bar
52
+ </td>
50
53
  <td
51
54
  class=""
52
55
  >
@@ -54,24 +57,33 @@ exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
54
57
  </td>
55
58
  <td
56
59
  class=""
57
- />
60
+ >
61
+ bar system
62
+ </td>
58
63
  <td
59
64
  class=""
60
65
  >
61
-
66
+ bar domain
62
67
  </td>
63
68
  <td
64
69
  class=""
65
70
  >
66
-
71
+ <span
72
+ title="bar rute"
73
+ >
74
+ bar rute
75
+ </span>
67
76
  </td>
68
77
  </tr>
69
78
  <tr
70
79
  class=""
71
80
  >
72
81
  <td
73
- class=""
74
- />
82
+ class="structure-cell-overflow"
83
+ title="foo"
84
+ >
85
+ foo
86
+ </td>
75
87
  <td
76
88
  class=""
77
89
  >
@@ -79,16 +91,22 @@ exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
79
91
  </td>
80
92
  <td
81
93
  class=""
82
- />
94
+ >
95
+ foo system
96
+ </td>
83
97
  <td
84
98
  class=""
85
99
  >
86
-
100
+ foo domain 1, foo domain 2
87
101
  </td>
88
102
  <td
89
103
  class=""
90
104
  >
91
-
105
+ <span
106
+ title="foo rute › other route"
107
+ >
108
+ foo rute › other route
109
+ </span>
92
110
  </td>
93
111
  </tr>
94
112
  </tbody>
@@ -9,7 +9,7 @@ const sn1 = {
9
9
  data_structure_id: 1,
10
10
  version: 1,
11
11
  status: "versioned",
12
- df_content: {
12
+ dynamic_content: {
13
13
  c1: { value: 1, origin: "user" },
14
14
  c2: { value: 2, origin: "user" },
15
15
  },
@@ -19,7 +19,7 @@ const sn2 = {
19
19
  data_structure_id: 1,
20
20
  version: 2,
21
21
  status: "published",
22
- df_content: {
22
+ dynamic_content: {
23
23
  c1: { value: 2, origin: "user" },
24
24
  c2: { value: 4, origin: "user" },
25
25
  },
@@ -29,7 +29,7 @@ const sn3 = {
29
29
  data_structure_id: 1,
30
30
  version: 3,
31
31
  status: "draft",
32
- df_content: {
32
+ dynamic_content: {
33
33
  c1: { value: 3, origin: "user" },
34
34
  c2: { value: 6, origin: "user" },
35
35
  },
@@ -44,7 +44,7 @@ describe("selectors: getSortedStructureNotes", () => {
44
44
 
45
45
  const activeStructureNotes = [sn3, sn2];
46
46
  const versionedStructureNotes = [sn1];
47
- const latestDfContent = sn3.df_content;
47
+ const latestDfContent = sn3.dynamic_content;
48
48
 
49
49
  it("getActiveStructureNotes", () => {
50
50
  expect(getActiveStructureNotes(state)).toEqual(activeStructureNotes);
@@ -15,5 +15,9 @@ export const getVersionedStructureNotes = createSelector(
15
15
 
16
16
  export const getLatestDfContent = createSelector(
17
17
  _.prop("structureNotes.structureNotes"),
18
- _.flow(_.orderBy(["version"], ["desc"]), _.head, _.getOr({}, "df_content"))
18
+ _.flow(
19
+ _.orderBy(["version"], ["desc"]),
20
+ _.head,
21
+ _.getOr({}, "dynamic_content")
22
+ )
19
23
  );
@@ -40,6 +40,10 @@ export {
40
40
  defaultStructureFieldColumns,
41
41
  } from "./getStructureFieldColumns";
42
42
  export { getStructureParent } from "./getStructureParent";
43
+ export {
44
+ getStructureNotesColumnsSelector,
45
+ defaultStructureNoteColumns,
46
+ } from "./structureNotesColumnsSelector";
43
47
  export { getStructuresFields } from "./getStructuresFields";
44
48
  export { getStructureSortingCriteria } from "./getStructureSortingCriteria";
45
49
  export { getStructureUpdatedAt } from "./getStructureUpdatedAt";
@@ -0,0 +1,65 @@
1
+ import _ from "lodash/fp";
2
+ import React from "react";
3
+ import PropTypes from "prop-types";
4
+ import { createSelector } from "reselect";
5
+ import { FormattedMessage } from "react-intl";
6
+
7
+ const translateDecorator = (id) =>
8
+ id ? <FormattedMessage id={id} defaultMessage={id} /> : null;
9
+
10
+ const DomainDecorator = (domains) =>
11
+ _.flow(_.map("name"), _.join(", "))(domains);
12
+
13
+ DomainDecorator.propTypes = {
14
+ domains: PropTypes.array,
15
+ };
16
+
17
+ const PathDecorator = (path) => (
18
+ <span title={_.join(" › ")(path)}>
19
+ {_.flow(_.join(" › "), _.truncate({ length: 90 }))(path)}
20
+ </span>
21
+ );
22
+ PathDecorator.propTypes = {
23
+ path: PropTypes.string,
24
+ };
25
+
26
+ export const defaultStructureNoteColumns = [
27
+ {
28
+ name: "name",
29
+ sort: { name: "name.sort" },
30
+ width: 2,
31
+ },
32
+ {
33
+ name: "status",
34
+ fieldSelector: ({ non_published_note: { status: status } }) =>
35
+ translateDecorator(`pendingStructureNotes.status.${status}`),
36
+ sort: { name: "non_published_note.status.sort" },
37
+ width: 1,
38
+ },
39
+
40
+ {
41
+ name: "system",
42
+ fieldSelector: _.path("system.name"),
43
+ sort: { name: "system.name.sort" },
44
+ width: 1,
45
+ },
46
+ {
47
+ name: "domain",
48
+ fieldSelector: _.pathOr([], "domains"),
49
+ fieldDecorator: DomainDecorator,
50
+ width: 1,
51
+ },
52
+ {
53
+ name: "path",
54
+ fieldSelector: _.path("path"),
55
+ fieldDecorator: PathDecorator,
56
+ width: 1,
57
+ },
58
+ ];
59
+
60
+ const getColumns = (state) => state.structuresNotesColumns;
61
+
62
+ export const getStructureNotesColumnsSelector = createSelector(
63
+ getColumns,
64
+ _.defaultTo(defaultStructureNoteColumns)
65
+ );