@truedat/dd 4.40.13 → 4.41.1

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 +18 -0
  2. package/package.json +6 -6
  3. package/src/api.js +3 -0
  4. package/src/components/DictionaryRoutes.js +17 -1
  5. package/src/components/EditDomainForm.js +37 -24
  6. package/src/components/PendingStructureNoteRow.js +45 -0
  7. package/src/components/PendingStructureNotes.js +149 -0
  8. package/src/components/PendingStructureNotesTable.js +73 -0
  9. package/src/components/StructuresDomainsUploadOption.js +54 -0
  10. package/src/components/StructuresOptions.js +4 -0
  11. package/src/components/__tests__/EditDomainForm.spec.js +2 -0
  12. package/src/components/__tests__/PendingStructureNoteRow.spec.js +48 -0
  13. package/src/components/__tests__/PendingStructureNotes.spec.js +102 -0
  14. package/src/components/__tests__/PendingStructureNotesTable.spec.js +83 -0
  15. package/src/components/__tests__/StructuresOptions.spec.js +6 -1
  16. package/src/components/__tests__/__snapshots__/DictionaryRoutes.spec.js.snap +4 -0
  17. package/src/components/__tests__/__snapshots__/EditDomainForm.spec.js.snap +66 -77
  18. package/src/components/__tests__/__snapshots__/PendingStructureNoteRow.spec.js.snap +35 -0
  19. package/src/components/__tests__/__snapshots__/PendingStructureNotes.spec.js.snap +126 -0
  20. package/src/components/__tests__/__snapshots__/PendingStructureNotesTable.spec.js.snap +123 -0
  21. package/src/components/__tests__/__snapshots__/StructuresOptions.spec.js.snap +14 -0
  22. package/src/messages/en.js +27 -0
  23. package/src/messages/es.js +30 -0
  24. package/src/reducers/__tests__/ddMessage.spec.js +73 -0
  25. package/src/reducers/ddMessage.js +51 -8
  26. package/src/routines.js +3 -0
  27. package/src/sagas/__tests__/uploadStructuresDomains.spec.js +81 -0
  28. package/src/sagas/index.js +3 -0
  29. package/src/sagas/uploadStructuresDomains.js +35 -0
