@truedat/lm 4.38.2 → 4.38.6

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.38.5] 2022-02-20
4
+
5
+ ### Added
6
+
7
+ - [TD-4297] Remove unnecessary code
8
+
9
+ ## [4.38.3] 2022-02-20
10
+
11
+ ### Added
12
+
13
+ - [TD-4297] Hide the type column if none of the links has any tag
14
+
3
15
  ## [4.38.1] 2022-02-17
4
16
 
5
17
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/lm",
3
- "version": "4.38.2",
3
+ "version": "4.38.6",
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.38.2",
36
+ "@truedat/test": "4.38.6",
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",
@@ -83,7 +83,7 @@
83
83
  ]
84
84
  },
85
85
  "dependencies": {
86
- "@truedat/core": "4.38.2",
86
+ "@truedat/core": "4.38.6",
87
87
  "path-to-regexp": "^1.7.0",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-graph-vis": "1.0.5",
@@ -100,5 +100,5 @@
100
100
  "react-dom": ">= 16.8.6 < 17",
101
101
  "semantic-ui-react": ">= 0.88.2 < 2.1"
102
102
  },
103
- "gitHead": "41504c0c5ccc40ea20e67985e3957fd7c1897e2e"
103
+ "gitHead": "0005b4c27ac7f10cca2036594b4ce3a7469492aa"
104
104
  }
@@ -1,10 +1,8 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
- import { connect } from "react-redux";
5
4
  import { Table } from "semantic-ui-react";
6
5
  import { columnDecorator } from "@truedat/core/services";
7
- import { structureLinkColumns } from "../constants";
8
6
 
9
7
  export const StructureLinkRow = ({ link, columns }) => (
10
8
  <Table.Row>
@@ -20,9 +18,7 @@ export const StructureLinkRow = ({ link, columns }) => (
20
18
 
21
19
  StructureLinkRow.propTypes = {
22
20
  link: PropTypes.object,
23
- columns: PropTypes.array
21
+ columns: PropTypes.array,
24
22
  };
25
23
 
26
- const mapStateToProps = ({}) => ({ columns: structureLinkColumns });
27
-
28
- export default connect(mapStateToProps)(StructureLinkRow);
24
+ export default 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) => <StructureLinkRow key={i} link={link} />;
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);
@@ -1 +0,0 @@
1
- export * from "./structureLinkColumns";
@@ -1,20 +0,0 @@
1
- import _ from "lodash/fp";
2
- import ConceptLink from "../components/ConceptLink";
3
- import ConceptLinkTags from "../components/ConceptLinkTags";
4
-
5
- export const structureLinkColumns = [
6
- {
7
- header: "concepts.props.name",
8
- fieldSelector: _.identity,
9
- fieldDecorator: ConceptLink,
10
- },
11
- {
12
- header: "Type",
13
- fieldSelector: _.identity,
14
- fieldDecorator: ConceptLinkTags,
15
- },
16
- {
17
- header: "concepts.props.domain",
18
- fieldSelector: _.path("domain.name"),
19
- }
20
- ];