@truedat/lm 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/lm",
3
- "version": "7.5.10",
3
+ "version": "7.5.12",
4
4
  "description": "Truedat Link Manager",
5
5
  "sideEffects": false,
6
6
  "module": "src/index.js",
@@ -46,35 +46,35 @@
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.2.0",
49
+ "@testing-library/react": "^16.3.0",
50
50
  "@testing-library/user-event": "^14.6.1",
51
- "@truedat/test": "7.5.10",
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.5",
58
- "axios": "^1.8.4",
59
- "graphql": "^16.10.0",
57
+ "@apollo/client": "^3.13.8",
58
+ "axios": "^1.9.0",
59
+ "graphql": "^16.11.0",
60
60
  "is-hotkey": "^0.2.0",
61
61
  "is-url": "^1.2.4",
62
62
  "lodash": "^4.17.21",
63
63
  "moment": "^2.30.1",
64
64
  "path-to-regexp": "^8.2.0",
65
65
  "prop-types": "^15.8.1",
66
- "query-string": "^7.1.2",
67
- "react": "^19.0.0",
66
+ "query-string": "^7.1.3",
67
+ "react": "^19.1.0",
68
68
  "react-csv": "^2.2.2",
69
- "react-dom": "^19.0.0",
69
+ "react-dom": "^19.1.0",
70
70
  "react-dropzone": "^14.3.8",
71
71
  "react-graph-vis": "1.0.7",
72
- "react-hook-form": "^7.54.2",
73
- "react-intl": "^7.1.10",
72
+ "react-hook-form": "^7.56.4",
73
+ "react-intl": "^7.1.11",
74
74
  "react-moment": "^1.1.3",
75
75
  "react-rangeslider": "^2.2.0",
76
76
  "react-redux": "^9.2.0",
77
- "react-router": "^7.4.0",
77
+ "react-router": "^7.6.0",
78
78
  "redux": "^5.0.1",
79
79
  "redux-saga": "^1.3.0",
80
80
  "redux-saga-routines": "^3.2.3",
@@ -83,5 +83,5 @@
83
83
  "semantic-ui-react": "^3.0.0-beta.2",
84
84
  "swr": "^2.3.3"
85
85
  },
86
- "gitHead": "8a8c49e9d5d6bb4e5f2b503b063bfd6dd20a503d"
86
+ "gitHead": "1476061ceb9ed15e0bacec71e20d695a0cd57986"
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 "react-graph-vis";
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
- color:
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
- bold: true,
30
- face: "Lato, Helvetica Neue, Arial, Helvetica, sans-serif",
21
+ fontWeight: "bold",
31
22
  }
32
- : null,
23
+ : { cursor: "pointer" },
33
24
  }))
34
25
  )(relationsGraph);
35
26
 
36
27
  const edges = _.flow(
37
28
  _.get("edges"),
38
- _.map(({ source_id: from, target_id: to, tags }) => ({
39
- from,
40
- to,
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 options = {
54
- autoResize: true,
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
- const events = {
98
- select: (event) => {
99
- const { nodes, edges } = event;
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
- // import Slider from "react-rangeslider";
5
- // import "react-rangeslider/lib/index.css";
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(payload);
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) });
@@ -11,7 +11,7 @@ export function* updateRelationTagSaga({ payload }) {
11
11
  payload.value
12
12
  );
13
13
 
14
- const url = compile(API_TAG)(payload);
14
+ const url = compile(API_TAG)({ id: `${payload.id}` });
15
15
 
16
16
  const requestData = {
17
17
  tag: { value: relationTagValue },