@@ -0,0 +1,102 @@
1
+ import React, { Suspense } from "react";
2
+ import { waitFor } from "@testing-library/react";
3
+ import { render } from "@truedat/test/render";
4
+ import {
5
+ PendingStructureNotes,
6
+ STRUCTURE_NOTES,
7
+ } from "../PendingStructureNotes";
8
+
9
+ jest.mock("react-redux", () => ({
10
+ ...jest.requireActual("react-redux"),
11
+ useSelector: jest.fn((selector) =>
12
+ selector({
13
+ systems: [
14
+ { external_id: "some_external_id", id: 10, name: "some system" },
15
+ ],
16
+ })
17
+ ),
18
+ }));
19
+
20
+ const domains = [
21
+ { id: 1, name: "Domain 1", level: 0 },
22
+ { id: 2, name: "Domain 2", level: 0 },
23
+ ];
24
+
25
+ const messages = {
26
+ en: {
27
+ "structure.notes.status.pending_approval": "Empty",
28
+ "pendingStructureNotes.filters": "Filters",
29
+ "pendingStructureNotes.props.status": "Status",
30
+ "pendingStructureNotes.props.system": "System",
31
+ "pendingStructureNotes.props.domains": "Domains",
32
+ "structure.notes.status.draft": "Draft",
33
+ "structure.notes.status.rejected": "Rejected",
34
+ "pendingStructureNotes.header": "Header",
35
+ "pendingStructureNotes.subheader": "Sub header",
36
+ "pendingStructureNotes.search.results.empty": "Serch Empty",
37
+ "domain.selector.placeholder": "Place Holder",
38
+ "domain.selector.label": "label",
39
+ "template.form.validation.empty_required": "empty required",
40
+ },
41
+ };
42
+
43
+ const structureNotes = {
44
+ loading: false,
45
+ structureNotes: [
46
+ {
47
+ id: "7207",
48
+ status: "draft",
49
+ data_structure: {
50
+ current_version: {
51
+ name: "bar",
52
+ path: ["bar rute"],
53
+ },
54
+ domains: [{ name: "bar domain" }],
55
+ system: { name: "bar system" },
56
+ },
57
+ },
58
+ {
59
+ id: "665214",
60
+ status: "rejected",
61
+ data_structure: {
62
+ current_version: {
63
+ name: "foo",
64
+ path: ["foo rute", "other route"],
65
+ },
66
+ domains: [{ name: "foo domain 1" }, { name: "foo domain 2" }],
67
+ system: { name: "foo system" },
68
+ },
69
+ },
70
+ ],
71
+ };
72
+
73
+ const StructureNotesMock = {
74
+ request: { query: STRUCTURE_NOTES },
75
+ result: { data: { structureNotes } },
76
+ };
77
+
78
+ const renderOpts = {
79
+ mocks: [StructureNotesMock],
80
+ messages,
81
+ state: { domains },
82
+ };
83
+
84
+ describe("<PendingStructureNotes />", () => {
85
+ it("matches the latest snapshot", async () => {
86
+ const { container, queryByText } = render(
87
+ <Suspense fallback={null}>
88
+ <PendingStructureNotes />
89
+ </Suspense>,
90
+ renderOpts
91
+ );
92
+ expect(container).toMatchSnapshot();
93
+
94
+ await waitFor(() => {
95
+ expect(queryByText(/some system/)).toBeTruthy();
96
+ });
97
+
98
+ await waitFor(() => {
99
+ expect(queryByText(/Domain 1/)).toBeTruthy();
100
+ });
101
+ });
102
+ });
@@ -0,0 +1,83 @@
1
+ import React from "react";
2
+ import { waitFor } from "@testing-library/react";
3
+ import { render } from "@truedat/test/render";
4
+ import PendingStructureNotesTable from "../PendingStructureNotesTable";
5
+
6
+ const renderOpts = {
7
+ messages: {
8
+ en: {
9
+ "pendingStructureNotes.search.results.empty": "Empty",
10
+ "pendingStructureNotes.props.structure": "Structure",
11
+ "pendingStructureNotes.props.status": "Status",
12
+ "pendingStructureNotes.props.system": "System",
13
+ "pendingStructureNotes.props.domains": "Domains",
14
+ "structure.notes.status.draft": "Draft",
15
+ "structure.notes.status.rejected": "Rejected",
16
+ "pendingStructureNotes.props.path": "Path",
17
+ },
18
+ },
19
+ };
20
+
21
+ const props = {
22
+ loading: false,
23
+ structureNotes: [
24
+ {
25
+ id: "7207",
26
+ status: "draft",
27
+ data_structure: {
28
+ current_version: {
29
+ name: "bar",
30
+ path: ["bar rute"],
31
+ },
32
+ domains: [{ name: "bar domain" }],
33
+ system: { name: "bar system" },
34
+ },
35
+ },
36
+ {
37
+ id: "665214",
38
+ status: "rejected",
39
+ data_structure: {
40
+ current_version: {
41
+ name: "foo",
42
+ path: ["foo rute", "other route"],
43
+ },
44
+ domains: [{ name: "foo domain 1" }, { name: "foo domain 2" }],
45
+ system: { name: "foo system" },
46
+ },
47
+ },
48
+ ],
49
+ };
50
+
51
+ describe("<PendingStructureNotesTable />", () => {
52
+ it("matches the latest snapshot", async () => {
53
+ const { container, queryByText } = render(
54
+ <PendingStructureNotesTable {...props} />,
55
+ renderOpts
56
+ );
57
+ expect(container).toMatchSnapshot();
58
+
59
+ await waitFor(() => {
60
+ expect(queryByText(/Draft/)).toBeTruthy();
61
+ });
62
+
63
+ await waitFor(() => {
64
+ expect(queryByText(/Rejected/)).toBeTruthy();
65
+ });
66
+ });
67
+
68
+ it("matches when StructureNotes are empty and not loading", async () => {
69
+ const props = {
70
+ loading: false,
71
+ structureNotes: [],
72
+ };
73
+
74
+ const { container, queryByText } = render(
75
+ <PendingStructureNotesTable {...props} />,
76
+ renderOpts
77
+ );
78
+ expect(container).toMatchSnapshot();
79
+ await waitFor(() => {
80
+ expect(queryByText(/Empty/)).toBeTruthy();
81
+ });
82
+ });
83
+ });
@@ -10,7 +10,12 @@ const renderOpts = {
10
10
  };
