@truedat/bg 7.5.10 → 7.5.12
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 +13 -13
- package/src/concepts/components/ConceptActions.js +39 -33
- package/src/concepts/components/ConceptEdit.js +3 -3
- package/src/concepts/reducers/conceptRedirect.js +3 -5
- package/src/concepts/relations/components/ConceptRelations.js +2 -1
- package/src/taxonomy/components/__tests__/Domain.spec.js +1 -1
- package/src/taxonomy/components/__tests__/DomainForm.spec.js +78 -76
- package/src/taxonomy/components/__tests__/Domains.spec.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.12",
|
|
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.
|
|
49
|
+
"@testing-library/react": "^16.3.0",
|
|
50
50
|
"@testing-library/user-event": "^14.6.1",
|
|
51
|
-
"@truedat/test": "7.5.
|
|
51
|
+
"@truedat/test": "7.5.12",
|
|
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.
|
|
58
|
-
"axios": "^1.
|
|
57
|
+
"@apollo/client": "^3.13.8",
|
|
58
|
+
"axios": "^1.9.0",
|
|
59
59
|
"file-saver": "^2.0.5",
|
|
60
|
-
"graphql": "^16.
|
|
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.
|
|
68
|
-
"react": "^19.
|
|
67
|
+
"query-string": "^7.1.3",
|
|
68
|
+
"react": "^19.1.0",
|
|
69
69
|
"react-csv": "^2.2.2",
|
|
70
|
-
"react-dom": "^19.
|
|
70
|
+
"react-dom": "^19.1.0",
|
|
71
71
|
"react-dropzone": "^14.3.8",
|
|
72
|
-
"react-hook-form": "^7.
|
|
73
|
-
"react-intl": "^7.1.
|
|
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.
|
|
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": "
|
|
85
|
+
"gitHead": "1476061ceb9ed15e0bacec71e20d695a0cd57986"
|
|
86
86
|
}
|
|
@@ -2,10 +2,10 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { connect } from "react-redux";
|
|
4
4
|
import { Button, Icon } from "semantic-ui-react";
|
|
5
|
-
import { Link } from "react-router";
|
|
5
|
+
import { Link, useNavigate } from "react-router";
|
|
6
6
|
import { FormattedMessage } from "react-intl";
|
|
7
7
|
import { ConfirmModal, GroupActions } from "@truedat/core/components";
|
|
8
|
-
import { linkTo } from "@truedat/core/routes";
|
|
8
|
+
import { CONCEPTS, linkTo } from "@truedat/core/routes";
|
|
9
9
|
import { conceptAction } from "../routines";
|
|
10
10
|
import { mapActionProps } from "../constants/mappings";
|
|
11
11
|
import ConceptDeleteModalBody from "./ConceptDeleteModalBody";
|
|
@@ -45,37 +45,43 @@ const ModalDelete = ({
|
|
|
45
45
|
deleteAction,
|
|
46
46
|
conceptVersion,
|
|
47
47
|
concept,
|
|
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
|
-
)
|
|
48
|
+
}) => {
|
|
49
|
+
const navigate = useNavigate();
|
|
50
|
+
return (
|
|
51
|
+
<ConfirmModal
|
|
52
|
+
icon="trash"
|
|
53
|
+
trigger={
|
|
54
|
+
<Button
|
|
55
|
+
icon={<Icon name="trash alternate outline" color="red" />}
|
|
56
|
+
content={<FormattedMessage id="actions.delete" />}
|
|
57
|
+
/>
|
|
58
|
+
}
|
|
59
|
+
header={
|
|
60
|
+
<FormattedMessage id="concepts.actions.delete.confirmation.header" />
|
|
61
|
+
}
|
|
62
|
+
content={
|
|
63
|
+
<>
|
|
64
|
+
{conceptVersion === 1 ? (
|
|
65
|
+
<ConceptDeleteModalBody
|
|
66
|
+
conceptName={_.prop("name")(concept)}
|
|
67
|
+
conceptDomain={_.prop("domain.name")(concept)}
|
|
68
|
+
linkCount={_.prop("link_count")(concept)}
|
|
69
|
+
ruleCount={_.prop("rule_count")(concept)}
|
|
70
|
+
conceptCount={_.prop("concept_count")(concept)}
|
|
71
|
+
conceptVersion={_.prop("version")(concept)}
|
|
72
|
+
/>
|
|
73
|
+
) : (
|
|
74
|
+
<FormattedMessage id="concepts.actions.delete.confirmation.content" />
|
|
75
|
+
)}
|
|
76
|
+
</>
|
|
77
|
+
}
|
|
78
|
+
onConfirm={() => {
|
|
79
|
+
conceptAction({ action: "delete", ...deleteAction });
|
|
80
|
+
navigate(CONCEPTS);
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
79
85
|
|
|
80
86
|
ModalDelete.propTypes = {
|
|
81
87
|
concept: PropTypes.object,
|
|
@@ -46,7 +46,7 @@ export const ConceptEdit = ({
|
|
|
46
46
|
|
|
47
47
|
const business_concept_version = {
|
|
48
48
|
name: defaultContent.name,
|
|
49
|
-
domain_id: domain
|
|
49
|
+
domain_id: domain?.id,
|
|
50
50
|
type: template.name,
|
|
51
51
|
content: newContent,
|
|
52
52
|
i18n_content: i18nSendConcept,
|
|
@@ -63,7 +63,7 @@ export const ConceptEdit = ({
|
|
|
63
63
|
<>
|
|
64
64
|
<ConceptForm
|
|
65
65
|
actionKey={actionKey}
|
|
66
|
-
domainId={domain
|
|
66
|
+
domainId={domain?.id}
|
|
67
67
|
template={template}
|
|
68
68
|
i18nConcept={i18nConcept}
|
|
69
69
|
loading={templateLoading || localesLoading}
|
|
@@ -94,7 +94,7 @@ export const ConceptEditLoader = (props) => {
|
|
|
94
94
|
const { locales } = useLanguage();
|
|
95
95
|
const { data, loading: templateLoading } = useTemplate({
|
|
96
96
|
name: templateName,
|
|
97
|
-
domainIds: [domain
|
|
97
|
+
domainIds: [domain?.id],
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
const template = _.prop("template")(data);
|
|
@@ -26,11 +26,9 @@ export const conceptRedirect = (
|
|
|
26
26
|
return initialState;
|
|
27
27
|
case conceptAction.SUCCESS:
|
|
28
28
|
const data = _.prop("data")(payload);
|
|
29
|
-
return _.
|
|
30
|
-
?
|
|
31
|
-
:
|
|
32
|
-
? conceptUrl(_.pick(["id", "business_concept_id"])(data))
|
|
33
|
-
: state;
|
|
29
|
+
return _.includes(_.prop("action")(meta))(["version", "update", "create"])
|
|
30
|
+
? conceptUrl(_.pick(["id", "business_concept_id"])(data))
|
|
31
|
+
: state;
|
|
34
32
|
case linkConcept.SUCCESS: {
|
|
35
33
|
const { redirectUrl } = meta;
|
|
36
34
|
return redirectUrl;
|
|
@@ -211,7 +211,8 @@ export const ConceptRelations = ({
|
|
|
211
211
|
maxDepth={maxDepth}
|
|
212
212
|
/>
|
|
213
213
|
<RelationGraph
|
|
214
|
-
|
|
214
|
+
key={`graph-${depth}-${_.size(limitedRelationGraph?.nodes)}`}
|
|
215
|
+
navigate={navigateToConcept}
|
|
215
216
|
currentId={currentId}
|
|
216
217
|
relationsGraph={limitedRelationGraph}
|
|
217
218
|
/>
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
166
|
-
useParams.
|
|
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.
|
|
176
|
-
useDomains.
|
|
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.
|
|
182
|
+
useNavigate.mockImplementation(() => mockHistoryPush);
|
|
183
183
|
|
|
184
184
|
const rendered = render(<Domains />, renderOpts);
|
|
185
185
|
await waitForLoad(rendered);
|