@truedat/dd 7.12.6 → 7.12.9
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/package.json +3 -3
- package/src/components/StructureCrumbs.js +2 -2
- package/src/components/StructureSummary.js +7 -9
- package/src/components/StructureTabs.js +160 -127
- package/src/components/__tests__/StructureSummary.spec.js +1 -0
- package/src/reducers/__tests__/structureRelations.spec.js +15 -15
- package/src/reducers/structure.js +1 -0
- package/src/reducers/structureRelations.js +4 -4
- package/src/routines.js +0 -2
- package/src/sagas/fetchStructureChildrens.js +0 -48
- package/src/sagas/fetchStructureParents.js +0 -48
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "7.12.
|
|
3
|
+
"version": "7.12.9",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
49
|
"@testing-library/react": "^16.3.0",
|
|
50
50
|
"@testing-library/user-event": "^14.6.1",
|
|
51
|
-
"@truedat/test": "7.12.
|
|
51
|
+
"@truedat/test": "7.12.7",
|
|
52
52
|
"identity-obj-proxy": "^3.0.0",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
54
|
"redux-saga-test-plan": "^4.0.6"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"svg-pan-zoom": "^3.6.2",
|
|
84
84
|
"swr": "^2.3.3"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "8b7fd09088e71d0bb6e1a7291250e0f76df27d6e"
|
|
87
87
|
}
|
|
@@ -169,11 +169,11 @@ const mapStateToProps = ({
|
|
|
169
169
|
structure,
|
|
170
170
|
structureAncestry: ancestry,
|
|
171
171
|
structureVersion: version,
|
|
172
|
-
structureSystem
|
|
172
|
+
structureSystem,
|
|
173
173
|
}) => ({
|
|
174
174
|
...structure,
|
|
175
175
|
ancestry,
|
|
176
|
-
system,
|
|
176
|
+
system: structureSystem || structure?.system,
|
|
177
177
|
version,
|
|
178
178
|
});
|
|
179
179
|
|
|
@@ -5,7 +5,6 @@ import Moment from "react-moment";
|
|
|
5
5
|
import { connect } from "react-redux";
|
|
6
6
|
import { useIntl } from "react-intl";
|
|
7
7
|
import ShareLinkPopup from "@truedat/audit/components/ShareLinkPopup";
|
|
8
|
-
import { getStructureUpdatedAt } from "../selectors";
|
|
9
8
|
import StructureProperties from "./StructureProperties";
|
|
10
9
|
import StructureConfidentialButton from "./StructureConfidentialButton";
|
|
11
10
|
import StructureDeleteButton from "./StructureDeleteButton";
|
|
@@ -35,7 +34,7 @@ Date.propTypes = {
|
|
|
35
34
|
label: PropTypes.string,
|
|
36
35
|
};
|
|
37
36
|
|
|
38
|
-
const dateProperties = (deleted_at,
|
|
37
|
+
const dateProperties = (deleted_at, updated_at) =>
|
|
39
38
|
deleted_at
|
|
40
39
|
? {
|
|
41
40
|
label: "deleted_at",
|
|
@@ -47,7 +46,7 @@ const dateProperties = (deleted_at, updatedAt) =>
|
|
|
47
46
|
label: "updated_at",
|
|
48
47
|
className: "basic",
|
|
49
48
|
icon: <Icon name="sync alternate" />,
|
|
50
|
-
date:
|
|
49
|
+
date: updated_at,
|
|
51
50
|
};
|
|
52
51
|
|
|
53
52
|
export const StructureSummary = ({
|
|
@@ -58,14 +57,14 @@ export const StructureSummary = ({
|
|
|
58
57
|
alias,
|
|
59
58
|
description,
|
|
60
59
|
userPermissions,
|
|
61
|
-
|
|
60
|
+
updated_at,
|
|
62
61
|
deleted_at,
|
|
63
62
|
isAdmin,
|
|
64
63
|
}) => {
|
|
65
64
|
const { formatMessage } = useIntl();
|
|
66
65
|
const shareUrl = window.location.href;
|
|
67
66
|
const shareTitle = formatMessage({ id: "structure.share.title" });
|
|
68
|
-
|
|
67
|
+
|
|
69
68
|
return (
|
|
70
69
|
<>
|
|
71
70
|
<Grid>
|
|
@@ -81,8 +80,8 @@ export const StructureSummary = ({
|
|
|
81
80
|
</Header>
|
|
82
81
|
</Grid.Column>
|
|
83
82
|
<Grid.Column width={6} textAlign="right">
|
|
84
|
-
{(deleted_at ||
|
|
85
|
-
<Date {...dateProperties(deleted_at,
|
|
83
|
+
{(deleted_at || updated_at) && (
|
|
84
|
+
<Date {...dateProperties(deleted_at, updated_at)} />
|
|
86
85
|
)}
|
|
87
86
|
<Divider hidden fitted />
|
|
88
87
|
{structureClasses?._grantable ? (
|
|
@@ -122,14 +121,13 @@ StructureSummary.propTypes = {
|
|
|
122
121
|
alias: PropTypes.string,
|
|
123
122
|
description: PropTypes.string,
|
|
124
123
|
userPermissions: PropTypes.object,
|
|
125
|
-
|
|
124
|
+
updated_at: PropTypes.string,
|
|
126
125
|
deleted_at: PropTypes.string,
|
|
127
126
|
isAdmin: PropTypes.bool,
|
|
128
127
|
};
|
|
129
128
|
|
|
130
129
|
const mapStateToProps = (state) => ({
|
|
131
130
|
userPermissions: state.userPermissions,
|
|
132
|
-
updatedAt: getStructureUpdatedAt(state),
|
|
133
131
|
...state.structure,
|
|
134
132
|
isAdmin: state.authentication.role === "admin",
|
|
135
133
|
});
|
|
@@ -24,11 +24,16 @@ const versionsLink = ({ id }, version) =>
|
|
|
24
24
|
export const StructureTabs = ({ path }) => {
|
|
25
25
|
const { formatMessage } = useIntl();
|
|
26
26
|
const customTabs = useStructureCustomTabs();
|
|
27
|
-
const version = useSelector(state => state.structureVersion);
|
|
28
|
-
const structure = useSelector(state => state.structure);
|
|
29
|
-
const structureTabsOrder = useSelector(state => state.structureTabsOrder);
|
|
27
|
+
const version = useSelector((state) => state.structureVersion);
|
|
28
|
+
const structure = useSelector((state) => state.structure);
|
|
29
|
+
const structureTabsOrder = useSelector((state) => state.structureTabsOrder);
|
|
30
30
|
const tabVisibility = useSelector(getTabVisibility);
|
|
31
|
-
const activeTab = getActiveTab({
|
|
31
|
+
const activeTab = getActiveTab({
|
|
32
|
+
tabVisibility,
|
|
33
|
+
path,
|
|
34
|
+
structureTabsOrder,
|
|
35
|
+
customTabs,
|
|
36
|
+
});
|
|
32
37
|
|
|
33
38
|
const customTabsItems = _.map((tab) => ({
|
|
34
39
|
active: activeTab === tab.name,
|
|
@@ -40,132 +45,160 @@ export const StructureTabs = ({ path }) => {
|
|
|
40
45
|
|
|
41
46
|
const items = !_.isEmpty(structure)
|
|
42
47
|
? _.filter("content")([
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
48
|
+
{
|
|
49
|
+
active: activeTab === "fields",
|
|
50
|
+
as: Link,
|
|
51
|
+
to: structureFields(structure, version),
|
|
52
|
+
content: tabVisibility?.fields
|
|
53
|
+
? formatMessage({ id: "tabs.dd.fields" })
|
|
54
|
+
: false,
|
|
55
|
+
key: "fields",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
active: activeTab === "children",
|
|
59
|
+
as: Link,
|
|
60
|
+
to: linkTo.STRUCTURE_CHILDREN(structure),
|
|
61
|
+
content: tabVisibility?.children
|
|
62
|
+
? formatMessage({ id: "tabs.dd.children" })
|
|
63
|
+
: false,
|
|
64
|
+
key: "children",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
active: activeTab === "notes",
|
|
68
|
+
as: Link,
|
|
69
|
+
to: linkTo.STRUCTURE_NOTES(structure),
|
|
70
|
+
content: tabVisibility?.notes
|
|
71
|
+
? formatMessage({ id: "tabs.dd.notes" })
|
|
72
|
+
: false,
|
|
73
|
+
key: "notes",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
active: activeTab === "parents",
|
|
77
|
+
as: Link,
|
|
78
|
+
to: linkTo.STRUCTURE_PARENTS(structure),
|
|
79
|
+
content: tabVisibility?.parents
|
|
80
|
+
? formatMessage({ id: "tabs.dd.parents" })
|
|
81
|
+
: false,
|
|
82
|
+
key: "parents",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
active: activeTab === "grants",
|
|
86
|
+
as: Link,
|
|
87
|
+
to: linkTo.STRUCTURE_GRANTS(structure),
|
|
88
|
+
content: tabVisibility?.grants
|
|
89
|
+
? formatMessage({ id: "tabs.dd.grants" })
|
|
90
|
+
: false,
|
|
91
|
+
key: "grants",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
active: activeTab === "metadata",
|
|
95
|
+
as: Link,
|
|
96
|
+
to: linkTo.STRUCTURE_METADATA(structure),
|
|
97
|
+
content: tabVisibility?.metadata
|
|
98
|
+
? formatMessage({ id: "tabs.dd.metadata" })
|
|
99
|
+
: false,
|
|
100
|
+
key: "metadata",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
active: activeTab === "profile",
|
|
104
|
+
as: Link,
|
|
105
|
+
to: linkTo.STRUCTURE_PROFILE(structure),
|
|
106
|
+
content: tabVisibility?.profile
|
|
107
|
+
? formatMessage({ id: "tabs.dd.profile" })
|
|
108
|
+
: false,
|
|
109
|
+
key: "profile",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
active: activeTab === "rules",
|
|
113
|
+
as: Link,
|
|
114
|
+
to: linkTo.STRUCTURE_RULES(structure),
|
|
115
|
+
content: tabVisibility?.rules
|
|
116
|
+
? formatMessage({ id: "tabs.dd.rules" })
|
|
117
|
+
: false,
|
|
118
|
+
key: "rules",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
active: activeTab === "links",
|
|
122
|
+
as: Link,
|
|
123
|
+
to: linkTo.STRUCTURE_LINKS(structure),
|
|
124
|
+
content: tabVisibility?.links
|
|
125
|
+
? formatMessage({ id: "tabs.dd.links" })
|
|
126
|
+
: false,
|
|
127
|
+
key: "links",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
active: activeTab === "structureLinks",
|
|
131
|
+
as: Link,
|
|
132
|
+
to: linkTo.STRUCTURE_STRUCTURE_LINKS(structure),
|
|
133
|
+
content: tabVisibility?.structureLinks
|
|
134
|
+
? formatMessage({ id: "tabs.dd.structureLinks" })
|
|
135
|
+
: false,
|
|
136
|
+
key: "structureLinks",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
active: activeTab === "lineage",
|
|
140
|
+
as: Link,
|
|
141
|
+
to: linkTo.STRUCTURE_LINEAGE(structure),
|
|
142
|
+
content: tabVisibility?.lineage
|
|
143
|
+
? formatMessage({ id: "tabs.dd.lineage" })
|
|
144
|
+
: false,
|
|
145
|
+
key: "lineage",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
active: activeTab === "impact",
|
|
149
|
+
as: Link,
|
|
150
|
+
to: linkTo.STRUCTURE_IMPACT(structure),
|
|
151
|
+
content: tabVisibility?.impact
|
|
152
|
+
? formatMessage({ id: "tabs.dd.impact" })
|
|
153
|
+
: false,
|
|
154
|
+
key: "impact",
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
active: activeTab === "versions",
|
|
158
|
+
as: Link,
|
|
159
|
+
to: versionsLink(structure, version),
|
|
160
|
+
content: tabVisibility?.versions
|
|
161
|
+
? formatMessage({ id: "tabs.dd.versions" })
|
|
162
|
+
: false,
|
|
163
|
+
key: "versions",
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
active: activeTab === "events",
|
|
167
|
+
as: Link,
|
|
168
|
+
to: linkTo.STRUCTURE_EVENTS(structure),
|
|
169
|
+
content: tabVisibility?.events
|
|
170
|
+
? formatMessage({ id: "tabs.dd.audit" })
|
|
171
|
+
: false,
|
|
172
|
+
key: "events",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
active: activeTab === "roles",
|
|
176
|
+
as: Link,
|
|
177
|
+
to: linkTo.STRUCTURE_MEMBERS(structure),
|
|
178
|
+
content: tabVisibility?.roles
|
|
179
|
+
? formatMessage({ id: "tabs.dd.roles" })
|
|
180
|
+
: false,
|
|
181
|
+
key: "roles",
|
|
182
|
+
},
|
|
183
|
+
...customTabsItems,
|
|
184
|
+
])
|
|
152
185
|
: null;
|
|
153
186
|
|
|
154
187
|
structureTabsOrder
|
|
155
188
|
? items.sort((a, b) => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
189
|
+
const aIndex = _.indexOf(a.key)(structureTabsOrder);
|
|
190
|
+
const bIndex = _.indexOf(b.key)(structureTabsOrder);
|
|
191
|
+
if (aIndex !== -1 && bIndex !== -1) {
|
|
192
|
+
return aIndex - bIndex;
|
|
193
|
+
}
|
|
194
|
+
if (aIndex !== -1) {
|
|
195
|
+
return -1;
|
|
196
|
+
}
|
|
197
|
+
if (bIndex !== -1) {
|
|
198
|
+
return 1;
|
|
199
|
+
}
|
|
200
|
+
return 0;
|
|
201
|
+
})
|
|
169
202
|
: items;
|
|
170
203
|
|
|
171
204
|
return (
|
|
@@ -183,6 +216,6 @@ export const StructureTabs = ({ path }) => {
|
|
|
183
216
|
);
|
|
184
217
|
};
|
|
185
218
|
|
|
186
|
-
StructureTabs.propTypes = { path: PropTypes.string
|
|
219
|
+
StructureTabs.propTypes = { path: PropTypes.string };
|
|
187
220
|
|
|
188
221
|
export default StructureTabs;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clearStructure,
|
|
1
|
+
import { clearStructure, fetchStructure } from "../../routines";
|
|
2
2
|
import { childrenRelations, parentRelations } from "..";
|
|
3
3
|
|
|
4
4
|
const fooState = { foo: "bar" };
|
|
@@ -6,36 +6,36 @@ const fooState = { foo: "bar" };
|
|
|
6
6
|
const relation_type = {
|
|
7
7
|
description: "relation type 1",
|
|
8
8
|
id: 1,
|
|
9
|
-
name: "used_by"
|
|
9
|
+
name: "used_by",
|
|
10
10
|
};
|
|
11
11
|
const children = [
|
|
12
12
|
{
|
|
13
13
|
id: 1,
|
|
14
14
|
relation_type,
|
|
15
|
-
structure: { id: 1, name: "Structure 1", type: "Some Type 1" }
|
|
15
|
+
structure: { id: 1, name: "Structure 1", type: "Some Type 1" },
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
id: 2,
|
|
19
19
|
relation_type,
|
|
20
|
-
structure: { id: 1, name: "Structure 2", type: "Some Type 2" }
|
|
21
|
-
}
|
|
20
|
+
structure: { id: 1, name: "Structure 2", type: "Some Type 2" },
|
|
21
|
+
},
|
|
22
22
|
];
|
|
23
23
|
|
|
24
24
|
const parents = [
|
|
25
25
|
{
|
|
26
26
|
id: 1,
|
|
27
27
|
relation_type,
|
|
28
|
-
structure: { id: 1, name: "Structure 3", type: "Some Type 3" }
|
|
28
|
+
structure: { id: 1, name: "Structure 3", type: "Some Type 3" },
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
id: 2,
|
|
32
32
|
relation_type,
|
|
33
|
-
structure: { id: 1, name: "Structure 4", type: "Some Type 4" }
|
|
34
|
-
}
|
|
33
|
+
structure: { id: 1, name: "Structure 4", type: "Some Type 4" },
|
|
34
|
+
},
|
|
35
35
|
];
|
|
36
36
|
|
|
37
37
|
const data = {
|
|
38
|
-
relations: { children, parents }
|
|
38
|
+
relations: { children, parents },
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
describe("reducers: childrenRelations", () => {
|
|
@@ -48,8 +48,8 @@ describe("reducers: childrenRelations", () => {
|
|
|
48
48
|
it("should handle the fetchStructures.SUCCESS action", () => {
|
|
49
49
|
expect(
|
|
50
50
|
childrenRelations(fooState, {
|
|
51
|
-
type:
|
|
52
|
-
payload: { data }
|
|
51
|
+
type: fetchStructure.SUCCESS,
|
|
52
|
+
payload: { data },
|
|
53
53
|
})
|
|
54
54
|
).toMatchObject(children);
|
|
55
55
|
});
|
|
@@ -57,7 +57,7 @@ describe("reducers: childrenRelations", () => {
|
|
|
57
57
|
it("should handle the clearStructure.TRIGGER action", () => {
|
|
58
58
|
expect(
|
|
59
59
|
childrenRelations(fooState, {
|
|
60
|
-
type: clearStructure.TRIGGER
|
|
60
|
+
type: clearStructure.TRIGGER,
|
|
61
61
|
})
|
|
62
62
|
).toMatchObject([]);
|
|
63
63
|
});
|
|
@@ -77,8 +77,8 @@ describe("reducers: parentRelations", () => {
|
|
|
77
77
|
it("should handle the fetchStructures.SUCCESS action", () => {
|
|
78
78
|
expect(
|
|
79
79
|
parentRelations(fooState, {
|
|
80
|
-
type:
|
|
81
|
-
payload: { data }
|
|
80
|
+
type: fetchStructure.SUCCESS,
|
|
81
|
+
payload: { data },
|
|
82
82
|
})
|
|
83
83
|
).toMatchObject(parents);
|
|
84
84
|
});
|
|
@@ -86,7 +86,7 @@ describe("reducers: parentRelations", () => {
|
|
|
86
86
|
it("should handle the clearStructure.TRIGGER action", () => {
|
|
87
87
|
expect(
|
|
88
88
|
childrenRelations(fooState, {
|
|
89
|
-
type: clearStructure.TRIGGER
|
|
89
|
+
type: clearStructure.TRIGGER,
|
|
90
90
|
})
|
|
91
91
|
).toMatchObject([]);
|
|
92
92
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import { clearStructure,
|
|
2
|
+
import { clearStructure, fetchStructure } from "../routines";
|
|
3
3
|
|
|
4
4
|
export const initialState = [];
|
|
5
5
|
|
|
@@ -7,9 +7,9 @@ export const childrenRelations = (state = initialState, { type, payload }) => {
|
|
|
7
7
|
switch (type) {
|
|
8
8
|
case clearStructure.TRIGGER:
|
|
9
9
|
return initialState;
|
|
10
|
-
case
|
|
10
|
+
case fetchStructure.TRIGGER:
|
|
11
11
|
return initialState;
|
|
12
|
-
case
|
|
12
|
+
case fetchStructure.SUCCESS:
|
|
13
13
|
return _.pathOr([], "data.relations.children")(payload);
|
|
14
14
|
default:
|
|
15
15
|
return state;
|
|
@@ -20,7 +20,7 @@ export const parentRelations = (state = initialState, { type, payload }) => {
|
|
|
20
20
|
switch (type) {
|
|
21
21
|
case clearStructure.TRIGGER:
|
|
22
22
|
return initialState;
|
|
23
|
-
case
|
|
23
|
+
case fetchStructure.SUCCESS:
|
|
24
24
|
return _.pathOr([], "data.relations.parents")(payload);
|
|
25
25
|
default:
|
|
26
26
|
return state;
|
package/src/routines.js
CHANGED
|
@@ -90,8 +90,6 @@ export const fetchProfileExecution = createRoutine("FETCH_EXECUTION_PROFILE");
|
|
|
90
90
|
export const fetchProfileGroup = createRoutine("FETCH_PROFILE_GROUP");
|
|
91
91
|
export const fetchStructure = createRoutine("FETCH_STRUCTURE");
|
|
92
92
|
export const legacyFetchStructure = createRoutine("LEGACY_FETCH_STRUCTURE");
|
|
93
|
-
export const fetchStructureParents = createRoutine("FETCH_STRUCTURE_PARENTS");
|
|
94
|
-
export const fetchStructureChildrens = createRoutine("FETCH_STRUCTURE_CHILDREN");
|
|
95
93
|
export const fetchStructureVersions = createRoutine("FETCH_STRUCTURE_VERSIONS");
|
|
96
94
|
export const fetchStructureGraph = createRoutine("FETCH_STRUCTURE_GRAPH");
|
|
97
95
|
export const fetchStructureNotes = createRoutine("FETCH_STRUCTURE_NOTES");
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
|
-
import { call, put, takeLatest, select, getContext } from "redux-saga/effects";
|
|
3
|
-
import { fetchStructureChildrens } from "../routines";
|
|
4
|
-
import { DATA_STRUCTURE_CHILDREN_QUERY } from "../api/queries";
|
|
5
|
-
import { getStructureFieldColumns } from "../selectors";
|
|
6
|
-
|
|
7
|
-
export function* fetchStructureChildrenSaga({ payload }) {
|
|
8
|
-
try {
|
|
9
|
-
const client = yield getContext("client");
|
|
10
|
-
|
|
11
|
-
yield put(fetchStructureChildrens.request());
|
|
12
|
-
|
|
13
|
-
const { id, version = "latest" } = payload;
|
|
14
|
-
const {
|
|
15
|
-
data: { dataStructureVersion },
|
|
16
|
-
} = yield call(client.query, {
|
|
17
|
-
fetchPolicy: "network-only",
|
|
18
|
-
query: DATA_STRUCTURE_CHILDREN_QUERY,
|
|
19
|
-
variables: {
|
|
20
|
-
dataStructureId: id,
|
|
21
|
-
version,
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const data = {
|
|
26
|
-
data: dataStructureVersion,
|
|
27
|
-
_actions: dataStructureVersion._actions,
|
|
28
|
-
user_permissions: dataStructureVersion.user_permissions,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const meta = { version };
|
|
32
|
-
|
|
33
|
-
yield put({ meta, ...fetchStructureChildrens.success(data) });
|
|
34
|
-
} catch (error) {
|
|
35
|
-
if (error.response) {
|
|
36
|
-
const { status, data } = error.response;
|
|
37
|
-
yield put(fetchStructureChildrens.failure({ status, data }));
|
|
38
|
-
} else {
|
|
39
|
-
yield put(fetchStructureChildrens.failure(error.message));
|
|
40
|
-
}
|
|
41
|
-
} finally {
|
|
42
|
-
yield put(fetchStructureChildrens.fulfill());
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function* fetchStructureChildrensRequestSaga() {
|
|
47
|
-
yield takeLatest(fetchStructureChildrens.TRIGGER, fetchStructureChildrensSaga);
|
|
48
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
|
-
import { call, put, takeLatest, select, getContext } from "redux-saga/effects";
|
|
3
|
-
import { fetchStructureParents } from "../routines";
|
|
4
|
-
import { DATA_STRUCTURE_PARENTS_QUERY } from "../api/queries";
|
|
5
|
-
import { getStructureFieldColumns } from "../selectors";
|
|
6
|
-
|
|
7
|
-
export function* fetchStructureParentsSaga({ payload }) {
|
|
8
|
-
try {
|
|
9
|
-
const client = yield getContext("client");
|
|
10
|
-
|
|
11
|
-
yield put(fetchStructureParents.request());
|
|
12
|
-
|
|
13
|
-
const { id, version = "latest" } = payload;
|
|
14
|
-
const {
|
|
15
|
-
data: { dataStructureVersion },
|
|
16
|
-
} = yield call(client.query, {
|
|
17
|
-
fetchPolicy: "network-only",
|
|
18
|
-
query: DATA_STRUCTURE_PARENTS_QUERY,
|
|
19
|
-
variables: {
|
|
20
|
-
dataStructureId: id,
|
|
21
|
-
version,
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const data = {
|
|
26
|
-
data: dataStructureVersion,
|
|
27
|
-
_actions: dataStructureVersion._actions,
|
|
28
|
-
user_permissions: dataStructureVersion.user_permissions,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const meta = { version };
|
|
32
|
-
|
|
33
|
-
yield put({ meta, ...fetchStructureParents.success(data) });
|
|
34
|
-
} catch (error) {
|
|
35
|
-
if (error.response) {
|
|
36
|
-
const { status, data } = error.response;
|
|
37
|
-
yield put(fetchStructureParents.failure({ status, data }));
|
|
38
|
-
} else {
|
|
39
|
-
yield put(fetchStructureParents.failure(error.message));
|
|
40
|
-
}
|
|
41
|
-
} finally {
|
|
42
|
-
yield put(fetchStructureParents.fulfill());
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function* fetchStructureParentsRequestSaga() {
|
|
47
|
-
yield takeLatest(fetchStructureParents.TRIGGER, fetchStructureParentsSaga);
|
|
48
|
-
}
|