11
11
 
12
12
  describe("<StructuresOptions />", () => {
13
- const props = { bulkUpload: {}, bulkUpdate: {}, autoPublish: {} };
13
+ const props = {
14
+ bulkUpload: {},
15
+ bulkUpdate: {},
16
+ bulkUploadDomains: {},
17
+ autoPublish: {},
18
+ };
14
19
 
15
20
  it("matches the latest snapshot", async () => {
16
21
  const { container } = render(<StructuresOptions {...props} />, renderOpts);
@@ -21,6 +21,10 @@ exports[`<DictionaryRoutes /> matches the latest snapshot 1`] = `
21
21
  path="/structure_types"
22
22
  render={[Function]}
23
23
  />
24
+ <Route
25
+ path="/structure_notes"
26
+ render={[Function]}
27
+ />
24
28
  <Route
25
29
  path="/profileGroups/:id"
26
30
  render={[Function]}
@@ -11,107 +11,96 @@ exports[`<EditDomainForm /> matches the latest snapshot 1`] = `
11
11
  >
12
12
  title
13
13
  </h2>
14
- <div
15
- class="required field"
14
+ <form
15
+ class="ui form"
16
16
  >
17
- <label>
18
- Domain
19
- </label>
20
17
  <div
21
- class="field"
18
+ class="ui segment"
22
19
  >
23
20
  <div
24
- aria-expanded="false"
25
- class="ui fluid multiple search selection dropdown"
26
- name="domain"
27
- role="combobox"
21
+ class="field"
28
22
  >
29
- <input
30
- aria-autocomplete="list"
31
- autocomplete="off"
32
- class="search"
33
- tabindex="0"
34
- type="text"
35
- value=""
36
- />
37
- <span
38
- class="sizer"
39
- />
40
- <div
41
- aria-atomic="true"
42
- aria-live="polite"
43
- class="divider default text"
44
- role="alert"
45
- >
46
- Select a domain...
47
- </div>
48
- <i
49
- aria-hidden="true"
50
- class="dropdown icon"
51
- />
52
23
  <div
24
+ aria-expanded="false"
53
25
  aria-multiselectable="true"
54
- class="menu transition"
26
+ class="ui floating multiple dropdown"
55
27
  role="listbox"
28
+ tabindex="0"
56
29
  >
30
+ <label>
31
+ Select domains ...
32
+ </label>
33
+ <i
34
+ aria-hidden="true"
35
+ class="dropdown icon"
36
+ />
57
37
  <div
58
- aria-checked="false"
59
- aria-selected="true"
60
- class="selected item"
61
- role="option"
62
- style="pointer-events: all;"
38
+ class="menu transition"
63
39
  >
64
40
  <div
65
- class="text"
66
- style="margin-left: 0px;"
41
+ class="ui left icon input search"
67
42
  >
43
+ <input
44
+ type="text"
45
+ />
68
46
  <i
69
47
  aria-hidden="true"
70
- class="icon"
48
+ class="search icon"
71
49
  />
72
- Domain 1
73
50
  </div>
74
- </div>
75
- <div
76
- aria-checked="false"
77
- aria-selected="false"
78
- class="item"
79
- role="option"
80
- style="pointer-events: all;"
81
- >
82
51
  <div
83
- class="text"
84
- style="margin-left: 0px;"
52
+ class="scrolling menu transition"
85
53
  >
86
- <i
87
- aria-hidden="true"
88
- class="icon"
89
- />
90
- Domain 2
54
+ <div
55
+ aria-selected="false"
56
+ class="item"
57
+ role="option"
58
+ >
59
+ <div
60
+ style="margin-left: 0px;"
61
+ >
62
+ <i
63
+ aria-hidden="true"
64
+ class="icon"
65
+ />
66
+ Domain 1
67
+ </div>
68
+ </div>
69
+ <div
70
+ aria-selected="false"
71
+ class="item"
72
+ role="option"
73
+ >
74
+ <div
75
+ style="margin-left: 0px;"
76
+ >
77
+ <i
78
+ aria-hidden="true"
79
+ class="icon"
80
+ />
81
+ Domain 2
82
+ </div>
83
+ </div>
91
84
  </div>
92
85
  </div>
93
86
  </div>
94
87
  </div>
95
88
  </div>
96
- </div>
97
- <div
98
- class="ui checked checkbox"
99
- >
100
- <input
101
- checked=""
102
- class="hidden"
103
- readonly=""
104
- tabindex="0"
105
- type="checkbox"
106
- value=""
107
- />
108
- <label>
109
- Apply on children
110
- </label>
111
- </div>
112
- <form
113
- class="ui form"
114
- >
89
+ <div
90
+ class="ui checked checkbox"
91
+ >
92
+ <input
93
+ checked=""
94
+ class="hidden"
95
+ readonly=""
96
+ tabindex="0"
97
+ type="checkbox"
98
+ value=""
99
+ />
100
+ <label>
101
+ Apply on children
102
+ </label>
103
+ </div>
115
104
  <div
116
105
  class="actions"
117
106
  >
@@ -0,0 +1,35 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<PendingStructureNoteRow /> matches the latest snapshot 1`] = `
4
+ <div>
5
+ <tr
6
+ class=""
7
+ >
8
+ <td
9
+ class=""
10
+ >
11
+ bar
12
+ </td>
13
+ <td
14
+ class=""
15
+ >
16
+ Draft
17
+ </td>
18
+ <td
19
+ class=""
20
+ >
21
+ bar system
22
+ </td>
23
+ <td
24
+ class=""
25
+ >
26
+ bar domain
27
+ </td>
28
+ <td
29
+ class=""
30
+ >
31
+ bar rute
32
+ </td>
33
+ </tr>
34
+ </div>
35
+ `;
@@ -0,0 +1,126 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<PendingStructureNotes /> matches the latest snapshot 1`] = `
4
+ <div>
5
+ <div
6
+ class="ui segment"
7
+ style="display: none;"
8
+ >
9
+ <h2
10
+ class="ui header"
11
+ >
12
+ <i
13
+ aria-hidden="true"
14
+ class="sticky note outline circular icon"
15
+ />
16
+ <div
17
+ class="content"
18
+ >
19
+ Header
20
+ <div
21
+ class="sub header"
22
+ >
23
+ Sub header
24
+ </div>
25
+ </div>
26
+ </h2>
27
+ <form
28
+ class="ui form"
29
+ >
30
+ <h5
31
+ class="ui header"
32
+ >
33
+ Filters
34
+ </h5>
35
+ <div
36
+ class="field subscriptions-checkbox-filters"
37
+ >
38
+ <label>
39
+ Status
40
+ </label>
41
+ <div
42
+ class="ui checked checkbox"
43
+ >
44
+ <input
45
+ checked=""
46
+ class="hidden"
47
+ readonly=""
48
+ tabindex="0"
49
+ type="checkbox"
50
+ value=""
51
+ />
52
+ <label>
53
+ Empty
54
+ </label>
55
+ </div>
56
+ <div
57
+ class="ui checked checkbox"
58
+ >
59
+ <input
60
+ checked=""
61
+ class="hidden"
62
+ readonly=""
63
+ tabindex="0"
64
+ type="checkbox"
65
+ value=""
66
+ />
67
+ <label>
68
+ Draft
69
+ </label>
70
+ </div>
71
+ <div
72
+ class="ui checked checkbox"
73
+ >
74
+ <input
75
+ checked=""
76
+ class="hidden"
77
+ readonly=""
78
+ tabindex="0"
79
+ type="checkbox"
80
+ value=""
81
+ />
82
+ <label>
83
+ Rejected
84
+ </label>
85
+ </div>
86
+ </div>
87
+ <div
88
+ class="field"
89
+ >
90
+ <label>
91
+ System
92
+ </label>
93
+ <div
94
+ aria-expanded="false"
95
+ aria-multiselectable="true"
96
+ class="ui multiple selection dropdown"
97
+ role="listbox"
98
+ tabindex="0"
99
+ >
100
+ <i
101
+ aria-hidden="true"
102
+ class="dropdown icon"
103
+ />
104
+ <div
105
+ class="menu transition"
106
+ >
107
+ <div
108
+ aria-checked="false"
109
+ aria-selected="true"
110
+ class="selected item"
111
+ role="option"
112
+ style="pointer-events: all;"
113
+ >
114
+ <span
115
+ class="text"
116
+ >
117
+ some system
118
+ </span>
119
+ </div>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </form>
124
+ </div>
125
+ </div>
126
+ `;
@@ -0,0 +1,123 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
4
+ <div>
5
+ <table
6
+ class="ui selectable table"
7
+ >
8
+ <thead
9
+ class=""
10
+ >
11
+ <tr
12
+ class=""
13
+ >
14
+ <th
15
+ class=""
16
+ >
17
+ Structure
18
+ </th>
19
+ <th
20
+ class=""
21
+ >
22
+ Status
23
+ </th>
24
+ <th
25
+ class=""
26
+ >
27
+ System
28
+ </th>
29
+ <th
30
+ class=""
31
+ >
32
+ Domains
33
+ </th>
34
+ <th
35
+ class=""
36
+ >
37
+ Path
38
+ </th>
39
+ </tr>
40
+ </thead>
41
+ <tbody
42
+ class=""
43
+ >
44
+ <tr
45
+ class=""
46
+ >
47
+ <td
48
+ class=""
49
+ >
50
+ bar
51
+ </td>
52
+ <td
53
+ class=""
54
+ >
55
+ Draft
56
+ </td>
57
+ <td
58
+ class=""
59
+ >
60
+ bar system
61
+ </td>
62
+ <td
63
+ class=""
64
+ >
65
+ bar domain
66
+ </td>
67
+ <td
68
+ class=""
69
+ >
70
+ bar rute
71
+ </td>
72
+ </tr>
73
+ <tr
74
+ class=""
75
+ >
76
+ <td
77
+ class=""
78
+ >
79
+ foo
80
+ </td>
81
+ <td
82
+ class=""
83
+ >
84
+ Rejected
85
+ </td>
86
+ <td
87
+ class=""
88
+ >
89
+ foo system
90
+ </td>
91
+ <td
92
+ class=""
93
+ >
94
+ foo domain 1, foo domain 2
95
+ </td>
96
+ <td
97
+ class=""
98
+ >
99
+ foo rute &gt; other route
100
+ </td>
101
+ </tr>
102
+ </tbody>
103
+ </table>
104
+ </div>
105
+ `;
106
+
107
+ exports[`<PendingStructureNotesTable /> matches when StructureNotes are empty and not loading 1`] = `
108
+ <div>
109
+ <h4
110
+ class="ui header"
111
+ >
112
+ <i
113
+ aria-hidden="true"
114
+ class="search icon"
115
+ />
116
+ <div
117
+ class="content"
118
+ >
119
+ Empty
120
+ </div>
121
+ </h4>
122
+ </div>
123
+ `;
@@ -68,6 +68,20 @@ exports[`<StructuresOptions /> matches the latest snapshot 1`] = `
68
68
  Upload structure notes
69
69
  </span>
70
70
  </div>
71
+ <div
72
+ class="item"
73
+ role="option"
74
+ >
75
+ <i
76
+ aria-hidden="true"
77
+ class="upload icon"
78
+ />
79
+ <span
80
+ class="text"
81
+ >
82
+ Update structure domains
83
+ </span>
84
+ </div>
71
85
  <div
72
86
  class="divider"
73
87
  />