@truedat/bg 7.5.11 → 7.5.13

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/bg",
3
- "version": "7.5.11",
3
+ "version": "7.5.13",
4
4
  "description": "Truedat Web Business Glossary",
5
5
  "sideEffects": false,
6
6
  "module": "src/index.js",
@@ -46,34 +46,34 @@
46
46
  "devDependencies": {
47
47
  "@testing-library/dom": "^10.4.0",
48
48
  "@testing-library/jest-dom": "^6.6.3",
49
- "@testing-library/react": "^16.2.0",
49
+ "@testing-library/react": "^16.3.0",
50
50
  "@testing-library/user-event": "^14.6.1",
51
- "@truedat/test": "7.5.11",
51
+ "@truedat/test": "7.5.13",
52
52
  "identity-obj-proxy": "^3.0.0",
53
53
  "jest": "^29.7.0",
54
54
  "redux-saga-test-plan": "^4.0.6"
55
55
  },
56
56
  "dependencies": {
57
- "@apollo/client": "^3.13.5",
58
- "axios": "^1.8.4",
57
+ "@apollo/client": "^3.13.8",
58
+ "axios": "^1.9.0",
59
59
  "file-saver": "^2.0.5",
60
- "graphql": "^16.10.0",
60
+ "graphql": "^16.11.0",
61
61
  "is-hotkey": "^0.2.0",
62
62
  "is-url": "^1.2.4",
63
63
  "lodash": "^4.17.21",
64
64
  "moment": "^2.30.1",
65
65
  "path-to-regexp": "^8.2.0",
66
66
  "prop-types": "^15.8.1",
67
- "query-string": "^7.1.2",
68
- "react": "^19.0.0",
67
+ "query-string": "^7.1.3",
68
+ "react": "^19.1.0",
69
69
  "react-csv": "^2.2.2",
70
- "react-dom": "^19.0.0",
70
+ "react-dom": "^19.1.0",
71
71
  "react-dropzone": "^14.3.8",
72
- "react-hook-form": "^7.54.2",
73
- "react-intl": "^7.1.10",
72
+ "react-hook-form": "^7.56.4",
73
+ "react-intl": "^7.1.11",
74
74
  "react-moment": "^1.1.3",
75
75
  "react-redux": "^9.2.0",
76
- "react-router": "^7.4.0",
76
+ "react-router": "^7.6.0",
77
77
  "redux": "^5.0.1",
78
78
  "redux-saga": "^1.3.0",
79
79
  "redux-saga-routines": "^3.2.3",
@@ -82,5 +82,5 @@
82
82
  "semantic-ui-react": "^3.0.0-beta.2",
83
83
  "swr": "^2.3.3"
84
84
  },
85
- "gitHead": "cbb92d5206752fe2add4195432b0401da17a0f23"
85
+ "gitHead": "83de799e59c0d13d4d52812070d232d24f0b5f82"
86
86
  }
@@ -235,6 +235,7 @@ const hiddenActions = [
235
235
  "set_confidential",
236
236
  "update_domain",
237
237
  "actions",
238
+ "suggest_structure_link",
238
239
  ];
239
240
 
240
241
  const editUrl = (conceptActions, concept) =>
@@ -4,7 +4,7 @@ import PropTypes from "prop-types";
4
4
  import { useIntl } from "react-intl";
5
5
  import { connect } from "react-redux";
6
6
  import { Button } from "semantic-ui-react";
7
- import { Link } from "react-router";
7
+ import { Link, useParams } from "react-router";
8
8
  import { linkTo } from "@truedat/core/routes";
9
9
  import { Checkbox } from "semantic-ui-react";
10
10
 
