@truedat/lm 4.37.5 → 4.38.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 +12 -0
- package/package.json +5 -4
- package/src/components/ConceptLinkTags.js +23 -0
- package/src/components/StructureLinkRow.js +1 -1
- package/src/components/StructureLinks.js +47 -7
- package/src/components/StructureRelationForm.js +1 -1
- package/src/components/__tests__/ConceptLinkTags.spec.js +16 -0
- package/src/components/__tests__/__snapshots__/ConceptLinkTags.spec.js.snap +24 -0
- package/src/constants/index.js +0 -1
- package/src/constants/structureLinkColumns.js +8 -2
- package/src/styles/ConceptLinkTags.less +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.38.1] 2022-02-17
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- [TD-4297]
|
|
8
|
+
- Add tags ("type") column to structure Linkage tab
|
|
9
|
+
- Hide the type column if none of the links has any tag
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- [TD-4297] Relation tags traduction messages now have the prefix `conceptRelations.relationType.`
|
|
14
|
+
|
|
3
15
|
## [4.30.0] 2021-10-06
|
|
4
16
|
|
|
5
17
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/lm",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.38.3",
|
|
4
4
|
"description": "Truedat Link Manager",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@testing-library/jest-dom": "^5.14.1",
|
|
34
34
|
"@testing-library/react": "^12.0.0",
|
|
35
35
|
"@testing-library/user-event": "^13.2.1",
|
|
36
|
-
"@truedat/test": "4.
|
|
36
|
+
"@truedat/test": "4.38.3",
|
|
37
37
|
"babel-jest": "^27.0.6",
|
|
38
38
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
39
39
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"enzyme": "^3.11.0",
|
|
43
43
|
"enzyme-adapter-react-16": "^1.15.6",
|
|
44
44
|
"enzyme-to-json": "^3.6.2",
|
|
45
|
+
"identity-obj-proxy": "^3.0.0",
|
|
45
46
|
"jest": "^27.0.6",
|
|
46
47
|
"react": "^16.14.0",
|
|
47
48
|
"react-dom": "^16.14.0",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
]
|
|
83
84
|
},
|
|
84
85
|
"dependencies": {
|
|
85
|
-
"@truedat/core": "4.
|
|
86
|
+
"@truedat/core": "4.38.3",
|
|
86
87
|
"path-to-regexp": "^1.7.0",
|
|
87
88
|
"prop-types": "^15.7.2",
|
|
88
89
|
"react-graph-vis": "1.0.5",
|
|
@@ -99,5 +100,5 @@
|
|
|
99
100
|
"react-dom": ">= 16.8.6 < 17",
|
|
100
101
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
101
102
|
},
|
|
102
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "0ad3a7fe5d8d09b9c5e6e7007d8298748f6677fe"
|
|
103
104
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import "../styles/ConceptLinkTags.less";
|
|
5
|
+
|
|
6
|
+
export const ConceptLinkTags = ({ tags }) => (
|
|
7
|
+
<ul className="concept-link-tags">
|
|
8
|
+
{tags.map((tag, i) => (
|
|
9
|
+
<li key={i}>
|
|
10
|
+
<FormattedMessage
|
|
11
|
+
id={`conceptRelations.relationType.${tag}`}
|
|
12
|
+
defaultMessage={tag}
|
|
13
|
+
/>
|
|
14
|
+
</li>
|
|
15
|
+
))}
|
|
16
|
+
</ul>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
ConceptLinkTags.propTypes = {
|
|
20
|
+
tags: PropTypes.array,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default ConceptLinkTags;
|
|
@@ -23,6 +23,6 @@ StructureLinkRow.propTypes = {
|
|
|
23
23
|
columns: PropTypes.array
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
const mapStateToProps = ({}) => ({ columns: structureLinkColumns });
|
|
26
|
+
const mapStateToProps = ({}) => ({ /*columns: structureLinkColumns*/ });
|
|
27
27
|
|
|
28
28
|
export default connect(mapStateToProps)(StructureLinkRow);
|
|
@@ -7,24 +7,64 @@ import { FormattedMessage } from "react-intl";
|
|
|
7
7
|
import { Link } from "react-router-dom";
|
|
8
8
|
import { linkTo } from "@truedat/core/routes";
|
|
9
9
|
import { accentInsensitivePathOrder } from "@truedat/core/services/sort";
|
|
10
|
-
import { structureLinkColumns } from "../constants";
|
|
11
10
|
import { getStructureToConceptLinks } from "../selectors/getStructureLinks";
|
|
11
|
+
import ConceptLink from "../components/ConceptLink";
|
|
12
|
+
import ConceptLinkTags from "../components/ConceptLinkTags";
|
|
12
13
|
import StructureLinkRow from "./StructureLinkRow";
|
|
13
14
|
|
|
14
15
|
export const StructureLinks = ({
|
|
15
|
-
columns,
|
|
16
16
|
structure,
|
|
17
17
|
structureLinks,
|
|
18
|
-
canCreateLink
|
|
18
|
+
canCreateLink,
|
|
19
19
|
}) => {
|
|
20
|
+
const structureLinkColumnsWithTags = [
|
|
21
|
+
{
|
|
22
|
+
header: "concepts.props.name",
|
|
23
|
+
fieldSelector: _.identity,
|
|
24
|
+
fieldDecorator: ConceptLink,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
header: "concepts.props.tags",
|
|
28
|
+
fieldSelector: _.identity,
|
|
29
|
+
fieldDecorator: ConceptLinkTags,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
header: "concepts.props.domain",
|
|
33
|
+
fieldSelector: _.path("domain.name"),
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const structureLinkColumnsWithoutTags = [
|
|
38
|
+
{
|
|
39
|
+
header: "concepts.props.name",
|
|
40
|
+
fieldSelector: _.identity,
|
|
41
|
+
fieldDecorator: ConceptLink,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
header: "concepts.props.domain",
|
|
45
|
+
fieldSelector: _.path("domain.name"),
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
const columns = _.every(
|
|
50
|
+
(structureLink) => _.isEmpty(structureLink.tags),
|
|
51
|
+
structureLinks
|
|
52
|
+
)
|
|
53
|
+
? structureLinkColumnsWithoutTags
|
|
54
|
+
: structureLinkColumnsWithTags;
|
|
55
|
+
|
|
20
56
|
const headerRow = columns.map(({ header }, key) => (
|
|
21
57
|
<Table.HeaderCell
|
|
22
58
|
key={key}
|
|
23
59
|
content={header ? <FormattedMessage id={header} /> : null}
|
|
24
60
|
/>
|
|
25
61
|
));
|
|
62
|
+
|
|
26
63
|
const id = _.prop("id")(structure);
|
|
27
|
-
const renderBodyRow = (link, i) =>
|
|
64
|
+
const renderBodyRow = (link, i) => (
|
|
65
|
+
<StructureLinkRow key={i} link={link} columns={columns} />
|
|
66
|
+
);
|
|
67
|
+
|
|
28
68
|
return (
|
|
29
69
|
<Grid>
|
|
30
70
|
{id && canCreateLink && (
|
|
@@ -52,17 +92,17 @@ export const StructureLinks = ({
|
|
|
52
92
|
};
|
|
53
93
|
|
|
54
94
|
StructureLinks.propTypes = {
|
|
95
|
+
structure: PropTypes.object,
|
|
55
96
|
canCreateLink: PropTypes.bool,
|
|
56
|
-
structureLinks: PropTypes.array
|
|
97
|
+
structureLinks: PropTypes.array,
|
|
57
98
|
};
|
|
58
99
|
|
|
59
|
-
const mapStateToProps = state => ({
|
|
100
|
+
const mapStateToProps = (state) => ({
|
|
60
101
|
structure: state.structure,
|
|
61
102
|
structureLinks: _.sortBy(accentInsensitivePathOrder("name"))(
|
|
62
103
|
getStructureToConceptLinks(state)
|
|
63
104
|
),
|
|
64
105
|
canCreateLink: _.has("create_link")(state.structureActions),
|
|
65
|
-
columns: structureLinkColumns
|
|
66
106
|
});
|
|
67
107
|
|
|
68
108
|
export default connect(mapStateToProps)(StructureLinks);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render } from "@truedat/test/render";
|
|
4
|
+
import { shallow } from "enzyme";
|
|
5
|
+
|
|
6
|
+
import ConceptLinkTags from "../ConceptLinkTags";
|
|
7
|
+
|
|
8
|
+
describe("ConceptLinkTags", () => {
|
|
9
|
+
it("matches the latest snapshot", () => {
|
|
10
|
+
const link = {
|
|
11
|
+
tags: ["otro tipo", "business_concept_to_field_master"],
|
|
12
|
+
};
|
|
13
|
+
const wrapper = shallow(<ConceptLinkTags {...link} />);
|
|
14
|
+
expect(wrapper).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`ConceptLinkTags matches the latest snapshot 1`] = `
|
|
4
|
+
<ul
|
|
5
|
+
className="concept-link-tags"
|
|
6
|
+
>
|
|
7
|
+
<li
|
|
8
|
+
key="0"
|
|
9
|
+
>
|
|
10
|
+
<MemoizedFormattedMessage
|
|
11
|
+
defaultMessage="otro tipo"
|
|
12
|
+
id="conceptRelations.relationType.otro tipo"
|
|
13
|
+
/>
|
|
14
|
+
</li>
|
|
15
|
+
<li
|
|
16
|
+
key="1"
|
|
17
|
+
>
|
|
18
|
+
<MemoizedFormattedMessage
|
|
19
|
+
defaultMessage="business_concept_to_field_master"
|
|
20
|
+
id="conceptRelations.relationType.business_concept_to_field_master"
|
|
21
|
+
/>
|
|
22
|
+
</li>
|
|
23
|
+
</ul>
|
|
24
|
+
`;
|
package/src/constants/index.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./structureLinkColumns";
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import ConceptLink from "../components/ConceptLink";
|
|
3
|
+
import ConceptLinkTags from "../components/ConceptLinkTags";
|
|
3
4
|
|
|
4
5
|
export const structureLinkColumns = [
|
|
5
6
|
{
|
|
6
7
|
header: "concepts.props.name",
|
|
7
8
|
fieldSelector: _.identity,
|
|
8
|
-
fieldDecorator: ConceptLink
|
|
9
|
+
fieldDecorator: ConceptLink,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
header: "Type",
|
|
13
|
+
fieldSelector: _.identity,
|
|
14
|
+
fieldDecorator: ConceptLinkTags,
|
|
9
15
|
},
|
|
10
16
|
{
|
|
11
17
|
header: "concepts.props.domain",
|
|
12
|
-
fieldSelector: _.path("domain.name")
|
|
18
|
+
fieldSelector: _.path("domain.name"),
|
|
13
19
|
}
|
|
14
20
|
];
|