@truedat/dd 6.7.1 → 6.8.2
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/components/GrantRequest.js +6 -3
- package/src/components/StructureNotes.js +1 -1
- package/src/components/SystemCards.js +20 -18
- package/src/components/SystemView.js +7 -4
- package/src/components/__tests__/GrantRequest.spec.js +2 -2
- package/src/components/__tests__/SystemCards.spec.js +6 -6
- package/src/selectors/__tests__/getSortedStructureNotes.spec.js +4 -4
- package/src/selectors/getSortedStructureNotes.js +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.2",
|
|
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": "6.
|
|
37
|
+
"@truedat/test": "6.8.2",
|
|
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.7.1",
|
|
91
|
-
"@truedat/auth": "6.
|
|
92
|
-
"@truedat/core": "6.
|
|
93
|
-
"@truedat/df": "6.
|
|
91
|
+
"@truedat/auth": "6.8.2",
|
|
92
|
+
"@truedat/core": "6.8.2",
|
|
93
|
+
"@truedat/df": "6.8.2",
|
|
94
94
|
"lodash": "^4.17.21",
|
|
95
95
|
"moment": "^2.29.4",
|
|
96
96
|
"path-to-regexp": "^1.7.0",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"react-dom": ">= 16.8.6 < 17",
|
|
116
116
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "be2060255c20fe0ae577185fcc990a07a3644106"
|
|
119
119
|
}
|
|
@@ -21,7 +21,7 @@ const ConditionSummary = React.lazy(() =>
|
|
|
21
21
|
|
|
22
22
|
export const GrantRequest = ({ grantRequest, template }) => {
|
|
23
23
|
const { formatMessage } = useIntl();
|
|
24
|
-
const
|
|
24
|
+
const dynamic_content = grantRequest?.dynamic_content;
|
|
25
25
|
const data_structure = grantRequest?._embedded?.data_structure;
|
|
26
26
|
const path = _.flow(
|
|
27
27
|
_.map("name"),
|
|
@@ -101,8 +101,11 @@ export const GrantRequest = ({ grantRequest, template }) => {
|
|
|
101
101
|
</List.Description>
|
|
102
102
|
</List.Item>
|
|
103
103
|
</List>
|
|
104
|
-
{
|
|
105
|
-
<DynamicFormViewer
|
|
104
|
+
{dynamic_content && template && (
|
|
105
|
+
<DynamicFormViewer
|
|
106
|
+
template={template}
|
|
107
|
+
content={dynamic_content}
|
|
108
|
+
/>
|
|
106
109
|
)}
|
|
107
110
|
</Segment>
|
|
108
111
|
</Grid.Column>
|
|
@@ -76,7 +76,7 @@ const StructureNote = ({ structureNote, template, structure, notesSize }) => {
|
|
|
76
76
|
{!collapsed && (
|
|
77
77
|
<DynamicFormViewer
|
|
78
78
|
template={template}
|
|
79
|
-
content={structureNote.
|
|
79
|
+
content={structureNote.dynamic_content}
|
|
80
80
|
diff={structureNote._diff}
|
|
81
81
|
/>
|
|
82
82
|
)}
|
|
@@ -13,31 +13,33 @@ import { linkTo } from "@truedat/core/routes";
|
|
|
13
13
|
export const SystemCards = ({ systems, structureTypes }) => {
|
|
14
14
|
const groups = _.flow(
|
|
15
15
|
_.map((system) =>
|
|
16
|
-
!system.
|
|
16
|
+
!system.dynamic_content?.system_group?.value
|
|
17
17
|
? _.set(
|
|
18
|
-
"
|
|
18
|
+
"dynamic_content.system_group",
|
|
19
19
|
{ value: "default", origin: "default" },
|
|
20
20
|
system
|
|
21
21
|
)
|
|
22
22
|
: system
|
|
23
23
|
),
|
|
24
|
-
_.groupBy("
|
|
24
|
+
_.groupBy("dynamic_content.system_group.value")
|
|
25
25
|
)(systems);
|
|
26
26
|
|
|
27
27
|
return Object.keys(groups).length > 1 ? (
|
|
28
28
|
<CardGroupsAccordion groups={groups} cardComponent={SystemCard} />
|
|
29
29
|
) : (
|
|
30
30
|
<Card.Group className="structures">
|
|
31
|
-
{_.map(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
{_.map(
|
|
32
|
+
({ id, name, structures_count: structures_count, dynamic_content }) => (
|
|
33
|
+
<SystemCard
|
|
34
|
+
key={id}
|
|
35
|
+
id={id}
|
|
36
|
+
name={name}
|
|
37
|
+
structures_count={structures_count}
|
|
38
|
+
dynamic_content={dynamic_content}
|
|
39
|
+
structureTypes={structureTypes}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
42
|
+
)(systems)}
|
|
41
43
|
</Card.Group>
|
|
42
44
|
);
|
|
43
45
|
};
|
|
@@ -51,7 +53,7 @@ export const SystemCard = ({
|
|
|
51
53
|
id,
|
|
52
54
|
name,
|
|
53
55
|
structures_count,
|
|
54
|
-
|
|
56
|
+
dynamic_content,
|
|
55
57
|
structureTypes,
|
|
56
58
|
}) => {
|
|
57
59
|
return (
|
|
@@ -64,10 +66,10 @@ export const SystemCard = ({
|
|
|
64
66
|
structureTypes={structureTypes}
|
|
65
67
|
/>
|
|
66
68
|
)}
|
|
67
|
-
{!_.isEmpty(_.get("logo.value")(
|
|
68
|
-
_.startsWith("data:image")(_.get("logo.value")(
|
|
69
|
+
{!_.isEmpty(_.get("logo.value")(dynamic_content)) &&
|
|
70
|
+
_.startsWith("data:image")(_.get("logo.value")(dynamic_content)) && (
|
|
69
71
|
<Image
|
|
70
|
-
src={_.get("logo.value")(
|
|
72
|
+
src={_.get("logo.value")(dynamic_content)}
|
|
71
73
|
className="system-image"
|
|
72
74
|
/>
|
|
73
75
|
)}
|
|
@@ -80,7 +82,7 @@ SystemCard.propTypes = {
|
|
|
80
82
|
id: PropTypes.number,
|
|
81
83
|
name: PropTypes.string,
|
|
82
84
|
structures_count: PropTypes.object,
|
|
83
|
-
|
|
85
|
+
dynamic_content: PropTypes.object,
|
|
84
86
|
structureTypes: PropTypes.array,
|
|
85
87
|
};
|
|
86
88
|
|
|
@@ -11,7 +11,7 @@ const DynamicFormViewer = React.lazy(() =>
|
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
export const SystemView = ({ system, systemTemplate }) => {
|
|
14
|
-
const { name, external_id,
|
|
14
|
+
const { name, external_id, dynamic_content } = system || {};
|
|
15
15
|
const SystemHeader = () => (
|
|
16
16
|
<Header as="h2">
|
|
17
17
|
<Header.Content>
|
|
@@ -24,7 +24,7 @@ export const SystemView = ({ system, systemTemplate }) => {
|
|
|
24
24
|
<div
|
|
25
25
|
style={{
|
|
26
26
|
textAlign: "center",
|
|
27
|
-
paddingBottom: "100px"
|
|
27
|
+
paddingBottom: "100px",
|
|
28
28
|
}}
|
|
29
29
|
>
|
|
30
30
|
<Image className="search" src={searchImage} />
|
|
@@ -38,11 +38,14 @@ export const SystemView = ({ system, systemTemplate }) => {
|
|
|
38
38
|
<Segment>
|
|
39
39
|
<SystemEditButton system={system} />
|
|
40
40
|
<SystemHeader />
|
|
41
|
-
{_.isEmpty(
|
|
41
|
+
{_.isEmpty(dynamic_content || {}) ? (
|
|
42
42
|
<EmptyImage />
|
|
43
43
|
) : (
|
|
44
44
|
systemTemplate && (
|
|
45
|
-
<DynamicFormViewer
|
|
45
|
+
<DynamicFormViewer
|
|
46
|
+
template={systemTemplate}
|
|
47
|
+
content={dynamic_content}
|
|
48
|
+
/>
|
|
46
49
|
)
|
|
47
50
|
)}
|
|
48
51
|
</Segment>
|
|
@@ -22,7 +22,7 @@ describe("<GrantRequest />", () => {
|
|
|
22
22
|
},
|
|
23
23
|
inserted_at: "2021-10-04T07:25:01.041463Z",
|
|
24
24
|
updated_at: "2021-10-04T07:25:01.044005Z",
|
|
25
|
-
|
|
25
|
+
dynamic_content: { bar: { value: "baz", origin: "user" } },
|
|
26
26
|
status: "pending",
|
|
27
27
|
_embedded: {
|
|
28
28
|
data_structure: { id: 1, name: "baz", path: [{ name: "foo" }] },
|
|
@@ -109,7 +109,7 @@ describe("<GrantRequest />", () => {
|
|
|
109
109
|
filters: {},
|
|
110
110
|
inserted_at: "2021-10-04T07:25:01.041463Z",
|
|
111
111
|
updated_at: "2021-10-04T07:25:01.044005Z",
|
|
112
|
-
|
|
112
|
+
dynamic_content: { bar: { value: "baz", origin: "user" } },
|
|
113
113
|
status: "failed",
|
|
114
114
|
status_reason: "there is always a reason",
|
|
115
115
|
_embedded: {
|
|
@@ -42,7 +42,7 @@ describe("<SystemCards />", () => {
|
|
|
42
42
|
const systems = [
|
|
43
43
|
{
|
|
44
44
|
...system_with_structures,
|
|
45
|
-
|
|
45
|
+
dynamic_content: {
|
|
46
46
|
system_group: { value: "foo-group", origin: "user" },
|
|
47
47
|
},
|
|
48
48
|
},
|
|
@@ -77,7 +77,7 @@ describe("<SystemCards />", () => {
|
|
|
77
77
|
const systems = [
|
|
78
78
|
{
|
|
79
79
|
...system_with_structures,
|
|
80
|
-
|
|
80
|
+
dynamic_content: {
|
|
81
81
|
logo: { value: imageSrc, origin: "user" },
|
|
82
82
|
},
|
|
83
83
|
},
|
|
@@ -107,13 +107,13 @@ describe("<SystemCards />", () => {
|
|
|
107
107
|
const systems = [
|
|
108
108
|
{
|
|
109
109
|
...system_with_structures,
|
|
110
|
-
|
|
110
|
+
dynamic_content: {
|
|
111
111
|
system_group: { value: "foo-group", origin: "user" },
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
...system_without_structures,
|
|
116
|
-
|
|
116
|
+
dynamic_content: {
|
|
117
117
|
system_group: { value: "foo-group", origin: "user" },
|
|
118
118
|
},
|
|
119
119
|
},
|
|
@@ -133,13 +133,13 @@ describe("<SystemCards />", () => {
|
|
|
133
133
|
const systems = [
|
|
134
134
|
{
|
|
135
135
|
...system_with_structures,
|
|
136
|
-
|
|
136
|
+
dynamic_content: {
|
|
137
137
|
system_group: { value: "foo-group", origin: "user" },
|
|
138
138
|
},
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
141
|
...system_without_structures,
|
|
142
|
-
|
|
142
|
+
dynamic_content: {
|
|
143
143
|
system_group: { value: "", origin: "user" },
|
|
144
144
|
},
|
|
145
145
|
},
|
|
@@ -9,7 +9,7 @@ const sn1 = {
|
|
|
9
9
|
data_structure_id: 1,
|
|
10
10
|
version: 1,
|
|
11
11
|
status: "versioned",
|
|
12
|
-
|
|
12
|
+
dynamic_content: {
|
|
13
13
|
c1: { value: 1, origin: "user" },
|
|
14
14
|
c2: { value: 2, origin: "user" },
|
|
15
15
|
},
|
|
@@ -19,7 +19,7 @@ const sn2 = {
|
|
|
19
19
|
data_structure_id: 1,
|
|
20
20
|
version: 2,
|
|
21
21
|
status: "published",
|
|
22
|
-
|
|
22
|
+
dynamic_content: {
|
|
23
23
|
c1: { value: 2, origin: "user" },
|
|
24
24
|
c2: { value: 4, origin: "user" },
|
|
25
25
|
},
|
|
@@ -29,7 +29,7 @@ const sn3 = {
|
|
|
29
29
|
data_structure_id: 1,
|
|
30
30
|
version: 3,
|
|
31
31
|
status: "draft",
|
|
32
|
-
|
|
32
|
+
dynamic_content: {
|
|
33
33
|
c1: { value: 3, origin: "user" },
|
|
34
34
|
c2: { value: 6, origin: "user" },
|
|
35
35
|
},
|
|
@@ -44,7 +44,7 @@ describe("selectors: getSortedStructureNotes", () => {
|
|
|
44
44
|
|
|
45
45
|
const activeStructureNotes = [sn3, sn2];
|
|
46
46
|
const versionedStructureNotes = [sn1];
|
|
47
|
-
const latestDfContent = sn3.
|
|
47
|
+
const latestDfContent = sn3.dynamic_content;
|
|
48
48
|
|
|
49
49
|
it("getActiveStructureNotes", () => {
|
|
50
50
|
expect(getActiveStructureNotes(state)).toEqual(activeStructureNotes);
|
|
@@ -15,5 +15,9 @@ export const getVersionedStructureNotes = createSelector(
|
|
|
15
15
|
|
|
16
16
|
export const getLatestDfContent = createSelector(
|
|
17
17
|
_.prop("structureNotes.structureNotes"),
|
|
18
|
-
_.flow(
|
|
18
|
+
_.flow(
|
|
19
|
+
_.orderBy(["version"], ["desc"]),
|
|
20
|
+
_.head,
|
|
21
|
+
_.getOr({}, "dynamic_content")
|
|
22
|
+
)
|
|
19
23
|
);
|