@truedat/dd 4.44.3 → 4.45.0
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 +24 -20
- 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/EditDomainPopup.js +1 -1
- package/src/components/FilteredNav.js +9 -9
- package/src/components/GrantFilters.js +1 -5
- package/src/components/GrantRequestApprovalPopup.js +0 -1
- package/src/components/PendingStructureNotes.js +1 -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/StructureConfidentialButton.js +1 -1
- package/src/components/StructureFilters.js +1 -5
- package/src/components/StructureNotesEdit.js +6 -6
- package/src/components/StructureProperties.js +4 -1
- package/src/components/StructureTabPane.js +4 -2
- package/src/components/StructureTagsRoutes.js +0 -1
- package/src/components/StructureTypesCrumbs.js +0 -1
- package/src/components/StructureVersionListItem.js +2 -2
- package/src/components/StructureView.js +1 -3
- package/src/components/SystemForm.js +1 -1
- package/src/components/__tests__/LineageRoutes.spec.js +4 -4
- 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__/StructureConfidentialButton.spec.js +26 -30
- package/src/components/__tests__/StructureNotesEdit.spec.js +2 -9
- package/src/components/__tests__/StructureProperties.spec.js +6 -8
- package/src/components/__tests__/StructureVersionListItem.spec.js +4 -4
- package/src/components/__tests__/__snapshots__/DictionaryRoutes.spec.js.snap +4 -0
- package/src/components/__tests__/__snapshots__/LineageRoutes.spec.js.snap +1 -20
- package/src/components/__tests__/__snapshots__/ProfileExecution.spec.js.snap +2 -1
- 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/components/__tests__/__snapshots__/StructureConfidentialButton.spec.js.snap +13 -33
- package/src/components/__tests__/__snapshots__/StructureProperties.spec.js.snap +76 -71
- package/src/components/__tests__/__snapshots__/StructureTabPane.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/StructureVersionListItem.spec.js.snap +31 -64
- package/src/components/index.js +0 -6
- 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
- package/src/selectors/getTabVisibility.js +1 -4
- package/src/components/ProfilingElements.js +0 -89
- package/src/components/ProfilingGraph.js +0 -89
- package/src/components/ProfilingPatterns.js +0 -57
- package/src/components/StructureProfiling.js +0 -124
- package/src/components/__tests__/StructureProfiling.spec.js +0 -45
- package/src/components/__tests__/__snapshots__/StructureProfiling.spec.js.snap +0 -444
|
@@ -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;
|
package/src/routines.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
/* eslint-disable prettier/prettier */
|
|
1
2
|
import { createRoutine } from "redux-saga-routines";
|
|
2
3
|
|
|
3
4
|
export const addGrantFilter = createRoutine("ADD_GRANT_FILTER");
|
|
5
|
+
export const addGrantRequestToCart = createRoutine("ADD_GRANT_REQUEST_TO_CART");
|
|
4
6
|
export const addStructureFilter = createRoutine("ADD_STRUCTURE_FILTER");
|
|
5
|
-
export const addStructureSelectedFilter = createRoutine(
|
|
6
|
-
"ADD_STRUCTURE_SELECTED_FILTER"
|
|
7
|
-
);
|
|
7
|
+
export const addStructureSelectedFilter = createRoutine("ADD_STRUCTURE_SELECTED_FILTER");
|
|
8
8
|
export const applyGrantDateFilter = createRoutine("APPLY_GRANT_DATE_FILTER");
|
|
9
|
-
export const applyStructureDateFilter = createRoutine(
|
|
10
|
-
"APPLY_STRUCTURE_DATE_FILTER"
|
|
11
|
-
);
|
|
9
|
+
export const applyStructureDateFilter = createRoutine("APPLY_STRUCTURE_DATE_FILTER");
|
|
12
10
|
export const applyUserSearchFilter = createRoutine("APPLY_USER_SEARCH_FILTER");
|
|
13
11
|
export const bulkUpdateStructures = createRoutine("BULK_UPDATE_STRUCTURES");
|
|
14
12
|
export const cancelPoll = createRoutine("CANCEL_POLL");
|
|
13
|
+
export const checkoutGrantRequest = createRoutine("CHECKOUT_GRANT_REQUEST");
|
|
15
14
|
export const clearGrantFilters = createRoutine("CLEAR_GRANT_FILTERS");
|
|
15
|
+
export const clearGrantRequest = createRoutine("CLEAR_GRANT_REQUEST");
|
|
16
|
+
export const clearGrantRequests = createRoutine("CLEAR_GRANT_REQUESTS");
|
|
16
17
|
export const clearGrants = createRoutine("CLEAR_GRANTS");
|
|
17
18
|
export const clearGrantsSort = createRoutine("CLEAR_GRANTS_SORT");
|
|
18
19
|
export const clearGraph = createRoutine("CLEAR_GRAPH");
|
|
@@ -28,47 +29,44 @@ export const clearStructureFilters = createRoutine("CLEAR_STRUCTURE_FILTERS");
|
|
|
28
29
|
export const clearStructureNotes = createRoutine("CLEAR_STRUCTURE_NOTES");
|
|
29
30
|
export const clearStructureType = createRoutine("CLEAR_STRUCTURE_TYPE");
|
|
30
31
|
export const clearStructureTypes = createRoutine("CLEAR_STRUCTURE_TYPES");
|
|
31
|
-
export const clearUserSearchFilters = createRoutine(
|
|
32
|
-
"CLEAR_USER_SEARCH_FILTERS"
|
|
33
|
-
);
|
|
34
32
|
export const clearStructures = createRoutine("CLEAR_STRUCTURES");
|
|
35
33
|
export const clearStructuresSort = createRoutine("CLEAR_STRUCTURES_SORT");
|
|
36
34
|
export const clearSystem = createRoutine("CLEAR_SYSTEM");
|
|
37
35
|
export const clearSystemStructures = createRoutine("CLEAR_SYSTEM_STRUCTURES");
|
|
38
36
|
export const clearSystems = createRoutine("CLEAR_SYSTEMS");
|
|
37
|
+
export const clearUserSearchFilters = createRoutine("CLEAR_USER_SEARCH_FILTERS");
|
|
39
38
|
export const closeGrantFilter = createRoutine("CLOSE_GRANT_FILTER");
|
|
40
39
|
export const closeStructureFilter = createRoutine("CLOSE_STRUCTURE_FILTER");
|
|
40
|
+
export const createGrantRequestApproval = createRoutine("CREATE_GRANT_REQUEST_APPROVAL");
|
|
41
41
|
export const createGraph = createRoutine("CREATE_GRAPH");
|
|
42
42
|
export const createProfileGroup = createRoutine("CREATE_PROFILE_GROUP");
|
|
43
|
+
export const createReferenceDataset = createRoutine("CREATE_REFERENCE_DATASET");
|
|
43
44
|
export const createStructureGraph = createRoutine("CREATE_STRUCTURE_GRAPH");
|
|
44
45
|
export const createStructureTag = createRoutine("CREATE_STRUCTURE_TAG");
|
|
45
46
|
export const createStructureType = createRoutine("CREATE_STRUCTURE_TYPE");
|
|
46
|
-
export const deleteStructure = createRoutine("DELETE_STRUCTURE");
|
|
47
47
|
export const createSystem = createRoutine("CREATE_SYSTEM");
|
|
48
|
-
export const
|
|
49
|
-
|
|
50
|
-
);
|
|
48
|
+
export const deleteReferenceDataset = createRoutine("DELETE_REFERENCE_DATASET");
|
|
49
|
+
export const deleteLinkStructureTag = createRoutine("DELETE_LINK_STRUCTURE_TAG");
|
|
50
|
+
export const deleteStructure = createRoutine("DELETE_STRUCTURE");
|
|
51
51
|
export const deleteStructureTag = createRoutine("DELETE_STRUCTURE_TAG");
|
|
52
|
-
export const deleteUserSearchFilter = createRoutine(
|
|
53
|
-
"DELETE_USER_SEARCH_FILTER"
|
|
54
|
-
);
|
|
52
|
+
export const deleteUserSearchFilter = createRoutine("DELETE_USER_SEARCH_FILTER");
|
|
55
53
|
export const doStructureNoteAction = createRoutine("DO_STRUCTURE_NOTE_ACTION");
|
|
56
54
|
export const downloadCsvGraph = createRoutine("DOWNLOAD_CSV_GRAPH");
|
|
57
|
-
export const downloadEditableStructures = createRoutine(
|
|
58
|
-
"DOWNLOAD_EDITABLE_STRUCTURES"
|
|
59
|
-
);
|
|
55
|
+
export const downloadEditableStructures = createRoutine("DOWNLOAD_EDITABLE_STRUCTURES");
|
|
60
56
|
export const downloadGrants = createRoutine("DOWNLOAD_GRANTS");
|
|
57
|
+
export const downloadReferenceDataset = createRoutine("DOWNLOAD_REFERENCE_DATASET");
|
|
61
58
|
export const downloadStructures = createRoutine("DOWNLOAD_STRUCTURES");
|
|
62
59
|
export const excludeNode = createRoutine("EXCLUDE_NODE");
|
|
63
60
|
export const fetchDomains = createRoutine("FETCH_DOMAINS"); // TODO: Is there a way to avoid repeating this routine here?
|
|
64
61
|
export const fetchGrant = createRoutine("FETCH_GRANT");
|
|
65
62
|
export const fetchGrantFilters = createRoutine("FETCH_GRANT_FILTERS");
|
|
63
|
+
export const fetchGrantRequest = createRoutine("FETCH_GRANT_REQUEST");
|
|
64
|
+
export const fetchGrantRequestTemplates = createRoutine("FETCH_GRANT_REQUEST_TEMPLATES");
|
|
65
|
+
export const fetchGrantRequests = createRoutine("FETCH_GRANT_REQUESTS");
|
|
66
66
|
export const fetchGrants = createRoutine("FETCH_GRANTS");
|
|
67
67
|
export const fetchGraph = createRoutine("FETCH_GRAPH");
|
|
68
68
|
export const fetchLineageEvents = createRoutine("FETCH_LINEAGE_EVENTS");
|
|
69
|
-
export const fetchLinksStructureTags = createRoutine(
|
|
70
|
-
"FETCH_LINKS_STRUCTURE_TAGS"
|
|
71
|
-
);
|
|
69
|
+
export const fetchLinksStructureTags = createRoutine("FETCH_LINKS_STRUCTURE_TAGS");
|
|
72
70
|
export const fetchNodes = createRoutine("FETCH_NODES");
|
|
73
71
|
export const fetchProfileExecution = createRoutine("FETCH_EXECUTION_PROFILE");
|
|
74
72
|
export const fetchProfileGroup = createRoutine("FETCH_PROFILE_GROUP");
|
|
@@ -78,89 +76,52 @@ export const fetchStructureGraph = createRoutine("FETCH_STRUCTURE_GRAPH");
|
|
|
78
76
|
export const fetchStructureNotes = createRoutine("FETCH_STRUCTURE_NOTES");
|
|
79
77
|
export const fetchStructureType = createRoutine("FETCH_STRUCTURE_TYPE");
|
|
80
78
|
export const fetchStructureTypes = createRoutine("FETCH_STRUCTURE_TYPES");
|
|
81
|
-
export const fetchUserSearchFilters = createRoutine(
|
|
82
|
-
"FETCH_USER_SEARCH_FILTERS"
|
|
83
|
-
);
|
|
84
79
|
export const fetchStructures = createRoutine("FETCH_STRUCTURES");
|
|
85
|
-
export const fetchStructuresUploadEvents = createRoutine(
|
|
86
|
-
"FETCH_STRUCTURES_UPLOAD_EVENTS"
|
|
87
|
-
);
|
|
80
|
+
export const fetchStructuresUploadEvents = createRoutine("FETCH_STRUCTURES_UPLOAD_EVENTS");
|
|
88
81
|
export const fetchSystem = createRoutine("FETCH_SYSTEM");
|
|
89
82
|
export const fetchSystemStructures = createRoutine("FETCH_SYSTEM_STRUCTURES");
|
|
90
83
|
export const fetchSystems = createRoutine("FETCH_SYSTEMS");
|
|
91
84
|
export const fetchUnitDomains = createRoutine("FETCH_UNIT_DOMAINS");
|
|
85
|
+
export const fetchUserSearchFilters = createRoutine("FETCH_USER_SEARCH_FILTERS");
|
|
92
86
|
export const filterStructures = createRoutine("FILTER_STRUCTURES");
|
|
93
87
|
export const hoverNode = createRoutine("HOVER_NODE");
|
|
94
88
|
export const initSvg = createRoutine("INIT_SVG");
|
|
95
|
-
export const loadLineageEvents = createRoutine("LOAD_LINEAGE_EVENTS");
|
|
96
89
|
export const linkStructureTag = createRoutine("LINK_STRUCTURE_TAG");
|
|
90
|
+
export const loadLineageEvents = createRoutine("LOAD_LINEAGE_EVENTS");
|
|
97
91
|
export const openGrantFilter = createRoutine("OPEN_GRANT_FILTER");
|
|
98
92
|
export const openStructureFilter = createRoutine("OPEN_STRUCTURE_FILTER");
|
|
99
93
|
export const removeGrantFilter = createRoutine("REMOVE_GRANT_FILTER");
|
|
94
|
+
export const removeGrantRequestFromCart = createRoutine("REMOVE_GRANT_REQUEST_FROM_CART");
|
|
95
|
+
export const removeGrantRequestsQuery = createRoutine("REMOVE_GRANT_REQUESTS_QUERY");
|
|
100
96
|
export const removeStructureFilter = createRoutine("REMOVE_STRUCTURE_FILTER");
|
|
101
|
-
export const removeStructureSelectedFilter = createRoutine(
|
|
102
|
-
"REMOVE_STRUCTURE_SELECTED_FILTER"
|
|
103
|
-
);
|
|
97
|
+
export const removeStructureSelectedFilter = createRoutine("REMOVE_STRUCTURE_SELECTED_FILTER");
|
|
104
98
|
export const resetGrantFilters = createRoutine("RESET_GRANT_FILTERS");
|
|
105
99
|
export const resetStructureFilters = createRoutine("RESET_STRUCTURE_FILTERS");
|
|
106
100
|
export const saveUserSearchFilters = createRoutine("SAVE_USER_SEARCH_FILTERS");
|
|
107
101
|
export const searchGrants = createRoutine("SEARCH_GRANTS");
|
|
108
102
|
export const searchStructures = createRoutine("SEARCH_STRUCTURES");
|
|
109
103
|
export const selectGrantPage = createRoutine("SELECT_GRANT_PAGE");
|
|
104
|
+
export const selectGrantRequestTemplate = createRoutine("SELECT_GRANT_REQUEST_TEMPLATE");
|
|
110
105
|
export const selectGroup = createRoutine("SELECT_GROUP");
|
|
111
106
|
export const selectNode = createRoutine("SELECT_NODE");
|
|
112
107
|
export const selectPath = createRoutine("SELECT_PATH");
|
|
113
108
|
export const selectResources = createRoutine("SELECT_RESOURCES");
|
|
114
109
|
export const selectStructure = createRoutine("SELECT_STRUCTURE");
|
|
115
110
|
export const selectStructurePage = createRoutine("SELECT_STRUCTURE_PAGE");
|
|
111
|
+
export const setGrantRequestsQuery = createRoutine("SET_GRANT_REQUESTS_QUERY");
|
|
116
112
|
export const sortGrants = createRoutine("SORT_GRANTS");
|
|
117
113
|
export const sortStructures = createRoutine("SORT_STRUCTURES");
|
|
118
114
|
export const toggleGrantDateFilter = createRoutine("TOGGLE_GRANT_DATE_FILTER");
|
|
119
|
-
export const toggleGrantFilterValue = createRoutine(
|
|
120
|
-
|
|
121
|
-
);
|
|
122
|
-
export const toggleStructureDateFilter = createRoutine(
|
|
123
|
-
"TOGGLE_STRUCTURE_DATE_FILTER"
|
|
124
|
-
);
|
|
125
|
-
export const toggleStructureFilterValue = createRoutine(
|
|
126
|
-
"TOGGLE_STRUCTURE_FILTER_VALUE"
|
|
127
|
-
);
|
|
115
|
+
export const toggleGrantFilterValue = createRoutine("TOGGLE_GRANT_FILTER_VALUE");
|
|
116
|
+
export const toggleStructureDateFilter = createRoutine("TOGGLE_STRUCTURE_DATE_FILTER");
|
|
117
|
+
export const toggleStructureFilterValue = createRoutine("TOGGLE_STRUCTURE_FILTER_VALUE");
|
|
128
118
|
export const updateGrant = createRoutine("UPDATE_GRANT");
|
|
119
|
+
export const updateGrantRequestFilter = createRoutine("UPDATE_GRANT_REQUEST_FILTER_SAGA");
|
|
120
|
+
export const updateGrantRequestTemplateContent = createRoutine("UPDATE_GRANT_REQUEST_TEMPLATE_CONTENT");
|
|
121
|
+
export const updateReferenceDataset = createRoutine("UPDATE_REFERENCE_DATASET");
|
|
129
122
|
export const updateStructure = createRoutine("UPDATE_STRUCTURE");
|
|
130
123
|
export const updateStructureTag = createRoutine("UPDATE_STRUCTURE_TAG");
|
|
131
124
|
export const updateStructureType = createRoutine("UPDATE_STRUCTURE_TYPE");
|
|
132
125
|
export const updateSystem = createRoutine("UPDATE_SYSTEM");
|
|
133
126
|
export const uploadStructures = createRoutine("UPLOAD_STRUCTURES");
|
|
134
|
-
export const uploadStructuresDomains = createRoutine(
|
|
135
|
-
"UPLOAD_STRUCTURES_DOMAINS"
|
|
136
|
-
);
|
|
137
|
-
export const addGrantRequestToCart = createRoutine("ADD_GRANT_REQUEST_TO_CART");
|
|
138
|
-
export const removeGrantRequestFromCart = createRoutine(
|
|
139
|
-
"REMOVE_GRANT_REQUEST_FROM_CART"
|
|
140
|
-
);
|
|
141
|
-
export const fetchGrantRequestTemplates = createRoutine(
|
|
142
|
-
"FETCH_GRANT_REQUEST_TEMPLATES"
|
|
143
|
-
);
|
|
144
|
-
export const selectGrantRequestTemplate = createRoutine(
|
|
145
|
-
"SELECT_GRANT_REQUEST_TEMPLATE"
|
|
146
|
-
);
|
|
147
|
-
export const updateGrantRequestTemplateContent = createRoutine(
|
|
148
|
-
"UPDATE_GRANT_REQUEST_TEMPLATE_CONTENT"
|
|
149
|
-
);
|
|
150
|
-
export const updateGrantRequestFilter = createRoutine(
|
|
151
|
-
"UPDATE_GRANT_REQUEST_FILTER_SAGA"
|
|
152
|
-
);
|
|
153
|
-
export const checkoutGrantRequest = createRoutine("CHECKOUT_GRANT_REQUEST");
|
|
154
|
-
|
|
155
|
-
export const clearGrantRequests = createRoutine("CLEAR_GRANT_REQUESTS");
|
|
156
|
-
export const fetchGrantRequests = createRoutine("FETCH_GRANT_REQUESTS");
|
|
157
|
-
export const fetchGrantRequest = createRoutine("FETCH_GRANT_REQUEST");
|
|
158
|
-
export const clearGrantRequest = createRoutine("CLEAR_GRANT_REQUEST");
|
|
159
|
-
export const removeGrantRequestsQuery = createRoutine(
|
|
160
|
-
"REMOVE_GRANT_REQUESTS_QUERY"
|
|
161
|
-
);
|
|
162
|
-
export const setGrantRequestsQuery = createRoutine("SET_GRANT_REQUESTS_QUERY");
|
|
163
|
-
|
|
164
|
-
export const createGrantRequestApproval = createRoutine(
|
|
165
|
-
"CREATE_GRANT_REQUEST_APPROVAL"
|
|
166
|
-
);
|
|
127
|
+
export const uploadStructuresDomains = createRoutine("UPLOAD_STRUCTURES_DOMAINS");
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { testSaga } from "redux-saga-test-plan";
|
|
2
|
+
import { toBase64 } from "@truedat/core/services/file";
|
|
3
|
+
import {
|
|
4
|
+
createReferenceDatasetRequestSaga,
|
|
5
|
+
createReferenceDatasetSaga,
|
|
6
|
+
onSuccess,
|
|
7
|
+
} from "../createReferenceDataset";
|
|
8
|
+
import { CREATE_REFERENCE_DATASET } from "../../api/mutations";
|
|
9
|
+
import { createReferenceDataset } from "../../routines";
|
|
10
|
+
|
|
11
|
+
describe("sagas: createReferenceDatasetRequestSaga", () => {
|
|
12
|
+
it("should invoke createReferenceDatasetSaga on createReferenceDataset.TRIGGER", () => {
|
|
13
|
+
expect(() => {
|
|
14
|
+
testSaga(createReferenceDatasetRequestSaga)
|
|
15
|
+
.next()
|
|
16
|
+
.takeLatest(createReferenceDataset.TRIGGER, createReferenceDatasetSaga)
|
|
17
|
+
.finish()
|
|
18
|
+
.isDone();
|
|
19
|
+
}).not.toThrow();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("should throw exception if an unhandled action is received", () => {
|
|
23
|
+
expect(() => {
|
|
24
|
+
testSaga(createReferenceDatasetRequestSaga)
|
|
25
|
+
.next()
|
|
26
|
+
.takeLatest("FOO", createReferenceDatasetRequestSaga);
|
|
27
|
+
}).toThrow();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe("sagas: createReferenceDatasetSaga", () => {
|
|
32
|
+
const client = { mutate: jest.fn() };
|
|
33
|
+
const file = { foo: "bar" };
|
|
34
|
+
const name = "foo";
|
|
35
|
+
const encoded = "data:text/csv;base64,Rk9PO0JBUjtCQVo=";
|
|
36
|
+
const payload = { name, file };
|
|
37
|
+
const dataset = { name, data: encoded };
|
|
38
|
+
const variables = { dataset };
|
|
39
|
+
|
|
40
|
+
it("should put a success action when a response is returned", () => {
|
|
41
|
+
expect(() => {
|
|
42
|
+
testSaga(createReferenceDatasetSaga, { payload })
|
|
43
|
+
.next()
|
|
44
|
+
.getContext("client")
|
|
45
|
+
.next(client)
|
|
46
|
+
.call(toBase64, file)
|
|
47
|
+
.next(encoded)
|
|
48
|
+
.put(createReferenceDataset.request(dataset))
|
|
49
|
+
.next()
|
|
50
|
+
.call(client.mutate, {
|
|
51
|
+
mutation: CREATE_REFERENCE_DATASET,
|
|
52
|
+
update: onSuccess,
|
|
53
|
+
variables,
|
|
54
|
+
})
|
|
55
|
+
.next({ data: payload })
|
|
56
|
+
.put(createReferenceDataset.success(payload))
|
|
57
|
+
.next()
|
|
58
|
+
.put(createReferenceDataset.fulfill())
|
|
59
|
+
.next()
|
|
60
|
+
.isDone();
|
|
61
|
+
}).not.toThrow();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("should put a failure action when the call returns an error", () => {
|
|
65
|
+
const message = "Request failed";
|
|
66
|
+
const error = { message };
|
|
67
|
+
|
|
68
|
+
expect(() => {
|
|
69
|
+
testSaga(createReferenceDatasetSaga, { payload })
|
|
70
|
+
.next()
|
|
71
|
+
.getContext("client")
|
|
72
|
+
.next(client)
|
|
73
|
+
.call(toBase64, file)
|
|
74
|
+
.next(encoded)
|
|
75
|
+
.put(createReferenceDataset.request(dataset))
|
|
76
|
+
.next()
|
|
77
|
+
.call(client.mutate, {
|
|
78
|
+
mutation: CREATE_REFERENCE_DATASET,
|
|
79
|
+
update: onSuccess,
|
|
80
|
+
variables,
|
|
81
|
+
})
|
|
82
|
+
.throw(error)
|
|
83
|
+
.put(createReferenceDataset.failure(message))
|
|
84
|
+
.next()
|
|
85
|
+
.put(createReferenceDataset.fulfill())
|
|
86
|
+
.next()
|
|
87
|
+
.isDone();
|
|
88
|
+
}).not.toThrow();
|
|
89
|
+
});
|
|
90
|
+
});
|