@truedat/core 5.9.3 → 5.9.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "5.9.3",
3
+ "version": "5.9.5",
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.3",
38
+ "@truedat/test": "5.9.5",
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": "703abeeedf1ca0f6ecbc09c9633178e9dcd83e20"
120
+ "gitHead": "e5921f6b5e5a2142ac6be90ad269d5e1fecb1e2c"
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 = _.flow(
42
- _.map(({ fieldType, fieldName }) => ({
43
- name: `${fieldType}.${fieldName}`,
44
- routes: [
45
- linkTo.BUCKETS_VIEW({ propertyPath: `${fieldType}.${fieldName}` }),
46
- ],
47
- beforeRest: true,
48
- })),
49
- _.orderBy(["name"], ["asc"])
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 = _.flow(
59
- _.partition({ beforeRest: true }),
60
- _.flatten
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 || [];
@@ -13,7 +13,10 @@ jest.mock("../../hooks", () => ({
13
13
 
14
14
  const commonRenderOpts = {
15
15
  messages: {
16
- en: {},
16
+ en: {
17
+ "metadata.region": "metadata.region",
18
+ "note.layer": "note.layer",
19
+ },
17
20
  },
18
21
  };
19
22
 
@@ -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="/bucketViewConfigs"
49
- name="catalogViewConfigs"
48
+ href="/referenceDatasets"
49
+ name="referenceData"
50
50
  role="option"
51
51
  >
52
52
  <span
53
53
  class="text"
54
54
  >
55
- catalogViewConfigs
55
+ referenceData
56
56
  </span>
57
57
  </a>
58
58
  <a
59
59
  aria-checked="false"
60
60
  class="item"
61
- href="/referenceDatasets"
62
- name="referenceData"
61
+ href="/structureNotes"
62
+ name="pending_structure_notes"
63
63
  role="option"
64
64
  >
65
65
  <span
66
66
  class="text"
67
67
  >
68
- referenceData
68
+ pending_structure_notes
69
69
  </span>
70
70
  </a>
71
71
  <a
72
72
  aria-checked="false"
73
73
  class="item"
74
- href="/structureTypes"
75
- name="structureTypes"
74
+ href="/bulkUpdateTemplateContentEvents"
75
+ name="structures_upload_events"
76
76
  role="option"
77
77
  >
78
78
  <span
79
79
  class="text"
80
80
  >
81
- structureTypes
81
+ structures_upload_events
82
82
  </span>
83
83
  </a>
84
84
  <a
85
85
  aria-checked="false"
86
86
  class="item"
87
- href="/structureTags"
88
- name="structureTags"
87
+ href="/bucketViewConfigs"
88
+ name="catalogViewConfigs"
89
89
  role="option"
90
90
  >
91
91
  <span
92
92
  class="text"
93
93
  >
94
- structureTags
94
+ catalogViewConfigs
95
95
  </span>
96
96
  </a>
97
97
  <a
98
98
  aria-checked="false"
99
99
  class="item"
100
- href="/structureNotes"
101
- name="pending_structure_notes"
100
+ href="/structureTypes"
101
+ name="structureTypes"
102
102
  role="option"
103
103
  >
104
104
  <span
105
105
  class="text"
106
106
  >
107
- pending_structure_notes
107
+ structureTypes
108
108
  </span>
109
109
  </a>
110
110
  <a
111
111
  aria-checked="false"
112
112
  class="item"
113
- href="/bulkUpdateTemplateContentEvents"
114
- name="structures_upload_events"
113
+ href="/structureTags"
114
+ name="structureTags"
115
115
  role="option"
116
116
  >
117
117
  <span
118
118
  class="text"
119
119
  >
120
- structures_upload_events
120
+ structureTags
121
121
  </span>
122
122
  </a>
123
123
  </div>
@@ -44,9 +44,6 @@ exports[`<SideMenu /> matches the latest snapshot 1`] = `
44
44
  </div>
45
45
  </div>
46
46
  </div>
47
- <div
48
- class="ui active loader"
49
- />
50
47
  <a
51
48
  class="item bottom"
52
49
  >
@@ -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: "(Missing selected bucket)",
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": "Bucket view config",
106
+ "sidemenu.catalogViewConfigs": "Catalog views",
107
107
  "sidemenu.concepts_links_management": "Links manager",
108
108
  "sidemenu.concepts_management": "Drafts",
109
109
  "sidemenu.concepts": "Glossary",
@@ -78,7 +78,7 @@ export default {
78
78
  "i18n.messages.search.placeholder": "Buscar mensajes",
79
79
 
80
80
  loading: "cargando...",
81
- missingBucket: "(Sin bucket seleccionado)",
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": "Config vistas bucket",
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",