@truedat/dd 4.33.2 → 4.33.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +6 -6
- package/src/api.js +2 -0
- package/src/components/DictionaryRoutes.js +21 -3
- package/src/components/StructureTypesLoader.js +4 -2
- package/src/sagas/fetchStructureTypes.js +5 -3
- package/src/selectors/__tests__/getTabVisibility.spec.js +3 -6
- package/src/selectors/getTabVisibility.js +3 -12
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "4.33.
|
|
3
|
+
"version": "4.33.3",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.14.1",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.33.
|
|
37
|
+
"@truedat/test": "4.33.3",
|
|
38
38
|
"babel-jest": "^27.0.6",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@truedat/auth": "4.33.
|
|
88
|
-
"@truedat/core": "4.33.
|
|
89
|
-
"@truedat/df": "4.33.
|
|
87
|
+
"@truedat/auth": "4.33.3",
|
|
88
|
+
"@truedat/core": "4.33.3",
|
|
89
|
+
"@truedat/df": "4.33.3",
|
|
90
90
|
"lodash": "^4.17.21",
|
|
91
91
|
"path-to-regexp": "^1.7.0",
|
|
92
92
|
"prop-types": "^15.7.2",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"react-dom": ">= 16.8.6 < 17",
|
|
108
108
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "4423c4077cf22e7d21d2679670287ed3d86ec8d7"
|
|
111
111
|
}
|
package/src/api.js
CHANGED
|
@@ -29,6 +29,7 @@ const API_STRUCTURE_TAG = "/api/data_structure_tags/:id";
|
|
|
29
29
|
const API_STRUCTURE_TAGS = "/api/data_structure_tags";
|
|
30
30
|
const API_STRUCTURE_TYPE = "/api/data_structure_types/:id";
|
|
31
31
|
const API_STRUCTURE_TYPES = "/api/data_structure_types";
|
|
32
|
+
const API_STRUCTURE_TYPES_LITE = "/api/data_structure_types/lite";
|
|
32
33
|
const API_STRUCTURES_TAG = "/api/data_structures/:data_structure_id/tags/:id";
|
|
33
34
|
const API_STRUCTURES_TAGS = "/api/data_structures/:data_structure_id/tags";
|
|
34
35
|
const API_STRUCTURE_USER_FILTERS = "/api/data_structure_user_filters";
|
|
@@ -73,6 +74,7 @@ export {
|
|
|
73
74
|
API_STRUCTURE_TAGS,
|
|
74
75
|
API_STRUCTURE_TYPE,
|
|
75
76
|
API_STRUCTURE_TYPES,
|
|
77
|
+
API_STRUCTURE_TYPES_LITE,
|
|
76
78
|
API_STRUCTURE_USER_FILTERS,
|
|
77
79
|
API_STRUCTURE_USER_FILTER,
|
|
78
80
|
API_STRUCTURES_TAG,
|
|
@@ -30,7 +30,6 @@ const TemplatesLoader = React.lazy(() =>
|
|
|
30
30
|
const Loaders = () => (
|
|
31
31
|
<>
|
|
32
32
|
<StructuresLoader />
|
|
33
|
-
<StructureTypesLoader />
|
|
34
33
|
<StructureFiltersLoader />
|
|
35
34
|
<TemplatesLoader scope="dd" />
|
|
36
35
|
</>
|
|
@@ -49,6 +48,7 @@ export const DictionaryRoutes = () => {
|
|
|
49
48
|
path={STRUCTURES}
|
|
50
49
|
render={() => (
|
|
51
50
|
<>
|
|
51
|
+
<StructureTypesLoader liteRequest={true} />
|
|
52
52
|
<SystemsLoader />
|
|
53
53
|
<StructuresRoutes />
|
|
54
54
|
</>
|
|
@@ -58,17 +58,35 @@ export const DictionaryRoutes = () => {
|
|
|
58
58
|
path={SYSTEMS}
|
|
59
59
|
render={() => (
|
|
60
60
|
<>
|
|
61
|
+
<StructureTypesLoader liteRequest={true} />
|
|
61
62
|
<SystemsLoader />
|
|
62
63
|
<SystemsRoutes />
|
|
63
64
|
</>
|
|
64
65
|
)}
|
|
65
66
|
/>
|
|
66
|
-
<Route
|
|
67
|
-
|
|
67
|
+
<Route
|
|
68
|
+
path={STRUCTURE_TAGS}
|
|
69
|
+
render={() => (
|
|
70
|
+
<>
|
|
71
|
+
<StructureTypesLoader liteRequest={true} />
|
|
72
|
+
<StructureTagsRoutes />
|
|
73
|
+
</>
|
|
74
|
+
)}
|
|
75
|
+
/>
|
|
76
|
+
<Route
|
|
77
|
+
path={STRUCTURE_TYPES}
|
|
78
|
+
render={() => (
|
|
79
|
+
<>
|
|
80
|
+
<StructureTypesLoader />
|
|
81
|
+
<StructureTypesRoutes />
|
|
82
|
+
</>
|
|
83
|
+
)}
|
|
84
|
+
/>
|
|
68
85
|
<Route
|
|
69
86
|
path={PROFILE_GROUP}
|
|
70
87
|
render={() => (
|
|
71
88
|
<>
|
|
89
|
+
<StructureTypesLoader liteRequest={true} />
|
|
72
90
|
<Route render={() => <ProfileGroupLoader />} />
|
|
73
91
|
<Switch>
|
|
74
92
|
<Route
|
|
@@ -6,19 +6,21 @@ import { clearStructureTypes, fetchStructureTypes } from "../routines";
|
|
|
6
6
|
export const StructureTypesLoader = ({
|
|
7
7
|
clearStructureTypes,
|
|
8
8
|
fetchStructureTypes,
|
|
9
|
+
liteRequest = false,
|
|
9
10
|
}) => {
|
|
10
11
|
useEffect(() => {
|
|
11
|
-
fetchStructureTypes();
|
|
12
|
+
fetchStructureTypes({ liteRequest });
|
|
12
13
|
return () => {
|
|
13
14
|
clearStructureTypes();
|
|
14
15
|
};
|
|
15
|
-
}, [clearStructureTypes, fetchStructureTypes]);
|
|
16
|
+
}, [clearStructureTypes, fetchStructureTypes, liteRequest]);
|
|
16
17
|
return null;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
StructureTypesLoader.propTypes = {
|
|
20
21
|
clearStructureTypes: PropTypes.func,
|
|
21
22
|
fetchStructureTypes: PropTypes.func,
|
|
23
|
+
liteRequest: PropTypes.bool,
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
export default connect(null, { clearStructureTypes, fetchStructureTypes })(
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { call, put, takeLatest } from "redux-saga/effects";
|
|
2
2
|
import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
|
|
3
3
|
import { fetchStructureTypes } from "../routines";
|
|
4
|
-
import { API_STRUCTURE_TYPES } from "../api";
|
|
4
|
+
import { API_STRUCTURE_TYPES, API_STRUCTURE_TYPES_LITE } from "../api";
|
|
5
5
|
|
|
6
|
-
export function* fetchStructureTypesSaga() {
|
|
6
|
+
export function* fetchStructureTypesSaga({ payload }) {
|
|
7
7
|
try {
|
|
8
|
+
const { liteRequest } = payload;
|
|
8
9
|
yield put(fetchStructureTypes.request());
|
|
9
|
-
const
|
|
10
|
+
const url = liteRequest ? API_STRUCTURE_TYPES_LITE : API_STRUCTURE_TYPES;
|
|
11
|
+
const { data } = yield call(apiJson, url, JSON_OPTS);
|
|
10
12
|
yield put(fetchStructureTypes.success(data));
|
|
11
13
|
} catch (error) {
|
|
12
14
|
if (error.response) {
|
|
@@ -83,10 +83,9 @@ describe("selectors: getTabVisibility", () => {
|
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
it("should include notes if
|
|
87
|
-
const structure = { type: "foo" };
|
|
88
|
-
const templates = [{ name: "foo" }];
|
|
89
|
-
const structureTypes = [{ name: "foo", template: { id: 1, name: "n" } }];
|
|
86
|
+
it("should include notes if template_id is in structure_note", () => {
|
|
87
|
+
const structure = { type: "foo", data_structure_type: { template_id: 1 } };
|
|
88
|
+
const templates = [{ name: "foo", id: 1 }];
|
|
90
89
|
expect(getTabVisibility({ templatesLoading: true })).toMatchObject({
|
|
91
90
|
notes: false,
|
|
92
91
|
});
|
|
@@ -94,8 +93,6 @@ describe("selectors: getTabVisibility", () => {
|
|
|
94
93
|
getTabVisibility({
|
|
95
94
|
structure,
|
|
96
95
|
templates,
|
|
97
|
-
structureTypes,
|
|
98
|
-
structureTypesLoading: false,
|
|
99
96
|
})
|
|
100
97
|
).toMatchObject({
|
|
101
98
|
notes: true,
|
|
@@ -24,25 +24,16 @@ const linksTabVisible = (state) => {
|
|
|
24
24
|
return conceptCount > 0 || !_.isEmpty(structureLinks);
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const notesTabVisible = ({
|
|
28
|
-
templatesLoading,
|
|
29
|
-
templates,
|
|
30
|
-
structure,
|
|
31
|
-
structureTypes,
|
|
32
|
-
structureTypesLoading,
|
|
33
|
-
}) =>
|
|
27
|
+
const notesTabVisible = ({ templatesLoading, templates, structure }) =>
|
|
34
28
|
!templatesLoading &&
|
|
35
29
|
notEmpty(templates) &&
|
|
36
30
|
_.has("type")(structure) &&
|
|
37
|
-
!structureTypesLoading &&
|
|
38
|
-
notEmpty(structureTypes) &&
|
|
39
31
|
_.flow(
|
|
40
32
|
_.find({
|
|
41
|
-
|
|
33
|
+
id: _.propOr(null, "data_structure_type.template_id")(structure),
|
|
42
34
|
}),
|
|
43
|
-
_.get("template"),
|
|
44
35
|
_.negate(_.isNil)
|
|
45
|
-
)(
|
|
36
|
+
)(templates);
|
|
46
37
|
|
|
47
38
|
const versionsTabVisible = notEmptyPath("structureVersions");
|
|
48
39
|
const rulesTabVisible = notEmptyPath("ruleImplementations");
|