@truedat/lm 4.38.2 → 4.38.3

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
@@ -4,7 +4,9 @@
4
4
 
5
5
  ### Added
6
6
 
7
- - [TD-4297] Add tags ("type") column to structure Linkage tab
7
+ - [TD-4297]
8
+ - Add tags ("type") column to structure Linkage tab
9
+ - Hide the type column if none of the links has any tag
8
10
 
9
11
  ### Changed
10
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/lm",
3
- "version": "4.38.2",
3
+ "version": "4.38.3",
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.3",
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.3",
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": "0ad3a7fe5d8d09b9c5e6e7007d8298748f6677fe"
104
104
  }
@@ -23,6 +23,6 @@ StructureLinkRow.propTypes = {
23
23
  columns: PropTypes.array
24
24
  };
25
25
 
26
- const mapStateToProps = ({}) => ({ columns: structureLinkColumns });
26
+ const mapStateToProps = ({}) => ({ /*columns: structureLinkColumns*/ });
27
27
 
28
28
  export default connect(mapStateToProps)(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";