@truedat/dd 4.40.0 → 4.40.3
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 +13 -0
- package/package.json +6 -6
- package/src/components/EditDomainForm.js +26 -17
- package/src/components/EditDomainPopup.js +1 -1
- package/src/components/StructureConfidentialButton.js +5 -2
- package/src/components/StructuresBulkUpdate.js +12 -18
- package/src/components/StructuresOptions.js +7 -7
- package/src/components/StructuresRoutes.js +0 -18
- package/src/components/StructuresView.js +4 -18
- package/src/components/__tests__/EditDomainForm.spec.js +38 -5
- package/src/components/__tests__/StructuresBulkUpdate.spec.js +2 -2
- package/src/components/__tests__/StructuresOptions.spec.js +19 -0
- package/src/components/__tests__/StructuresView.spec.js +5 -7
- package/src/components/__tests__/__snapshots__/EditDomainForm.spec.js.snap +5 -1
- package/src/components/__tests__/__snapshots__/StructureSummary.spec.js.snap +2 -0
- package/src/components/__tests__/__snapshots__/StructuresOptions.spec.js.snap +77 -0
- package/src/components/__tests__/__snapshots__/StructuresView.spec.js.snap +1 -2
- package/src/messages/en.js +2 -2
- package/src/messages/es.js +2 -2
- package/src/reducers/__tests__/structure.spec.js +2 -2
- package/src/reducers/__tests__/structuresActions.spec.js +38 -0
- package/src/reducers/index.js +18 -16
- package/src/reducers/structure.js +2 -2
- package/src/reducers/structuresActions.js +18 -0
- package/src/sagas/__tests__/updateStructure.spec.js +3 -2
- package/src/sagas/updateStructure.js +5 -2
- package/src/selectors/getStructureProperties.js +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.40.2] 2022-03-14
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- [TD-4500] Support for data structures with multiple domain_ids
|
|
8
|
+
|
|
9
|
+
## [4.40.1] 2022-03-08
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- [TD-4604] Use actions from `/api/data_structures/search` instead of fetching
|
|
14
|
+
permissions
|
|
15
|
+
|
|
3
16
|
## [4.39.1] 2022-03-04
|
|
4
17
|
|
|
5
18
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "4.40.
|
|
3
|
+
"version": "4.40.3",
|
|
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.14.1",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.
|
|
37
|
+
"@truedat/test": "4.40.3",
|
|
38
38
|
"babel-jest": "^27.0.6",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@truedat/auth": "4.40.
|
|
88
|
-
"@truedat/core": "4.40.
|
|
89
|
-
"@truedat/df": "4.40.
|
|
87
|
+
"@truedat/auth": "4.40.3",
|
|
88
|
+
"@truedat/core": "4.40.3",
|
|
89
|
+
"@truedat/df": "4.40.3",
|
|
90
90
|
"lodash": "^4.17.21",
|
|
91
91
|
"path-to-regexp": "^1.7.0",
|
|
92
92
|
"prop-types": "^15.7.2",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"react-dom": ">= 16.8.6 < 17",
|
|
108
108
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "03104a28941b568007ad53b85874ff58225eaa6a"
|
|
111
111
|
}
|
|
@@ -8,24 +8,25 @@ import { useIntl } from "react-intl";
|
|
|
8
8
|
import { connect } from "react-redux";
|
|
9
9
|
import { updateStructure } from "../routines";
|
|
10
10
|
|
|
11
|
-
export const EditDomainForm = ({
|
|
11
|
+
export const EditDomainForm = ({
|
|
12
|
+
saving,
|
|
13
|
+
title,
|
|
14
|
+
updateStructure,
|
|
15
|
+
structure,
|
|
16
|
+
}) => {
|
|
12
17
|
const { formatMessage } = useIntl();
|
|
13
|
-
const [
|
|
14
|
-
const [
|
|
18
|
+
const [domainIds, setDomainIds] = useState(structure?.domain_ids || []);
|
|
19
|
+
const [inherit, setInherit] = useState(true);
|
|
15
20
|
|
|
16
21
|
const onSubmit = () => {
|
|
17
|
-
const data_structure = {
|
|
18
|
-
id: structure.id,
|
|
19
|
-
domain_id: domainId,
|
|
20
|
-
with_inheritance,
|
|
21
|
-
};
|
|
22
|
+
const data_structure = { id: structure.id, domain_ids: domainIds };
|
|
22
23
|
const redirect = linkTo.STRUCTURE_NOTES(data_structure);
|
|
23
24
|
|
|
24
|
-
updateStructure({ data_structure, redirect });
|
|
25
|
+
updateStructure({ data_structure, inherit, redirect });
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
const handleDomainSelected = (e, { value }) => {
|
|
28
|
-
|
|
29
|
+
setDomainIds(value);
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
return (
|
|
@@ -33,27 +34,33 @@ export const EditDomainForm = ({ title, updateStructure, structure }) => {
|
|
|
33
34
|
<Header as="h2" content={title} />
|
|
34
35
|
<DomainDropdownSelector
|
|
35
36
|
clearable={false}
|
|
37
|
+
multiple={true}
|
|
36
38
|
onChange={handleDomainSelected}
|
|
37
39
|
name="domain"
|
|
38
|
-
value={
|
|
40
|
+
value={domainIds}
|
|
39
41
|
/>
|
|
40
42
|
|
|
41
43
|
<Checkbox
|
|
42
44
|
label={formatMessage({
|
|
43
|
-
id: "structureDomain.actions.update.
|
|
45
|
+
id: "structureDomain.actions.update.inherit",
|
|
44
46
|
})}
|
|
45
|
-
checked={
|
|
47
|
+
checked={inherit}
|
|
46
48
|
onChange={(e) => {
|
|
47
|
-
|
|
49
|
+
setInherit(!inherit);
|
|
48
50
|
e.preventDefault();
|
|
49
51
|
}}
|
|
50
52
|
/>
|
|
51
53
|
|
|
52
|
-
<Form onSubmit={onSubmit}>
|
|
54
|
+
<Form onSubmit={saving ? null : onSubmit}>
|
|
53
55
|
<div className="actions">
|
|
54
56
|
<Button
|
|
55
57
|
type="submit"
|
|
56
|
-
|
|
58
|
+
loading={saving}
|
|
59
|
+
disabled={
|
|
60
|
+
saving ||
|
|
61
|
+
_.isEmpty(domainIds) ||
|
|
62
|
+
domainIds == [structure?.domain_ids]
|
|
63
|
+
}
|
|
57
64
|
primary
|
|
58
65
|
content={formatMessage({ id: "structureDomain.actions.update" })}
|
|
59
66
|
/>
|
|
@@ -67,10 +74,12 @@ EditDomainForm.propTypes = {
|
|
|
67
74
|
structure: PropTypes.object,
|
|
68
75
|
updateStructure: PropTypes.func,
|
|
69
76
|
title: PropTypes.string,
|
|
77
|
+
saving: PropTypes.bool,
|
|
70
78
|
};
|
|
71
79
|
|
|
72
80
|
const mapStateToProps = (state) => ({
|
|
73
|
-
structure: _.pick(["id", "
|
|
81
|
+
structure: _.pick(["id", "domain_ids"])(state.structure),
|
|
82
|
+
saving: state.structureUpdating,
|
|
74
83
|
});
|
|
75
84
|
|
|
76
85
|
export default connect(mapStateToProps, { updateStructure })(EditDomainForm);
|
|
@@ -5,7 +5,7 @@ import { Button, Icon, Popup } from "semantic-ui-react";
|
|
|
5
5
|
import PropTypes from "prop-types";
|
|
6
6
|
import EditDomainForm from "./EditDomainForm";
|
|
7
7
|
|
|
8
|
-
export const EditDomainPopup = ({ userPermissions, saving }) => {
|
|
8
|
+
export const EditDomainPopup = ({ userPermissions, saving, text }) => {
|
|
9
9
|
const { formatMessage } = useIntl();
|
|
10
10
|
const [open, setOpen] = useState(false);
|
|
11
11
|
|
|
@@ -19,8 +19,11 @@ export class StructureConfidentialButton extends React.Component {
|
|
|
19
19
|
const {
|
|
20
20
|
structure: { id, confidential },
|
|
21
21
|
} = this.props;
|
|
22
|
-
const data_structure = {
|
|
23
|
-
|
|
22
|
+
const data_structure = {
|
|
23
|
+
id,
|
|
24
|
+
confidential: !confidential,
|
|
25
|
+
};
|
|
26
|
+
this.props.updateStructure({ data_structure, inherit: true });
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
render() {
|
|
@@ -35,7 +35,7 @@ const isValid = _.conforms({
|
|
|
35
35
|
domain_id: _.isFinite,
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
const actions = (handleSubmit,
|
|
38
|
+
const actions = (handleSubmit, autoPublish) => {
|
|
39
39
|
const standardActions = [
|
|
40
40
|
{
|
|
41
41
|
key: "no",
|
|
@@ -52,7 +52,7 @@ const actions = (handleSubmit, canAutoPublish) => {
|
|
|
52
52
|
},
|
|
53
53
|
];
|
|
54
54
|
|
|
55
|
-
return
|
|
55
|
+
return autoPublish
|
|
56
56
|
? [
|
|
57
57
|
...standardActions,
|
|
58
58
|
{
|
|
@@ -74,6 +74,7 @@ const isEmptyNumberOrObject = (value) =>
|
|
|
74
74
|
export class StructuresBulkUpdate extends React.Component {
|
|
75
75
|
static propTypes = {
|
|
76
76
|
applyTemplate: PropTypes.func,
|
|
77
|
+
autoPublish: PropTypes.object,
|
|
77
78
|
bulkUpdateStructures: PropTypes.func,
|
|
78
79
|
loading: PropTypes.bool,
|
|
79
80
|
selectTemplate: PropTypes.func,
|
|
@@ -81,7 +82,7 @@ export class StructuresBulkUpdate extends React.Component {
|
|
|
81
82
|
template: PropTypes.object,
|
|
82
83
|
templateId: PropTypes.number,
|
|
83
84
|
templatesLoaded: PropTypes.bool,
|
|
84
|
-
|
|
85
|
+
enabled: PropTypes.bool,
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
state = initialState;
|
|
@@ -123,13 +124,13 @@ export class StructuresBulkUpdate extends React.Component {
|
|
|
123
124
|
|
|
124
125
|
render() {
|
|
125
126
|
const {
|
|
127
|
+
autoPublish,
|
|
128
|
+
enabled,
|
|
126
129
|
loading,
|
|
130
|
+
structureCount,
|
|
127
131
|
template,
|
|
128
132
|
templateId,
|
|
129
|
-
structureCount,
|
|
130
133
|
templatesLoaded,
|
|
131
|
-
canAutoPublish,
|
|
132
|
-
structureActiveFilters,
|
|
133
134
|
} = this.props;
|
|
134
135
|
const { content } = this.state;
|
|
135
136
|
const disableAction = !template || _.isEmpty(template);
|
|
@@ -137,9 +138,7 @@ export class StructuresBulkUpdate extends React.Component {
|
|
|
137
138
|
return templatesLoaded ? (
|
|
138
139
|
<Container as={Segment} text>
|
|
139
140
|
<TemplateLoader />
|
|
140
|
-
{
|
|
141
|
-
structureCount != 0 &&
|
|
142
|
-
_.has("type.raw")(structureActiveFilters) ? (
|
|
141
|
+
{enabled ? (
|
|
143
142
|
<>
|
|
144
143
|
<Header as="h2">
|
|
145
144
|
<Icon name="book" />
|
|
@@ -169,7 +168,7 @@ export class StructuresBulkUpdate extends React.Component {
|
|
|
169
168
|
/>
|
|
170
169
|
)}
|
|
171
170
|
<ConfirmModal
|
|
172
|
-
actions={actions(this.handleSubmit,
|
|
171
|
+
actions={actions(this.handleSubmit, autoPublish)}
|
|
173
172
|
trigger={
|
|
174
173
|
<Button
|
|
175
174
|
primary
|
|
@@ -236,8 +235,7 @@ const mapStateToProps = ({
|
|
|
236
235
|
structures,
|
|
237
236
|
structureTypes,
|
|
238
237
|
structureTypesLoading,
|
|
239
|
-
|
|
240
|
-
structureActiveFilters,
|
|
238
|
+
structuresActions,
|
|
241
239
|
}) => {
|
|
242
240
|
const structure = _.head(structures);
|
|
243
241
|
const templateId = findTemplate(structureTypes, templates, structure);
|
|
@@ -249,12 +247,8 @@ const mapStateToProps = ({
|
|
|
249
247
|
structureCount,
|
|
250
248
|
structureTypesLoaded: !structureTypesLoading,
|
|
251
249
|
templatesLoaded: !templatesLoading && !_.isEmpty(templates),
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
!_.isEmpty(domains) &&
|
|
255
|
-
["publish_structure_note_from_draft"].includes(permission)
|
|
256
|
-
)(userDomains),
|
|
257
|
-
structureActiveFilters,
|
|
250
|
+
autoPublish: structuresActions?.autoPublish,
|
|
251
|
+
enabled: !!templateId && !!structuresActions?.bulkUpdate,
|
|
258
252
|
};
|
|
259
253
|
};
|
|
260
254
|
|
|
@@ -8,9 +8,9 @@ import StructuresUpdateOption from "./StructuresUpdateOption";
|
|
|
8
8
|
import StructuresUploadOption from "./StructuresUploadOption";
|
|
9
9
|
|
|
10
10
|
export const StructuresOptions = ({
|
|
11
|
+
autoPublish,
|
|
12
|
+
bulkUpload,
|
|
11
13
|
hasFilterApplied,
|
|
12
|
-
canBulkUpload,
|
|
13
|
-
canAutoPublish,
|
|
14
14
|
}) => (
|
|
15
15
|
<Dropdown
|
|
16
16
|
icon="ellipsis vertical"
|
|
@@ -23,9 +23,9 @@ export const StructuresOptions = ({
|
|
|
23
23
|
<Dropdown.Divider />
|
|
24
24
|
<StructuresDownloadOption hasFilterApplied={hasFilterApplied} />
|
|
25
25
|
<StructuresEditableDownloadOption hasFilterApplied={hasFilterApplied} />
|
|
26
|
-
{
|
|
27
|
-
<StructuresUploadOption canAutoPublish={
|
|
28
|
-
)}
|
|
26
|
+
{bulkUpload ? (
|
|
27
|
+
<StructuresUploadOption canAutoPublish={!!autoPublish} />
|
|
28
|
+
) : null}
|
|
29
29
|
<Dropdown.Divider />
|
|
30
30
|
<StructuresUpdateOption />
|
|
31
31
|
</Dropdown.Menu>
|
|
@@ -33,9 +33,9 @@ export const StructuresOptions = ({
|
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
StructuresOptions.propTypes = {
|
|
36
|
+
autoPublish: PropTypes.object,
|
|
37
|
+
bulkUpload: PropTypes.object,
|
|
36
38
|
hasFilterApplied: PropTypes.bool,
|
|
37
|
-
canBulkUpload: PropTypes.bool,
|
|
38
|
-
canAutoPublish: PropTypes.bool,
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export default StructuresOptions;
|
|
@@ -31,10 +31,6 @@ const RuleImplementationsLoader = React.lazy(() =>
|
|
|
31
31
|
import("@truedat/dq/components/RuleImplementationsLoader")
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
const UserDomainsLoader = React.lazy(() =>
|
|
35
|
-
import("@truedat/auth/users/components/UserDomainsLoader")
|
|
36
|
-
);
|
|
37
|
-
|
|
38
34
|
const ConceptSelectorConceptsLoader = () => (
|
|
39
35
|
<ConceptsLoader
|
|
40
36
|
pageSize={7}
|
|
@@ -72,13 +68,6 @@ const AuthorizedRoutes = () => {
|
|
|
72
68
|
render={() => (
|
|
73
69
|
<>
|
|
74
70
|
<UserSearchFiltersLoader scope="data_structure" />
|
|
75
|
-
<UserDomainsLoader
|
|
76
|
-
permissions={[
|
|
77
|
-
"publish_structure_note_from_draft",
|
|
78
|
-
"edit_structure_note",
|
|
79
|
-
"create_structure_note",
|
|
80
|
-
]}
|
|
81
|
-
/>
|
|
82
71
|
<StructuresView />
|
|
83
72
|
</>
|
|
84
73
|
)}
|
|
@@ -88,13 +77,6 @@ const AuthorizedRoutes = () => {
|
|
|
88
77
|
path={STRUCTURES_BULK_UPDATE}
|
|
89
78
|
render={() => (
|
|
90
79
|
<>
|
|
91
|
-
<UserDomainsLoader
|
|
92
|
-
permissions={[
|
|
93
|
-
"publish_structure_note_from_draft",
|
|
94
|
-
"edit_structure_note",
|
|
95
|
-
"create_structure_note",
|
|
96
|
-
]}
|
|
97
|
-
/>
|
|
98
80
|
<StructureCrumbs
|
|
99
81
|
name={formatMessage({ id: "structures.bulkUpdate.crumbs.top" })}
|
|
100
82
|
/>
|
|
@@ -27,32 +27,18 @@ export const StructuresHeader = () => (
|
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
export const StructuresView = ({
|
|
30
|
+
actions = {},
|
|
30
31
|
loading,
|
|
31
32
|
structures,
|
|
32
33
|
hasFilterApplied,
|
|
33
34
|
systemsLoading,
|
|
34
|
-
userDomains,
|
|
35
35
|
}) => {
|
|
36
36
|
const history = useHistory();
|
|
37
|
-
const canBulkUpload = _.any(
|
|
38
|
-
({ domains, permission }) =>
|
|
39
|
-
!_.isEmpty(domains) &&
|
|
40
|
-
["edit_structure_note", "create_structure_note"].includes(permission)
|
|
41
|
-
)(userDomains);
|
|
42
|
-
const canAutoPublish = _.any(
|
|
43
|
-
({ domains, permission }) =>
|
|
44
|
-
!_.isEmpty(domains) &&
|
|
45
|
-
["publish_structure_note_from_draft"].includes(permission)
|
|
46
|
-
)(userDomains);
|
|
47
37
|
return (
|
|
48
38
|
<Segment loading={systemsLoading}>
|
|
49
39
|
<StructuresHeader />
|
|
50
40
|
<Divider hidden />
|
|
51
|
-
<StructuresOptions
|
|
52
|
-
hasFilterApplied={hasFilterApplied}
|
|
53
|
-
canBulkUpload={canBulkUpload}
|
|
54
|
-
canAutoPublish={canAutoPublish}
|
|
55
|
-
/>
|
|
41
|
+
<StructuresOptions hasFilterApplied={hasFilterApplied} {...actions} />
|
|
56
42
|
<StructuresSearch />
|
|
57
43
|
<StructureSelectedFilters />
|
|
58
44
|
<StructureDateFilter />
|
|
@@ -70,11 +56,11 @@ export const StructuresView = ({
|
|
|
70
56
|
};
|
|
71
57
|
|
|
72
58
|
StructuresView.propTypes = {
|
|
59
|
+
actions: PropTypes.object,
|
|
73
60
|
structures: PropTypes.array,
|
|
74
61
|
loading: PropTypes.bool,
|
|
75
62
|
systemsLoading: PropTypes.bool,
|
|
76
63
|
hasFilterApplied: PropTypes.bool,
|
|
77
|
-
userDomains: PropTypes.array,
|
|
78
64
|
};
|
|
79
65
|
|
|
80
66
|
const selectedFilters = ({ structureActiveFilters, structureDateFilter }) =>
|
|
@@ -87,11 +73,11 @@ const isEmptyPath = (state, path) => _.flow(_.path(path), _.isEmpty)(state);
|
|
|
87
73
|
|
|
88
74
|
const mapStateToProps = (state) => ({
|
|
89
75
|
structures: structureRowsSelector(state),
|
|
76
|
+
actions: state.structuresActions,
|
|
90
77
|
loading: state.structuresLoading,
|
|
91
78
|
systemsLoading: state.systemsLoading,
|
|
92
79
|
hasFilterApplied:
|
|
93
80
|
!isEmptyPath(state, "structureQuery.query") || selectedFilters(state),
|
|
94
|
-
userDomains: state.userDomains,
|
|
95
81
|
});
|
|
96
82
|
|
|
97
83
|
export default connect(mapStateToProps)(StructuresView);
|
|
@@ -18,15 +18,15 @@ describe("<EditDomainForm />", () => {
|
|
|
18
18
|
|
|
19
19
|
const props = {
|
|
20
20
|
title: "title",
|
|
21
|
-
saving: true,
|
|
22
21
|
updateStructure,
|
|
23
|
-
structure
|
|
22
|
+
structure,
|
|
24
23
|
};
|
|
24
|
+
|
|
25
25
|
const messages = {
|
|
26
26
|
en: {
|
|
27
27
|
"structure.edit_domain.title": "Edit domain",
|
|
28
28
|
"structureDomain.actions.update": "Update",
|
|
29
|
-
"structureDomain.actions.update.
|
|
29
|
+
"structureDomain.actions.update.inherit": "Apply on children",
|
|
30
30
|
"domain.selector.label": "Domain",
|
|
31
31
|
"domain.selector.placeholder": "Select a domain...",
|
|
32
32
|
},
|
|
@@ -82,7 +82,8 @@ describe("<EditDomainForm />", () => {
|
|
|
82
82
|
});
|
|
83
83
|
expect(updateStructure).toHaveBeenCalledWith(
|
|
84
84
|
expect.objectContaining({
|
|
85
|
-
data_structure: {
|
|
85
|
+
data_structure: { domain_ids: [1], id: 42 },
|
|
86
|
+
inherit: true,
|
|
86
87
|
redirect: "/structures/42/notes",
|
|
87
88
|
})
|
|
88
89
|
);
|
|
@@ -111,7 +112,39 @@ describe("<EditDomainForm />", () => {
|
|
|
111
112
|
});
|
|
112
113
|
expect(updateStructure).toHaveBeenCalledWith(
|
|
113
114
|
expect.objectContaining({
|
|
114
|
-
data_structure: {
|
|
115
|
+
data_structure: { domain_ids: [1], id: 42 },
|
|
116
|
+
inherit: false,
|
|
117
|
+
redirect: "/structures/42/notes",
|
|
118
|
+
})
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("send selected multiple domain ids when button clicked", async () => {
|
|
123
|
+
const { getByRole } = render(<EditDomainForm {...props} />, {
|
|
124
|
+
state: { domains },
|
|
125
|
+
messages,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const button = getByRole("button", { name: /update/i });
|
|
129
|
+
const checkbox = getByRole("checkbox");
|
|
130
|
+
const optionOne = getByRole("option", { name: /Domain 1/i });
|
|
131
|
+
const optionTwo = getByRole("option", { name: /Domain 2/i });
|
|
132
|
+
|
|
133
|
+
expect(button).toBeDisabled();
|
|
134
|
+
expect(checkbox).toBeChecked();
|
|
135
|
+
userEvent.click(optionTwo);
|
|
136
|
+
userEvent.click(optionOne);
|
|
137
|
+
await waitFor(() => {
|
|
138
|
+
expect(button).not.toBeDisabled();
|
|
139
|
+
});
|
|
140
|
+
userEvent.click(button);
|
|
141
|
+
await waitFor(() => {
|
|
142
|
+
expect(updateStructure.mock.calls.length).toBe(1);
|
|
143
|
+
});
|
|
144
|
+
expect(updateStructure).toHaveBeenCalledWith(
|
|
145
|
+
expect.objectContaining({
|
|
146
|
+
data_structure: { domain_ids: [2, 1], id: 42 },
|
|
147
|
+
inherit: true,
|
|
115
148
|
redirect: "/structures/42/notes",
|
|
116
149
|
})
|
|
117
150
|
);
|
|
@@ -17,7 +17,7 @@ describe("<StructuresBulkUpdate />", () => {
|
|
|
17
17
|
templatesLoaded: true,
|
|
18
18
|
structureTypes: [{ name: "doc", template_id: 1 }],
|
|
19
19
|
structureTypesLoaded: true,
|
|
20
|
-
|
|
20
|
+
enabled: true,
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
it("matches the latest snapshot", () => {
|
|
@@ -137,7 +137,7 @@ describe("<StructuresBulkUpdate />", () => {
|
|
|
137
137
|
selectedDomain: { id: 1 },
|
|
138
138
|
templatesLoaded: true,
|
|
139
139
|
bulkUpdateStructures: jest.fn(),
|
|
140
|
-
|
|
140
|
+
enabled: true,
|
|
141
141
|
};
|
|
142
142
|
const wrapper = shallow(<StructuresBulkUpdate {...props} />);
|
|
143
143
|
wrapper.setState({
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import { render } from "@truedat/test/render";
|
|
4
|
+
import coreEn from "@truedat/core/messages/en";
|
|
5
|
+
import StructuresOptions from "../StructuresOptions";
|
|
6
|
+
import en from "../../messages/en";
|
|
7
|
+
|
|
8
|
+
const renderOpts = {
|
|
9
|
+
messages: { en: { ...coreEn, ...en } },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
describe("<StructuresOptions />", () => {
|
|
13
|
+
const props = { bulkUpload: {}, bulkUpdate: {}, autoPublish: {} };
|
|
14
|
+
|
|
15
|
+
it("matches the latest snapshot", async () => {
|
|
16
|
+
const { container } = render(<StructuresOptions {...props} />, renderOpts);
|
|
17
|
+
await waitFor(() => expect(container).toMatchSnapshot());
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -31,13 +31,11 @@ describe("<StructuresView />", () => {
|
|
|
31
31
|
{ name: "group" },
|
|
32
32
|
];
|
|
33
33
|
|
|
34
|
-
const
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
];
|
|
40
|
-
const props = { structures, columns, userDomains };
|
|
34
|
+
const actions = {
|
|
35
|
+
bulkUpdate: {},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const props = { structures, columns, actions };
|
|
41
39
|
const wrapper = shallow(<StructuresView {...props} />);
|
|
42
40
|
expect(wrapper).toMatchSnapshot();
|
|
43
41
|
|
|
@@ -22,7 +22,7 @@ exports[`<EditDomainForm /> matches the latest snapshot 1`] = `
|
|
|
22
22
|
>
|
|
23
23
|
<div
|
|
24
24
|
aria-expanded="false"
|
|
25
|
-
class="ui fluid search selection dropdown"
|
|
25
|
+
class="ui fluid multiple search selection dropdown"
|
|
26
26
|
name="domain"
|
|
27
27
|
role="combobox"
|
|
28
28
|
>
|
|
@@ -34,6 +34,9 @@ exports[`<EditDomainForm /> matches the latest snapshot 1`] = `
|
|
|
34
34
|
type="text"
|
|
35
35
|
value=""
|
|
36
36
|
/>
|
|
37
|
+
<span
|
|
38
|
+
class="sizer"
|
|
39
|
+
/>
|
|
37
40
|
<div
|
|
38
41
|
aria-atomic="true"
|
|
39
42
|
aria-live="polite"
|
|
@@ -47,6 +50,7 @@ exports[`<EditDomainForm /> matches the latest snapshot 1`] = `
|
|
|
47
50
|
class="dropdown icon"
|
|
48
51
|
/>
|
|
49
52
|
<div
|
|
53
|
+
aria-multiselectable="true"
|
|
50
54
|
class="menu transition"
|
|
51
55
|
role="listbox"
|
|
52
56
|
>
|
|
@@ -162,6 +162,7 @@ exports[`<StructureSummary /> renders custom grant label when grant provided 1`]
|
|
|
162
162
|
<div
|
|
163
163
|
class="description"
|
|
164
164
|
>
|
|
165
|
+
|
|
165
166
|
<button
|
|
166
167
|
class="ui basic icon button"
|
|
167
168
|
style="box-shadow: none;"
|
|
@@ -310,6 +311,7 @@ exports[`<StructureSummary /> renders label when grant provided 1`] = `
|
|
|
310
311
|
<div
|
|
311
312
|
class="description"
|
|
312
313
|
>
|
|
314
|
+
|
|
313
315
|
<button
|
|
314
316
|
class="ui basic icon button"
|
|
315
317
|
style="box-shadow: none;"
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<StructuresOptions /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
aria-expanded="false"
|
|
7
|
+
class="ui floating dropdown button icon group-actions button-update"
|
|
8
|
+
role="listbox"
|
|
9
|
+
tabindex="0"
|
|
10
|
+
>
|
|
11
|
+
<i
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
class="ellipsis vertical icon"
|
|
14
|
+
/>
|
|
15
|
+
<div
|
|
16
|
+
class="menu transition left"
|
|
17
|
+
>
|
|
18
|
+
<div
|
|
19
|
+
class="divider"
|
|
20
|
+
/>
|
|
21
|
+
<div
|
|
22
|
+
aria-disabled="true"
|
|
23
|
+
class="disabled item"
|
|
24
|
+
role="option"
|
|
25
|
+
>
|
|
26
|
+
<i
|
|
27
|
+
aria-hidden="true"
|
|
28
|
+
class="download icon"
|
|
29
|
+
/>
|
|
30
|
+
<span>
|
|
31
|
+
Download structures metadata
|
|
32
|
+
</span>
|
|
33
|
+
<p
|
|
34
|
+
class="menu-item-description"
|
|
35
|
+
>
|
|
36
|
+
You must search or filter to download structures
|
|
37
|
+
</p>
|
|
38
|
+
</div>
|
|
39
|
+
<div
|
|
40
|
+
aria-disabled="true"
|
|
41
|
+
class="disabled item"
|
|
42
|
+
role="option"
|
|
43
|
+
>
|
|
44
|
+
<i
|
|
45
|
+
aria-hidden="true"
|
|
46
|
+
class="download icon"
|
|
47
|
+
/>
|
|
48
|
+
<span>
|
|
49
|
+
Download editable structures metadata
|
|
50
|
+
</span>
|
|
51
|
+
<p
|
|
52
|
+
class="menu-item-description"
|
|
53
|
+
>
|
|
54
|
+
You must search or filter to download structures
|
|
55
|
+
</p>
|
|
56
|
+
</div>
|
|
57
|
+
<div
|
|
58
|
+
class="item"
|
|
59
|
+
role="option"
|
|
60
|
+
>
|
|
61
|
+
<i
|
|
62
|
+
aria-hidden="true"
|
|
63
|
+
class="upload icon"
|
|
64
|
+
/>
|
|
65
|
+
<span
|
|
66
|
+
class="text"
|
|
67
|
+
>
|
|
68
|
+
Upload structure notes
|
|
69
|
+
</span>
|
|
70
|
+
</div>
|
|
71
|
+
<div
|
|
72
|
+
class="divider"
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
`;
|
|
@@ -7,8 +7,7 @@ exports[`<StructuresView /> matches the latest snapshot 1`] = `
|
|
|
7
7
|
hidden={true}
|
|
8
8
|
/>
|
|
9
9
|
<StructuresOptions
|
|
10
|
-
|
|
11
|
-
canBulkUpload={true}
|
|
10
|
+
bulkUpdate={Object {}}
|
|
12
11
|
/>
|
|
13
12
|
<Connect(StructuresSearch) />
|
|
14
13
|
<injectIntl(Connect(SelectedFilters)) />
|
package/src/messages/en.js
CHANGED
|
@@ -314,7 +314,7 @@ export default {
|
|
|
314
314
|
"structure.version.inserted_at": "Imported {when}",
|
|
315
315
|
"structure.version.version": "Version {version}",
|
|
316
316
|
"structureDomain.actions.update": "Update",
|
|
317
|
-
"structureDomain.actions.update.
|
|
317
|
+
"structureDomain.actions.update.inherit": "Apply on children",
|
|
318
318
|
"structureSelector.union.criteria": "Union criteria",
|
|
319
319
|
"structureTagForm.props.name": "Name",
|
|
320
320
|
"structureTags.actions.create": "Create Structure Tag",
|
|
@@ -353,7 +353,7 @@ export default {
|
|
|
353
353
|
"structures.actions.editableDownload.tooltip":
|
|
354
354
|
"Download editable structures metadata",
|
|
355
355
|
"structures.actions.download.popup":
|
|
356
|
-
"You
|
|
356
|
+
"You must search or filter to download structures",
|
|
357
357
|
"structures.actions.download.tooltip": "Download structures metadata",
|
|
358
358
|
"structures.actions.edit_system": "Edit system",
|
|
359
359
|
"structures.actions.new_system": "New system",
|
package/src/messages/es.js
CHANGED
|
@@ -318,7 +318,7 @@ export default {
|
|
|
318
318
|
"structure.version.inserted_at": "Importada {when}",
|
|
319
319
|
"structure.version.version": "Versión {version}",
|
|
320
320
|
"structureDomain.actions.update": "Actualizar",
|
|
321
|
-
"structureDomain.actions.update.
|
|
321
|
+
"structureDomain.actions.update.inherit": "Aplicar en hijos",
|
|
322
322
|
"structureSelector.union.criteria": "Criterio de unión",
|
|
323
323
|
"structureTagForm.props.name": "Nombre",
|
|
324
324
|
"structureTags.actions.create": "Crear Etiqueta de Estructura",
|
|
@@ -428,7 +428,7 @@ export default {
|
|
|
428
428
|
"structures.props.system": "Sistema",
|
|
429
429
|
"structures.props.type": "Tipo",
|
|
430
430
|
"structures.relation.new.header":
|
|
431
|
-
"Vas a vincular este campo a un término del
|
|
431
|
+
"Vas a vincular este campo a un término del glosario",
|
|
432
432
|
"structures.retrieved.results": "{count} elementos encontrados",
|
|
433
433
|
"structures.search.placeholder": "Buscar estructuras...",
|
|
434
434
|
"structures.searching": "Buscando Estructuras...",
|
|
@@ -23,7 +23,7 @@ describe("reducers: structure", () => {
|
|
|
23
23
|
const type = "table";
|
|
24
24
|
const group = "kong";
|
|
25
25
|
const system = { id: 1, name: "king" };
|
|
26
|
-
const
|
|
26
|
+
const domains = [{ id: 1, name: "Domain" }];
|
|
27
27
|
const metadata = { foo: "bar" };
|
|
28
28
|
const grant = { id: 1, detail: { foo: "bar" } };
|
|
29
29
|
const siblings = [{ id: 1, name: "foo" }];
|
|
@@ -32,7 +32,7 @@ describe("reducers: structure", () => {
|
|
|
32
32
|
inserted_at: "foo",
|
|
33
33
|
updated_at: "foo",
|
|
34
34
|
confidential: false,
|
|
35
|
-
|
|
35
|
+
domains,
|
|
36
36
|
};
|
|
37
37
|
const data = {
|
|
38
38
|
data_structure,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { clearStructures, fetchStructures } from "../../routines";
|
|
2
|
+
import { structuresActions, initialState } from "../structuresActions";
|
|
3
|
+
|
|
4
|
+
const fooState = { foo: "bar" };
|
|
5
|
+
|
|
6
|
+
describe("reducers: structuresActions", () => {
|
|
7
|
+
it("should provide the initial state", () => {
|
|
8
|
+
expect(structuresActions(undefined, {})).toBe(initialState);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("should handle the clearStructures.TRIGGER action", () => {
|
|
12
|
+
expect(structuresActions(fooState, { type: clearStructures.TRIGGER })).toBe(
|
|
13
|
+
initialState
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should handle the fetchStructures.TRIGGER action", () => {
|
|
18
|
+
expect(structuresActions(fooState, { type: fetchStructures.TRIGGER })).toBe(
|
|
19
|
+
initialState
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("should handle the fetchStructures.SUCCESS action", () => {
|
|
24
|
+
const _actions = { bulkUpdate: {} };
|
|
25
|
+
const data = { _actions };
|
|
26
|
+
|
|
27
|
+
expect(
|
|
28
|
+
structuresActions(fooState, {
|
|
29
|
+
type: fetchStructures.SUCCESS,
|
|
30
|
+
payload: { data },
|
|
31
|
+
})
|
|
32
|
+
).toMatchObject(_actions);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("should ignore unknown actions", () => {
|
|
36
|
+
expect(structuresActions(fooState, { type: "FOO" })).toBe(fooState);
|
|
37
|
+
});
|
|
38
|
+
});
|
package/src/reducers/index.js
CHANGED
|
@@ -13,9 +13,11 @@ import { grantLoading } from "./grantLoading";
|
|
|
13
13
|
import { grantQuery } from "./grantQuery";
|
|
14
14
|
import { grantRequest } from "./grantRequest";
|
|
15
15
|
import { grantRequests } from "./grantRequests";
|
|
16
|
+
import { grantRequestsCart } from "./grantRequestsCart";
|
|
16
17
|
import { grantRequestsLoading } from "./grantRequestsLoading";
|
|
17
|
-
import {
|
|
18
|
+
import { grantRequestsQuery } from "./grantRequestsQuery";
|
|
18
19
|
import { grantSelectedFilter } from "./grantSelectedFilter";
|
|
20
|
+
import { grants } from "./grants";
|
|
19
21
|
import { grantsPageSize } from "./grantsPageSize";
|
|
20
22
|
import { graph } from "./graph";
|
|
21
23
|
import { graphLoading } from "./graphLoading";
|
|
@@ -37,6 +39,7 @@ import { profileGroupLoading } from "./profileGroupLoading";
|
|
|
37
39
|
import { selectedGroups } from "./selectedGroups";
|
|
38
40
|
import { selectedNode } from "./selectedNode";
|
|
39
41
|
import { selectedResources } from "./selectedResources";
|
|
42
|
+
import { selectedUserSearchFilter } from "./selectedUserSearchFilter";
|
|
40
43
|
import { structure } from "./structure";
|
|
41
44
|
import { structureActions } from "./structureActions";
|
|
42
45
|
import { structureActiveFilters } from "./structureActiveFilters";
|
|
@@ -60,9 +63,7 @@ import { structureProfile } from "./structureProfile";
|
|
|
60
63
|
import { structureQuery } from "./structureQuery";
|
|
61
64
|
import { structureRedirect } from "./structureRedirect";
|
|
62
65
|
import { structureSelectedFilter } from "./structureSelectedFilter";
|
|
63
|
-
import { selectedUserSearchFilter } from "./selectedUserSearchFilter";
|
|
64
66
|
import { structureSiblings } from "./structureSiblings";
|
|
65
|
-
import { structuresSiblings } from "./structureSiblings";
|
|
66
67
|
import { structureSystem } from "./structureSystem";
|
|
67
68
|
import { structureTagCreating, structureTag } from "./structureTag";
|
|
68
69
|
import { structureTagLoading } from "./structureTagLoading";
|
|
@@ -73,25 +74,25 @@ import { structureTypeLoading } from "./structureTypeLoading";
|
|
|
73
74
|
import { structureTypes } from "./structureTypes";
|
|
74
75
|
import { structureTypesLoading } from "./structureTypesLoading";
|
|
75
76
|
import { structureUpdating } from "./structureUpdating";
|
|
76
|
-
import { userSearchFilters } from "./userSearchFilters";
|
|
77
77
|
import { structureVersion } from "./structureVersion";
|
|
78
78
|
import { structureVersions } from "./structureVersions";
|
|
79
79
|
import { structures } from "./structures";
|
|
80
|
-
import {
|
|
80
|
+
import { structuresActions } from "./structuresActions";
|
|
81
81
|
import { structuresDownloading } from "./structuresDownloading";
|
|
82
|
+
import { structuresEditableDownloading } from "./structuresEditableDownloading";
|
|
82
83
|
import { structuresLoading } from "./structuresLoading";
|
|
83
84
|
import { structuresPageSize } from "./structuresPageSize";
|
|
85
|
+
import { structuresSiblings } from "./structureSiblings";
|
|
84
86
|
import { system } from "./system";
|
|
85
87
|
import { systemId } from "./systemId";
|
|
86
88
|
import { systemStructures } from "./systemStructures";
|
|
87
89
|
import { systemStructuresLoading } from "./systemStructuresLoading";
|
|
88
90
|
import { systems } from "./systems";
|
|
89
91
|
import { systemsLoading } from "./systemsLoading";
|
|
90
|
-
import { uploadingStructuresFile } from "./uploadingStructuresFile";
|
|
91
92
|
import { unitDomains } from "./unitDomains";
|
|
93
|
+
import { uploadingStructuresFile } from "./uploadingStructuresFile";
|
|
92
94
|
import { userPermissions } from "./userPermissions";
|
|
93
|
-
import {
|
|
94
|
-
import { grantRequestsQuery } from "./grantRequestsQuery";
|
|
95
|
+
import { userSearchFilters } from "./userSearchFilters";
|
|
95
96
|
|
|
96
97
|
export {
|
|
97
98
|
bulkUpdateStructuresLoading,
|
|
@@ -107,11 +108,13 @@ export {
|
|
|
107
108
|
grantFiltersLoading,
|
|
108
109
|
grantLoading,
|
|
109
110
|
grantQuery,
|
|
110
|
-
grants,
|
|
111
111
|
grantRequest,
|
|
112
112
|
grantRequests,
|
|
113
|
+
grantRequestsCart,
|
|
113
114
|
grantRequestsLoading,
|
|
115
|
+
grantRequestsQuery,
|
|
114
116
|
grantSelectedFilter,
|
|
117
|
+
grants,
|
|
115
118
|
grantsPageSize,
|
|
116
119
|
graph,
|
|
117
120
|
graphLoading,
|
|
@@ -134,6 +137,7 @@ export {
|
|
|
134
137
|
selectedGroups,
|
|
135
138
|
selectedNode,
|
|
136
139
|
selectedResources,
|
|
140
|
+
selectedUserSearchFilter,
|
|
137
141
|
structure,
|
|
138
142
|
structureActions,
|
|
139
143
|
structureActiveFilters,
|
|
@@ -157,10 +161,8 @@ export {
|
|
|
157
161
|
structureQuery,
|
|
158
162
|
structureRedirect,
|
|
159
163
|
structureSelectedFilter,
|
|
160
|
-
selectedUserSearchFilter,
|
|
161
164
|
structureSiblings,
|
|
162
165
|
structureSystem,
|
|
163
|
-
structuresSiblings,
|
|
164
166
|
structureTag,
|
|
165
167
|
structureTagCreating,
|
|
166
168
|
structureTagLoading,
|
|
@@ -171,24 +173,24 @@ export {
|
|
|
171
173
|
structureTypes,
|
|
172
174
|
structureTypesLoading,
|
|
173
175
|
structureUpdating,
|
|
174
|
-
userSearchFilters,
|
|
175
176
|
structureVersion,
|
|
176
177
|
structureVersions,
|
|
177
178
|
structures,
|
|
178
|
-
|
|
179
|
+
structuresActions,
|
|
179
180
|
structuresDownloading,
|
|
181
|
+
structuresEditableDownloading,
|
|
180
182
|
structuresFields,
|
|
181
183
|
structuresLoading,
|
|
182
184
|
structuresPageSize,
|
|
185
|
+
structuresSiblings,
|
|
183
186
|
system,
|
|
184
187
|
systemId,
|
|
185
188
|
systemStructures,
|
|
186
189
|
systemStructuresLoading,
|
|
187
190
|
systems,
|
|
188
191
|
systemsLoading,
|
|
189
|
-
uploadingStructuresFile,
|
|
190
192
|
unitDomains,
|
|
193
|
+
uploadingStructuresFile,
|
|
191
194
|
userPermissions,
|
|
192
|
-
|
|
193
|
-
grantRequestsQuery,
|
|
195
|
+
userSearchFilters,
|
|
194
196
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { clearStructures, fetchStructures } from "../routines";
|
|
2
|
+
|
|
3
|
+
export const initialState = null;
|
|
4
|
+
|
|
5
|
+
const structuresActions = (state = initialState, { type, payload }) => {
|
|
6
|
+
switch (type) {
|
|
7
|
+
case clearStructures.TRIGGER:
|
|
8
|
+
return initialState;
|
|
9
|
+
case fetchStructures.TRIGGER:
|
|
10
|
+
return initialState;
|
|
11
|
+
case fetchStructures.SUCCESS:
|
|
12
|
+
return payload?.data?._actions || initialState;
|
|
13
|
+
default:
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { structuresActions };
|
|
@@ -35,8 +35,9 @@ describe("sagas: updateStructureSaga", () => {
|
|
|
35
35
|
const url = compile(API_DATA_STRUCTURE)({ id });
|
|
36
36
|
const data_structure = { id, description, lopd };
|
|
37
37
|
const redirect = "foo";
|
|
38
|
-
const
|
|
39
|
-
const
|
|
38
|
+
const inherit = false;
|
|
39
|
+
const payload = { data_structure, redirect, inherit };
|
|
40
|
+
const requestData = { data_structure: { description, lopd }, inherit };
|
|
40
41
|
const successData = { ...data_structure, redirect };
|
|
41
42
|
|
|
42
43
|
it("should put a success action when a response is returned", () => {
|
|
@@ -7,9 +7,12 @@ import { API_DATA_STRUCTURE } from "../api";
|
|
|
7
7
|
|
|
8
8
|
export function* updateStructureSaga({ payload }) {
|
|
9
9
|
try {
|
|
10
|
-
const { data_structure, redirect } = payload;
|
|
10
|
+
const { data_structure, inherit, redirect } = payload;
|
|
11
11
|
const url = compile(API_DATA_STRUCTURE)(data_structure);
|
|
12
|
-
const requestData = {
|
|
12
|
+
const requestData = {
|
|
13
|
+
data_structure: _.omit(["id"])(data_structure),
|
|
14
|
+
inherit,
|
|
15
|
+
};
|
|
13
16
|
yield put(updateStructure.request());
|
|
14
17
|
const { data } = yield call(apiJsonPatch, url, requestData, JSON_OPTS);
|
|
15
18
|
const successPayload = redirect ? { ...data, redirect } : data;
|
|
@@ -3,18 +3,17 @@ import React from "react";
|
|
|
3
3
|
import { createSelector } from "reselect";
|
|
4
4
|
import EditDomainPopup from "../components/EditDomainPopup";
|
|
5
5
|
|
|
6
|
-
const domainDecorator = (
|
|
6
|
+
const domainDecorator = (domainNames) => (
|
|
7
7
|
<>
|
|
8
|
-
{
|
|
8
|
+
{domainNames}
|
|
9
9
|
<EditDomainPopup />
|
|
10
10
|
</>
|
|
11
11
|
);
|
|
12
|
-
false;
|
|
13
12
|
|
|
14
13
|
export const defaultStructureProperties = [
|
|
15
14
|
{
|
|
16
15
|
name: "domain",
|
|
17
|
-
fieldSelector: _.
|
|
16
|
+
fieldSelector: _.flow(_.propOr([], "domains"), _.map("name"), _.join(", ")),
|
|
18
17
|
fieldDecorator: domainDecorator,
|
|
19
18
|
},
|
|
20
19
|
{ name: "group" },
|