@truedat/lm 7.5.10 → 7.5.11
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/lm",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.11",
|
|
4
4
|
"description": "Truedat Link Manager",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
49
|
"@testing-library/react": "^16.2.0",
|
|
50
50
|
"@testing-library/user-event": "^14.6.1",
|
|
51
|
-
"@truedat/test": "7.5.
|
|
51
|
+
"@truedat/test": "7.5.11",
|
|
52
52
|
"identity-obj-proxy": "^3.0.0",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
54
|
"redux-saga-test-plan": "^4.0.6"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
84
84
|
"swr": "^2.3.3"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "cbb92d5206752fe2add4195432b0401da17a0f23"
|
|
87
87
|
}
|
|
@@ -2,42 +2,34 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import Graph from "
|
|
5
|
+
import { Graph } from "@truedat/core/components";
|
|
6
6
|
|
|
7
7
|
export const RelationGraph = ({ navigate, currentId, relationsGraph }) => {
|
|
8
8
|
const { formatMessage } = useIntl();
|
|
9
|
-
const [network, setNetwork] = useState({});
|
|
10
9
|
|
|
11
10
|
const nodes = _.flow(
|
|
12
11
|
_.get("nodes"),
|
|
13
|
-
_.map(({ id, name: label }) => ({
|
|
12
|
+
_.map(({ id, name: label, resource_id }) => ({
|
|
14
13
|
id,
|
|
15
|
-
label,
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
data: { label },
|
|
15
|
+
resource_id,
|
|
16
|
+
style:
|
|
18
17
|
currentId === id
|
|
19
18
|
? {
|
|
20
19
|
background: "#ed5c17",
|
|
21
|
-
border: "black",
|
|
22
|
-
}
|
|
23
|
-
: null,
|
|
24
|
-
|
|
25
|
-
font:
|
|
26
|
-
currentId === id
|
|
27
|
-
? {
|
|
28
20
|
color: "white",
|
|
29
|
-
|
|
30
|
-
face: "Lato, Helvetica Neue, Arial, Helvetica, sans-serif",
|
|
21
|
+
fontWeight: "bold",
|
|
31
22
|
}
|
|
32
|
-
:
|
|
23
|
+
: { cursor: "pointer" },
|
|
33
24
|
}))
|
|
34
25
|
)(relationsGraph);
|
|
35
26
|
|
|
36
27
|
const edges = _.flow(
|
|
37
28
|
_.get("edges"),
|
|
38
|
-
_.map(({ source_id:
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
_.map(({ id: id, source_id: source, target_id: target, tags }) => ({
|
|
30
|
+
id,
|
|
31
|
+
source,
|
|
32
|
+
target,
|
|
41
33
|
label: _.flow(
|
|
42
34
|
_.map((tag) =>
|
|
43
35
|
formatMessage({
|
|
@@ -50,92 +42,13 @@ export const RelationGraph = ({ navigate, currentId, relationsGraph }) => {
|
|
|
50
42
|
}))
|
|
51
43
|
)(relationsGraph);
|
|
52
44
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
height: "99%",
|
|
56
|
-
width: "99%",
|
|
57
|
-
layout: {
|
|
58
|
-
hierarchical: {
|
|
59
|
-
direction: "UD",
|
|
60
|
-
sortMethod: "directed",
|
|
61
|
-
levelSeparation: 170,
|
|
62
|
-
edgeMinimization: false,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
edges: {
|
|
66
|
-
color: "#000000",
|
|
67
|
-
smooth: true,
|
|
68
|
-
font: {
|
|
69
|
-
face: "Lato, Helvetica Neue, Arial, Helvetica, sans-serif",
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
nodes: {
|
|
73
|
-
shape: "box",
|
|
74
|
-
margin: 10,
|
|
75
|
-
color: {
|
|
76
|
-
background: "white",
|
|
77
|
-
border: "grey",
|
|
78
|
-
},
|
|
79
|
-
widthConstraint: {
|
|
80
|
-
maximum: 200,
|
|
81
|
-
minimum: 100,
|
|
82
|
-
},
|
|
83
|
-
font: {
|
|
84
|
-
face: "Lato, Helvetica Neue, Arial, Helvetica, sans-serif",
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
physics: {
|
|
88
|
-
hierarchicalRepulsion: {
|
|
89
|
-
nodeDistance: 250,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
interaction: {
|
|
93
|
-
hover: true,
|
|
94
|
-
},
|
|
45
|
+
const onClick = (_, { resource_id }) => {
|
|
46
|
+
if (navigate) navigate({ resource_id });
|
|
95
47
|
};
|
|
96
48
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (!_.isEmpty(nodes)) {
|
|
101
|
-
const nodeId = _.head(nodes);
|
|
102
|
-
if (navigate)
|
|
103
|
-
navigate(
|
|
104
|
-
_.flow(
|
|
105
|
-
_.getOr([], "nodes"),
|
|
106
|
-
_.find({ id: nodeId })
|
|
107
|
-
)(relationsGraph),
|
|
108
|
-
_.isEmpty(edges)
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
hoverNode: (event) => {
|
|
113
|
-
const { node } = event;
|
|
114
|
-
if (node !== currentId) {
|
|
115
|
-
const style = _.path("canvas.frame.style")(network);
|
|
116
|
-
style.setProperty("cursor", "pointer");
|
|
117
|
-
setNetwork(network);
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
blurNode: () => {
|
|
121
|
-
const style = _.path("canvas.frame.style")(network);
|
|
122
|
-
style.setProperty("cursor", "default");
|
|
123
|
-
setNetwork(network);
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
return (
|
|
127
|
-
<>
|
|
128
|
-
{!_.isEmpty(relationsGraph) && (
|
|
129
|
-
<Graph
|
|
130
|
-
graph={{ nodes, edges }}
|
|
131
|
-
options={options}
|
|
132
|
-
events={events}
|
|
133
|
-
style={{ height: "640px" }}
|
|
134
|
-
getNetwork={setNetwork}
|
|
135
|
-
/>
|
|
136
|
-
)}
|
|
137
|
-
</>
|
|
138
|
-
);
|
|
49
|
+
return !_.isEmpty(relationsGraph) ? (
|
|
50
|
+
<Graph nodes={nodes} edges={edges} onNodeClick={onClick} />
|
|
51
|
+
) : null;
|
|
139
52
|
};
|
|
140
53
|
|
|
141
54
|
RelationGraph.propTypes = {
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { Segment } from "semantic-ui-react";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import Slider from "react-rangeslider";
|
|
5
|
+
import "react-rangeslider/lib/index.css";
|
|
6
6
|
import { FormattedMessage } from "react-intl";
|
|
7
7
|
|
|
8
|
-
const Slider = () => {
|
|
9
|
-
return <div>Slider</div>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
8
|
export const RelationGraphDepth = ({ onChange, depth, maxDepth }) => {
|
|
13
9
|
return _.isUndefined(maxDepth) ? null : (
|
|
14
10
|
<Segment className={`graph-depth ${maxDepth == 0 ? "disabled" : ""}`}>
|
|
@@ -13,7 +13,6 @@ export const RelationTagCards = ({
|
|
|
13
13
|
relationTagsLoading,
|
|
14
14
|
}) => {
|
|
15
15
|
const { formatMessage } = useIntl();
|
|
16
|
-
|
|
17
16
|
if (relationTagsLoading) return <div />;
|
|
18
17
|
|
|
19
18
|
return (
|
|
@@ -75,7 +74,7 @@ export const RelationTagCards = ({
|
|
|
75
74
|
values={{ type: <i>{tag.value.type}</i> }}
|
|
76
75
|
/>
|
|
77
76
|
}
|
|
78
|
-
onConfirm={() => deleteRelationTag({ id: tag.id })}
|
|
77
|
+
onConfirm={() => deleteRelationTag({ id: `${tag.id}` })}
|
|
79
78
|
/>
|
|
80
79
|
</div>
|
|
81
80
|
</Card.Content>
|
|
@@ -10,7 +10,7 @@ export function* deleteRelationSaga({ payload }) {
|
|
|
10
10
|
try {
|
|
11
11
|
const { id } = payload;
|
|
12
12
|
const meta = { id };
|
|
13
|
-
const url = toApiPath(
|
|
13
|
+
const url = toApiPath({ id: `${id}` });
|
|
14
14
|
yield put({ meta, ...deleteRelation.request() });
|
|
15
15
|
yield call(apiJsonDelete, url, JSON_OPTS);
|
|
16
16
|
yield put({ meta, ...deleteRelation.success(payload) });
|