@truedat/bg 4.42.3 → 4.42.4
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": "4.42.
|
|
3
|
+
"version": "4.42.4",
|
|
4
4
|
"description": "Truedat Web Business Glossary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.14.1",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.42.
|
|
37
|
+
"@truedat/test": "4.42.4",
|
|
38
38
|
"babel-jest": "^27.0.6",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
]
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@truedat/core": "4.42.
|
|
87
|
-
"@truedat/df": "4.42.
|
|
86
|
+
"@truedat/core": "4.42.4",
|
|
87
|
+
"@truedat/df": "4.42.4",
|
|
88
88
|
"file-saver": "^2.0.5",
|
|
89
89
|
"moment": "^2.24.0",
|
|
90
90
|
"path-to-regexp": "^1.7.0",
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"react-dom": ">= 16.8.6 < 17",
|
|
105
105
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "3130f82b417611c76542fc29a6885b4bf85cdd30"
|
|
108
108
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React, { useState } from "react";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Button, Segment, Grid, Icon, Table } from "semantic-ui-react";
|
|
@@ -8,6 +8,11 @@ import { useHistory, useLocation } from "react-router-dom";
|
|
|
8
8
|
|
|
9
9
|
import { RelationGraph } from "@truedat/lm/components";
|
|
10
10
|
import { linkTo } from "@truedat/core/routes";
|
|
11
|
+
import {
|
|
12
|
+
selectMaxDepth,
|
|
13
|
+
selectLimitedGraph,
|
|
14
|
+
} from "@truedat/lm/selectors/relationGraphTraversal";
|
|
15
|
+
import { RelationGraphDepth } from "@truedat/lm/components";
|
|
11
16
|
import { getConceptToConceptRelations } from "../selectors/getConceptRelations";
|
|
12
17
|
|
|
13
18
|
import ConceptRelationActions from "./ConceptRelationActions";
|
|
@@ -30,7 +35,40 @@ export const ConceptRelationsHeaders = () => (
|
|
|
30
35
|
</Table.Header>
|
|
31
36
|
);
|
|
32
37
|
|
|
33
|
-
export const ConceptRelations = ({
|
|
38
|
+
export const ConceptRelations = ({
|
|
39
|
+
conceptRelations,
|
|
40
|
+
concept,
|
|
41
|
+
relationsGraph,
|
|
42
|
+
initialDepth,
|
|
43
|
+
}) => {
|
|
44
|
+
const [depth, setDepth] = useState(initialDepth || Infinity);
|
|
45
|
+
const [maxDepth, setMaxDepth] = useState();
|
|
46
|
+
const [currentId, setCurrentId] = useState();
|
|
47
|
+
const [limitedRelationGraph, setLimitedRelationGraph] =
|
|
48
|
+
useState(relationsGraph);
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
!_.isEmpty(concept) &&
|
|
52
|
+
setCurrentId(`business_concept:${concept.business_concept_id}`);
|
|
53
|
+
}, [concept]);
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!_.isEmpty(relationsGraph) && currentId) {
|
|
57
|
+
const useEffectMaxDepth = selectMaxDepth({ relationsGraph }, currentId);
|
|
58
|
+
|
|
59
|
+
setMaxDepth(useEffectMaxDepth);
|
|
60
|
+
if (depth === Infinity) {
|
|
61
|
+
setDepth(useEffectMaxDepth);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, [relationsGraph, currentId]);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
setLimitedRelationGraph(
|
|
68
|
+
selectLimitedGraph({ relationsGraph }, currentId, depth)
|
|
69
|
+
);
|
|
70
|
+
}, [relationsGraph, currentId, depth]);
|
|
71
|
+
|
|
34
72
|
const { formatMessage } = useIntl();
|
|
35
73
|
const history = useHistory();
|
|
36
74
|
const location = useLocation();
|
|
@@ -41,10 +79,10 @@ export const ConceptRelations = ({ conceptRelations, concept }) => {
|
|
|
41
79
|
history.push(
|
|
42
80
|
linkTo.CONCEPT_LINKS_CONCEPTS({
|
|
43
81
|
business_concept_id: resource_id,
|
|
44
|
-
id: "current"
|
|
82
|
+
id: "current",
|
|
45
83
|
}),
|
|
46
84
|
{
|
|
47
|
-
show_graph: !emptyEdges
|
|
85
|
+
show_graph: !emptyEdges,
|
|
48
86
|
}
|
|
49
87
|
);
|
|
50
88
|
};
|
|
@@ -61,7 +99,7 @@ export const ConceptRelations = ({ conceptRelations, concept }) => {
|
|
|
61
99
|
active={graphRender}
|
|
62
100
|
icon
|
|
63
101
|
data-tooltip={formatMessage({
|
|
64
|
-
id: "relations.actions.maps.tooltip"
|
|
102
|
+
id: "relations.actions.maps.tooltip",
|
|
65
103
|
})}
|
|
66
104
|
onClick={() => setGraphRender(true)}
|
|
67
105
|
>
|
|
@@ -71,7 +109,7 @@ export const ConceptRelations = ({ conceptRelations, concept }) => {
|
|
|
71
109
|
active={!graphRender}
|
|
72
110
|
icon
|
|
73
111
|
data-tooltip={formatMessage({
|
|
74
|
-
id: "relations.actions.list.tooltip"
|
|
112
|
+
id: "relations.actions.list.tooltip",
|
|
75
113
|
})}
|
|
76
114
|
onClick={() => setGraphRender(false)}
|
|
77
115
|
>
|
|
@@ -86,17 +124,26 @@ export const ConceptRelations = ({ conceptRelations, concept }) => {
|
|
|
86
124
|
{conceptRelations && (
|
|
87
125
|
<Grid.Row>
|
|
88
126
|
<Grid.Column>
|
|
89
|
-
{graphRender ? (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
127
|
+
{graphRender && !_.isEmpty(currentId) ? (
|
|
128
|
+
<>
|
|
129
|
+
<RelationGraphDepth
|
|
130
|
+
onClick={(_e) => setDepth(maxDepth)}
|
|
131
|
+
onChange={(newDepth) => setDepth(parseInt(newDepth))}
|
|
132
|
+
depth={depth}
|
|
133
|
+
maxDepth={maxDepth}
|
|
134
|
+
/>
|
|
135
|
+
<RelationGraph
|
|
136
|
+
navigate={navigate}
|
|
137
|
+
currentId={currentId}
|
|
138
|
+
relationsGraph={limitedRelationGraph}
|
|
139
|
+
/>
|
|
140
|
+
</>
|
|
94
141
|
) : (
|
|
95
142
|
<Table selectable>
|
|
96
143
|
<Table.Body>
|
|
97
|
-
{conceptRelations.map(relation => (
|
|
144
|
+
{conceptRelations.map((relation, index) => (
|
|
98
145
|
<ConceptRelationRow
|
|
99
|
-
key={relation.id}
|
|
146
|
+
key={`${relation.id}.${index}`}
|
|
100
147
|
relationContext={relation.context}
|
|
101
148
|
{...relation}
|
|
102
149
|
/>
|
|
@@ -119,23 +166,27 @@ export const ConceptRelations = ({ conceptRelations, concept }) => {
|
|
|
119
166
|
|
|
120
167
|
ConceptRelations.propTypes = {
|
|
121
168
|
conceptRelations: PropTypes.array,
|
|
122
|
-
concept: PropTypes.object
|
|
169
|
+
concept: PropTypes.object,
|
|
170
|
+
relationsGraph: PropTypes.object,
|
|
171
|
+
initialDepth: PropTypes.number,
|
|
123
172
|
};
|
|
124
173
|
|
|
125
|
-
const sortByDirectionAndTag = concept => {
|
|
174
|
+
const sortByDirectionAndTag = (concept) => {
|
|
126
175
|
const concept_id = _.propOr("", "business_concept_id")(concept);
|
|
127
176
|
return _.sortBy([
|
|
128
177
|
_.negate(_.propEq("source_id", concept_id)),
|
|
129
|
-
_.pathOr("", "tags[0].value.type")
|
|
178
|
+
_.pathOr("", "tags[0].value.type"),
|
|
130
179
|
]);
|
|
131
180
|
};
|
|
132
181
|
|
|
133
|
-
const mapStateToProps = state => ({
|
|
182
|
+
const mapStateToProps = (state) => ({
|
|
134
183
|
conceptRelations: sortByDirectionAndTag(state.concept)(
|
|
135
184
|
getConceptToConceptRelations(state)
|
|
136
185
|
),
|
|
137
186
|
concept: state.concept,
|
|
138
|
-
relationsLoading: state.relationsLoading
|
|
187
|
+
relationsLoading: state.relationsLoading,
|
|
188
|
+
relationsGraph: state.relationsGraph,
|
|
189
|
+
initialDepth: state.conceptGraphInitialDepth,
|
|
139
190
|
});
|
|
140
191
|
|
|
141
192
|
export default connect(mapStateToProps)(ConceptRelations);
|
|
@@ -27,16 +27,16 @@ const Tag = ({ tag }) => {
|
|
|
27
27
|
<List.Item className="concept-summary">
|
|
28
28
|
<Bold>{tag.i18n}</Bold>
|
|
29
29
|
<List.List>
|
|
30
|
-
{tag.relations.map(relation =>
|
|
30
|
+
{tag.relations.map((relation, index) =>
|
|
31
31
|
relation.relationSide === "source" ? (
|
|
32
32
|
<Relation
|
|
33
|
-
key={`${relation.relationSide}.${relation.id}`}
|
|
33
|
+
key={`${relation.relationSide}.${relation.id}.${index}`}
|
|
34
34
|
id={getLinkId(relation, relation.relationSide)}
|
|
35
35
|
name={relation.context.target.name}
|
|
36
36
|
/>
|
|
37
37
|
) : (
|
|
38
38
|
<Relation
|
|
39
|
-
key={`${relation.relationSide}.${relation.id}`}
|
|
39
|
+
key={`${relation.relationSide}.${relation.id}.${index}`}
|
|
40
40
|
id={getLinkId(relation, relation.relationSide)}
|
|
41
41
|
name={relation.context.source.name}
|
|
42
42
|
/>
|
|
@@ -57,12 +57,12 @@ const Relation = ({ id, name }) => (
|
|
|
57
57
|
);
|
|
58
58
|
|
|
59
59
|
Tag.propTypes = {
|
|
60
|
-
tag: PropTypes.object
|
|
60
|
+
tag: PropTypes.object,
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
Relation.propTypes = {
|
|
64
64
|
id: PropTypes.string,
|
|
65
|
-
name: PropTypes.string
|
|
65
|
+
name: PropTypes.string,
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
export const ConceptRelationsSummary = ({ conceptRelations }) =>
|
|
@@ -72,7 +72,7 @@ export const ConceptRelationsSummary = ({ conceptRelations }) =>
|
|
|
72
72
|
<FormattedMessage id="concepts.relations" />
|
|
73
73
|
</Header>
|
|
74
74
|
<List>
|
|
75
|
-
{conceptRelations.map(tag => {
|
|
75
|
+
{conceptRelations.map((tag) => {
|
|
76
76
|
return <Tag key={`${tag.relationSide}.${tag.id}`} tag={tag} />;
|
|
77
77
|
})}
|
|
78
78
|
</List>
|
|
@@ -80,11 +80,11 @@ export const ConceptRelationsSummary = ({ conceptRelations }) =>
|
|
|
80
80
|
);
|
|
81
81
|
|
|
82
82
|
ConceptRelationsSummary.propTypes = {
|
|
83
|
-
conceptRelations: PropTypes.array
|
|
83
|
+
conceptRelations: PropTypes.array,
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
const mapStateToProps = (state, { intl: { formatMessage } }) => ({
|
|
87
|
-
conceptRelations: getConceptRelations(formatMessage)(state)
|
|
87
|
+
conceptRelations: getConceptRelations(formatMessage)(state),
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
export default compose(
|