@@ -15,8 +15,10 @@ export const ConceptLinksActions = ({
15
15
  createLinkUrl,
16
16
  grantView,
17
17
  onGrantViewChange,
18
+ canSuggestLinks,
18
19
  }) => {
19
20
  const { formatMessage } = useIntl();
21
+ const params = useParams();
20
22
 
21
23
  return createLinkUrl ? (
22
24
  <div style={{ float: "right" }}>
@@ -33,6 +35,15 @@ export const ConceptLinksActions = ({
33
35
  <ConceptLinkstRequestGrantButton disabled={!grantView} />
34
36
  </Fragment>
35
37
  ) : null}
38
+ {canSuggestLinks && (
39
+ <Button
40
+ secondary
41
+ as={Link}
42
+ icon="lightbulb outline"
43
+ content={formatMessage({ id: "links.actions.suggest" })}
44
+ to={linkTo.CONCEPT_LINKS_STRUCTURES_SUGGEST(params)}
45
+ />
46
+ )}
36
47
  <Button
37
48
  primary
38
49
  as={Link}
@@ -48,6 +59,7 @@ ConceptLinksActions.propTypes = {
48
59
  createLinkUrl: PropTypes.string,
49
60
  grantView: PropTypes.bool,
50
61
  onGrantViewChange: PropTypes.func,
62
+ canSuggestLinks: PropTypes.bool,
51
63
  };
52
64
 
53
65
  const mapStateToProps = ({ conceptActions, conceptActionLoading, concept }) => {
@@ -56,6 +68,8 @@ const mapStateToProps = ({ conceptActions, conceptActionLoading, concept }) => {
56
68
  _.has("create_structure_link")(conceptActions) && _.has("id")(concept)
57
69
  ? linkTo.CONCEPT_LINKS_STRUCTURES_NEW(concept)
58
70
  : null,
71
+ canSuggestLinks:
72
+ _.has("suggest_structure_link")(conceptActions) && _.has("id")(concept),
59
73
  conceptActionLoading,
60
74
  canManageGrantRequests: concept.actions?.manage_grant_requests,
61
75
  };
@@ -3,13 +3,6 @@ import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { Route, Routes } from "react-router";
5
5
  import { connect } from "react-redux";
6
- import {
7
- CONCEPT_LINKS_CONCEPTS,
8
- CONCEPT_LINKS_CONCEPTS_NEW,
9
- CONCEPT_LINKS_STRUCTURES,
10
- CONCEPT_LINKS_STRUCTURES_NEW,
11
- CONCEPT_LINKS_IMPLEMENTATIONS,
12
- } from "@truedat/core/routes";
13
6
  import ConceptStructureLinks from "./ConceptStructureLinks";
14
7
  import ConceptRelations from "./ConceptRelations";
15
8
  import ConceptRelationForm from "./ConceptRelationForm";
@@ -19,6 +12,10 @@ const ConceptStructureLinkForm = React.lazy(
19
12
  () => import("@truedat/lm/components/ConceptStructureLinkForm")
20
13
  );
21
14
 
15
+ const ConceptSuggestionLinkForm = React.lazy(
16
+ () => import("@truedat/lm/components/ConceptSuggestionLinkForm")
17
+ );
18
+
22
19
  const StructureTypesLoader = React.lazy(
23
20
  () => import("@truedat/dd/components/StructureTypesLoader")
24
21
  );
@@ -37,6 +34,7 @@ export const ConceptRelationsRoutes = ({ conceptLoaded, relationsLoading }) => {
37
34
  }
38
35
  />
39
36
  <Route path="new" element={<ConceptStructureLinkForm />} />
37
+ <Route path="suggest" element={<ConceptSuggestionLinkForm />} />
40
38
  </Route>
41
39
  <Route path="concepts">
42
40
  <Route index element={<ConceptRelations />} />
@@ -54,12 +54,14 @@ const ConceptStructureLinksSegment = ({ groups, visible }) => {
54
54
  </Grid.Row>
55
55
  </Grid>
56
56
  ) : (
57
- <LinksPane
58
- groups={groups}
59
- sourceType="concept"
60
- targetType="structure"
61
- linksActions={LinksActions}
62
- />
57
+ <>
58
+ <LinksPane
59
+ groups={groups}
60
+ sourceType="concept"
61
+ targetType="structure"
62
+ linksActions={LinksActions}
63
+ />
64
+ </>
63
65
  )}
64
66
  </Segment>
65
67
  );
@@ -79,7 +79,7 @@ describe("<Domain />", () => {
79
79
  });
80
80
 
81
81
  it("renders null when domain is not available", async () => {
82
- useDomain.mockImplementationOnce(() => ({
82
+ useDomain.mockImplementation(() => ({
83
83
  data: null,
84
84
  }));
85
85
 
@@ -6,82 +6,81 @@ import { useDomains } from "../../../hooks/useDomains";
6
6
 
7
7
  jest.mock("../../../hooks/useDomains", () => ({
8
8
  ...jest.requireActual("../../../hooks/useDomains"),
9
- useDomains: jest.fn(() => ({
10
- data: [
11
- {
12
- description: "No tiene padre",
13
- domain_group: null,
14
- external_id: "1",
15
- id: 1,
16
- name: "domain_1",
17
- parent_id: null,
18
- parents: null,
19
- type: null,
20
- },
21
- {
22
- description: "No tiene padre",
23
- domain_group: null,
24
- external_id: "2",
25
- id: 2,
26
- name: "domain_2",
27
- parent_id: null,
28
- parents: null,
29
- type: null,
30
- },
31
- {
32
- description: "el padre es domain_2",
33
- domain_group: null,
34
- external_id: "3",
35
- id: 3,
36
- name: "domain_3",
37
- parent_id: 2,
38
- parents: null,
39
- type: null,
40
- },
41
- {
42
- description: "el padre es domain_2",
43
- domain_group: null,
44
- external_id: "4",
45
- id: 4,
46
- name: "domain_4",
47
- parent_id: 2,
48
- parents: null,
49
- type: null,
50
- },
51
- {
52
- description: "No tiene padre",
53
- domain_group: null,
54
- external_id: "5",
55
- id: 5,
56
- name: "domain_5",
57
- parent_id: null,
58
- parents: null,
59
- type: null,
60
- },
61
- {
62
- description: "el padre es domain_5",
63
- domain_group: null,
64
- external_id: "6",
65
- id: 6,
66
- name: "domain_6",
67
- parent_id: 5,
68
- parents: null,
69
- type: null,
70
- },
71
- {
72
- description: "el padre es domain_6",
73
- domain_group: null,
74
- external_id: "7",
75
- id: 7,
76
- name: "domain_7",
77
- parent_id: 6,
78
- parents: null,
79
- type: null,
80
- },
81
- ],
82
- })),
9
+ useDomains: jest.fn(() => {}),
83
10
  }));
84
11
 
12
+ const data = [
13
+ {
14
+ description: "No tiene padre",
15
+ domain_group: null,
16
+ external_id: "1",
17
+ id: 1,
18
+ name: "domain_1",
19
+ parent_id: null,
20
+ parents: null,
21
+ type: null,
22
+ },
23
+ {
24
+ description: "No tiene padre",
25
+ domain_group: null,
26
+ external_id: "2",
27
+ id: 2,
28
+ name: "domain_2",
29
+ parent_id: null,
30
+ parents: null,
31
+ type: null,
32
+ },
33
+ {
34
+ description: "el padre es domain_2",
35
+ domain_group: null,
36
+ external_id: "3",
37
+ id: 3,
38
+ name: "domain_3",
39
+ parent_id: 2,
40
+ parents: null,
41
+ type: null,
42
+ },
43
+ {
44
+ description: "el padre es domain_2",
45
+ domain_group: null,
46
+ external_id: "4",
47
+ id: 4,
48
+ name: "domain_4",
49
+ parent_id: 2,
50
+ parents: null,
51
+ type: null,
52
+ },
53
+ {
54
+ description: "No tiene padre",
55
+ domain_group: null,
56
+ external_id: "5",
57
+ id: 5,
58
+ name: "domain_5",
59
+ parent_id: null,
60
+ parents: null,
61
+ type: null,
62
+ },
63
+ {
64
+ description: "el padre es domain_5",
65
+ domain_group: null,
66
+ external_id: "6",
67
+ id: 6,
68
+ name: "domain_6",
69
+ parent_id: 5,
70
+ parents: null,
71
+ type: null,
72
+ },
73
+ {
74
+ description: "el padre es domain_6",
75
+ domain_group: null,
76
+ external_id: "7",
77
+ id: 7,
78
+ name: "domain_7",
79
+ parent_id: 6,
80
+ parents: null,
81
+ type: null,
82
+ },
83
+ ];
85
84
  describe("<DomainForm />", () => {
86
85
  const onSubmit = jest.fn();
87
86
  const domain = { id: 1, name: "nn", external_id: "foo", description: "dd" };
@@ -89,12 +88,14 @@ describe("<DomainForm />", () => {
89
88
  const props = { domain, onSubmit, isSubmitting };
90
89
 
91
90
  it("matches the latest snapshot", async () => {
91
+ useDomains.mockImplementation(() => ({ data }));
92
92
  const rendered = render(<DomainForm {...props} />);
93
93
  await waitForLoad(rendered);
94
94
  expect(rendered.container).toMatchSnapshot();
95
95
  });
96
96
 
97
97
  it("enables submit when required fields have values", async () => {
98
+ useDomains.mockImplementation(() => ({ data }));
98
99
  const props = { domain: {}, onSubmit: jest.fn() };
99
100
  const rendered = render(<DomainForm {...props} />);
100
101
  await waitForLoad(rendered);
@@ -121,7 +122,7 @@ describe("<DomainForm />", () => {
121
122
  });
122
123
 
123
124
  it("should generate unique domain group options", async () => {
124
- useDomains.mockImplementationOnce(() => ({
125
+ useDomains.mockImplementation(() => ({
125
126
  data: [
126
127
  { domain_group: { name: "DomainGroup1" } },
127
128
  { domain_group: { name: "DomainGroup2" } },
@@ -149,7 +150,7 @@ describe("<DomainForm />", () => {
149
150
  });
150
151
 
151
152
  it("should generate unique type options", async () => {
152
- useDomains.mockImplementationOnce(() => ({
153
+ useDomains.mockImplementation(() => ({
153
154
  data: [
154
155
  { type: "Type1" },
155
156
  { type: "Type2" },
@@ -172,6 +173,7 @@ describe("<DomainForm />", () => {
172
173
  });
173
174
 
174
175
  it("should generate domain parent options", async () => {
176
+ useDomains.mockImplementation(() => ({ data }));
175
177
  const domain = { id: 2, parentable_ids: [1, 5, 6, 7] };
176
178
 
177
179
  const rendered = render(
@@ -162,8 +162,8 @@ describe("<Domains />", () => {
162
162
 
163
163
  it("redirects to domains list if domainId is invalid", async () => {
164
164
  const mockHistoryPush = jest.fn();
165
- useNavigate.mockImplementationOnce(() => mockHistoryPush);
166
- useParams.mockImplementationOnce(() => ({ id: 999 }));
165
+ useNavigate.mockImplementation(() => mockHistoryPush);
166
+ useParams.mockImplementation(() => ({ id: 999 }));
167
167
 
168
168
  const rendered = render(<Domains />, renderOpts);
169
169
  await waitForLoad(rendered);
@@ -172,14 +172,14 @@ describe("<Domains />", () => {
172
172
  });
173
173
 
174
174
  it("renders EmptyImage when no domains available", async () => {
175
- useParams.mockImplementationOnce(() => ({ id: undefined }));
176
- useDomains.mockImplementationOnce(() => ({
175
+ useParams.mockImplementation(() => ({ id: undefined }));
176
+ useDomains.mockImplementation(() => ({
177
177
  data: [],
178
178
  actions: {},
179
179
  loading: false,
180
180
  }));
181
181
  const mockHistoryPush = jest.fn();
182
- useNavigate.mockImplementationOnce(() => mockHistoryPush);
182
+ useNavigate.mockImplementation(() => mockHistoryPush);
183
183
 
184
184
  const rendered = render(<Domains />, renderOpts);
185
185
  await waitForLoad(rendered);