@truedat/bg 6.16.4 → 7.0.1
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 +6 -6
- package/src/concepts/components/ConceptRow.js +3 -8
- package/src/concepts/components/ConceptsTable.js +1 -1
- package/src/concepts/components/__tests__/ConceptRow.spec.js +44 -20
- package/src/concepts/components/__tests__/Concepts.spec.js +1 -0
- package/src/concepts/components/__tests__/ConceptsPanel.spec.js +1 -0
- package/src/concepts/components/__tests__/__snapshots__/ConceptRow.spec.js.snap +46 -15
- package/src/concepts/components/__tests__/__snapshots__/Concepts.spec.js.snap +6 -2
- package/src/concepts/components/__tests__/__snapshots__/ConceptsPanel.spec.js.snap +6 -2
- package/src/concepts/components/__tests__/__snapshots__/ConceptsTable.spec.js.snap +1 -1
- package/src/concepts/selectors/getConceptColumns.js +14 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "Truedat Web Business Glossary",
|
|
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": "
|
|
37
|
+
"@truedat/test": "7.0.1",
|
|
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",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
]
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@truedat/core": "
|
|
90
|
-
"@truedat/df": "
|
|
91
|
-
"@truedat/lm": "
|
|
89
|
+
"@truedat/core": "7.0.1",
|
|
90
|
+
"@truedat/df": "7.0.1",
|
|
91
|
+
"@truedat/lm": "7.0.1",
|
|
92
92
|
"decode-uri-component": "^0.2.2",
|
|
93
93
|
"file-saver": "^2.0.5",
|
|
94
94
|
"moment": "^2.29.4",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"react-dom": ">= 16.8.6 < 17",
|
|
112
112
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "fff3313b142abb69e4d4139e0b6fd85d1af1a898"
|
|
115
115
|
}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { useHistory } from "react-router-dom";
|
|
5
4
|
import { Table } from "semantic-ui-react";
|
|
6
5
|
import { columnDecorator } from "@truedat/core/services";
|
|
7
|
-
import { linkTo } from "@truedat/core/routes";
|
|
8
6
|
|
|
9
7
|
export const ConceptRow = ({ concept, columns }) => {
|
|
10
8
|
const id = _.prop("id")(concept);
|
|
11
|
-
|
|
9
|
+
|
|
12
10
|
return _.isEmpty(columns) || _.isEmpty(concept) ? null : (
|
|
13
|
-
<Table.Row
|
|
14
|
-
key={id}
|
|
15
|
-
onClick={() => history.push(linkTo.CONCEPT_VERSION(concept))}
|
|
16
|
-
>
|
|
11
|
+
<Table.Row key={id}>
|
|
17
12
|
{columns.map((column, i) => (
|
|
18
13
|
<Table.Cell
|
|
19
14
|
key={i}
|
|
@@ -27,7 +22,7 @@ export const ConceptRow = ({ concept, columns }) => {
|
|
|
27
22
|
|
|
28
23
|
ConceptRow.propTypes = {
|
|
29
24
|
concept: PropTypes.object.isRequired,
|
|
30
|
-
columns: PropTypes.array.isRequired
|
|
25
|
+
columns: PropTypes.array.isRequired,
|
|
31
26
|
};
|
|
32
27
|
|
|
33
28
|
export default ConceptRow;
|
|
@@ -1,34 +1,58 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
3
|
import { ConceptRow } from "../ConceptRow";
|
|
4
|
+
import { getConceptColumns } from "../../selectors";
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
-
|
|
6
|
+
const renderOpts = {
|
|
7
|
+
messages: {
|
|
8
|
+
en: {
|
|
9
|
+
"concepts.status.draft": "draft",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
7
12
|
};
|
|
8
13
|
|
|
9
|
-
jest.mock("react-router-dom", () => ({
|
|
10
|
-
...jest.requireActual("react-router-dom"),
|
|
11
|
-
useHistory: () => mockHistory
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
14
|
describe("<ConceptRow />", () => {
|
|
15
15
|
it("matches the latest snapshot", () => {
|
|
16
|
-
const columns =
|
|
17
|
-
const concept = {
|
|
16
|
+
const columns = getConceptColumns({ conceptColumns: null }).concepts;
|
|
17
|
+
const concept = {
|
|
18
|
+
business_concept_id: 12,
|
|
19
|
+
id: 42,
|
|
20
|
+
name: "foo",
|
|
21
|
+
status: "draft",
|
|
22
|
+
last_change_at: "2018-06-27T07:32:53.154377Z",
|
|
23
|
+
};
|
|
18
24
|
const props = { columns, concept };
|
|
19
|
-
const
|
|
20
|
-
|
|
25
|
+
const { container } = render(
|
|
26
|
+
<table>
|
|
27
|
+
<tbody>
|
|
28
|
+
<ConceptRow {...props} />
|
|
29
|
+
</tbody>
|
|
30
|
+
</table>,
|
|
31
|
+
renderOpts
|
|
32
|
+
);
|
|
33
|
+
expect(container).toMatchSnapshot();
|
|
21
34
|
});
|
|
22
35
|
|
|
23
|
-
it("
|
|
24
|
-
const columns =
|
|
25
|
-
const concept = {
|
|
36
|
+
it("renders concept name as link", () => {
|
|
37
|
+
const columns = getConceptColumns({ conceptColumns: null }).concepts;
|
|
38
|
+
const concept = {
|
|
39
|
+
business_concept_id: 12,
|
|
40
|
+
id: 42,
|
|
41
|
+
name: "foo",
|
|
42
|
+
status: "draft",
|
|
43
|
+
last_change_at: "2018-06-27T07:32:53.154377Z",
|
|
44
|
+
};
|
|
26
45
|
const props = { columns, concept };
|
|
27
|
-
const wrapper =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
46
|
+
const wrapper = render(
|
|
47
|
+
<table>
|
|
48
|
+
<tbody>
|
|
49
|
+
<ConceptRow {...props} />
|
|
50
|
+
</tbody>
|
|
51
|
+
</table>,
|
|
52
|
+
renderOpts
|
|
32
53
|
);
|
|
54
|
+
|
|
55
|
+
const link = wrapper.getByText("foo");
|
|
56
|
+
expect(link).toHaveAttribute("href", "/concepts/12/versions/42");
|
|
33
57
|
});
|
|
34
58
|
});
|
|
@@ -1,19 +1,50 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<ConceptRow /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</
|
|
4
|
+
<div>
|
|
5
|
+
<table>
|
|
6
|
+
<tbody>
|
|
7
|
+
<tr
|
|
8
|
+
class=""
|
|
9
|
+
>
|
|
10
|
+
<td
|
|
11
|
+
class=""
|
|
12
|
+
>
|
|
13
|
+
<a
|
|
14
|
+
href="/concepts/12/versions/42"
|
|
15
|
+
>
|
|
16
|
+
foo
|
|
17
|
+
</a>
|
|
18
|
+
</td>
|
|
19
|
+
<td
|
|
20
|
+
class=""
|
|
21
|
+
/>
|
|
22
|
+
<td
|
|
23
|
+
class=""
|
|
24
|
+
>
|
|
25
|
+
draft
|
|
26
|
+
</td>
|
|
27
|
+
<td
|
|
28
|
+
class="center aligned"
|
|
29
|
+
>
|
|
30
|
+
|
|
31
|
+
</td>
|
|
32
|
+
<td
|
|
33
|
+
class="center aligned"
|
|
34
|
+
>
|
|
35
|
+
|
|
36
|
+
</td>
|
|
37
|
+
<td
|
|
38
|
+
class="center aligned"
|
|
39
|
+
>
|
|
40
|
+
<time
|
|
41
|
+
datetime="1530084773154"
|
|
42
|
+
>
|
|
43
|
+
2018-06-27 07:32
|
|
44
|
+
</time>
|
|
45
|
+
</td>
|
|
46
|
+
</tr>
|
|
47
|
+
</tbody>
|
|
48
|
+
</table>
|
|
49
|
+
</div>
|
|
19
50
|
`;
|
|
@@ -96,7 +96,7 @@ exports[`<Concepts /> matches the latest snapshot 1`] = `
|
|
|
96
96
|
123 concepts found
|
|
97
97
|
</div>
|
|
98
98
|
<table
|
|
99
|
-
class="ui
|
|
99
|
+
class="ui sortable table"
|
|
100
100
|
>
|
|
101
101
|
<thead
|
|
102
102
|
class=""
|
|
@@ -140,7 +140,11 @@ exports[`<Concepts /> matches the latest snapshot 1`] = `
|
|
|
140
140
|
<td
|
|
141
141
|
class=""
|
|
142
142
|
>
|
|
143
|
-
|
|
143
|
+
<a
|
|
144
|
+
href="/concepts/1/versions/1"
|
|
145
|
+
>
|
|
146
|
+
s1
|
|
147
|
+
</a>
|
|
144
148
|
</td>
|
|
145
149
|
<td
|
|
146
150
|
class=""
|
|
@@ -72,7 +72,7 @@ exports[`<ConceptsPanel /> matches latest snapshot 1`] = `
|
|
|
72
72
|
123 concepts found
|
|
73
73
|
</div>
|
|
74
74
|
<table
|
|
75
|
-
class="ui
|
|
75
|
+
class="ui sortable table"
|
|
76
76
|
>
|
|
77
77
|
<thead
|
|
78
78
|
class=""
|
|
@@ -116,7 +116,11 @@ exports[`<ConceptsPanel /> matches latest snapshot 1`] = `
|
|
|
116
116
|
<td
|
|
117
117
|
class=""
|
|
118
118
|
>
|
|
119
|
-
|
|
119
|
+
<a
|
|
120
|
+
href="/concepts/1/versions/1"
|
|
121
|
+
>
|
|
122
|
+
concept
|
|
123
|
+
</a>
|
|
120
124
|
</td>
|
|
121
125
|
<td
|
|
122
126
|
class=""
|
|
@@ -4,6 +4,13 @@ import { Icon } from "semantic-ui-react";
|
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
5
|
import { createSelector } from "reselect";
|
|
6
6
|
import Moment from "react-moment";
|
|
7
|
+
import { Link } from "react-router-dom";
|
|
8
|
+
import { linkTo } from "@truedat/core/routes";
|
|
9
|
+
|
|
10
|
+
const ConceptLink = (concept) =>
|
|
11
|
+
concept?.id ? (
|
|
12
|
+
<Link to={linkTo.CONCEPT_VERSION(concept)}>{concept?.name}</Link>
|
|
13
|
+
) : null;
|
|
7
14
|
|
|
8
15
|
const iconDecorator = (field) =>
|
|
9
16
|
field > 0 ? <Icon name="check circle" /> : "";
|
|
@@ -15,7 +22,13 @@ const dateDecorator = (date) => (
|
|
|
15
22
|
);
|
|
16
23
|
|
|
17
24
|
export const defaultConceptColumns = [
|
|
18
|
-
{
|
|
25
|
+
{
|
|
26
|
+
name: "name",
|
|
27
|
+
sort: { name: "name.raw" },
|
|
28
|
+
width: 7,
|
|
29
|
+
fieldDecorator: ConceptLink,
|
|
30
|
+
fieldSelector: _.identity,
|
|
31
|
+
},
|
|
19
32
|
{
|
|
20
33
|
name: "domain",
|
|
21
34
|
sort: { name: "domain.name.sort" },
|