@truedat/lm 8.7.0 → 8.7.1
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 +3 -3
- package/src/components/ConceptLinkForm.js +6 -6
- package/src/components/ConceptStructureLinkForm.js +1 -1
- package/src/components/ConceptSuggestionLinkForm.js +1 -1
- package/src/components/ImplementationLinks.js +4 -4
- package/src/components/ImplementationRelationForm.js +3 -3
- package/src/components/LinksPane.js +3 -3
- package/src/components/LinksSearch.js +1 -1
- package/src/components/QualityControlConcepts.js +1 -1
- package/src/components/QualityControlStructures.js +4 -2
- package/src/components/RelationGraph.js +20 -12
- package/src/components/RelationGraphDepth.js +22 -7
- package/src/components/RelationTagForm.js +2 -2
- package/src/components/RelationTagsLoader.js +1 -1
- package/src/components/RelationsLoader.js +1 -1
- package/src/components/StructureLinkForm.js +6 -6
- package/src/components/StructureLinks.js +3 -3
- package/src/components/StructureRelationForm.js +3 -3
- package/src/components/StructureSuggestionLinkForm.js +54 -50
- package/src/components/TagTypeDropdownSelector.js +4 -4
- package/src/components/__tests__/ConceptImplementationLink.spec.js +1 -1
- package/src/components/__tests__/ConceptLinkForm.spec.js +5 -5
- package/src/components/__tests__/ConceptSuggestionLinkForm.spec.js +7 -8
- package/src/components/__tests__/ConfirmDeleteRelation.spec.js +1 -1
- package/src/components/__tests__/ImplementationLinkRow.spec.js +1 -1
- package/src/components/__tests__/ImplementationLinks.spec.js +2 -2
- package/src/components/__tests__/ImplementationRelationForm.spec.js +8 -8
- package/src/components/__tests__/LinksPane.spec.js +28 -5
- package/src/components/__tests__/LinksSearch.spec.js +13 -13
- package/src/components/__tests__/QualityControlConcepts.spec.js +23 -23
- package/src/components/__tests__/QualityControlStructures.spec.js +15 -15
- package/src/components/__tests__/RelationRoutes.spec.js +3 -3
- package/src/components/__tests__/RelationRow.spec.js +4 -4
- package/src/components/__tests__/RelationTagForm.spec.js +7 -7
- package/src/components/__tests__/Relations.spec.js +1 -1
- package/src/components/__tests__/RelationsLoader.spec.js +1 -1
- package/src/components/__tests__/StructureLinkForm.spec.js +6 -6
- package/src/components/__tests__/StructureRelationForm.spec.js +9 -9
- package/src/components/__tests__/StructureSuggestionLinkForm.spec.js +87 -85
- package/src/hooks/useRelations.js +6 -5
- package/src/messages/en.js +2 -1
- package/src/messages/es.js +2 -1
- package/src/messages/index.js +1 -1
- package/src/reducers/__tests__/handlingRelation.spec.js +3 -3
- package/src/reducers/__tests__/relationRedirect.spec.js +8 -8
- package/src/reducers/__tests__/relationTags.spec.js +4 -4
- package/src/reducers/__tests__/relationTagsLoading.spec.js +2 -2
- package/src/reducers/__tests__/relations.spec.js +4 -4
- package/src/reducers/__tests__/relationsActions.spec.js +6 -6
- package/src/reducers/__tests__/relationsGraph.spec.js +21 -21
- package/src/reducers/__tests__/relationsGraphLoading.spec.js +2 -2
- package/src/reducers/__tests__/relationsLoading.spec.js +2 -2
- package/src/reducers/__tests__/selectedRelationTags.spec.js +5 -5
- package/src/reducers/relationTags.js +1 -1
- package/src/reducers/selectedRelationTags.js +1 -1
- package/src/routines.js +2 -2
- package/src/sagas/createRelation.js +1 -1
- package/src/sagas/createRelationTag.js +1 -1
- package/src/sagas/fetchRelations.js +1 -1
- package/src/sagas/updateRelationTag.js +1 -1
- package/src/selectors/getImplementationToConceptLinks.js +1 -1
- package/src/selectors/getStructureLinks.js +1 -1
- package/src/selectors/index.js +1 -1
- package/src/selectors/messages.js +3 -2
- package/src/services/__tests__/edgeColorPalette.spec.js +3 -5
- package/src/services/__tests__/relationGraphTraversal.spec.js +2 -2
- package/src/services/edgeColorPalette.js +6 -1
- package/src/services/relationGraphTraversal.js +14 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/lm",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.1",
|
|
4
4
|
"description": "Truedat Link Manager",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@testing-library/jest-dom": "^6.6.3",
|
|
55
55
|
"@testing-library/react": "^16.3.0",
|
|
56
56
|
"@testing-library/user-event": "^14.6.1",
|
|
57
|
-
"@truedat/test": "8.7.
|
|
57
|
+
"@truedat/test": "8.7.1",
|
|
58
58
|
"identity-obj-proxy": "^3.0.0",
|
|
59
59
|
"jest": "^29.7.0",
|
|
60
60
|
"redux-saga-test-plan": "^4.0.6"
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
87
87
|
"swr": "^2.3.3"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "f7605a6ea3f78839b42bb7d8339eec125ba49acb"
|
|
90
90
|
}
|
|
@@ -2,21 +2,21 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import { lazy, useState, useEffect } from "react";
|
|
3
3
|
import { useSelector, useDispatch } from "react-redux";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
|
-
import { clearSelectedRelationTags } from "../routines";
|
|
6
5
|
import { Divider, Button } from "semantic-ui-react";
|
|
7
6
|
import { HistoryBackButton } from "@truedat/core/components";
|
|
8
7
|
import { useWebContext } from "@truedat/core/webContext";
|
|
9
|
-
import RelationTagsLoader from "./RelationTagsLoader";
|
|
10
|
-
import { useCreateRelation } from "../hooks/useRelations";
|
|
11
8
|
import { useNavigate } from "react-router";
|
|
9
|
+
import { useCreateRelation } from "../hooks/useRelations";
|
|
10
|
+
import { clearSelectedRelationTags } from "../routines";
|
|
12
11
|
import { getRelationErrorAlertMessage } from "../selectors/messages";
|
|
12
|
+
import RelationTagsLoader from "./RelationTagsLoader";
|
|
13
13
|
|
|
14
14
|
const TagTypeDropdownSelector = lazy(
|
|
15
|
-
() => import("@truedat/lm/components/TagTypeDropdownSelector")
|
|
15
|
+
() => import("@truedat/lm/components/TagTypeDropdownSelector"),
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
const ConceptSelector = lazy(
|
|
19
|
-
() => import("@truedat/bg/concepts/relations/components/ConceptSelector")
|
|
19
|
+
() => import("@truedat/bg/concepts/relations/components/ConceptSelector"),
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
const filters = {
|
|
@@ -32,7 +32,7 @@ export const ConceptLinkForm = ({
|
|
|
32
32
|
}) => {
|
|
33
33
|
const navigate = useNavigate();
|
|
34
34
|
const selectedRelationTags = useSelector(
|
|
35
|
-
(state) => state?.selectedRelationTags
|
|
35
|
+
(state) => state?.selectedRelationTags,
|
|
36
36
|
);
|
|
37
37
|
const tagOptions = useSelector(selectTagOptions);
|
|
38
38
|
const { trigger: createRelation, isMutating: creatingRelation } =
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import TagTypeDropdownSelector from "./TagTypeDropdownSelector";
|
|
16
16
|
|
|
17
17
|
const StructureSelector = lazy(
|
|
18
|
-
() => import("@truedat/dd/components/StructureSelector")
|
|
18
|
+
() => import("@truedat/dd/components/StructureSelector"),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
export const ConceptStructureLinkForm = ({
|
|
@@ -14,7 +14,7 @@ import TagTypeDropdownSelector from "./TagTypeDropdownSelector";
|
|
|
14
14
|
import RelationTagsLoader from "./RelationTagsLoader";
|
|
15
15
|
|
|
16
16
|
const StructureSuggestions = React.lazy(
|
|
17
|
-
() => import("@truedat/ai/components/StructureSuggestions")
|
|
17
|
+
() => import("@truedat/ai/components/StructureSuggestions"),
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
const selectTagOptions = makeTagOptionsSelector("data_field");
|
|
@@ -36,7 +36,7 @@ export const ImplementationLinks = ({
|
|
|
36
36
|
const hasTags = _.flow(
|
|
37
37
|
_.map("tags"),
|
|
38
38
|
_.flatten,
|
|
39
|
-
_.isEmpty
|
|
39
|
+
_.isEmpty,
|
|
40
40
|
)(implementationLinks);
|
|
41
41
|
|
|
42
42
|
const tagsColumn = !hasTags
|
|
@@ -122,7 +122,7 @@ ImplementationLinks.propTypes = {
|
|
|
122
122
|
|
|
123
123
|
const mapStateToProps = (state) => {
|
|
124
124
|
const implementationLinks = _.sortBy(accentInsensitivePathOrder("name"))(
|
|
125
|
-
getImplementationToConceptLinks(state)
|
|
125
|
+
getImplementationToConceptLinks(state),
|
|
126
126
|
);
|
|
127
127
|
|
|
128
128
|
const filteredImplementationLinks = _.filter((link) => {
|
|
@@ -130,14 +130,14 @@ const mapStateToProps = (state) => {
|
|
|
130
130
|
(link.status == "published" &&
|
|
131
131
|
_.propOr(
|
|
132
132
|
false,
|
|
133
|
-
"view_published_concept"
|
|
133
|
+
"view_published_concept",
|
|
134
134
|
)(state.implementationActions)) ||
|
|
135
135
|
(link.status == "draft" &&
|
|
136
136
|
_.propOr(false, "view_draft_concept")(state.implementationActions)) ||
|
|
137
137
|
(link.status == "pending_approval" &&
|
|
138
138
|
_.propOr(
|
|
139
139
|
false,
|
|
140
|
-
"view_approval_pending_concept"
|
|
140
|
+
"view_approval_pending_concept",
|
|
141
141
|
)(state.implementationActions))
|
|
142
142
|
);
|
|
143
143
|
})(implementationLinks);
|
|
@@ -11,11 +11,11 @@ import { linkConcept } from "../routines";
|
|
|
11
11
|
import RelationTagsLoader from "./RelationTagsLoader";
|
|
12
12
|
|
|
13
13
|
const TagTypeDropdownSelector = lazy(
|
|
14
|
-
() => import("@truedat/lm/components/TagTypeDropdownSelector")
|
|
14
|
+
() => import("@truedat/lm/components/TagTypeDropdownSelector"),
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
const ConceptSelector = lazy(
|
|
18
|
-
() => import("@truedat/bg/concepts/relations/components/ConceptSelector")
|
|
18
|
+
() => import("@truedat/bg/concepts/relations/components/ConceptSelector"),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
const filters = {
|
|
@@ -113,5 +113,5 @@ const makeMapStateToProps = () => {
|
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
export default connect(makeMapStateToProps, { linkConcept })(
|
|
116
|
-
ImplementationRelationForm
|
|
116
|
+
ImplementationRelationForm,
|
|
117
117
|
);
|
|
@@ -33,7 +33,7 @@ export const Links = ({ tag, sourceType, targetType, columns, links }) => {
|
|
|
33
33
|
const structureIds = _.flow(
|
|
34
34
|
_.filter(_.propEq("resource_type", "data_structure")),
|
|
35
35
|
_.map(({ resource_id }) => parseInt(resource_id)),
|
|
36
|
-
_.uniq
|
|
36
|
+
_.uniq,
|
|
37
37
|
)(links);
|
|
38
38
|
|
|
39
39
|
if (_.isEmpty(structureIds)) {
|
|
@@ -50,7 +50,7 @@ export const Links = ({ tag, sourceType, targetType, columns, links }) => {
|
|
|
50
50
|
|
|
51
51
|
const structuresMap = _.flow(
|
|
52
52
|
_.getOr([], "data.data"),
|
|
53
|
-
_.keyBy("id")
|
|
53
|
+
_.keyBy("id"),
|
|
54
54
|
)(response);
|
|
55
55
|
|
|
56
56
|
const enriched = _.map((link) => {
|
|
@@ -74,7 +74,7 @@ export const Links = ({ tag, sourceType, targetType, columns, links }) => {
|
|
|
74
74
|
}, [links, trigger]);
|
|
75
75
|
|
|
76
76
|
const linksData = _.orderBy(["business_concept_id", "name"])(["desc", "asc"])(
|
|
77
|
-
enrichedLinks
|
|
77
|
+
enrichedLinks,
|
|
78
78
|
);
|
|
79
79
|
|
|
80
80
|
const filteredColumns = filterColumns(columns, enrichedLinks);
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
import { useEffect, useRef } from "react";
|
|
7
7
|
import { useNavigate, useLocation } from "react-router";
|
|
8
8
|
import SearchWidget from "@truedat/core/search/SearchWidget";
|
|
9
|
-
import { useRelations, useRelationFilters } from "../hooks/useRelations";
|
|
10
9
|
import { Table, Segment, Header, Icon } from "semantic-ui-react";
|
|
11
10
|
import { FormattedMessage } from "react-intl";
|
|
12
11
|
import { columnDecorator } from "@truedat/core/services";
|
|
12
|
+
import { useRelations, useRelationFilters } from "../hooks/useRelations";
|
|
13
13
|
import LinksPagination from "./LinksPagination";
|
|
14
14
|
|
|
15
15
|
const LinkRow = ({ link, columns, highlight }) => (
|
|
@@ -3,9 +3,9 @@ import { useState } from "react";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { Button, Grid, Label, Segment } from "semantic-ui-react";
|
|
5
5
|
import { FormattedMessage } from "react-intl";
|
|
6
|
-
import { useDeleteRelation } from "../hooks/useRelations";
|
|
7
6
|
import { Link, useLocation } from "react-router";
|
|
8
7
|
import { linkTo } from "@truedat/core/routes";
|
|
8
|
+
import { useDeleteRelation } from "../hooks/useRelations";
|
|
9
9
|
import { ConfirmDeleteRelation } from "./ConfirmDeleteRelation";
|
|
10
10
|
import LinksSearch from "./LinksSearch";
|
|
11
11
|
|
|
@@ -3,13 +3,13 @@ import { useState } from "react";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { Button, Grid, Icon, Label, Segment } from "semantic-ui-react";
|
|
5
5
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
|
-
import { useDeleteRelation } from "../hooks/useRelations";
|
|
7
6
|
import { Link, useLocation } from "react-router";
|
|
8
7
|
import { linkTo } from "@truedat/core/routes";
|
|
8
|
+
import Moment from "react-moment";
|
|
9
|
+
import { useDeleteRelation } from "../hooks/useRelations";
|
|
9
10
|
import { useRelations, useRelationFilters } from "../hooks/useRelations";
|
|
10
11
|
import { ConfirmDeleteRelation } from "./ConfirmDeleteRelation";
|
|
11
12
|
import LinksSearch from "./LinksSearch";
|
|
12
|
-
import Moment from "react-moment";
|
|
13
13
|
|
|
14
14
|
const StructureLink = ({ target_id: id, target_name: name }) => (
|
|
15
15
|
<Link to={linkTo.STRUCTURE({ id })} title={name}>
|
|
@@ -167,7 +167,9 @@ export const QualityControlStructures = ({ qualityControl, actions }) => {
|
|
|
167
167
|
setRefetchSearch={setRefetchSearch}
|
|
168
168
|
targetType={target_type}
|
|
169
169
|
initialSortColumn="target_name.raw"
|
|
170
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
170
171
|
useSearch={() => useRelations({ document: "all" })}
|
|
172
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
171
173
|
useFilters={() => useRelationFilters({ document: "all" })}
|
|
172
174
|
/>
|
|
173
175
|
</Grid.Column>
|
|
@@ -5,7 +5,12 @@ import PropTypes from "prop-types";
|
|
|
5
5
|
import { Graph } from "@truedat/core/components";
|
|
6
6
|
import { EMPTY_EDGE_TYPE } from "../services/edgeColorPalette";
|
|
7
7
|
|
|
8
|
-
export const RelationGraph = ({
|
|
8
|
+
export const RelationGraph = ({
|
|
9
|
+
navigate,
|
|
10
|
+
currentId,
|
|
11
|
+
relationsGraph,
|
|
12
|
+
colorMap,
|
|
13
|
+
}) => {
|
|
9
14
|
const { formatMessage } = useIntl();
|
|
10
15
|
|
|
11
16
|
const nodes = useMemo(
|
|
@@ -17,9 +22,9 @@ export const RelationGraph = ({ navigate, currentId, relationsGraph, colorMap })
|
|
|
17
22
|
type: "concept",
|
|
18
23
|
data: { label, isActive: currentId === id },
|
|
19
24
|
resource_id,
|
|
20
|
-
}))
|
|
25
|
+
})),
|
|
21
26
|
)(relationsGraph),
|
|
22
|
-
[relationsGraph, currentId]
|
|
27
|
+
[relationsGraph, currentId],
|
|
23
28
|
);
|
|
24
29
|
|
|
25
30
|
const edges = useMemo(
|
|
@@ -27,7 +32,8 @@ export const RelationGraph = ({ navigate, currentId, relationsGraph, colorMap })
|
|
|
27
32
|
_.flow(
|
|
28
33
|
_.get("edges"),
|
|
29
34
|
_.map(({ id: id, source_id: source, target_id: target, tags }) => {
|
|
30
|
-
const primaryType =
|
|
35
|
+
const primaryType =
|
|
36
|
+
_.path([0, "value", "type"])(tags) || EMPTY_EDGE_TYPE;
|
|
31
37
|
const label = _.isEmpty(tags)
|
|
32
38
|
? formatMessage({
|
|
33
39
|
id: `source.${EMPTY_EDGE_TYPE}`,
|
|
@@ -38,11 +44,12 @@ export const RelationGraph = ({ navigate, currentId, relationsGraph, colorMap })
|
|
|
38
44
|
formatMessage({
|
|
39
45
|
id: `source.${_.prop("value.type")(tag)}`,
|
|
40
46
|
defaultMessage: _.prop("value.type")(tag),
|
|
41
|
-
})
|
|
47
|
+
}),
|
|
42
48
|
),
|
|
43
|
-
_.join("\n")
|
|
49
|
+
_.join("\n"),
|
|
44
50
|
)(tags);
|
|
45
|
-
const color =
|
|
51
|
+
const color =
|
|
52
|
+
primaryType && colorMap ? colorMap.get(primaryType) : undefined;
|
|
46
53
|
|
|
47
54
|
return {
|
|
48
55
|
id,
|
|
@@ -60,16 +67,17 @@ export const RelationGraph = ({ navigate, currentId, relationsGraph, colorMap })
|
|
|
60
67
|
},
|
|
61
68
|
}),
|
|
62
69
|
};
|
|
63
|
-
})
|
|
70
|
+
}),
|
|
64
71
|
)(relationsGraph),
|
|
65
|
-
[relationsGraph, formatMessage, colorMap]
|
|
72
|
+
[relationsGraph, formatMessage, colorMap],
|
|
66
73
|
);
|
|
67
74
|
|
|
68
75
|
const safeEdges = useMemo(() => {
|
|
69
76
|
const safeNodeIds = new Set(_.map("id", nodes));
|
|
70
77
|
return _.filter(
|
|
71
|
-
({ source, target }) =>
|
|
72
|
-
|
|
78
|
+
({ source, target }) =>
|
|
79
|
+
safeNodeIds.has(source) && safeNodeIds.has(target),
|
|
80
|
+
edges,
|
|
73
81
|
);
|
|
74
82
|
}, [nodes, edges]);
|
|
75
83
|
|
|
@@ -78,7 +86,7 @@ export const RelationGraph = ({ navigate, currentId, relationsGraph, colorMap })
|
|
|
78
86
|
nodes,
|
|
79
87
|
edges: safeEdges,
|
|
80
88
|
}),
|
|
81
|
-
[nodes, safeEdges]
|
|
89
|
+
[nodes, safeEdges],
|
|
82
90
|
);
|
|
83
91
|
|
|
84
92
|
const onClick = (_, { resource_id }) => {
|
|
@@ -18,17 +18,24 @@ export const RelationGraphDepth = ({ onChange, depth, maxDepth }) => {
|
|
|
18
18
|
(clientY) => {
|
|
19
19
|
if (!sliderRef.current || !maxDepth) return;
|
|
20
20
|
const rect = sliderRef.current.getBoundingClientRect();
|
|
21
|
-
const relativeY = Math.max(
|
|
21
|
+
const relativeY = Math.max(
|
|
22
|
+
0,
|
|
23
|
+
Math.min(1, (rect.bottom - clientY) / rect.height),
|
|
24
|
+
);
|
|
22
25
|
const newDepth = Math.round(relativeY * maxDepth);
|
|
23
26
|
setLocalDepth(newDepth);
|
|
24
27
|
latestDepthRef.current = newDepth;
|
|
25
28
|
},
|
|
26
|
-
[maxDepth]
|
|
29
|
+
[maxDepth],
|
|
27
30
|
);
|
|
28
31
|
|
|
29
32
|
useEffect(() => {
|
|
30
|
-
const handleMouseMove = (e) => {
|
|
31
|
-
|
|
33
|
+
const handleMouseMove = (e) => {
|
|
34
|
+
if (isDragging) updateDepthFromY(e.clientY);
|
|
35
|
+
};
|
|
36
|
+
const handleTouchMove = (e) => {
|
|
37
|
+
if (isDragging) updateDepthFromY(e.touches[0].clientY);
|
|
38
|
+
};
|
|
32
39
|
const handleEnd = () => {
|
|
33
40
|
setIsDragging(false);
|
|
34
41
|
if (onChange) onChange(latestDepthRef.current);
|
|
@@ -57,13 +64,21 @@ export const RelationGraphDepth = ({ onChange, depth, maxDepth }) => {
|
|
|
57
64
|
<span className="graph-depth-v-label">{label}</span>
|
|
58
65
|
<div
|
|
59
66
|
ref={sliderRef}
|
|
60
|
-
onMouseDown={(e) => {
|
|
61
|
-
|
|
67
|
+
onMouseDown={(e) => {
|
|
68
|
+
setIsDragging(true);
|
|
69
|
+
updateDepthFromY(e.clientY);
|
|
70
|
+
}}
|
|
71
|
+
onTouchStart={(e) => {
|
|
72
|
+
setIsDragging(true);
|
|
73
|
+
updateDepthFromY(e.touches[0].clientY);
|
|
74
|
+
}}
|
|
62
75
|
className="graph-depth-v-track"
|
|
63
76
|
style={{ "--td-depth-pct": `${percentage}%` }}
|
|
64
77
|
>
|
|
65
78
|
<div className="graph-depth-v-fill" />
|
|
66
|
-
<div
|
|
79
|
+
<div
|
|
80
|
+
className={`graph-depth-v-thumb${isDragging ? " dragging" : ""}`}
|
|
81
|
+
/>
|
|
67
82
|
</div>
|
|
68
83
|
</div>
|
|
69
84
|
);
|
|
@@ -45,7 +45,7 @@ export const RelationTagForm = ({ relationTag, isSubmitting, onSubmit }) => {
|
|
|
45
45
|
rules={{
|
|
46
46
|
required: formatMessage(
|
|
47
47
|
{ id: "form.validation.required" },
|
|
48
|
-
{ prop: formatMessage({ id: "relationTags.props.type" }) }
|
|
48
|
+
{ prop: formatMessage({ id: "relationTags.props.type" }) },
|
|
49
49
|
),
|
|
50
50
|
}}
|
|
51
51
|
render={({ field: { onBlur, onChange, value } }) => (
|
|
@@ -73,7 +73,7 @@ export const RelationTagForm = ({ relationTag, isSubmitting, onSubmit }) => {
|
|
|
73
73
|
rules={{
|
|
74
74
|
required: formatMessage(
|
|
75
75
|
{ id: "form.validation.required" },
|
|
76
|
-
{ prop: formatMessage({ id: "relationTags.props.target_type" }) }
|
|
76
|
+
{ prop: formatMessage({ id: "relationTags.props.target_type" }) },
|
|
77
77
|
),
|
|
78
78
|
}}
|
|
79
79
|
render={({ field: { onBlur, onChange, value } }) => (
|
|
@@ -2,21 +2,21 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import { lazy, useState, useEffect } from "react";
|
|
3
3
|
import { useSelector, useDispatch } from "react-redux";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
|
-
import { clearSelectedRelationTags } from "../routines";
|
|
6
5
|
import { Divider, Button } from "semantic-ui-react";
|
|
7
6
|
import { HistoryBackButton } from "@truedat/core/components";
|
|
8
7
|
import { useWebContext } from "@truedat/core/webContext";
|
|
9
|
-
import RelationTagsLoader from "./RelationTagsLoader";
|
|
10
|
-
import { useCreateRelation } from "../hooks/useRelations";
|
|
11
8
|
import { useNavigate } from "react-router";
|
|
9
|
+
import { useCreateRelation } from "../hooks/useRelations";
|
|
10
|
+
import { clearSelectedRelationTags } from "../routines";
|
|
12
11
|
import { getRelationErrorAlertMessage } from "../selectors/messages";
|
|
12
|
+
import RelationTagsLoader from "./RelationTagsLoader";
|
|
13
13
|
|
|
14
14
|
const TagTypeDropdownSelector = lazy(
|
|
15
|
-
() => import("@truedat/lm/components/TagTypeDropdownSelector")
|
|
15
|
+
() => import("@truedat/lm/components/TagTypeDropdownSelector"),
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
const StructureSelector = lazy(
|
|
19
|
-
() => import("@truedat/dd/components/StructureSelector")
|
|
19
|
+
() => import("@truedat/dd/components/StructureSelector"),
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
export const StructureLinkForm = ({
|
|
@@ -27,7 +27,7 @@ export const StructureLinkForm = ({
|
|
|
27
27
|
}) => {
|
|
28
28
|
const navigate = useNavigate();
|
|
29
29
|
const selectedRelationTags = useSelector(
|
|
30
|
-
(state) => state?.selectedRelationTags
|
|
30
|
+
(state) => state?.selectedRelationTags,
|
|
31
31
|
);
|
|
32
32
|
const tagOptions = useSelector(selectTagOptions);
|
|
33
33
|
const { trigger: createRelation, isMutating: creatingRelation } =
|
|
@@ -6,13 +6,13 @@ import { FormattedMessage } from "react-intl";
|
|
|
6
6
|
import { Link, useNavigate } from "react-router";
|
|
7
7
|
import { linkTo } from "@truedat/core/routes";
|
|
8
8
|
import { accentInsensitivePathOrder } from "@truedat/core/services/sort";
|
|
9
|
+
import { useQuery } from "@apollo/client";
|
|
10
|
+
import { DATA_STRUCTURE_VERSION_LINKS_QUERY } from "@truedat/dd/api/queries";
|
|
11
|
+
import SuggestLinkButton from "@truedat/ai/components/SuggestLinkButton";
|
|
9
12
|
import { getStructureToConceptLinks } from "../selectors/getStructureLinks";
|
|
10
13
|
import ConceptLink from "../components/ConceptLink";
|
|
11
14
|
import ConceptLinkTags from "../components/ConceptLinkTags";
|
|
12
15
|
import StructureLinkRow from "./StructureLinkRow";
|
|
13
|
-
import { useQuery } from "@apollo/client";
|
|
14
|
-
import { DATA_STRUCTURE_VERSION_LINKS_QUERY } from "@truedat/dd/api/queries";
|
|
15
|
-
import SuggestLinkButton from "@truedat/ai/components/SuggestLinkButton";
|
|
16
16
|
|
|
17
17
|
export const StructureLinks = ({
|
|
18
18
|
structure,
|
|
@@ -11,11 +11,11 @@ import { linkConcept } from "../routines";
|
|
|
11
11
|
import RelationTagsLoader from "./RelationTagsLoader";
|
|
12
12
|
|
|
13
13
|
const ConceptSelector = lazy(
|
|
14
|
-
() => import("@truedat/bg/concepts/relations/components/ConceptSelector")
|
|
14
|
+
() => import("@truedat/bg/concepts/relations/components/ConceptSelector"),
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
const TagTypeDropdownSelector = lazy(
|
|
18
|
-
() => import("@truedat/lm/components/TagTypeDropdownSelector")
|
|
18
|
+
() => import("@truedat/lm/components/TagTypeDropdownSelector"),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
const filters = {
|
|
@@ -103,5 +103,5 @@ const makeMapStateToProps = () => {
|
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
export default connect(makeMapStateToProps, { linkConcept })(
|
|
106
|
-
StructureRelationForm
|
|
106
|
+
StructureRelationForm,
|
|
107
107
|
);
|
|
@@ -13,67 +13,71 @@ import { linkConcept, clearSelectedRelationTags } from "../routines";
|
|
|
13
13
|
import TagTypeDropdownSelector from "./TagTypeDropdownSelector";
|
|
14
14
|
import RelationTagsLoader from "./RelationTagsLoader";
|
|
15
15
|
|
|
16
|
-
const ConceptSuggestions = React.lazy(
|
|
16
|
+
const ConceptSuggestions = React.lazy(
|
|
17
|
+
() => import("@truedat/ai/components/ConceptSuggestions"),
|
|
18
|
+
);
|
|
17
19
|
|
|
18
20
|
const selectTagOptions = makeTagOptionsSelector("data_field");
|
|
19
21
|
|
|
20
22
|
export const StructureSuggestionLinkForm = () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const { id: targetId } = useParams();
|
|
24
|
+
const selectedRelationTags = useSelector(
|
|
25
|
+
(state) => state?.selectedRelationTags,
|
|
26
|
+
);
|
|
27
|
+
const tagOptions = useSelector(selectTagOptions);
|
|
28
|
+
const conceptLinking = useSelector((state) => state?.conceptLinking);
|
|
29
|
+
const dispatch = useDispatch();
|
|
30
|
+
const [selectedConcept, setSelectedConcept] = useState(null);
|
|
31
|
+
const { formatMessage } = useIntl();
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
return () => {
|
|
35
|
+
dispatch(clearSelectedRelationTags.trigger());
|
|
36
|
+
};
|
|
37
|
+
}, [clearSelectedRelationTags, dispatch]);
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
dispatch(linkConcept.trigger(link));
|
|
39
|
+
const handleSubmit = () => {
|
|
40
|
+
const link = {
|
|
41
|
+
redirectUrl: linkTo.STRUCTURE_LINKS({ id: targetId }),
|
|
42
|
+
source_id: selectedConcept?.business_concept_id,
|
|
43
|
+
source_type: "business_concept",
|
|
44
|
+
target_id: targetId,
|
|
45
|
+
target_type: "data_structure",
|
|
46
|
+
tag_ids: selectedRelationTags ? selectedRelationTags : [],
|
|
47
|
+
origin: "suggested",
|
|
46
48
|
};
|
|
49
|
+
dispatch(linkConcept.trigger(link));
|
|
50
|
+
};
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
const disabled = !(selectedConcept && selectedRelationTags);
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
<Divider hidden />
|
|
57
|
+
<RelationTagsLoader />
|
|
58
|
+
{!_.isEmpty(tagOptions) && (
|
|
51
59
|
<>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{!_.isEmpty(tagOptions) && (
|
|
55
|
-
<>
|
|
56
|
-
<TagTypeDropdownSelector options={tagOptions} />
|
|
57
|
-
<Divider hidden />
|
|
58
|
-
</>
|
|
59
|
-
)}
|
|
60
|
-
<ConceptSuggestions
|
|
61
|
-
handleConceptSelected={setSelectedConcept}
|
|
62
|
-
selectedConcept={selectedConcept}
|
|
63
|
-
/>
|
|
64
|
-
<Divider hidden />
|
|
65
|
-
<Button.Group>
|
|
66
|
-
<Button
|
|
67
|
-
primary
|
|
68
|
-
loading={conceptLinking}
|
|
69
|
-
content={formatMessage({ id: "actions.create" })}
|
|
70
|
-
disabled={disabled}
|
|
71
|
-
onClick={handleSubmit}
|
|
72
|
-
/>
|
|
73
|
-
<HistoryBackButton content={formatMessage({ id: "actions.cancel" })} />
|
|
74
|
-
</Button.Group>
|
|
60
|
+
<TagTypeDropdownSelector options={tagOptions} />
|
|
61
|
+
<Divider hidden />
|
|
75
62
|
</>
|
|
76
|
-
|
|
63
|
+
)}
|
|
64
|
+
<ConceptSuggestions
|
|
65
|
+
handleConceptSelected={setSelectedConcept}
|
|
66
|
+
selectedConcept={selectedConcept}
|
|
67
|
+
/>
|
|
68
|
+
<Divider hidden />
|
|
69
|
+
<Button.Group>
|
|
70
|
+
<Button
|
|
71
|
+
primary
|
|
72
|
+
loading={conceptLinking}
|
|
73
|
+
content={formatMessage({ id: "actions.create" })}
|
|
74
|
+
disabled={disabled}
|
|
75
|
+
onClick={handleSubmit}
|
|
76
|
+
/>
|
|
77
|
+
<HistoryBackButton content={formatMessage({ id: "actions.cancel" })} />
|
|
78
|
+
</Button.Group>
|
|
79
|
+
</>
|
|
80
|
+
);
|
|
77
81
|
};
|
|
78
82
|
|
|
79
83
|
export default StructureSuggestionLinkForm;
|
|
@@ -17,8 +17,8 @@ const formatOption = (formatMessage) => (options) =>
|
|
|
17
17
|
id: `source.${text}`,
|
|
18
18
|
defaultMessage: formatMessage({ id: text, defaultMessage: text }),
|
|
19
19
|
}),
|
|
20
|
-
}
|
|
21
|
-
)
|
|
20
|
+
},
|
|
21
|
+
),
|
|
22
22
|
)(options);
|
|
23
23
|
|
|
24
24
|
export const TagTypeDropdownSelector = ({
|
|
@@ -35,7 +35,7 @@ export const TagTypeDropdownSelector = ({
|
|
|
35
35
|
setClearDropdown(true);
|
|
36
36
|
},
|
|
37
37
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
|
-
[options]
|
|
38
|
+
[options],
|
|
39
39
|
);
|
|
40
40
|
|
|
41
41
|
const onChange = (_e, { value }) => {
|
|
@@ -74,5 +74,5 @@ TagTypeDropdownSelector.propTypes = {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
export default connect(null, { setSelectedRelationTags })(
|
|
77
|
-
TagTypeDropdownSelector
|
|
77
|
+
TagTypeDropdownSelector,
|
|
78
78
|
);
|