@truedat/core 5.9.4 → 5.9.6
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/CatalogMenu.js +21 -24
- package/src/components/__tests__/CatalogMenu.spec.js +4 -1
- package/src/components/__tests__/__snapshots__/CatalogMenu.spec.js.snap +18 -18
- package/src/components/__tests__/__snapshots__/SideMenu.spec.js.snap +0 -3
- package/src/messages/en.js +2 -2
- package/src/messages/es.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/core",
|
|
3
|
-
"version": "5.9.
|
|
3
|
+
"version": "5.9.6",
|
|
4
4
|
"description": "Truedat Web Core",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@testing-library/jest-dom": "^5.16.5",
|
|
36
36
|
"@testing-library/react": "^12.0.0",
|
|
37
37
|
"@testing-library/user-event": "^13.2.1",
|
|
38
|
-
"@truedat/test": "5.9.
|
|
38
|
+
"@truedat/test": "5.9.6",
|
|
39
39
|
"babel-jest": "^28.1.0",
|
|
40
40
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
41
41
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"react-dom": ">= 16.8.6 < 17",
|
|
118
118
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "9f323fd84b59cac49e60b9cf0e441efc192465de"
|
|
121
121
|
}
|
|
@@ -4,6 +4,7 @@ import React from "react";
|
|
|
4
4
|
import { useQuery } from "@apollo/client";
|
|
5
5
|
import { CATALOG_VIEW_CONFIGS_QUERY } from "@truedat/dd/api/queries";
|
|
6
6
|
import { linkTo } from "@truedat/core/routes";
|
|
7
|
+
import { useIntl } from "react-intl";
|
|
7
8
|
import { useAuthorized } from "../hooks";
|
|
8
9
|
import {
|
|
9
10
|
BUCKET_VIEW_CONFIGS,
|
|
@@ -18,16 +19,10 @@ import {
|
|
|
18
19
|
import { Loading } from "./Loading";
|
|
19
20
|
import Submenu from "./Submenu";
|
|
20
21
|
|
|
21
|
-
const items = [
|
|
22
|
-
{ name: "structures", routes: [STRUCTURES, SYSTEMS], beforeRest: true },
|
|
23
|
-
{ name: "referenceData", routes: [REFERENCE_DATASETS] },
|
|
24
|
-
];
|
|
25
|
-
|
|
26
22
|
const adminItems = [
|
|
27
23
|
{
|
|
28
24
|
name: "catalogViewConfigs",
|
|
29
25
|
routes: [BUCKET_VIEW_CONFIGS],
|
|
30
|
-
beforeRest: true,
|
|
31
26
|
},
|
|
32
27
|
{ name: "structureTypes", routes: [STRUCTURE_TYPES] },
|
|
33
28
|
{ name: "structureTags", routes: [STRUCTURE_TAGS] },
|
|
@@ -38,32 +33,31 @@ const structureNoteItems = [
|
|
|
38
33
|
{ name: "structures_upload_events", routes: [STRUCTURES_UPLOAD_EVENTS] },
|
|
39
34
|
];
|
|
40
35
|
|
|
41
|
-
const catalogViewConfigItems =
|
|
42
|
-
_.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
);
|
|
36
|
+
const catalogViewConfigItems = (formatMessage) =>
|
|
37
|
+
_.flow(
|
|
38
|
+
_.map(({ fieldType, fieldName }) => ({
|
|
39
|
+
name: formatMessage({ id: `${fieldType}.${fieldName}` }),
|
|
40
|
+
routes: [
|
|
41
|
+
linkTo.BUCKETS_VIEW({ propertyPath: `${fieldType}.${fieldName}` }),
|
|
42
|
+
],
|
|
43
|
+
})),
|
|
44
|
+
_.orderBy(["name"], ["asc"])
|
|
45
|
+
);
|
|
51
46
|
|
|
52
47
|
export const CatalogMenu = ({ catalogViewConfigs }) => {
|
|
53
48
|
const adminAuthorized = useAuthorized();
|
|
54
49
|
const structureNotesAuthorized = useAuthorized(
|
|
55
50
|
"data_dictionary_structure_notes"
|
|
56
51
|
);
|
|
52
|
+
const { formatMessage } = useIntl();
|
|
57
53
|
|
|
58
|
-
const submenuItems =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
...items,
|
|
63
|
-
...catalogViewConfigItems(catalogViewConfigs),
|
|
64
|
-
...(adminAuthorized ? adminItems : []),
|
|
54
|
+
const submenuItems = [
|
|
55
|
+
{ name: "structures", routes: [STRUCTURES, SYSTEMS] },
|
|
56
|
+
...catalogViewConfigItems(formatMessage)(catalogViewConfigs),
|
|
57
|
+
{ name: "referenceData", routes: [REFERENCE_DATASETS] },
|
|
65
58
|
...(structureNotesAuthorized ? structureNoteItems : []),
|
|
66
|
-
|
|
59
|
+
...(adminAuthorized ? adminItems : []),
|
|
60
|
+
];
|
|
67
61
|
|
|
68
62
|
const authorized = useAuthorized("data_dictionary");
|
|
69
63
|
return authorized ? (
|
|
@@ -76,9 +70,12 @@ CatalogMenu.propTypes = {
|
|
|
76
70
|
};
|
|
77
71
|
|
|
78
72
|
export const CatalogMenuLoader = (props) => {
|
|
73
|
+
const adminAuthorized = useAuthorized();
|
|
79
74
|
const { loading, error, data } = useQuery(CATALOG_VIEW_CONFIGS_QUERY, {
|
|
80
75
|
fetchPolicy: "cache-and-network",
|
|
76
|
+
skip: !adminAuthorized,
|
|
81
77
|
});
|
|
78
|
+
|
|
82
79
|
if (error) return null;
|
|
83
80
|
if (loading) return <Loading />;
|
|
84
81
|
const configs = data?.catalogViewConfigs || [];
|
|
@@ -45,79 +45,79 @@ exports[`<CatalogMenu /> matches the latest snapshot 1`] = `
|
|
|
45
45
|
<a
|
|
46
46
|
aria-checked="false"
|
|
47
47
|
class="item"
|
|
48
|
-
href="/
|
|
49
|
-
name="
|
|
48
|
+
href="/referenceDatasets"
|
|
49
|
+
name="referenceData"
|
|
50
50
|
role="option"
|
|
51
51
|
>
|
|
52
52
|
<span
|
|
53
53
|
class="text"
|
|
54
54
|
>
|
|
55
|
-
|
|
55
|
+
referenceData
|
|
56
56
|
</span>
|
|
57
57
|
</a>
|
|
58
58
|
<a
|
|
59
59
|
aria-checked="false"
|
|
60
60
|
class="item"
|
|
61
|
-
href="/
|
|
62
|
-
name="
|
|
61
|
+
href="/structureNotes"
|
|
62
|
+
name="pending_structure_notes"
|
|
63
63
|
role="option"
|
|
64
64
|
>
|
|
65
65
|
<span
|
|
66
66
|
class="text"
|
|
67
67
|
>
|
|
68
|
-
|
|
68
|
+
pending_structure_notes
|
|
69
69
|
</span>
|
|
70
70
|
</a>
|
|
71
71
|
<a
|
|
72
72
|
aria-checked="false"
|
|
73
73
|
class="item"
|
|
74
|
-
href="/
|
|
75
|
-
name="
|
|
74
|
+
href="/bulkUpdateTemplateContentEvents"
|
|
75
|
+
name="structures_upload_events"
|
|
76
76
|
role="option"
|
|
77
77
|
>
|
|
78
78
|
<span
|
|
79
79
|
class="text"
|
|
80
80
|
>
|
|
81
|
-
|
|
81
|
+
structures_upload_events
|
|
82
82
|
</span>
|
|
83
83
|
</a>
|
|
84
84
|
<a
|
|
85
85
|
aria-checked="false"
|
|
86
86
|
class="item"
|
|
87
|
-
href="/
|
|
88
|
-
name="
|
|
87
|
+
href="/bucketViewConfigs"
|
|
88
|
+
name="catalogViewConfigs"
|
|
89
89
|
role="option"
|
|
90
90
|
>
|
|
91
91
|
<span
|
|
92
92
|
class="text"
|
|
93
93
|
>
|
|
94
|
-
|
|
94
|
+
catalogViewConfigs
|
|
95
95
|
</span>
|
|
96
96
|
</a>
|
|
97
97
|
<a
|
|
98
98
|
aria-checked="false"
|
|
99
99
|
class="item"
|
|
100
|
-
href="/
|
|
101
|
-
name="
|
|
100
|
+
href="/structureTypes"
|
|
101
|
+
name="structureTypes"
|
|
102
102
|
role="option"
|
|
103
103
|
>
|
|
104
104
|
<span
|
|
105
105
|
class="text"
|
|
106
106
|
>
|
|
107
|
-
|
|
107
|
+
structureTypes
|
|
108
108
|
</span>
|
|
109
109
|
</a>
|
|
110
110
|
<a
|
|
111
111
|
aria-checked="false"
|
|
112
112
|
class="item"
|
|
113
|
-
href="/
|
|
114
|
-
name="
|
|
113
|
+
href="/structureTags"
|
|
114
|
+
name="structureTags"
|
|
115
115
|
role="option"
|
|
116
116
|
>
|
|
117
117
|
<span
|
|
118
118
|
class="text"
|
|
119
119
|
>
|
|
120
|
-
|
|
120
|
+
structureTags
|
|
121
121
|
</span>
|
|
122
122
|
</a>
|
|
123
123
|
</div>
|
package/src/messages/en.js
CHANGED
|
@@ -76,7 +76,7 @@ export default {
|
|
|
76
76
|
"i18n.messages.locale.es": "Spanish",
|
|
77
77
|
"i18n.messages.locale.en": "English",
|
|
78
78
|
"i18n.messages.search.placeholder": "Search messages",
|
|
79
|
-
missingBucket: "(
|
|
79
|
+
missingBucket: "(Unclassified)",
|
|
80
80
|
"navigation.dashboard": "Dashboard",
|
|
81
81
|
"navigation.menu": "Menu",
|
|
82
82
|
"search.applied_filters": "Filters:",
|
|
@@ -103,7 +103,7 @@ export default {
|
|
|
103
103
|
"validation.header.message.error": "Could you check something!",
|
|
104
104
|
"sidemenu.admin": "Administration",
|
|
105
105
|
"sidemenu.catalog": "Catalog",
|
|
106
|
-
"sidemenu.catalogViewConfigs": "
|
|
106
|
+
"sidemenu.catalogViewConfigs": "Catalog views",
|
|
107
107
|
"sidemenu.concepts_links_management": "Links manager",
|
|
108
108
|
"sidemenu.concepts_management": "Drafts",
|
|
109
109
|
"sidemenu.concepts": "Glossary",
|
package/src/messages/es.js
CHANGED
|
@@ -78,7 +78,7 @@ export default {
|
|
|
78
78
|
"i18n.messages.search.placeholder": "Buscar mensajes",
|
|
79
79
|
|
|
80
80
|
loading: "cargando...",
|
|
81
|
-
missingBucket: "(Sin
|
|
81
|
+
missingBucket: "(Sin clasificar)",
|
|
82
82
|
"navigation.dashboard": "Dashboard",
|
|
83
83
|
"navigation.menu": "Menú",
|
|
84
84
|
"search.applied_filters": "Filtros aplicados:",
|
|
@@ -107,7 +107,7 @@ export default {
|
|
|
107
107
|
"validation.header.message.error": "Faltan campos por rellenar!",
|
|
108
108
|
"sidemenu.admin": "Administración",
|
|
109
109
|
"sidemenu.catalog": "Catálogo",
|
|
110
|
-
"sidemenu.catalogViewConfigs": "
|
|
110
|
+
"sidemenu.catalogViewConfigs": "Vistas de catálogo",
|
|
111
111
|
"sidemenu.concepts_links_management": "Gestión de vínculos",
|
|
112
112
|
"sidemenu.concepts_management": "Borradores",
|
|
113
113
|
"sidemenu.concepts": "Glosario",
|