@truedat/dd 5.2.2 → 5.2.4
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 +12 -0
- package/package.json +6 -6
- package/src/components/StructureCrumbs.js +6 -1
- package/src/components/StructureRow.js +7 -2
- package/src/components/StructureSelector.js +11 -2
- package/src/components/StructuresSearchResults.js +6 -0
- package/src/components/StructuresTable.js +21 -5
- package/src/components/__tests__/__snapshots__/StructureCrumbs.spec.js.snap +2 -0
- package/src/components/__tests__/__snapshots__/StructureSelector.spec.js.snap +1 -0
- package/src/hooks/useStructures.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.2.4] 2023-02-24
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- [TD-3541] Error showing versions in StructureCrumbs
|
|
8
|
+
|
|
9
|
+
## [5.2.3] 2023-02-23
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- [TD-4554] Concept link manager integration with Structure search results
|
|
14
|
+
|
|
3
15
|
## [5.2.1] 2023-02-22
|
|
4
16
|
|
|
5
17
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.4",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.16.5",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "5.2.
|
|
37
|
+
"@truedat/test": "5.2.4",
|
|
38
38
|
"babel-jest": "^28.1.0",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@apollo/client": "^3.7.1",
|
|
90
|
-
"@truedat/auth": "5.2.
|
|
91
|
-
"@truedat/core": "5.2.
|
|
92
|
-
"@truedat/df": "5.2.
|
|
90
|
+
"@truedat/auth": "5.2.4",
|
|
91
|
+
"@truedat/core": "5.2.4",
|
|
92
|
+
"@truedat/df": "5.2.4",
|
|
93
93
|
"lodash": "^4.17.21",
|
|
94
94
|
"moment": "^2.29.4",
|
|
95
95
|
"path-to-regexp": "^1.7.0",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"react-dom": ">= 16.8.6 < 17",
|
|
115
115
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "30945576a3812f88a70b30553caec79bb8957d5c"
|
|
118
118
|
}
|
|
@@ -102,7 +102,12 @@ export const StructureCrumbs = ({
|
|
|
102
102
|
version={version}
|
|
103
103
|
isStructureCrumbActive={isStructureCrumbActive}
|
|
104
104
|
/>
|
|
105
|
-
{_.isNil(version) ? null :
|
|
105
|
+
{_.isNil(version) || version === "latest" ? null : (
|
|
106
|
+
<>
|
|
107
|
+
{" "}
|
|
108
|
+
<VersionCrumb id={id} version={version} />
|
|
109
|
+
</>
|
|
110
|
+
)}
|
|
106
111
|
</Breadcrumb>
|
|
107
112
|
) : null;
|
|
108
113
|
|
|
@@ -9,12 +9,14 @@ export const StructureRow = ({
|
|
|
9
9
|
columns,
|
|
10
10
|
onClick,
|
|
11
11
|
active,
|
|
12
|
-
disabled
|
|
12
|
+
disabled,
|
|
13
|
+
positive,
|
|
13
14
|
}) =>
|
|
14
15
|
_.isEmpty(columns) || _.isEmpty(structure) ? null : (
|
|
15
16
|
<Table.Row
|
|
16
17
|
active={active}
|
|
17
18
|
disabled={disabled}
|
|
19
|
+
positive={positive}
|
|
18
20
|
onClick={() => onClick && onClick(structure)}
|
|
19
21
|
>
|
|
20
22
|
{columns.map((column, i) => (
|
|
@@ -30,7 +32,10 @@ export const StructureRow = ({
|
|
|
30
32
|
StructureRow.propTypes = {
|
|
31
33
|
structure: PropTypes.object,
|
|
32
34
|
columns: PropTypes.array,
|
|
33
|
-
onClick: PropTypes.func
|
|
35
|
+
onClick: PropTypes.func,
|
|
36
|
+
active: PropTypes.bool,
|
|
37
|
+
disabled: PropTypes.bool,
|
|
38
|
+
positive: PropTypes.bool,
|
|
34
39
|
};
|
|
35
40
|
|
|
36
41
|
export default StructureRow;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React, { useState } from "react";
|
|
2
|
+
import React, { useState, useEffect } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Segment } from "semantic-ui-react";
|
|
@@ -23,8 +23,13 @@ export const StructureSelector = ({
|
|
|
23
23
|
selectedStructure: structure,
|
|
24
24
|
onSelect,
|
|
25
25
|
pageSize = 7,
|
|
26
|
+
links,
|
|
27
|
+
placeToTop,
|
|
26
28
|
}) => {
|
|
27
|
-
const [selectedStructure, setSelectedStructure] = useState(
|
|
29
|
+
const [selectedStructure, setSelectedStructure] = useState(null);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setSelectedStructure(structure);
|
|
32
|
+
}, [structure]);
|
|
28
33
|
|
|
29
34
|
const handleSelect = (structure) => {
|
|
30
35
|
const selectedStructure = _.find(_.propEq("id", structure.id))(structures);
|
|
@@ -48,6 +53,8 @@ export const StructureSelector = ({
|
|
|
48
53
|
structures={structuresRows}
|
|
49
54
|
onSelect={handleSelect}
|
|
50
55
|
selectedStructure={selectedStructure}
|
|
56
|
+
links={links}
|
|
57
|
+
placeToTop={placeToTop}
|
|
51
58
|
/>
|
|
52
59
|
</Segment>
|
|
53
60
|
);
|
|
@@ -63,6 +70,8 @@ StructureSelector.propTypes = {
|
|
|
63
70
|
selectedStructure: PropTypes.object,
|
|
64
71
|
structures: PropTypes.array,
|
|
65
72
|
structuresRows: PropTypes.array,
|
|
73
|
+
links: PropTypes.array,
|
|
74
|
+
placeToTop: PropTypes.bool,
|
|
66
75
|
};
|
|
67
76
|
|
|
68
77
|
export const mapStateToProps = (state, props) => ({
|
|
@@ -15,6 +15,8 @@ export const StructuresSearchResults = ({
|
|
|
15
15
|
selectedStructure,
|
|
16
16
|
structures,
|
|
17
17
|
loading,
|
|
18
|
+
links,
|
|
19
|
+
placeToTop,
|
|
18
20
|
}) => (
|
|
19
21
|
<Dimmer.Dimmable dimmed={loading}>
|
|
20
22
|
<Dimmer active={loading} inverted>
|
|
@@ -29,6 +31,8 @@ export const StructuresSearchResults = ({
|
|
|
29
31
|
selectedStructure={selectedStructure}
|
|
30
32
|
structures={structures}
|
|
31
33
|
onStructureSelected={onSelect}
|
|
34
|
+
links={links}
|
|
35
|
+
placeToTop={placeToTop}
|
|
32
36
|
/>
|
|
33
37
|
<StructuresPagination size={size} />
|
|
34
38
|
</>
|
|
@@ -55,6 +59,8 @@ StructuresSearchResults.propTypes = {
|
|
|
55
59
|
structures: PropTypes.array,
|
|
56
60
|
selectedStructure: PropTypes.object,
|
|
57
61
|
loading: PropTypes.bool,
|
|
62
|
+
links: PropTypes.array,
|
|
63
|
+
placeToTop: PropTypes.bool,
|
|
58
64
|
};
|
|
59
65
|
|
|
60
66
|
export default StructuresSearchResults;
|
|
@@ -9,6 +9,15 @@ import { sortStructures } from "../routines";
|
|
|
9
9
|
import { structureColumnsSelector } from "../selectors";
|
|
10
10
|
import StructureRow from "./StructureRow";
|
|
11
11
|
|
|
12
|
+
const isPositive = (links, id) => {
|
|
13
|
+
const link = _.find(
|
|
14
|
+
(link) =>
|
|
15
|
+
_.propEq("resource_id", id.toString())(link) &&
|
|
16
|
+
_.propEq("resource_type", "data_structure")(link)
|
|
17
|
+
)(links);
|
|
18
|
+
return link ? true : false;
|
|
19
|
+
};
|
|
20
|
+
|
|
12
21
|
export class StructuresTable extends React.Component {
|
|
13
22
|
state = {
|
|
14
23
|
sortedColumn: _.prop("column")(getSortInfo(this.props.structuresSort)),
|
|
@@ -40,6 +49,8 @@ export class StructuresTable extends React.Component {
|
|
|
40
49
|
size,
|
|
41
50
|
sortStructures,
|
|
42
51
|
structures,
|
|
52
|
+
links = [],
|
|
53
|
+
placeToTop = true,
|
|
43
54
|
} = this.props;
|
|
44
55
|
const { sortedColumn, direction } = this.state;
|
|
45
56
|
|
|
@@ -47,11 +58,13 @@ export class StructuresTable extends React.Component {
|
|
|
47
58
|
return null;
|
|
48
59
|
} else {
|
|
49
60
|
// selectedStructure will be placed at top unless it is present in structures
|
|
50
|
-
const tableData =
|
|
51
|
-
|
|
52
|
-
? structures
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
const tableData =
|
|
62
|
+
_.has("id")(selectedStructure) && placeToTop
|
|
63
|
+
? _.any(_.propEq("id", selectedStructure.id))(structures) &&
|
|
64
|
+
placeToTop
|
|
65
|
+
? structures
|
|
66
|
+
: [selectedStructure, ...structures]
|
|
67
|
+
: structures;
|
|
55
68
|
const headerRow = columns.map((column, key) => (
|
|
56
69
|
<Table.HeaderCell
|
|
57
70
|
key={key}
|
|
@@ -83,6 +96,7 @@ export class StructuresTable extends React.Component {
|
|
|
83
96
|
columns={columns}
|
|
84
97
|
structure={s}
|
|
85
98
|
active={selectedStructure && _.propEq("id", s.id)(selectedStructure)}
|
|
99
|
+
positive={isPositive(links, s.id)}
|
|
86
100
|
onClick={onStructureSelected}
|
|
87
101
|
/>
|
|
88
102
|
);
|
|
@@ -108,6 +122,8 @@ StructuresTable.propTypes = {
|
|
|
108
122
|
sortStructures: PropTypes.func,
|
|
109
123
|
structures: PropTypes.array,
|
|
110
124
|
structuresSort: PropTypes.array,
|
|
125
|
+
links: PropTypes.array,
|
|
126
|
+
placeToTop: PropTypes.bool,
|
|
111
127
|
};
|
|
112
128
|
|
|
113
129
|
const mapStateToProps = (state, props) => ({
|
|
@@ -72,6 +72,7 @@ exports[`<StructureCrumbs /> matches the latest snapshot (system, ancestry, stru
|
|
|
72
72
|
name="structure a"
|
|
73
73
|
version="32"
|
|
74
74
|
/>
|
|
75
|
+
|
|
75
76
|
<VersionCrumb
|
|
76
77
|
id={123}
|
|
77
78
|
version="32"
|
|
@@ -101,6 +102,7 @@ exports[`<StructureCrumbs /> matches the latest snapshot (system. ancestry, stru
|
|
|
101
102
|
name="structure a"
|
|
102
103
|
version="32"
|
|
103
104
|
/>
|
|
105
|
+
|
|
104
106
|
<VersionCrumb
|
|
105
107
|
id={123}
|
|
106
108
|
version="32"
|
|
@@ -21,7 +21,6 @@ const asQueryParams = (queryParams) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export const useStructures = (args) => {
|
|
24
|
-
console.log(args);
|
|
25
24
|
const url = toApiPath({ id: args.systemId });
|
|
26
25
|
const requestData = () => apiJson(`${url}${asQueryParams(args)}`);
|
|
27
26
|
const options = { keepPreviousData: true };
|