@truedat/dd 6.6.6 → 6.7.0
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/Grant.js +1 -1
- package/src/components/SystemCards.js +13 -6
- package/src/components/__tests__/GrantRequest.spec.js +3 -4
- package/src/components/__tests__/StructureNotes.spec.js +10 -7
- package/src/components/__tests__/StructureNotesEdit.spec.js +4 -4
- package/src/components/__tests__/StructuresBulkUpdate.spec.js +2 -2
- package/src/components/__tests__/SystemCards.spec.js +6 -6
- package/src/reducers/__tests__/grantRequests.spec.js +1 -1
- package/src/selectors/__tests__/getSortedStructureNotes.spec.js +15 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
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.7.0",
|
|
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.7.0",
|
|
92
|
+
"@truedat/core": "6.7.0",
|
|
93
|
+
"@truedat/df": "6.7.0",
|
|
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": "6a4284b126a917e396160f1b36c03ca0faf6bac5"
|
|
119
119
|
}
|
package/src/components/Grant.js
CHANGED
|
@@ -13,11 +13,15 @@ import { linkTo } from "@truedat/core/routes";
|
|
|
13
13
|
export const SystemCards = ({ systems, structureTypes }) => {
|
|
14
14
|
const groups = _.flow(
|
|
15
15
|
_.map((system) =>
|
|
16
|
-
!system.df_content?.system_group
|
|
17
|
-
? _.set(
|
|
16
|
+
!system.df_content?.system_group?.value
|
|
17
|
+
? _.set(
|
|
18
|
+
"df_content.system_group",
|
|
19
|
+
{ value: "default", origin: "default" },
|
|
20
|
+
system
|
|
21
|
+
)
|
|
18
22
|
: system
|
|
19
23
|
),
|
|
20
|
-
_.groupBy("df_content.system_group")
|
|
24
|
+
_.groupBy("df_content.system_group.value")
|
|
21
25
|
)(systems);
|
|
22
26
|
|
|
23
27
|
return Object.keys(groups).length > 1 ? (
|
|
@@ -60,9 +64,12 @@ export const SystemCard = ({
|
|
|
60
64
|
structureTypes={structureTypes}
|
|
61
65
|
/>
|
|
62
66
|
)}
|
|
63
|
-
{!_.isEmpty(_.get("logo")(df_content)) &&
|
|
64
|
-
_.startsWith("data:image")(_.get("logo")(df_content)) && (
|
|
65
|
-
<Image
|
|
67
|
+
{!_.isEmpty(_.get("logo.value")(df_content)) &&
|
|
68
|
+
_.startsWith("data:image")(_.get("logo.value")(df_content)) && (
|
|
69
|
+
<Image
|
|
70
|
+
src={_.get("logo.value")(df_content)}
|
|
71
|
+
className="system-image"
|
|
72
|
+
/>
|
|
66
73
|
)}
|
|
67
74
|
</Card.Content>
|
|
68
75
|
</Card>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Suspense } from "react";
|
|
2
2
|
import { render } from "@truedat/test/render";
|
|
3
3
|
import { GrantRequest } from "../GrantRequest";
|
|
4
|
-
import en from "../../messages/en";
|
|
5
4
|
|
|
6
5
|
describe("<GrantRequest />", () => {
|
|
7
6
|
const grantRequest = {
|
|
@@ -23,7 +22,7 @@ describe("<GrantRequest />", () => {
|
|
|
23
22
|
},
|
|
24
23
|
inserted_at: "2021-10-04T07:25:01.041463Z",
|
|
25
24
|
updated_at: "2021-10-04T07:25:01.044005Z",
|
|
26
|
-
metadata: { bar: "baz" },
|
|
25
|
+
metadata: { bar: { value: "baz", origin: "user" } },
|
|
27
26
|
status: "pending",
|
|
28
27
|
_embedded: {
|
|
29
28
|
data_structure: { id: 1, name: "baz", path: [{ name: "foo" }] },
|
|
@@ -40,7 +39,7 @@ describe("<GrantRequest />", () => {
|
|
|
40
39
|
fields: [
|
|
41
40
|
{
|
|
42
41
|
cardinality: "?",
|
|
43
|
-
default: "",
|
|
42
|
+
default: { value: "", origin: "default" },
|
|
44
43
|
label: "bar",
|
|
45
44
|
name: "bar",
|
|
46
45
|
values: null,
|
|
@@ -110,7 +109,7 @@ describe("<GrantRequest />", () => {
|
|
|
110
109
|
filters: {},
|
|
111
110
|
inserted_at: "2021-10-04T07:25:01.041463Z",
|
|
112
111
|
updated_at: "2021-10-04T07:25:01.044005Z",
|
|
113
|
-
metadata: { bar: "baz" },
|
|
112
|
+
metadata: { bar: { value: "baz", origin: "user" } },
|
|
114
113
|
status: "failed",
|
|
115
114
|
status_reason: "there is always a reason",
|
|
116
115
|
_embedded: {
|
|
@@ -17,7 +17,7 @@ describe("<StructureNotes />", () => {
|
|
|
17
17
|
{
|
|
18
18
|
id: 2,
|
|
19
19
|
status: "published",
|
|
20
|
-
df_content: { foo: "bar" },
|
|
20
|
+
df_content: { foo: { value: "bar", origin: "user" } },
|
|
21
21
|
version: "2",
|
|
22
22
|
},
|
|
23
23
|
],
|
|
@@ -25,7 +25,7 @@ describe("<StructureNotes />", () => {
|
|
|
25
25
|
{
|
|
26
26
|
id: 1,
|
|
27
27
|
status: "versioned",
|
|
28
|
-
df_content: { foo: "bar1" },
|
|
28
|
+
df_content: { foo: { value: "bar1", origin: "user" } },
|
|
29
29
|
version: "1",
|
|
30
30
|
},
|
|
31
31
|
],
|
|
@@ -51,19 +51,22 @@ describe("<StructureNotes />", () => {
|
|
|
51
51
|
it("matches the latest snapshot with draft structure note", async () => {
|
|
52
52
|
const props = {
|
|
53
53
|
structure: { id: 1 },
|
|
54
|
-
structureNotes: {
|
|
54
|
+
structureNotes: {
|
|
55
|
+
_actions: { foo: { value: "bar", origin: "user" } },
|
|
56
|
+
loading: false,
|
|
57
|
+
},
|
|
55
58
|
activeStructureNotes: [
|
|
56
59
|
{
|
|
57
60
|
id: 3,
|
|
58
61
|
status: "draft",
|
|
59
|
-
df_content: { foo: "xyz" },
|
|
62
|
+
df_content: { foo: { value: "xyz", origin: "user" } },
|
|
60
63
|
version: "3",
|
|
61
64
|
_diff: ["foo"],
|
|
62
65
|
},
|
|
63
66
|
{
|
|
64
67
|
id: 2,
|
|
65
68
|
status: "published",
|
|
66
|
-
df_content: { foo: "bar" },
|
|
69
|
+
df_content: { foo: { value: "bar", origin: "user" } },
|
|
67
70
|
version: "2",
|
|
68
71
|
},
|
|
69
72
|
],
|
|
@@ -71,7 +74,7 @@ describe("<StructureNotes />", () => {
|
|
|
71
74
|
{
|
|
72
75
|
id: 1,
|
|
73
76
|
status: "versioned",
|
|
74
|
-
df_content: { foo: "bar1" },
|
|
77
|
+
df_content: { foo: { value: "bar1", origin: "user" } },
|
|
75
78
|
version: "1",
|
|
76
79
|
},
|
|
77
80
|
],
|
|
@@ -82,7 +85,7 @@ describe("<StructureNotes />", () => {
|
|
|
82
85
|
fields: [
|
|
83
86
|
{
|
|
84
87
|
cardinality: "?",
|
|
85
|
-
default: "",
|
|
88
|
+
default: { value: "", origin: "default" },
|
|
86
89
|
label: "foo",
|
|
87
90
|
name: "foo",
|
|
88
91
|
type: "string",
|
|
@@ -16,7 +16,7 @@ describe("<StructureNotesEdit />", () => {
|
|
|
16
16
|
structureNotes: {
|
|
17
17
|
structureNotes: [],
|
|
18
18
|
},
|
|
19
|
-
latestDfContent: { foo: "bar" },
|
|
19
|
+
latestDfContent: { foo: { value: "bar", origin: "user" } },
|
|
20
20
|
applyTemplate: applyTemplate({ id: 2 }),
|
|
21
21
|
selectDomains: jest.fn(),
|
|
22
22
|
};
|
|
@@ -41,7 +41,7 @@ describe("<StructureNotesEdit />", () => {
|
|
|
41
41
|
},
|
|
42
42
|
structureNotes: [],
|
|
43
43
|
},
|
|
44
|
-
latestDfContent: { foo: "bar" },
|
|
44
|
+
latestDfContent: { foo: { value: "bar", origin: "user" } },
|
|
45
45
|
applyTemplate: applyTemplate({ id: 2 }),
|
|
46
46
|
selectDomains: jest.fn(),
|
|
47
47
|
};
|
|
@@ -89,7 +89,7 @@ describe("<StructureNotesEdit />", () => {
|
|
|
89
89
|
structureNotes: {
|
|
90
90
|
structureNotes: [],
|
|
91
91
|
},
|
|
92
|
-
latestDfContent: { foo: "bar" },
|
|
92
|
+
latestDfContent: { foo: { value: "bar", origin: "user" } },
|
|
93
93
|
applyTemplate: applyTemplate(template),
|
|
94
94
|
selectDomains: jest.fn(),
|
|
95
95
|
};
|
|
@@ -108,7 +108,7 @@ describe("<StructureNotesEdit />", () => {
|
|
|
108
108
|
expect(doStructureNoteAction).toHaveBeenCalledWith(
|
|
109
109
|
expect.objectContaining({
|
|
110
110
|
action: {
|
|
111
|
-
input: { df_content: { foo: "bar" } },
|
|
111
|
+
input: { df_content: { foo: { value: "bar", origin: "user" } } },
|
|
112
112
|
},
|
|
113
113
|
dataStructureId: 1,
|
|
114
114
|
redirect: true,
|
|
@@ -89,7 +89,7 @@ describe("<StructuresBulkUpdate />", () => {
|
|
|
89
89
|
structureCount: 10,
|
|
90
90
|
update_attributes: {
|
|
91
91
|
df_content: {
|
|
92
|
-
field1: "bar",
|
|
92
|
+
field1: { value: "bar", origin: "user" },
|
|
93
93
|
},
|
|
94
94
|
},
|
|
95
95
|
},
|
|
@@ -126,7 +126,7 @@ describe("<StructuresBulkUpdate />", () => {
|
|
|
126
126
|
structureCount: 10,
|
|
127
127
|
update_attributes: {
|
|
128
128
|
df_content: {
|
|
129
|
-
field1: "bar",
|
|
129
|
+
field1: { value: "bar", origin: "user" },
|
|
130
130
|
},
|
|
131
131
|
},
|
|
132
132
|
},
|
|
@@ -43,7 +43,7 @@ describe("<SystemCards />", () => {
|
|
|
43
43
|
{
|
|
44
44
|
...system_with_structures,
|
|
45
45
|
df_content: {
|
|
46
|
-
system_group: "foo-group",
|
|
46
|
+
system_group: { value: "foo-group", origin: "user" },
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
{ ...system_without_structures },
|
|
@@ -78,7 +78,7 @@ describe("<SystemCards />", () => {
|
|
|
78
78
|
{
|
|
79
79
|
...system_with_structures,
|
|
80
80
|
df_content: {
|
|
81
|
-
logo: imageSrc,
|
|
81
|
+
logo: { value: imageSrc, origin: "user" },
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
{ ...system_without_structures },
|
|
@@ -108,13 +108,13 @@ describe("<SystemCards />", () => {
|
|
|
108
108
|
{
|
|
109
109
|
...system_with_structures,
|
|
110
110
|
df_content: {
|
|
111
|
-
system_group: "foo-group",
|
|
111
|
+
system_group: { value: "foo-group", origin: "user" },
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
...system_without_structures,
|
|
116
116
|
df_content: {
|
|
117
|
-
system_group: "foo-group",
|
|
117
|
+
system_group: { value: "foo-group", origin: "user" },
|
|
118
118
|
},
|
|
119
119
|
},
|
|
120
120
|
];
|
|
@@ -134,13 +134,13 @@ describe("<SystemCards />", () => {
|
|
|
134
134
|
{
|
|
135
135
|
...system_with_structures,
|
|
136
136
|
df_content: {
|
|
137
|
-
system_group: "foo-group",
|
|
137
|
+
system_group: { value: "foo-group", origin: "user" },
|
|
138
138
|
},
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
141
|
...system_without_structures,
|
|
142
142
|
df_content: {
|
|
143
|
-
system_group: "",
|
|
143
|
+
system_group: { value: "", origin: "user" },
|
|
144
144
|
},
|
|
145
145
|
},
|
|
146
146
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getActiveStructureNotes,
|
|
3
3
|
getVersionedStructureNotes,
|
|
4
|
-
getLatestDfContent
|
|
4
|
+
getLatestDfContent,
|
|
5
5
|
} from "..";
|
|
6
6
|
|
|
7
7
|
const sn1 = {
|
|
@@ -9,28 +9,37 @@ const sn1 = {
|
|
|
9
9
|
data_structure_id: 1,
|
|
10
10
|
version: 1,
|
|
11
11
|
status: "versioned",
|
|
12
|
-
df_content: {
|
|
12
|
+
df_content: {
|
|
13
|
+
c1: { value: 1, origin: "user" },
|
|
14
|
+
c2: { value: 2, origin: "user" },
|
|
15
|
+
},
|
|
13
16
|
};
|
|
14
17
|
const sn2 = {
|
|
15
18
|
id: 2,
|
|
16
19
|
data_structure_id: 1,
|
|
17
20
|
version: 2,
|
|
18
21
|
status: "published",
|
|
19
|
-
df_content: {
|
|
22
|
+
df_content: {
|
|
23
|
+
c1: { value: 2, origin: "user" },
|
|
24
|
+
c2: { value: 4, origin: "user" },
|
|
25
|
+
},
|
|
20
26
|
};
|
|
21
27
|
const sn3 = {
|
|
22
28
|
id: 3,
|
|
23
29
|
data_structure_id: 1,
|
|
24
30
|
version: 3,
|
|
25
31
|
status: "draft",
|
|
26
|
-
df_content: {
|
|
32
|
+
df_content: {
|
|
33
|
+
c1: { value: 3, origin: "user" },
|
|
34
|
+
c2: { value: 6, origin: "user" },
|
|
35
|
+
},
|
|
27
36
|
};
|
|
28
37
|
|
|
29
38
|
describe("selectors: getSortedStructureNotes", () => {
|
|
30
39
|
const state = {
|
|
31
40
|
structureNotes: {
|
|
32
|
-
structureNotes: [sn1, sn2, sn3]
|
|
33
|
-
}
|
|
41
|
+
structureNotes: [sn1, sn2, sn3],
|
|
42
|
+
},
|
|
34
43
|
};
|
|
35
44
|
|
|
36
45
|
const activeStructureNotes = [sn3, sn2];
|