@truedat/dd 4.45.0 → 4.45.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 +6 -0
- package/package.json +6 -6
- package/src/components/StructureCrumbs.js +28 -11
- package/src/components/StructureItem.js +2 -1
- package/src/components/StructureSummary.js +7 -9
- package/src/components/__tests__/StructureItem.spec.js +23 -6
- package/src/components/__tests__/StructureItems.spec.js +14 -4
- package/src/components/__tests__/StructureProperties.spec.js +1 -1
- package/src/components/__tests__/StructureSummary.spec.js +13 -0
- package/src/components/__tests__/__snapshots__/StructureItem.spec.js.snap +68 -43
- package/src/components/__tests__/__snapshots__/StructureItems.spec.js.snap +47 -4
- package/src/components/__tests__/__snapshots__/StructureProperties.spec.js.snap +22 -0
- package/src/components/__tests__/__snapshots__/StructureSummary.spec.js.snap +102 -11
- package/src/reducers/structure.js +1 -0
- package/src/reducers/structures.js +2 -0
- package/src/selectors/__tests__/getStructureParent.spec.js +13 -4
- package/src/selectors/__tests__/getStructureProperties.spec.js +2 -2
- package/src/selectors/getSortedStructureChildren.js +1 -1
- package/src/selectors/getStructureFieldColumns.js +20 -14
- package/src/selectors/getStructureParent.js +9 -4
- package/src/selectors/getStructureProperties.js +12 -0
- package/src/selectors/structureColumnsSelector.js +11 -3
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "4.45.
|
|
3
|
+
"version": "4.45.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.4",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.45.
|
|
37
|
+
"@truedat/test": "4.45.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",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@apollo/client": "^3.6.4",
|
|
91
|
-
"@truedat/auth": "4.45.
|
|
92
|
-
"@truedat/core": "4.45.
|
|
93
|
-
"@truedat/df": "4.45.
|
|
91
|
+
"@truedat/auth": "4.45.4",
|
|
92
|
+
"@truedat/core": "4.45.1",
|
|
93
|
+
"@truedat/df": "4.45.4",
|
|
94
94
|
"lodash": "^4.17.21",
|
|
95
95
|
"path-to-regexp": "^1.7.0",
|
|
96
96
|
"prop-types": "^15.8.1",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"react-dom": ">= 16.8.6 < 17",
|
|
112
112
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "40ec430c50a2da5eca991e9b946e8e47ffe1e477"
|
|
115
115
|
}
|
|
@@ -29,18 +29,21 @@ export const SystemCrumb = ({ name, id }) => (
|
|
|
29
29
|
</>
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
export const AncestorCrumb = ({ name, id }) => (
|
|
32
|
+
export const AncestorCrumb = ({ name, id, published_note }) => (
|
|
33
33
|
<>
|
|
34
34
|
<Breadcrumb.Section as={Link} to={linkTo.STRUCTURE({ id })} active={false}>
|
|
35
|
-
{name}
|
|
35
|
+
{_.isEmpty(published_note?.alias) ? name : published_note.alias}
|
|
36
36
|
</Breadcrumb.Section>
|
|
37
37
|
<Breadcrumb.Divider icon="right angle" />
|
|
38
38
|
</>
|
|
39
39
|
);
|
|
40
40
|
|
|
41
|
-
export const StructureCrumb = ({ name, id, version }) =>
|
|
41
|
+
export const StructureCrumb = ({ name, id, version, published_note }) =>
|
|
42
42
|
_.isNil(version) ? (
|
|
43
|
-
<Breadcrumb.Section
|
|
43
|
+
<Breadcrumb.Section
|
|
44
|
+
active
|
|
45
|
+
content={_.isEmpty(published_note?.alias) ? name : published_note.alias}
|
|
46
|
+
/>
|
|
44
47
|
) : (
|
|
45
48
|
<>
|
|
46
49
|
<Breadcrumb.Section
|
|
@@ -48,7 +51,7 @@ export const StructureCrumb = ({ name, id, version }) =>
|
|
|
48
51
|
to={linkTo.STRUCTURE({ id })}
|
|
49
52
|
active={false}
|
|
50
53
|
>
|
|
51
|
-
{name}
|
|
54
|
+
{_.isEmpty(published_note?.alias) ? name : published_note.alias}
|
|
52
55
|
</Breadcrumb.Section>
|
|
53
56
|
<Breadcrumb.Divider icon="right angle" />
|
|
54
57
|
</>
|
|
@@ -60,20 +63,33 @@ export const VersionCrumb = ({ version }) => (
|
|
|
60
63
|
</Breadcrumb.Section>
|
|
61
64
|
);
|
|
62
65
|
|
|
63
|
-
export const StructureCrumbs = ({
|
|
66
|
+
export const StructureCrumbs = ({
|
|
67
|
+
id,
|
|
68
|
+
system,
|
|
69
|
+
ancestry,
|
|
70
|
+
name,
|
|
71
|
+
version,
|
|
72
|
+
published_note,
|
|
73
|
+
}) =>
|
|
64
74
|
name ? (
|
|
65
75
|
<Breadcrumb>
|
|
66
76
|
<StructuresCrumb />
|
|
67
77
|
{!_.isEmpty(system) && <SystemCrumb {...system} />}
|
|
68
78
|
{!_.isEmpty(ancestry) &&
|
|
69
|
-
_.map(({ data_structure_id, name }) => (
|
|
79
|
+
_.map(({ data_structure_id, name, published_note }) => (
|
|
70
80
|
<AncestorCrumb
|
|
71
81
|
key={data_structure_id}
|
|
72
82
|
name={name}
|
|
73
83
|
id={data_structure_id}
|
|
84
|
+
published_note={published_note}
|
|
74
85
|
/>
|
|
75
86
|
))(ancestry)}
|
|
76
|
-
<StructureCrumb
|
|
87
|
+
<StructureCrumb
|
|
88
|
+
name={name}
|
|
89
|
+
id={id}
|
|
90
|
+
version={version}
|
|
91
|
+
published_note={published_note}
|
|
92
|
+
/>
|
|
77
93
|
{!_.isNil(version) && <VersionCrumb id={id} version={version} />}
|
|
78
94
|
</Breadcrumb>
|
|
79
95
|
) : null;
|
|
@@ -84,18 +100,19 @@ StructureCrumbs.propTypes = {
|
|
|
84
100
|
name: PropTypes.string,
|
|
85
101
|
field: PropTypes.object,
|
|
86
102
|
system: PropTypes.object,
|
|
87
|
-
version: PropTypes.string
|
|
103
|
+
version: PropTypes.string,
|
|
104
|
+
published_note: PropTypes.object,
|
|
88
105
|
};
|
|
89
106
|
|
|
90
107
|
const mapStateToProps = ({
|
|
91
108
|
structure,
|
|
92
109
|
structureAncestry: ancestry,
|
|
93
110
|
structureVersion: version,
|
|
94
|
-
structureSystem: system
|
|
111
|
+
structureSystem: system,
|
|
95
112
|
}) => ({
|
|
96
113
|
...structure,
|
|
97
114
|
ancestry,
|
|
98
115
|
system,
|
|
99
|
-
version
|
|
116
|
+
version,
|
|
100
117
|
});
|
|
101
118
|
export default connect(mapStateToProps)(StructureCrumbs);
|
|
@@ -49,13 +49,14 @@ StructureItem.propTypes = {
|
|
|
49
49
|
|
|
50
50
|
export const mapStateToProps = (
|
|
51
51
|
{ structure },
|
|
52
|
-
{ data_structure_id, id: structureId, type }
|
|
52
|
+
{ data_structure_id, id: structureId, type, name, published_note }
|
|
53
53
|
) => {
|
|
54
54
|
const id = data_structure_id || structureId;
|
|
55
55
|
return {
|
|
56
56
|
id: id,
|
|
57
57
|
active:
|
|
58
58
|
type !== "system" && _.isFinite(id) && _.propEq("id", id)(structure),
|
|
59
|
+
name: _.isEmpty(published_note?.alias) ? name : published_note.alias,
|
|
59
60
|
};
|
|
60
61
|
};
|
|
61
62
|
|
|
@@ -56,6 +56,7 @@ const dateProperties = (deleted_at, updatedAt) =>
|
|
|
56
56
|
export const StructureSummary = ({
|
|
57
57
|
class: structureClass,
|
|
58
58
|
name,
|
|
59
|
+
published_note,
|
|
59
60
|
description,
|
|
60
61
|
type,
|
|
61
62
|
userPermissions,
|
|
@@ -79,7 +80,9 @@ export const StructureSummary = ({
|
|
|
79
80
|
<Dimmer.Dimmable dimmed={linkedStructureTagsLoading}>
|
|
80
81
|
<Header as="h2">
|
|
81
82
|
<Header.Content>
|
|
82
|
-
{
|
|
83
|
+
{_.isEmpty(published_note?.alias)
|
|
84
|
+
? name
|
|
85
|
+
: published_note.alias}
|
|
83
86
|
{grant ? (
|
|
84
87
|
structureGrant ? (
|
|
85
88
|
structureGrant(grant)
|
|
@@ -92,14 +95,8 @@ export const StructureSummary = ({
|
|
|
92
95
|
) : (
|
|
93
96
|
<StructureGrantRequestButton />
|
|
94
97
|
)}
|
|
95
|
-
{
|
|
96
|
-
<Header.Subheader>
|
|
97
|
-
{formatMessage({
|
|
98
|
-
id: `structure.type.${type}.text`,
|
|
99
|
-
defaultMessage:
|
|
100
|
-
_.get("translation")(data_structure_type) || type,
|
|
101
|
-
})}
|
|
102
|
-
</Header.Subheader>
|
|
98
|
+
{!_.isEmpty(published_note?.alias) && (
|
|
99
|
+
<Header.Subheader>{name}</Header.Subheader>
|
|
103
100
|
)}
|
|
104
101
|
</Header.Content>
|
|
105
102
|
</Header>
|
|
@@ -136,6 +133,7 @@ export const StructureSummary = ({
|
|
|
136
133
|
StructureSummary.propTypes = {
|
|
137
134
|
class: PropTypes.string,
|
|
138
135
|
name: PropTypes.string,
|
|
136
|
+
published_note: PropTypes.object,
|
|
139
137
|
description: PropTypes.string,
|
|
140
138
|
type: PropTypes.string,
|
|
141
139
|
userPermissions: PropTypes.object,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
2
3
|
import { shallow } from "enzyme";
|
|
3
4
|
import { Link } from "react-router-dom";
|
|
4
5
|
import { intl } from "@truedat/test/intl-stub";
|
|
5
|
-
import
|
|
6
|
+
import DefaultStructureItem, {
|
|
7
|
+
StructureItem,
|
|
8
|
+
mapStateToProps,
|
|
9
|
+
} from "../StructureItem";
|
|
6
10
|
|
|
7
11
|
// workaround for enzyme issue with React.useContext
|
|
8
12
|
// see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
|
|
@@ -14,14 +18,27 @@ describe("<StructureItem />", () => {
|
|
|
14
18
|
|
|
15
19
|
it("matches the latest snapshot", () => {
|
|
16
20
|
const props = { id, name };
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
|
|
22
|
+
const { container } = render(<DefaultStructureItem {...props} />);
|
|
23
|
+
expect(container).toMatchSnapshot();
|
|
19
24
|
});
|
|
20
25
|
|
|
21
26
|
it("matches the latest snapshot (active state)", () => {
|
|
22
|
-
const props = {
|
|
23
|
-
const
|
|
24
|
-
|
|
27
|
+
const props = { data_structure_id: 8, name, type: "not_system" };
|
|
28
|
+
const state = {
|
|
29
|
+
structure: { id: 8 },
|
|
30
|
+
};
|
|
31
|
+
const { container } = render(<DefaultStructureItem {...props} />, {
|
|
32
|
+
state,
|
|
33
|
+
});
|
|
34
|
+
expect(container).toMatchSnapshot();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("matches the latest snapshot with alias", () => {
|
|
38
|
+
const props = { id, name, published_note: { alias: "alias" } };
|
|
39
|
+
|
|
40
|
+
const { container } = render(<DefaultStructureItem {...props} />);
|
|
41
|
+
expect(container).toMatchSnapshot();
|
|
25
42
|
});
|
|
26
43
|
|
|
27
44
|
it("renders as a link to the /structures/:id route if id is present", () => {
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
3
|
import { StructureItems } from "../StructureItems";
|
|
4
4
|
|
|
5
5
|
describe("<StructureItems />", () => {
|
|
6
6
|
it("matches the latest snapshot", () => {
|
|
7
|
-
const structures = [{ id: 1 }];
|
|
7
|
+
const structures = [{ id: 1, name: "some structure" }];
|
|
8
8
|
const props = { structures };
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
expect(
|
|
10
|
+
const { container } = render(<StructureItems {...props} />);
|
|
11
|
+
expect(container).toMatchSnapshot();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("matches the latest snapshot with alias", () => {
|
|
15
|
+
const structures = [
|
|
16
|
+
{ id: 1, name: "some structure", published_note: { alias: "alias" } },
|
|
17
|
+
];
|
|
18
|
+
const props = { structures };
|
|
19
|
+
|
|
20
|
+
const { container } = render(<StructureItems {...props} />);
|
|
21
|
+
expect(container).toMatchSnapshot();
|
|
12
22
|
});
|
|
13
23
|
});
|
|
@@ -4,7 +4,7 @@ import StructureProperties from "../StructureProperties";
|
|
|
4
4
|
|
|
5
5
|
describe("<StructureProperties />", () => {
|
|
6
6
|
it("matches the latest snapshot", () => {
|
|
7
|
-
const structure = { description: "dd", group: "gp" };
|
|
7
|
+
const structure = { description: "dd", group: "gp", type: "Database" };
|
|
8
8
|
const state = { structure };
|
|
9
9
|
const { container } = render(<StructureProperties />, { state });
|
|
10
10
|
expect(container).toMatchSnapshot();
|
|
@@ -44,6 +44,19 @@ describe("<StructureSummary />", () => {
|
|
|
44
44
|
expect(wrapper).toMatchSnapshot();
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
+
it("matches the latest snapshot with alias", () => {
|
|
48
|
+
const props = {
|
|
49
|
+
...structure,
|
|
50
|
+
published_note: { alias: "some alias" },
|
|
51
|
+
updatedAt,
|
|
52
|
+
deleted_at,
|
|
53
|
+
structureFields,
|
|
54
|
+
linkedStructureTagsLoading: false,
|
|
55
|
+
};
|
|
56
|
+
const wrapper = shallow(<StructureSummary {...props} />);
|
|
57
|
+
expect(wrapper).toMatchSnapshot();
|
|
58
|
+
});
|
|
59
|
+
|
|
47
60
|
it("renders loading when linkedStructureTagsLoading is true", () => {
|
|
48
61
|
const props = {
|
|
49
62
|
...structure,
|
|
@@ -1,50 +1,75 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<StructureItem /> matches the latest snapshot (active state) 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<a
|
|
6
|
+
class="active item"
|
|
7
|
+
role="listitem"
|
|
8
|
+
title="foo"
|
|
9
|
+
>
|
|
10
|
+
<i
|
|
11
|
+
aria-hidden="true"
|
|
12
|
+
class="question circle outline icon middle aligned"
|
|
13
|
+
/>
|
|
14
|
+
<div
|
|
15
|
+
class="content"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
class="description"
|
|
19
|
+
>
|
|
20
|
+
foo
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</a>
|
|
24
|
+
</div>
|
|
19
25
|
`;
|
|
20
26
|
|
|
21
27
|
exports[`<StructureItem /> matches the latest snapshot 1`] = `
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
28
|
+
<div>
|
|
29
|
+
<a
|
|
30
|
+
class="item"
|
|
31
|
+
href="/structures/1"
|
|
32
|
+
role="listitem"
|
|
33
|
+
title="foo"
|
|
34
|
+
>
|
|
35
|
+
<i
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
class="question circle outline icon middle aligned"
|
|
38
|
+
/>
|
|
39
|
+
<div
|
|
40
|
+
class="content"
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
class="description"
|
|
44
|
+
>
|
|
45
|
+
foo
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</a>
|
|
49
|
+
</div>
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
exports[`<StructureItem /> matches the latest snapshot with alias 1`] = `
|
|
53
|
+
<div>
|
|
54
|
+
<a
|
|
55
|
+
class="item"
|
|
56
|
+
href="/structures/1"
|
|
57
|
+
role="listitem"
|
|
58
|
+
title="alias"
|
|
59
|
+
>
|
|
60
|
+
<i
|
|
61
|
+
aria-hidden="true"
|
|
62
|
+
class="question circle outline icon middle aligned"
|
|
63
|
+
/>
|
|
64
|
+
<div
|
|
65
|
+
class="content"
|
|
66
|
+
>
|
|
67
|
+
<div
|
|
68
|
+
class="description"
|
|
69
|
+
>
|
|
70
|
+
alias
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</a>
|
|
74
|
+
</div>
|
|
50
75
|
`;
|
|
@@ -1,8 +1,51 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<StructureItems /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<a
|
|
6
|
+
class="item"
|
|
7
|
+
href="/structures/1"
|
|
8
|
+
role="listitem"
|
|
9
|
+
title="some structure"
|
|
10
|
+
>
|
|
11
|
+
<i
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
class="question circle outline icon middle aligned"
|
|
14
|
+
/>
|
|
15
|
+
<div
|
|
16
|
+
class="content"
|
|
17
|
+
>
|
|
18
|
+
<div
|
|
19
|
+
class="description"
|
|
20
|
+
>
|
|
21
|
+
some structure
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</a>
|
|
25
|
+
</div>
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
exports[`<StructureItems /> matches the latest snapshot with alias 1`] = `
|
|
29
|
+
<div>
|
|
30
|
+
<a
|
|
31
|
+
class="item"
|
|
32
|
+
href="/structures/1"
|
|
33
|
+
role="listitem"
|
|
34
|
+
title="alias"
|
|
35
|
+
>
|
|
36
|
+
<i
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
class="question circle outline icon middle aligned"
|
|
39
|
+
/>
|
|
40
|
+
<div
|
|
41
|
+
class="content"
|
|
42
|
+
>
|
|
43
|
+
<div
|
|
44
|
+
class="description"
|
|
45
|
+
>
|
|
46
|
+
alias
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</a>
|
|
50
|
+
</div>
|
|
8
51
|
`;
|
|
@@ -95,6 +95,28 @@ exports[`<StructureProperties /> matches the latest snapshot 1`] = `
|
|
|
95
95
|
</div>
|
|
96
96
|
</div>
|
|
97
97
|
</div>
|
|
98
|
+
<div
|
|
99
|
+
class="three wide column"
|
|
100
|
+
>
|
|
101
|
+
<div
|
|
102
|
+
class="item"
|
|
103
|
+
>
|
|
104
|
+
<div
|
|
105
|
+
class="content"
|
|
106
|
+
>
|
|
107
|
+
<h5
|
|
108
|
+
class="header"
|
|
109
|
+
>
|
|
110
|
+
Type
|
|
111
|
+
</h5>
|
|
112
|
+
<div
|
|
113
|
+
class="description"
|
|
114
|
+
>
|
|
115
|
+
Database
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
98
120
|
</div>
|
|
99
121
|
</div>
|
|
100
122
|
</div>
|
|
@@ -16,8 +16,65 @@ exports[`<StructureSummary /> matches the latest snapshot 1`] = `
|
|
|
16
16
|
<HeaderContent>
|
|
17
17
|
s1
|
|
18
18
|
<Connect(StructureGrantRequestButton) />
|
|
19
|
+
</HeaderContent>
|
|
20
|
+
</Header>
|
|
21
|
+
<Dimmer
|
|
22
|
+
active={false}
|
|
23
|
+
inverted={true}
|
|
24
|
+
>
|
|
25
|
+
<Loader />
|
|
26
|
+
</Dimmer>
|
|
27
|
+
</DimmerDimmable>
|
|
28
|
+
</GridColumn>
|
|
29
|
+
<GridColumn
|
|
30
|
+
textAlign="right"
|
|
31
|
+
width={6}
|
|
32
|
+
>
|
|
33
|
+
<Date
|
|
34
|
+
className="alert warning"
|
|
35
|
+
date="2019-01-02T03:04:05Z"
|
|
36
|
+
icon={
|
|
37
|
+
<Icon
|
|
38
|
+
as="i"
|
|
39
|
+
color="red"
|
|
40
|
+
name="warning circle"
|
|
41
|
+
/>
|
|
42
|
+
}
|
|
43
|
+
label="deleted_at"
|
|
44
|
+
/>
|
|
45
|
+
<Connect(ShareLinkPopup)
|
|
46
|
+
description="dd"
|
|
47
|
+
name="s1"
|
|
48
|
+
title="structure.share.title"
|
|
49
|
+
url="http://localhost/"
|
|
50
|
+
/>
|
|
51
|
+
<injectIntl(Connect(StructureConfidentialButton)) />
|
|
52
|
+
</GridColumn>
|
|
53
|
+
</GridRow>
|
|
54
|
+
</Grid>
|
|
55
|
+
<Connect(TagsHeader) />
|
|
56
|
+
<Connect(StructureProperties) />
|
|
57
|
+
</Fragment>
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
exports[`<StructureSummary /> matches the latest snapshot with alias 1`] = `
|
|
61
|
+
<Fragment>
|
|
62
|
+
<Grid>
|
|
63
|
+
<GridRow>
|
|
64
|
+
<GridColumn
|
|
65
|
+
width={10}
|
|
66
|
+
>
|
|
67
|
+
<DimmerDimmable
|
|
68
|
+
dimmed={false}
|
|
69
|
+
>
|
|
70
|
+
<Header
|
|
71
|
+
as="h2"
|
|
72
|
+
>
|
|
73
|
+
<HeaderContent>
|
|
74
|
+
some alias
|
|
75
|
+
<Connect(StructureGrantRequestButton) />
|
|
19
76
|
<HeaderSubheader>
|
|
20
|
-
|
|
77
|
+
s1
|
|
21
78
|
</HeaderSubheader>
|
|
22
79
|
</HeaderContent>
|
|
23
80
|
</Header>
|
|
@@ -84,11 +141,6 @@ exports[`<StructureSummary /> renders custom grant label when grant provided 1`]
|
|
|
84
141
|
<p>
|
|
85
142
|
bar
|
|
86
143
|
</p>
|
|
87
|
-
<div
|
|
88
|
-
class="sub header"
|
|
89
|
-
>
|
|
90
|
-
foo
|
|
91
|
-
</div>
|
|
92
144
|
</div>
|
|
93
145
|
</h2>
|
|
94
146
|
<div
|
|
@@ -198,6 +250,28 @@ exports[`<StructureSummary /> renders custom grant label when grant provided 1`]
|
|
|
198
250
|
</div>
|
|
199
251
|
</div>
|
|
200
252
|
</div>
|
|
253
|
+
<div
|
|
254
|
+
class="three wide column"
|
|
255
|
+
>
|
|
256
|
+
<div
|
|
257
|
+
class="item"
|
|
258
|
+
>
|
|
259
|
+
<div
|
|
260
|
+
class="content"
|
|
261
|
+
>
|
|
262
|
+
<h5
|
|
263
|
+
class="header"
|
|
264
|
+
>
|
|
265
|
+
structure.type
|
|
266
|
+
</h5>
|
|
267
|
+
<div
|
|
268
|
+
class="description"
|
|
269
|
+
>
|
|
270
|
+
foo
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
201
275
|
</div>
|
|
202
276
|
</div>
|
|
203
277
|
</div>
|
|
@@ -233,11 +307,6 @@ exports[`<StructureSummary /> renders label when grant provided 1`] = `
|
|
|
233
307
|
/>
|
|
234
308
|
structure.grant.has_grant
|
|
235
309
|
</div>
|
|
236
|
-
<div
|
|
237
|
-
class="sub header"
|
|
238
|
-
>
|
|
239
|
-
foo
|
|
240
|
-
</div>
|
|
241
310
|
</div>
|
|
242
311
|
</h2>
|
|
243
312
|
<div
|
|
@@ -347,6 +416,28 @@ exports[`<StructureSummary /> renders label when grant provided 1`] = `
|
|
|
347
416
|
</div>
|
|
348
417
|
</div>
|
|
349
418
|
</div>
|
|
419
|
+
<div
|
|
420
|
+
class="three wide column"
|
|
421
|
+
>
|
|
422
|
+
<div
|
|
423
|
+
class="item"
|
|
424
|
+
>
|
|
425
|
+
<div
|
|
426
|
+
class="content"
|
|
427
|
+
>
|
|
428
|
+
<h5
|
|
429
|
+
class="header"
|
|
430
|
+
>
|
|
431
|
+
structure.type
|
|
432
|
+
</h5>
|
|
433
|
+
<div
|
|
434
|
+
class="description"
|
|
435
|
+
>
|
|
436
|
+
foo
|
|
437
|
+
</div>
|
|
438
|
+
</div>
|
|
439
|
+
</div>
|
|
440
|
+
</div>
|
|
350
441
|
</div>
|
|
351
442
|
</div>
|
|
352
443
|
</div>
|
|
@@ -2,24 +2,33 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import { getStructureParent } from "..";
|
|
3
3
|
|
|
4
4
|
const structureParents = [
|
|
5
|
-
{
|
|
5
|
+
{
|
|
6
|
+
id: "1",
|
|
7
|
+
name: "structure",
|
|
8
|
+
type: "structure type",
|
|
9
|
+
published_note: { alias: "alias" },
|
|
10
|
+
},
|
|
6
11
|
];
|
|
7
12
|
const system = { id: "1", name: "system", type: "system" };
|
|
8
13
|
|
|
9
14
|
const structure = {
|
|
10
15
|
id: "1",
|
|
11
16
|
name: "structure",
|
|
12
|
-
system: _.omit(["type"])(system)
|
|
17
|
+
system: _.omit(["type"])(system),
|
|
13
18
|
};
|
|
14
19
|
|
|
15
20
|
describe("selectors: getStructureParent", () => {
|
|
16
21
|
const state = {
|
|
17
22
|
structureParents,
|
|
18
|
-
structure
|
|
23
|
+
structure,
|
|
19
24
|
};
|
|
20
25
|
|
|
21
26
|
it("get structure parent from state when is not empty", () => {
|
|
22
|
-
const reply = _.flow(
|
|
27
|
+
const reply = _.flow(
|
|
28
|
+
_.head,
|
|
29
|
+
_.set("name", ".."),
|
|
30
|
+
_.omit("published_note")
|
|
31
|
+
)(structureParents);
|
|
23
32
|
expect(getStructureParent(state)).toEqual(reply);
|
|
24
33
|
});
|
|
25
34
|
|
|
@@ -10,9 +10,9 @@ describe("selectors: getStructureProperties", () => {
|
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
describe("selectors: getStructureProperties", () => {
|
|
13
|
-
it("should return
|
|
13
|
+
it("should return default properties when present", () => {
|
|
14
14
|
const res = getStructureProperties({});
|
|
15
|
-
expect(res).toHaveLength(
|
|
15
|
+
expect(res).toHaveLength(3);
|
|
16
16
|
expect(res).toEqual(defaultStructureProperties);
|
|
17
17
|
});
|
|
18
18
|
});
|
|
@@ -7,25 +7,31 @@ import { Link } from "react-router-dom";
|
|
|
7
7
|
import { linkTo } from "@truedat/core/routes";
|
|
8
8
|
import { accentInsensitivePathOrder } from "@truedat/core/services/sort";
|
|
9
9
|
|
|
10
|
-
const translateDecorator = text => <FormattedMessage id={text} />;
|
|
10
|
+
const translateDecorator = (text) => <FormattedMessage id={text} />;
|
|
11
11
|
|
|
12
12
|
const translateDecoratorWithDefault = (text, default_text) => (
|
|
13
13
|
<FormattedMessage id={text} defaultMessage={default_text} />
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
const typeDecorator = field =>
|
|
16
|
+
const typeDecorator = (field) =>
|
|
17
17
|
translateDecoratorWithDefault(`structure.type.${field}`, field);
|
|
18
18
|
|
|
19
|
-
const linkToStructureDecorator = ({
|
|
20
|
-
|
|
19
|
+
const linkToStructureDecorator = ({
|
|
20
|
+
data_structure_id: id,
|
|
21
|
+
name,
|
|
22
|
+
published_note,
|
|
23
|
+
}) => (
|
|
24
|
+
<Link to={linkTo.STRUCTURE({ id })}>
|
|
25
|
+
{_.isEmpty(published_note?.alias) ? name : published_note.alias}
|
|
26
|
+
</Link>
|
|
21
27
|
);
|
|
22
28
|
|
|
23
|
-
const nullableDecorator = field =>
|
|
29
|
+
const nullableDecorator = (field) =>
|
|
24
30
|
field
|
|
25
31
|
? translateDecorator("structure.field.nullable.true")
|
|
26
32
|
: translateDecorator("structure.field.nullable.false");
|
|
27
33
|
|
|
28
|
-
const hasDfContentDecorator = has_df_content =>
|
|
34
|
+
const hasDfContentDecorator = (has_df_content) =>
|
|
29
35
|
has_df_content && translateDecorator("structure.field.nullable.true");
|
|
30
36
|
|
|
31
37
|
const lineageLinkDecorator = ({ degree, data_structure_id: id }) =>
|
|
@@ -42,7 +48,7 @@ const lineageLinkDecorator = ({ degree, data_structure_id: id }) =>
|
|
|
42
48
|
</Link>
|
|
43
49
|
);
|
|
44
50
|
|
|
45
|
-
export const linksDecorator = links => {
|
|
51
|
+
export const linksDecorator = (links) => {
|
|
46
52
|
const sortedLinks = _.sortBy(accentInsensitivePathOrder("name"))(links);
|
|
47
53
|
return (
|
|
48
54
|
!_.isEmpty(sortedLinks) && (
|
|
@@ -52,7 +58,7 @@ export const linksDecorator = links => {
|
|
|
52
58
|
<Link
|
|
53
59
|
to={linkTo.CONCEPT_VERSION({
|
|
54
60
|
business_concept_id: resource.resource_id,
|
|
55
|
-
id: "current"
|
|
61
|
+
id: "current",
|
|
56
62
|
})}
|
|
57
63
|
>
|
|
58
64
|
{resource.name}
|
|
@@ -67,8 +73,8 @@ export const linksDecorator = links => {
|
|
|
67
73
|
export const defaultStructureFieldColumns = [
|
|
68
74
|
{
|
|
69
75
|
name: "name",
|
|
70
|
-
fieldSelector: _.pick(["data_structure_id", "name"]),
|
|
71
|
-
fieldDecorator: linkToStructureDecorator
|
|
76
|
+
fieldSelector: _.pick(["data_structure_id", "name", "published_note"]),
|
|
77
|
+
fieldDecorator: linkToStructureDecorator,
|
|
72
78
|
},
|
|
73
79
|
{ name: "type", fieldDecorator: typeDecorator },
|
|
74
80
|
{ name: "precision" },
|
|
@@ -76,18 +82,18 @@ export const defaultStructureFieldColumns = [
|
|
|
76
82
|
{ name: "description" },
|
|
77
83
|
{
|
|
78
84
|
name: "has_df_content",
|
|
79
|
-
fieldDecorator: hasDfContentDecorator
|
|
85
|
+
fieldDecorator: hasDfContentDecorator,
|
|
80
86
|
},
|
|
81
87
|
{
|
|
82
88
|
name: "degree",
|
|
83
89
|
fieldSelector: _.pick(["degree", "data_structure_id"]),
|
|
84
90
|
fieldDecorator: lineageLinkDecorator,
|
|
85
|
-
textAlign: "center"
|
|
91
|
+
textAlign: "center",
|
|
86
92
|
},
|
|
87
93
|
{
|
|
88
94
|
name: "links",
|
|
89
|
-
fieldDecorator: linksDecorator
|
|
90
|
-
}
|
|
95
|
+
fieldDecorator: linksDecorator,
|
|
96
|
+
},
|
|
91
97
|
];
|
|
92
98
|
|
|
93
99
|
export const getStructureFieldColumns = createSelector(
|
|
@@ -3,16 +3,21 @@ import { createSelector } from "reselect";
|
|
|
3
3
|
|
|
4
4
|
const defaultName = "..";
|
|
5
5
|
|
|
6
|
-
const systemNavItem = structure =>
|
|
6
|
+
const systemNavItem = (structure) =>
|
|
7
7
|
_.flow(
|
|
8
8
|
_.propOr({}, "system"),
|
|
9
9
|
_.pick(["id", "name"]),
|
|
10
10
|
_.set("type", "system"),
|
|
11
|
-
_.set("name", defaultName)
|
|
11
|
+
_.set("name", defaultName),
|
|
12
|
+
_.omit(["published_note"])
|
|
12
13
|
)(structure);
|
|
13
14
|
|
|
14
|
-
const structureNavItem = structures =>
|
|
15
|
-
_.flow(
|
|
15
|
+
const structureNavItem = (structures) =>
|
|
16
|
+
_.flow(
|
|
17
|
+
_.head,
|
|
18
|
+
_.set("name", defaultName),
|
|
19
|
+
_.omit(["published_note"])
|
|
20
|
+
)(structures);
|
|
16
21
|
|
|
17
22
|
export const getStructureParent = createSelector(
|
|
18
23
|
[_.propOr({}, "structure"), _.propOr([], "structureParents")],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { createSelector } from "reselect";
|
|
4
|
+
import { FormattedMessage } from "react-intl";
|
|
4
5
|
import EditDomainPopup from "../components/EditDomainPopup";
|
|
5
6
|
|
|
6
7
|
const domainDecorator = (domainNames) => (
|
|
@@ -10,6 +11,12 @@ const domainDecorator = (domainNames) => (
|
|
|
10
11
|
</>
|
|
11
12
|
);
|
|
12
13
|
|
|
14
|
+
const typeDecorator = ({ type, data_structure_type }) => (
|
|
15
|
+
<FormattedMessage
|
|
16
|
+
id={`structure.type.${type}.text`}
|
|
17
|
+
defaultMessage={_.get("translation")(data_structure_type) || type}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
13
20
|
export const defaultStructureProperties = [
|
|
14
21
|
{
|
|
15
22
|
name: "domain",
|
|
@@ -17,6 +24,11 @@ export const defaultStructureProperties = [
|
|
|
17
24
|
fieldDecorator: domainDecorator,
|
|
18
25
|
},
|
|
19
26
|
{ name: "group" },
|
|
27
|
+
{
|
|
28
|
+
name: "type",
|
|
29
|
+
fieldSelector: _.pick(["type", "data_structure_type"]),
|
|
30
|
+
fieldDecorator: typeDecorator,
|
|
31
|
+
},
|
|
20
32
|
];
|
|
21
33
|
|
|
22
34
|
export const getStructureProperties = createSelector(
|
|
@@ -14,9 +14,15 @@ const typeTranslateDecorator = ({ type, data_structure_type }) => (
|
|
|
14
14
|
const dateDecorator = (date) => (
|
|
15
15
|
<Moment locale="es" date={date} format="YYYY-MM-DD HH:mm" />
|
|
16
16
|
);
|
|
17
|
-
|
|
17
|
+
const nameFieldSelector = ({ name, published_note }) =>
|
|
18
|
+
_.isEmpty(published_note?.alias) ? name : published_note.alias;
|
|
18
19
|
export const defaultStructureColumns = [
|
|
19
|
-
{
|
|
20
|
+
{
|
|
21
|
+
name: "name",
|
|
22
|
+
fieldSelector: nameFieldSelector,
|
|
23
|
+
sort: { name: "name.sort" },
|
|
24
|
+
width: 2,
|
|
25
|
+
},
|
|
20
26
|
{
|
|
21
27
|
name: "type",
|
|
22
28
|
fieldSelector: _.pick(["type", "data_structure_type"]),
|
|
@@ -82,5 +88,7 @@ export const structureRowsSelector = createSelector(
|
|
|
82
88
|
getStructures,
|
|
83
89
|
getStructureColumnNames,
|
|
84
90
|
(structures, columnNames) =>
|
|
85
|
-
_.map(_.pick([...columnNames, "id", "domain_id"]))(
|
|
91
|
+
_.map(_.pick([...columnNames, "id", "domain_id", "published_note"]))(
|
|
92
|
+
structures
|
|
93
|
+
)
|
|
86
94
|
);
|