@truedat/dd 4.44.3 → 4.44.4
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/CHANGELOG.md +10 -0
- package/package.json +6 -6
- package/src/api/mutations.js +27 -0
- package/src/api/queries.js +24 -0
- package/src/api.js +2 -0
- package/src/components/DictionaryRoutes.js +7 -5
- package/src/components/FilteredNav.js +9 -9
- package/src/components/GrantRequestApprovalPopup.js +0 -1
- package/src/components/ReferenceDataset.js +23 -0
- package/src/components/ReferenceDatasetActions.js +88 -0
- package/src/components/ReferenceDatasetBreadcrumbs.js +22 -0
- package/src/components/ReferenceDatasetCreate.js +36 -0
- package/src/components/ReferenceDatasetDetail.js +42 -0
- package/src/components/ReferenceDatasetForm.js +109 -0
- package/src/components/ReferenceDatasetHeader.js +32 -0
- package/src/components/ReferenceDatasetRoutes.js +56 -0
- package/src/components/ReferenceDatasetTable.js +42 -0
- package/src/components/ReferenceDatasets.js +61 -0
- package/src/components/ReferenceDatasetsTable.js +105 -0
- package/src/components/StructureTagsRoutes.js +0 -1
- package/src/components/StructureTypesCrumbs.js +0 -1
- package/src/components/StructureView.js +1 -3
- package/src/components/SystemForm.js +1 -1
- package/src/components/__tests__/ReferenceDataset.spec.js +64 -0
- package/src/components/__tests__/ReferenceDatasetActions.spec.js +17 -0
- package/src/components/__tests__/ReferenceDatasetBreadcrumbs.spec.js +12 -0
- package/src/components/__tests__/ReferenceDatasetCreate.spec.js +12 -0
- package/src/components/__tests__/ReferenceDatasetDetail.spec.js +37 -0
- package/src/components/__tests__/ReferenceDatasetForm.spec.js +51 -0
- package/src/components/__tests__/ReferenceDatasetHeader.spec.js +17 -0
- package/src/components/__tests__/ReferenceDatasetRoutes.spec.js +74 -0
- package/src/components/__tests__/ReferenceDatasetTable.spec.js +18 -0
- package/src/components/__tests__/ReferenceDatasets.spec.js +32 -0
- package/src/components/__tests__/ReferenceDatasetsTable.spec.js +22 -0
- package/src/components/__tests__/__snapshots__/DictionaryRoutes.spec.js.snap +4 -0
- package/src/components/__tests__/__snapshots__/ReferenceDataset.spec.js.snap +365 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetActions.spec.js.snap +65 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetBreadcrumbs.spec.js.snap +25 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetCreate.spec.js.snap +98 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetDetail.spec.js.snap +135 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetForm.spec.js.snap +61 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetHeader.spec.js.snap +95 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetRoutes.spec.js.snap +414 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetTable.spec.js.snap +75 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasets.spec.js.snap +128 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetsTable.spec.js.snap +86 -0
- package/src/messages/en.js +18 -0
- package/src/messages/es.js +20 -0
- package/src/reducers/__tests__/ddMessage.spec.js +26 -5
- package/src/reducers/__tests__/graph.spec.js +1 -6
- package/src/reducers/__tests__/referenceDatasetSaving.spec.js +44 -0
- package/src/reducers/__tests__/structureRedirect.spec.js +37 -13
- package/src/reducers/ddMessage.js +26 -1
- package/src/reducers/index.js +2 -0
- package/src/reducers/referenceDatasetSaving.js +16 -0
- package/src/reducers/structureRedirect.js +36 -15
- package/src/reducers/structuresUploadEvents.js +0 -1
- package/src/routines.js +35 -74
- package/src/sagas/__tests__/createReferenceDataset.spec.js +90 -0
- package/src/sagas/__tests__/deleteReferenceDataset.spec.js +81 -0
- package/src/sagas/__tests__/updateReferenceDataset.spec.js +116 -0
- package/src/sagas/createReferenceDataset.js +34 -0
- package/src/sagas/deleteReferenceDataset.js +29 -0
- package/src/sagas/downloadReferenceDataset.js +44 -0
- package/src/sagas/index.js +31 -22
- package/src/sagas/updateReferenceDataset.js +35 -0
- package/src/selectors/getRelationSortingCriteria.js +3 -5
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<ReferenceDatasets /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui segment"
|
|
7
|
+
>
|
|
8
|
+
<h2
|
|
9
|
+
class="ui header"
|
|
10
|
+
>
|
|
11
|
+
<a
|
|
12
|
+
class="ui primary right floated button"
|
|
13
|
+
href="/referenceDatasets/new"
|
|
14
|
+
role="button"
|
|
15
|
+
>
|
|
16
|
+
New Dataset
|
|
17
|
+
</a>
|
|
18
|
+
<i
|
|
19
|
+
aria-hidden="true"
|
|
20
|
+
class="list ol circular icon"
|
|
21
|
+
/>
|
|
22
|
+
<div
|
|
23
|
+
class="content"
|
|
24
|
+
>
|
|
25
|
+
Reference Data
|
|
26
|
+
<div
|
|
27
|
+
class="sub header"
|
|
28
|
+
>
|
|
29
|
+
Manage reference datasets
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</h2>
|
|
33
|
+
<div
|
|
34
|
+
class="ui icon input"
|
|
35
|
+
>
|
|
36
|
+
<input
|
|
37
|
+
placeholder="Search datasets..."
|
|
38
|
+
type="text"
|
|
39
|
+
value=""
|
|
40
|
+
/>
|
|
41
|
+
<i
|
|
42
|
+
aria-hidden="true"
|
|
43
|
+
class="search link icon"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
<table
|
|
47
|
+
class="ui table"
|
|
48
|
+
>
|
|
49
|
+
<caption
|
|
50
|
+
class="text-right"
|
|
51
|
+
>
|
|
52
|
+
One dataset found
|
|
53
|
+
</caption>
|
|
54
|
+
<thead
|
|
55
|
+
class=""
|
|
56
|
+
>
|
|
57
|
+
<tr
|
|
58
|
+
class=""
|
|
59
|
+
>
|
|
60
|
+
<th
|
|
61
|
+
class=""
|
|
62
|
+
>
|
|
63
|
+
Name
|
|
64
|
+
</th>
|
|
65
|
+
<th
|
|
66
|
+
class=""
|
|
67
|
+
>
|
|
68
|
+
Headers
|
|
69
|
+
</th>
|
|
70
|
+
<th
|
|
71
|
+
class="right aligned"
|
|
72
|
+
>
|
|
73
|
+
Rows
|
|
74
|
+
</th>
|
|
75
|
+
<th
|
|
76
|
+
class="right aligned"
|
|
77
|
+
>
|
|
78
|
+
Updated
|
|
79
|
+
|
|
80
|
+
<a>
|
|
81
|
+
<i
|
|
82
|
+
aria-hidden="true"
|
|
83
|
+
class="calendar outline icon"
|
|
84
|
+
/>
|
|
85
|
+
</a>
|
|
86
|
+
</th>
|
|
87
|
+
</tr>
|
|
88
|
+
</thead>
|
|
89
|
+
<tbody
|
|
90
|
+
class=""
|
|
91
|
+
>
|
|
92
|
+
<tr
|
|
93
|
+
class=""
|
|
94
|
+
>
|
|
95
|
+
<td
|
|
96
|
+
class=""
|
|
97
|
+
>
|
|
98
|
+
<a
|
|
99
|
+
href="/referenceDatasets/123"
|
|
100
|
+
>
|
|
101
|
+
foo
|
|
102
|
+
</a>
|
|
103
|
+
</td>
|
|
104
|
+
<td
|
|
105
|
+
class=""
|
|
106
|
+
>
|
|
107
|
+
foo, bar, baz
|
|
108
|
+
</td>
|
|
109
|
+
<td
|
|
110
|
+
class="right aligned one wide"
|
|
111
|
+
>
|
|
112
|
+
2
|
|
113
|
+
</td>
|
|
114
|
+
<td
|
|
115
|
+
class="right aligned three wide"
|
|
116
|
+
>
|
|
117
|
+
<time
|
|
118
|
+
datetime="1577836800000"
|
|
119
|
+
>
|
|
120
|
+
2 years ago
|
|
121
|
+
</time>
|
|
122
|
+
</td>
|
|
123
|
+
</tr>
|
|
124
|
+
</tbody>
|
|
125
|
+
</table>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
`;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<ReferenceDatasetsTable /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<table
|
|
6
|
+
class="ui table"
|
|
7
|
+
>
|
|
8
|
+
<caption
|
|
9
|
+
class="text-right"
|
|
10
|
+
>
|
|
11
|
+
One dataset found
|
|
12
|
+
</caption>
|
|
13
|
+
<thead
|
|
14
|
+
class=""
|
|
15
|
+
>
|
|
16
|
+
<tr
|
|
17
|
+
class=""
|
|
18
|
+
>
|
|
19
|
+
<th
|
|
20
|
+
class=""
|
|
21
|
+
>
|
|
22
|
+
Name
|
|
23
|
+
</th>
|
|
24
|
+
<th
|
|
25
|
+
class=""
|
|
26
|
+
>
|
|
27
|
+
Headers
|
|
28
|
+
</th>
|
|
29
|
+
<th
|
|
30
|
+
class="right aligned"
|
|
31
|
+
>
|
|
32
|
+
Rows
|
|
33
|
+
</th>
|
|
34
|
+
<th
|
|
35
|
+
class="right aligned"
|
|
36
|
+
>
|
|
37
|
+
Updated
|
|
38
|
+
|
|
39
|
+
<a>
|
|
40
|
+
<i
|
|
41
|
+
aria-hidden="true"
|
|
42
|
+
class="calendar outline icon"
|
|
43
|
+
/>
|
|
44
|
+
</a>
|
|
45
|
+
</th>
|
|
46
|
+
</tr>
|
|
47
|
+
</thead>
|
|
48
|
+
<tbody
|
|
49
|
+
class=""
|
|
50
|
+
>
|
|
51
|
+
<tr
|
|
52
|
+
class=""
|
|
53
|
+
>
|
|
54
|
+
<td
|
|
55
|
+
class=""
|
|
56
|
+
>
|
|
57
|
+
<a
|
|
58
|
+
href="/referenceDatasets/123"
|
|
59
|
+
>
|
|
60
|
+
foo
|
|
61
|
+
</a>
|
|
62
|
+
</td>
|
|
63
|
+
<td
|
|
64
|
+
class=""
|
|
65
|
+
>
|
|
66
|
+
foo, bar, baz
|
|
67
|
+
</td>
|
|
68
|
+
<td
|
|
69
|
+
class="right aligned one wide"
|
|
70
|
+
>
|
|
71
|
+
2
|
|
72
|
+
</td>
|
|
73
|
+
<td
|
|
74
|
+
class="right aligned three wide"
|
|
75
|
+
>
|
|
76
|
+
<time
|
|
77
|
+
datetime="1577836800000"
|
|
78
|
+
>
|
|
79
|
+
2 years ago
|
|
80
|
+
</time>
|
|
81
|
+
</td>
|
|
82
|
+
</tr>
|
|
83
|
+
</tbody>
|
|
84
|
+
</table>
|
|
85
|
+
</div>
|
|
86
|
+
`;
|
package/src/messages/en.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export default {
|
|
2
|
+
"alert.createReferenceDataset.success.header": "Dataset created",
|
|
2
3
|
"alert.createStructureTag.failed.header": "Error creating structure tag",
|
|
4
|
+
"alert.deleteReferenceDataset.success.header": "Dataset deleted",
|
|
3
5
|
"alert.export.csv": "Export to CSV",
|
|
4
6
|
"alert.linkStructureTag.failed.header": "Error linking tag to structure",
|
|
5
7
|
"alert.saveUserSearchFilters.failed.header": "Error saving filter",
|
|
6
8
|
"alert.show.more": "Show more",
|
|
9
|
+
"alert.updateReferenceDataset.success.header": "Dataset updated",
|
|
7
10
|
"alert.updateStructureTag.failed.header": "Error editing structure tag",
|
|
8
11
|
"alert.updateSystem.failed.header": "Error updating system",
|
|
9
12
|
"createStructureTag.error.name.has already been taken":
|
|
@@ -174,6 +177,21 @@ export default {
|
|
|
174
177
|
"profiling.field.name": "Name",
|
|
175
178
|
"profiling.field.null": "Nulls",
|
|
176
179
|
"profiling.field.unique": "Uniques",
|
|
180
|
+
referenceDataset: "Reference Dataset",
|
|
181
|
+
"referenceDataset.actions.delete.confirmation.content":
|
|
182
|
+
"Dataset {name} will be deleted. Are you sure?",
|
|
183
|
+
"referenceDataset.actions.delete.confirmation.header": "Delete dataset",
|
|
184
|
+
"referenceDataset.file": "Dataset File",
|
|
185
|
+
"referenceDataset.headers": "Headers",
|
|
186
|
+
"referenceDataset.name": "Name",
|
|
187
|
+
"referenceDataset.rowCount": "Rows",
|
|
188
|
+
"referenceDataset.updatedAt": "Updated",
|
|
189
|
+
"referenceDatasets.actions.create": "New Dataset",
|
|
190
|
+
"referenceDatasets.count":
|
|
191
|
+
"{count, plural, =0 {No datasets found} =1 {One dataset found} other {# datasets found}}",
|
|
192
|
+
"referenceDatasets.header": "Reference Data",
|
|
193
|
+
"referenceDatasets.search.placeholder": "Search datasets...",
|
|
194
|
+
"referenceDatasets.subheader": "Manage reference datasets",
|
|
177
195
|
"saveUserSearchFilters.error.name.duplicated": "Duplicated name",
|
|
178
196
|
"structure._actions": " ",
|
|
179
197
|
"structure.actions.delete.confirmation.content":
|
package/src/messages/es.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
export default {
|
|
2
|
+
"alert.createReferenceDataset.success.header": "Dataset creado correctamente",
|
|
2
3
|
"alert.createStructureTag.failed.header": "Error al crear Etiqueta",
|
|
4
|
+
"alert.deleteReferenceDataset.success.header":
|
|
5
|
+
"Dataset eliminado correctamente",
|
|
3
6
|
"alert.export.csv": "Exportar a CSV",
|
|
4
7
|
"alert.linkStructureTag.failed.header":
|
|
5
8
|
"Error asociando etiqueta a estructura",
|
|
6
9
|
"alert.saveUserSearchFilters.failed.header": "Error guardando filtro",
|
|
7
10
|
"alert.show.more": "Mostrar más",
|
|
11
|
+
"alert.updateReferenceDataset.success.header":
|
|
12
|
+
"Dataset actualizado correctamente",
|
|
8
13
|
"alert.updateStructureTag.failed.header": "Error al editar Etiqueta",
|
|
9
14
|
"alert.updateSystem.failed.header": "Error actualizando sistema",
|
|
10
15
|
"createStructureTag.error.name.has already been taken":
|
|
@@ -178,6 +183,21 @@ export default {
|
|
|
178
183
|
"profiling.field.name": "Nombre",
|
|
179
184
|
"profiling.field.null": "Nulos",
|
|
180
185
|
"profiling.field.unique": "Únicos",
|
|
186
|
+
referenceDataset: "Datos de referencia",
|
|
187
|
+
"referenceDataset.actions.delete.confirmation.content":
|
|
188
|
+
"El dataset {name} va a ser eliminado. ¿Estás seguro?",
|
|
189
|
+
"referenceDataset.actions.delete.confirmation.header": "Eliminar dataset",
|
|
190
|
+
"referenceDataset.file": "Fichero de datos",
|
|
191
|
+
"referenceDataset.headers": "Cabeceras",
|
|
192
|
+
"referenceDataset.name": "Nombre",
|
|
193
|
+
"referenceDataset.rowCount": "Filas",
|
|
194
|
+
"referenceDataset.updatedAt": "Actualizado",
|
|
195
|
+
"referenceDatasets.actions.create": "Nuevo dataset",
|
|
196
|
+
"referenceDatasets.count":
|
|
197
|
+
"{count, plural, =0 {Ningún dataset encontrado} =1 {Un dataset encontrado} other {# datasets encontrados}}",
|
|
198
|
+
"referenceDatasets.header": "Datos de referencia",
|
|
199
|
+
"referenceDatasets.search.placeholder": "Buscar datasets...",
|
|
200
|
+
"referenceDatasets.subheader": "Gestionar conjuntos de datos de referencia",
|
|
181
201
|
"saveUserSearchFilters.error.name.duplicated": "Nombre duplicado",
|
|
182
202
|
"structure._actions": " ",
|
|
183
203
|
"structure.actions.delete.confirmation.content":
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createReferenceDataset,
|
|
3
|
+
deleteReferenceDataset,
|
|
4
|
+
updateReferenceDataset,
|
|
5
|
+
uploadStructuresDomains,
|
|
6
|
+
} from "../../routines";
|
|
7
|
+
import { ddMessage, initialState } from "../ddMessage";
|
|
3
8
|
|
|
4
9
|
const fooState = { foo: "bar" };
|
|
5
10
|
|
|
6
11
|
describe("reducers: ddMessage", () => {
|
|
7
|
-
const initialState = null;
|
|
8
|
-
|
|
9
12
|
it("should provide the initial state", () => {
|
|
10
|
-
expect(ddMessage(undefined, {})).
|
|
13
|
+
expect(ddMessage(undefined, {})).toBe(initialState);
|
|
11
14
|
});
|
|
12
15
|
|
|
13
16
|
it("should handle the uploadStructuresDomains.SUCCESS action returning some errored rows", () => {
|
|
@@ -70,4 +73,22 @@ describe("reducers: ddMessage", () => {
|
|
|
70
73
|
content: "invalid_headers, must be: external_id, domain_external_ids",
|
|
71
74
|
});
|
|
72
75
|
});
|
|
76
|
+
|
|
77
|
+
it("should handle the createReferenceDataset.SUCCESS action", () => {
|
|
78
|
+
expect(ddMessage(fooState, createReferenceDataset.success())).toMatchObject(
|
|
79
|
+
{ header: "alert.createReferenceDataset.success.header" }
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("should handle the deleteReferenceDataset.SUCCESS action", () => {
|
|
84
|
+
expect(ddMessage(fooState, deleteReferenceDataset.success())).toMatchObject(
|
|
85
|
+
{ header: "alert.deleteReferenceDataset.success.header" }
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("should handle the updateReferenceDataset.SUCCESS action", () => {
|
|
90
|
+
expect(ddMessage(fooState, updateReferenceDataset.success())).toMatchObject(
|
|
91
|
+
{ header: "alert.updateReferenceDataset.success.header" }
|
|
92
|
+
);
|
|
93
|
+
});
|
|
73
94
|
});
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { graph, initialState } from "../graph";
|
|
2
|
-
import {
|
|
3
|
-
clearGraph,
|
|
4
|
-
clearStructure,
|
|
5
|
-
fetchGraph,
|
|
6
|
-
fetchStructure,
|
|
7
|
-
} from "../../routines";
|
|
2
|
+
import { clearGraph, fetchGraph, fetchStructure } from "../../routines";
|
|
8
3
|
|
|
9
4
|
const fooState = { foo: "bar" };
|
|
10
5
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createReferenceDataset, updateReferenceDataset } from "../../routines";
|
|
2
|
+
import { referenceDatasetSaving } from "..";
|
|
3
|
+
|
|
4
|
+
const fooState = { foo: "bar" };
|
|
5
|
+
|
|
6
|
+
describe("reducers: referenceDatasetSaving", () => {
|
|
7
|
+
const initialState = false;
|
|
8
|
+
|
|
9
|
+
it("should provide the initial state", () => {
|
|
10
|
+
expect(referenceDatasetSaving(undefined, {})).toBe(initialState);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("should handle the createReferenceDataset.TRIGGER action", () => {
|
|
14
|
+
expect(
|
|
15
|
+
referenceDatasetSaving(fooState, { type: createReferenceDataset.TRIGGER })
|
|
16
|
+
).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should handle the createReferenceDataset.FULFILL action", () => {
|
|
20
|
+
expect(
|
|
21
|
+
referenceDatasetSaving(fooState, {
|
|
22
|
+
type: createReferenceDataset.FULFILL,
|
|
23
|
+
})
|
|
24
|
+
).toBe(false);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("should handle the updateReferenceDataset.TRIGGER action", () => {
|
|
28
|
+
expect(
|
|
29
|
+
referenceDatasetSaving(fooState, { type: updateReferenceDataset.TRIGGER })
|
|
30
|
+
).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("should handle the updateReferenceDataset.FULFILL action", () => {
|
|
34
|
+
expect(
|
|
35
|
+
referenceDatasetSaving(fooState, {
|
|
36
|
+
type: updateReferenceDataset.FULFILL,
|
|
37
|
+
})
|
|
38
|
+
).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("should ignore unknown actions", () => {
|
|
42
|
+
expect(referenceDatasetSaving(fooState, { type: "FOO" })).toBe(fooState);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { linkTo } from "@truedat/core/routes";
|
|
2
1
|
import { clearRedirect } from "@truedat/core/routines";
|
|
3
2
|
import {
|
|
3
|
+
createReferenceDataset,
|
|
4
|
+
deleteReferenceDataset,
|
|
5
|
+
updateReferenceDataset,
|
|
4
6
|
updateStructureType,
|
|
5
7
|
updateStructure,
|
|
6
8
|
uploadStructures,
|
|
@@ -8,36 +10,35 @@ import {
|
|
|
8
10
|
import { structureRedirect, initialState } from "../structureRedirect";
|
|
9
11
|
|
|
10
12
|
const fooState = { foo: "bar" };
|
|
13
|
+
const id = "42";
|
|
11
14
|
|
|
12
15
|
describe("reducers: structureRedirect", () => {
|
|
13
16
|
it("should provide the initial state", () => {
|
|
14
17
|
expect(structureRedirect(undefined, {})).toBe(initialState);
|
|
15
18
|
});
|
|
16
19
|
|
|
17
|
-
it("should be
|
|
20
|
+
it("should be initial state after receiving the fetchStructure.TRIGGER action", () => {
|
|
18
21
|
expect(structureRedirect(fooState, { type: clearRedirect.TRIGGER })).toBe(
|
|
19
22
|
initialState
|
|
20
23
|
);
|
|
21
24
|
});
|
|
22
25
|
|
|
23
|
-
it("should be
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const payload = { ...data, redirect };
|
|
26
|
+
it("should be redirect value from payload after receiving the updateStructure.SUCCESS action", () => {
|
|
27
|
+
const redirect = "/foo/bar";
|
|
28
|
+
const payload = { id, redirect };
|
|
27
29
|
|
|
28
30
|
expect(
|
|
29
31
|
structureRedirect(fooState, { type: updateStructure.SUCCESS, payload })
|
|
30
32
|
).toBe(redirect);
|
|
31
33
|
});
|
|
32
34
|
|
|
33
|
-
it("should be
|
|
34
|
-
const link = linkTo.STRUCTURE_TYPES();
|
|
35
|
+
it("should be /structureTypes after receiving updateStructureType.SUCCESS action", () => {
|
|
35
36
|
expect(
|
|
36
37
|
structureRedirect(fooState, { type: updateStructureType.SUCCESS })
|
|
37
|
-
).toBe(
|
|
38
|
+
).toBe("/structureTypes");
|
|
38
39
|
});
|
|
39
40
|
|
|
40
|
-
it("should
|
|
41
|
+
it("should not change the current state after receiving updateStructure.SUCCESS if redirect is absent", () => {
|
|
41
42
|
expect(
|
|
42
43
|
structureRedirect(fooState, {
|
|
43
44
|
type: updateStructure.SUCCESS,
|
|
@@ -46,12 +47,35 @@ describe("reducers: structureRedirect", () => {
|
|
|
46
47
|
).toBe(fooState);
|
|
47
48
|
});
|
|
48
49
|
|
|
49
|
-
it("should be
|
|
50
|
-
const link = linkTo.STRUCTURES();
|
|
50
|
+
it("should be /structures after receiving uploadStructures.SUCCESS", () => {
|
|
51
51
|
expect(
|
|
52
52
|
structureRedirect(fooState, {
|
|
53
53
|
type: uploadStructures.SUCCESS,
|
|
54
54
|
})
|
|
55
|
-
).toBe(
|
|
55
|
+
).toBe("/structures");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("should be /referenceDatasets/42 after receiving createReferenceDataset.SUCCESS", () => {
|
|
59
|
+
expect(
|
|
60
|
+
structureRedirect(
|
|
61
|
+
fooState,
|
|
62
|
+
createReferenceDataset.success({ createReferenceDataset: { id } })
|
|
63
|
+
)
|
|
64
|
+
).toBe("/referenceDatasets/42");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("should be /referenceDatasets after receiving deleteReferenceDataset.SUCCESS", () => {
|
|
68
|
+
expect(structureRedirect(fooState, deleteReferenceDataset.success())).toBe(
|
|
69
|
+
"/referenceDatasets"
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("should be /referenceDatasets/42 after receiving updateReferenceDataset.SUCCESS", () => {
|
|
74
|
+
expect(
|
|
75
|
+
structureRedirect(
|
|
76
|
+
fooState,
|
|
77
|
+
updateReferenceDataset.success({ updateReferenceDataset: { id } })
|
|
78
|
+
)
|
|
79
|
+
).toBe("/referenceDatasets/42");
|
|
56
80
|
});
|
|
57
81
|
});
|
|
@@ -3,12 +3,15 @@ import { dismissAlert } from "@truedat/core/routines";
|
|
|
3
3
|
import { STRUCTURES_UPLOAD_EVENTS } from "@truedat/core/routes";
|
|
4
4
|
import {
|
|
5
5
|
bulkUpdateStructures,
|
|
6
|
+
createReferenceDataset,
|
|
7
|
+
deleteReferenceDataset,
|
|
8
|
+
updateReferenceDataset,
|
|
6
9
|
uploadStructures,
|
|
7
10
|
updateStructureType,
|
|
8
11
|
uploadStructuresDomains,
|
|
9
12
|
} from "../routines";
|
|
10
13
|
|
|
11
|
-
const initialState = null;
|
|
14
|
+
export const initialState = null;
|
|
12
15
|
|
|
13
16
|
const bulkUpdateErrors = (payload) => {
|
|
14
17
|
const messagesImp = _.has("errors")(payload.data)
|
|
@@ -125,6 +128,7 @@ const ddMessage = (state = initialState, { type, payload }) => {
|
|
|
125
128
|
icon: "check",
|
|
126
129
|
color: "green",
|
|
127
130
|
};
|
|
131
|
+
|
|
128
132
|
case uploadStructures.FAILURE:
|
|
129
133
|
if (payload.status != 500) {
|
|
130
134
|
const { data } = payload;
|
|
@@ -161,6 +165,27 @@ const ddMessage = (state = initialState, { type, payload }) => {
|
|
|
161
165
|
} else {
|
|
162
166
|
return state;
|
|
163
167
|
}
|
|
168
|
+
case createReferenceDataset.SUCCESS:
|
|
169
|
+
return {
|
|
170
|
+
error: false,
|
|
171
|
+
header: "alert.createReferenceDataset.success.header",
|
|
172
|
+
icon: "check",
|
|
173
|
+
color: "green",
|
|
174
|
+
};
|
|
175
|
+
case deleteReferenceDataset.SUCCESS:
|
|
176
|
+
return {
|
|
177
|
+
error: false,
|
|
178
|
+
header: "alert.deleteReferenceDataset.success.header",
|
|
179
|
+
icon: "check",
|
|
180
|
+
color: "green",
|
|
181
|
+
};
|
|
182
|
+
case updateReferenceDataset.SUCCESS:
|
|
183
|
+
return {
|
|
184
|
+
error: false,
|
|
185
|
+
header: "alert.updateReferenceDataset.success.header",
|
|
186
|
+
icon: "check",
|
|
187
|
+
color: "green",
|
|
188
|
+
};
|
|
164
189
|
default:
|
|
165
190
|
return state;
|
|
166
191
|
}
|
package/src/reducers/index.js
CHANGED
|
@@ -37,6 +37,7 @@ import { profileExecution } from "./profileExecution";
|
|
|
37
37
|
import { profileExecutionLoading } from "./profileExecutionLoading";
|
|
38
38
|
import { profileGroup } from "./profileGroup";
|
|
39
39
|
import { profileGroupLoading } from "./profileGroupLoading";
|
|
40
|
+
import { referenceDatasetSaving } from "./referenceDatasetSaving";
|
|
40
41
|
import { selectedGroups } from "./selectedGroups";
|
|
41
42
|
import { selectedNode } from "./selectedNode";
|
|
42
43
|
import { selectedResources } from "./selectedResources";
|
|
@@ -135,6 +136,7 @@ export {
|
|
|
135
136
|
profileExecutionLoading,
|
|
136
137
|
profileGroup,
|
|
137
138
|
profileGroupLoading,
|
|
139
|
+
referenceDatasetSaving,
|
|
138
140
|
selectedGroups,
|
|
139
141
|
selectedNode,
|
|
140
142
|
selectedResources,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createReferenceDataset, updateReferenceDataset } from "../routines";
|
|
2
|
+
|
|
3
|
+
export const referenceDatasetSaving = (state = false, { type }) => {
|
|
4
|
+
switch (type) {
|
|
5
|
+
case createReferenceDataset.TRIGGER:
|
|
6
|
+
return true;
|
|
7
|
+
case createReferenceDataset.FULFILL:
|
|
8
|
+
return false;
|
|
9
|
+
case updateReferenceDataset.TRIGGER:
|
|
10
|
+
return true;
|
|
11
|
+
case updateReferenceDataset.FULFILL:
|
|
12
|
+
return false;
|
|
13
|
+
default:
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import { clearRedirect } from "@truedat/core/routines";
|
|
3
|
-
import { linkTo } from "@truedat/core/routes";
|
|
4
3
|
import {
|
|
5
|
-
|
|
4
|
+
GRANT_REQUEST_APPROVALS,
|
|
5
|
+
REFERENCE_DATASETS,
|
|
6
|
+
STRUCTURES,
|
|
7
|
+
STRUCTURE_TAGS,
|
|
8
|
+
STRUCTURE_TYPES,
|
|
9
|
+
linkTo,
|
|
10
|
+
} from "@truedat/core/routes";
|
|
11
|
+
import {
|
|
6
12
|
bulkUpdateStructures,
|
|
13
|
+
checkoutGrantRequest,
|
|
14
|
+
createGrantRequestApproval,
|
|
7
15
|
createProfileGroup,
|
|
8
|
-
|
|
9
|
-
updateSystem,
|
|
16
|
+
createReferenceDataset,
|
|
10
17
|
createStructureTag,
|
|
18
|
+
createSystem,
|
|
19
|
+
deleteReferenceDataset,
|
|
20
|
+
deleteStructure,
|
|
11
21
|
deleteStructureTag,
|
|
22
|
+
doStructureNoteAction,
|
|
23
|
+
updateReferenceDataset,
|
|
24
|
+
updateStructure,
|
|
12
25
|
updateStructureTag,
|
|
13
|
-
deleteStructure,
|
|
14
26
|
updateStructureType,
|
|
27
|
+
updateSystem,
|
|
15
28
|
uploadStructures,
|
|
16
|
-
doStructureNoteAction,
|
|
17
|
-
checkoutGrantRequest,
|
|
18
|
-
createGrantRequestApproval,
|
|
19
29
|
} from "../routines";
|
|
20
30
|
|
|
21
31
|
export const initialState = "";
|
|
@@ -30,7 +40,7 @@ export const structureRedirect = (
|
|
|
30
40
|
case updateStructure.SUCCESS:
|
|
31
41
|
return payload?.redirect || state;
|
|
32
42
|
case bulkUpdateStructures.SUCCESS:
|
|
33
|
-
return
|
|
43
|
+
return STRUCTURES;
|
|
34
44
|
case createSystem.SUCCESS: {
|
|
35
45
|
const id = _.path("data.id")(payload);
|
|
36
46
|
return linkTo.SYSTEM_STRUCTURES({ id });
|
|
@@ -41,7 +51,7 @@ export const structureRedirect = (
|
|
|
41
51
|
}
|
|
42
52
|
case checkoutGrantRequest.SUCCESS:
|
|
43
53
|
case uploadStructures.SUCCESS: {
|
|
44
|
-
return
|
|
54
|
+
return STRUCTURES;
|
|
45
55
|
}
|
|
46
56
|
case doStructureNoteAction.SUCCESS: {
|
|
47
57
|
return meta?.redirect
|
|
@@ -49,27 +59,38 @@ export const structureRedirect = (
|
|
|
49
59
|
: state;
|
|
50
60
|
}
|
|
51
61
|
case createStructureTag.SUCCESS: {
|
|
52
|
-
return
|
|
62
|
+
return STRUCTURE_TAGS;
|
|
53
63
|
}
|
|
54
64
|
case deleteStructure.SUCCESS: {
|
|
55
65
|
const { id } = payload;
|
|
56
66
|
return linkTo.STRUCTURE({ id: id });
|
|
57
67
|
}
|
|
58
68
|
case deleteStructureTag.SUCCESS: {
|
|
59
|
-
return
|
|
69
|
+
return STRUCTURE_TAGS;
|
|
60
70
|
}
|
|
61
71
|
case updateStructureTag.SUCCESS: {
|
|
62
|
-
return
|
|
72
|
+
return STRUCTURE_TAGS;
|
|
63
73
|
}
|
|
64
74
|
case updateStructureType.SUCCESS: {
|
|
65
|
-
return
|
|
75
|
+
return STRUCTURE_TYPES;
|
|
66
76
|
}
|
|
67
77
|
case createProfileGroup.SUCCESS: {
|
|
68
78
|
const id = _.prop("data.id")(payload);
|
|
69
79
|
return linkTo.PROFILE_GROUP({ id });
|
|
70
80
|
}
|
|
71
81
|
case createGrantRequestApproval.SUCCESS: {
|
|
72
|
-
return
|
|
82
|
+
return GRANT_REQUEST_APPROVALS;
|
|
83
|
+
}
|
|
84
|
+
case createReferenceDataset.SUCCESS: {
|
|
85
|
+
const id = payload?.createReferenceDataset?.id;
|
|
86
|
+
return linkTo.REFERENCE_DATASET({ id });
|
|
87
|
+
}
|
|
88
|
+
case updateReferenceDataset.SUCCESS: {
|
|
89
|
+
const id = payload?.updateReferenceDataset?.id;
|
|
90
|
+
return linkTo.REFERENCE_DATASET({ id });
|
|
91
|
+
}
|
|
92
|
+
case deleteReferenceDataset.SUCCESS: {
|
|
93
|
+
return REFERENCE_DATASETS;
|
|
73
94
|
}
|
|
74
95
|
default:
|
|
75
96
|
return state;
|