@truedat/dd 4.51.2 → 4.51.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 +7 -0
- package/package.json +6 -6
- package/src/api/queries.js +24 -0
- package/src/api.js +0 -2
- package/src/components/DictionaryRoutes.js +0 -5
- package/src/components/EditDomainForm.js +15 -20
- package/src/components/LineageForm.js +23 -34
- package/src/components/PendingStructureNoteRow.js +5 -8
- package/src/components/PendingStructureNotes.js +25 -46
- package/src/components/PendingStructureNotesTable.js +46 -57
- package/src/components/StructuresRoutes.js +1 -11
- package/src/components/__tests__/EditDomainForm.spec.js +31 -46
- package/src/components/__tests__/LineageForm.spec.js +37 -122
- package/src/components/__tests__/PendingStructureNoteRow.spec.js +2 -2
- package/src/components/__tests__/PendingStructureNotes.spec.js +13 -15
- package/src/components/__tests__/__snapshots__/EditDomainForm.spec.js.snap +2 -71
- package/src/components/__tests__/__snapshots__/LineageForm.spec.js.snap +13 -14
- package/src/components/__tests__/__snapshots__/PendingStructureNotes.spec.js.snap +1 -2
- package/src/components/__tests__/__snapshots__/PendingStructureNotesTable.spec.js.snap +8 -16
- package/src/reducers/index.js +0 -2
- package/src/routines.js +0 -1
- package/src/sagas/index.js +0 -3
- package/src/selectors/index.js +0 -1
- package/src/reducers/__tests__/unitDomains.spec.js +0 -27
- package/src/reducers/unitDomains.js +0 -16
- package/src/sagas/__tests__/fetchUnitDomains.spec.js +0 -91
- package/src/sagas/fetchUnitDomains.js +0 -29
- package/src/selectors/__tests__/getDomainOptions.spec.js +0 -32
- package/src/selectors/getDomainOptions.js +0 -17
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "4.51.
|
|
3
|
+
"version": "4.51.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.16.4",
|
|
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.51.3",
|
|
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.51.
|
|
92
|
-
"@truedat/core": "4.51.
|
|
93
|
-
"@truedat/df": "4.51.
|
|
91
|
+
"@truedat/auth": "4.51.3",
|
|
92
|
+
"@truedat/core": "4.51.3",
|
|
93
|
+
"@truedat/df": "4.51.3",
|
|
94
94
|
"lodash": "^4.17.21",
|
|
95
95
|
"path-to-regexp": "^1.7.0",
|
|
96
96
|
"prop-types": "^15.8.1",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"react-dom": ">= 16.8.6 < 17",
|
|
113
113
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "69d6cf8f7379eb2ef5744a4fdd357a7dd662b115"
|
|
116
116
|
}
|
package/src/api/queries.js
CHANGED
|
@@ -95,3 +95,27 @@ export const LATEST_GRANT_REQUEST_QUERY = gql`
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
`;
|
|
98
|
+
|
|
99
|
+
export const STRUCTURE_NOTES_QUERY = gql`
|
|
100
|
+
query StructureNotes($filter: StructureNotesFilter) {
|
|
101
|
+
structureNotes(filter: $filter) {
|
|
102
|
+
id
|
|
103
|
+
status
|
|
104
|
+
dataStructure {
|
|
105
|
+
id
|
|
106
|
+
currentVersion {
|
|
107
|
+
id
|
|
108
|
+
name
|
|
109
|
+
path
|
|
110
|
+
version
|
|
111
|
+
}
|
|
112
|
+
system {
|
|
113
|
+
name
|
|
114
|
+
}
|
|
115
|
+
domains {
|
|
116
|
+
name
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`;
|
package/src/api.js
CHANGED
|
@@ -43,7 +43,6 @@ const API_STRUCTURES_UPLOAD_EVENTS =
|
|
|
43
43
|
"/api/data_structures/bulk_update_template_content_events";
|
|
44
44
|
const API_STRUCTURE_NOTE = "/api/data_structures/:data_structure_id/notes/:id";
|
|
45
45
|
const API_STRUCTURE_NOTES = "/api/data_structures/:data_structure_id/notes";
|
|
46
|
-
const API_UNIT_DOMAINS = "/api/unit_domains";
|
|
47
46
|
|
|
48
47
|
export {
|
|
49
48
|
API_DATA_STRUCTURE,
|
|
@@ -88,5 +87,4 @@ export {
|
|
|
88
87
|
API_STRUCTURES_UPLOAD_EVENTS,
|
|
89
88
|
API_STRUCTURE_NOTE,
|
|
90
89
|
API_STRUCTURE_NOTES,
|
|
91
|
-
API_UNIT_DOMAINS,
|
|
92
90
|
};
|
|
@@ -33,10 +33,6 @@ const TemplatesLoader = React.lazy(() =>
|
|
|
33
33
|
import("@truedat/df/templates/components/TemplatesLoader")
|
|
34
34
|
);
|
|
35
35
|
|
|
36
|
-
const DomainsLoader = React.lazy(() =>
|
|
37
|
-
import("@truedat/bg/taxonomy/components/DomainsLoader")
|
|
38
|
-
);
|
|
39
|
-
|
|
40
36
|
const Loaders = () => (
|
|
41
37
|
<>
|
|
42
38
|
<StructuresLoader />
|
|
@@ -93,7 +89,6 @@ export const DictionaryRoutes = () => {
|
|
|
93
89
|
render={() => (
|
|
94
90
|
<>
|
|
95
91
|
<SystemsLoader />
|
|
96
|
-
<DomainsLoader />
|
|
97
92
|
<PendingStructureNotes />
|
|
98
93
|
</>
|
|
99
94
|
)}
|
|
@@ -12,8 +12,7 @@ import { linkTo } from "@truedat/core/routes";
|
|
|
12
12
|
import PropTypes from "prop-types";
|
|
13
13
|
import { useIntl } from "react-intl";
|
|
14
14
|
import { connect } from "react-redux";
|
|
15
|
-
import {
|
|
16
|
-
import { getDomainSelectorOptions } from "@truedat/bg/taxonomy/selectors";
|
|
15
|
+
import { DomainSelector } from "@truedat/core/components";
|
|
17
16
|
import { updateStructure } from "../routines";
|
|
18
17
|
|
|
19
18
|
export const EditDomainForm = ({
|
|
@@ -21,9 +20,9 @@ export const EditDomainForm = ({
|
|
|
21
20
|
title,
|
|
22
21
|
updateStructure,
|
|
23
22
|
structure,
|
|
24
|
-
domainOptions,
|
|
25
23
|
}) => {
|
|
26
24
|
const { formatMessage } = useIntl();
|
|
25
|
+
const [loading, setLoading] = useState(true);
|
|
27
26
|
const [domainIds, setDomainIds] = useState(structure?.domain_ids || []);
|
|
28
27
|
const [inherit, setInherit] = useState(true);
|
|
29
28
|
|
|
@@ -34,23 +33,22 @@ export const EditDomainForm = ({
|
|
|
34
33
|
updateStructure({ data_structure, inherit, redirect });
|
|
35
34
|
};
|
|
36
35
|
|
|
37
|
-
const handleDomainSelected = (e, { value }) => {
|
|
38
|
-
setDomainIds(value);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
36
|
return (
|
|
42
37
|
<Container style={{ width: "400px" }}>
|
|
43
38
|
<Header as="h2" content={title} />
|
|
44
39
|
|
|
45
40
|
<Form onSubmit={saving ? null : onSubmit}>
|
|
46
|
-
<Segment>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
<Segment loading={loading}>
|
|
42
|
+
<DomainSelector
|
|
43
|
+
action="manageStructuresDomain"
|
|
44
|
+
label={formatMessage({ id: "domain.multiple.placeholder" })}
|
|
45
|
+
labels
|
|
46
|
+
multiple
|
|
47
|
+
onChange={(_e, { value }) => setDomainIds(value)}
|
|
48
|
+
onLoad={() => setLoading(false)}
|
|
50
49
|
value={domainIds}
|
|
51
50
|
/>
|
|
52
51
|
</Segment>
|
|
53
|
-
|
|
54
52
|
<Checkbox
|
|
55
53
|
label={formatMessage({
|
|
56
54
|
id: "structureDomain.actions.update.inherit",
|
|
@@ -66,6 +64,7 @@ export const EditDomainForm = ({
|
|
|
66
64
|
type="submit"
|
|
67
65
|
loading={saving}
|
|
68
66
|
disabled={
|
|
67
|
+
loading ||
|
|
69
68
|
saving ||
|
|
70
69
|
_.isEmpty(domainIds) ||
|
|
71
70
|
domainIds == [structure?.domain_ids]
|
|
@@ -80,19 +79,15 @@ export const EditDomainForm = ({
|
|
|
80
79
|
};
|
|
81
80
|
|
|
82
81
|
EditDomainForm.propTypes = {
|
|
83
|
-
domainOptions: PropTypes.array,
|
|
84
82
|
structure: PropTypes.object,
|
|
85
83
|
updateStructure: PropTypes.func,
|
|
86
84
|
title: PropTypes.string,
|
|
87
85
|
saving: PropTypes.bool,
|
|
88
86
|
};
|
|
89
87
|
|
|
90
|
-
const mapStateToProps = (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
domainOptions: getDomainSelectorOptions(state),
|
|
95
|
-
};
|
|
96
|
-
};
|
|
88
|
+
const mapStateToProps = ({ structure, structureUpdating }) => ({
|
|
89
|
+
structure: _.pick(["id", "domain_ids"])(structure),
|
|
90
|
+
saving: structureUpdating,
|
|
91
|
+
});
|
|
97
92
|
|
|
98
93
|
export default connect(mapStateToProps, { updateStructure })(EditDomainForm);
|
|
@@ -11,16 +11,15 @@ import {
|
|
|
11
11
|
Header,
|
|
12
12
|
Button,
|
|
13
13
|
} from "semantic-ui-react";
|
|
14
|
+
import { DomainSelector } from "@truedat/core/components";
|
|
14
15
|
import {
|
|
15
16
|
clearNodes,
|
|
16
17
|
selectGroup,
|
|
17
18
|
fetchNodes,
|
|
18
|
-
fetchUnitDomains,
|
|
19
19
|
createGraph,
|
|
20
20
|
selectResources,
|
|
21
21
|
} from "../routines";
|
|
22
22
|
import {
|
|
23
|
-
getDomainOptions,
|
|
24
23
|
groupOptionsSelector,
|
|
25
24
|
resourceOptionsSelector,
|
|
26
25
|
levelsSelection,
|
|
@@ -28,17 +27,10 @@ import {
|
|
|
28
27
|
} from "../selectors";
|
|
29
28
|
import LineageDownloadButton from "./LineageDownloadButton";
|
|
30
29
|
|
|
31
|
-
const DomainDropdownSelector = React.lazy(() =>
|
|
32
|
-
import("@truedat/bg/taxonomy/components/DomainDropdownSelector")
|
|
33
|
-
);
|
|
34
|
-
|
|
35
30
|
export const LineageForm = ({
|
|
36
|
-
domain,
|
|
37
|
-
domainOptions,
|
|
38
31
|
createGraph,
|
|
39
32
|
clearNodes,
|
|
40
33
|
fetchNodes,
|
|
41
|
-
fetchUnitDomains,
|
|
42
34
|
graph,
|
|
43
35
|
graphLoading,
|
|
44
36
|
groupOptions,
|
|
@@ -51,6 +43,7 @@ export const LineageForm = ({
|
|
|
51
43
|
selectedGroups,
|
|
52
44
|
selectedResources,
|
|
53
45
|
}) => {
|
|
46
|
+
const [domainId, setDomainId] = useState(null);
|
|
54
47
|
const [open, setOpen] = useState(true);
|
|
55
48
|
const [selectLevels, setSelectLevels] = useState(levelsSelection);
|
|
56
49
|
const [levels, setLevels] = useState(lineageLevels);
|
|
@@ -67,11 +60,8 @@ export const LineageForm = ({
|
|
|
67
60
|
selectLevels === "all" && setLevels();
|
|
68
61
|
}, [selectLevels]);
|
|
69
62
|
useEffect(() => {
|
|
70
|
-
_.isEmpty(groupOptions) &&
|
|
71
|
-
}, [
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
domain && _.isEmpty(groupOptions) && fetchNodes({ domain_id: domain.id });
|
|
74
|
-
}, [domain, fetchNodes, groupOptions]);
|
|
63
|
+
domainId && _.isEmpty(groupOptions) && fetchNodes({ domain_id: domainId });
|
|
64
|
+
}, [domainId, fetchNodes, groupOptions]);
|
|
75
65
|
useEffect(() => {
|
|
76
66
|
return () => {
|
|
77
67
|
clearNodes();
|
|
@@ -86,11 +76,15 @@ export const LineageForm = ({
|
|
|
86
76
|
_.isInteger(intValue) && setLevels(intValue);
|
|
87
77
|
_.isEmpty(value) && setLevels();
|
|
88
78
|
};
|
|
89
|
-
|
|
79
|
+
|
|
80
|
+
const handleDomainChange = (e, { value }) => {
|
|
90
81
|
e && e.preventDefault();
|
|
91
82
|
e && e.stopPropagation();
|
|
92
|
-
_.
|
|
93
|
-
|
|
83
|
+
if (_.isEmpty(value)) {
|
|
84
|
+
clearNodes();
|
|
85
|
+
} else {
|
|
86
|
+
fetchNodes({ domain_id: value });
|
|
87
|
+
}
|
|
94
88
|
};
|
|
95
89
|
|
|
96
90
|
const handleKeyDown = (e) => {
|
|
@@ -99,6 +93,12 @@ export const LineageForm = ({
|
|
|
99
93
|
}
|
|
100
94
|
};
|
|
101
95
|
|
|
96
|
+
const handleDomainsLoaded = ({ domains }) => {
|
|
97
|
+
if (domains?.length == 1) {
|
|
98
|
+
setDomainId(domains[0].id);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
102
|
return (
|
|
103
103
|
<Segment>
|
|
104
104
|
<Accordion>
|
|
@@ -117,13 +117,12 @@ export const LineageForm = ({
|
|
|
117
117
|
</Accordion.Title>
|
|
118
118
|
<Accordion.Content active={open}>
|
|
119
119
|
<Form size="small" loading={loading}>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
)}
|
|
120
|
+
<DomainSelector
|
|
121
|
+
action="viewLineage"
|
|
122
|
+
labels
|
|
123
|
+
onChange={handleDomainChange}
|
|
124
|
+
onLoad={handleDomainsLoaded}
|
|
125
|
+
/>
|
|
127
126
|
{_.map.convert({ cap: false })((options, level) => (
|
|
128
127
|
<Form.Dropdown
|
|
129
128
|
key={level}
|
|
@@ -254,12 +253,9 @@ export const LineageForm = ({
|
|
|
254
253
|
};
|
|
255
254
|
|
|
256
255
|
LineageForm.propTypes = {
|
|
257
|
-
domain: PropTypes.object,
|
|
258
|
-
domainOptions: PropTypes.array,
|
|
259
256
|
clearNodes: PropTypes.func.isRequired,
|
|
260
257
|
createGraph: PropTypes.func.isRequired,
|
|
261
258
|
fetchNodes: PropTypes.func,
|
|
262
|
-
fetchUnitDomains: PropTypes.func,
|
|
263
259
|
graph: PropTypes.object,
|
|
264
260
|
graphLoading: PropTypes.bool,
|
|
265
261
|
groupOptions: PropTypes.array,
|
|
@@ -273,13 +269,7 @@ LineageForm.propTypes = {
|
|
|
273
269
|
selectedResources: PropTypes.array,
|
|
274
270
|
};
|
|
275
271
|
|
|
276
|
-
const getDefaultDomain = (domains) => {
|
|
277
|
-
const filtered = _.filter((d) => !_.isNil(d.unit))(domains);
|
|
278
|
-
return _.size(filtered) == 1 && _.head(filtered);
|
|
279
|
-
};
|
|
280
272
|
const mapStateToProps = (state) => ({
|
|
281
|
-
domain: getDefaultDomain(state.unitDomains),
|
|
282
|
-
domainOptions: getDomainOptions(state),
|
|
283
273
|
groupOptions: groupOptionsSelector(state),
|
|
284
274
|
resourceOptions: resourceOptionsSelector(state),
|
|
285
275
|
levelsSelection: levelsSelection(state),
|
|
@@ -295,7 +285,6 @@ export default connect(mapStateToProps, {
|
|
|
295
285
|
clearNodes,
|
|
296
286
|
createGraph,
|
|
297
287
|
fetchNodes,
|
|
298
|
-
fetchUnitDomains,
|
|
299
288
|
selectGroup,
|
|
300
289
|
selectResources,
|
|
301
290
|
})(LineageForm);
|
|
@@ -9,15 +9,12 @@ import { linkTo } from "@truedat/core/routes";
|
|
|
9
9
|
const PendingStructureNoteRow = ({ structureNote }) => {
|
|
10
10
|
const { formatMessage } = useIntl();
|
|
11
11
|
const history = useHistory();
|
|
12
|
-
const dataStructure =
|
|
13
|
-
const path = _.propOr(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)(structureNote);
|
|
17
|
-
const name = _.prop("data_structure.current_version.name")(structureNote);
|
|
18
|
-
const system = _.prop("data_structure.system.name")(structureNote);
|
|
12
|
+
const dataStructure = structureNote?.dataStructure;
|
|
13
|
+
const path = _.propOr([], "dataStructure.currentVersion.path")(structureNote);
|
|
14
|
+
const name = dataStructure?.currentVersion?.name;
|
|
15
|
+
const system = dataStructure?.system?.name;
|
|
19
16
|
const domainsNames = _.flow(
|
|
20
|
-
_.prop("
|
|
17
|
+
_.prop("dataStructure.domains"),
|
|
21
18
|
_.map("name")
|
|
22
19
|
)(structureNote);
|
|
23
20
|
|
|
@@ -3,51 +3,26 @@ import React, { useState } from "react";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
|
-
import {
|
|
6
|
+
import { useQuery } from "@apollo/client";
|
|
7
7
|
import { Checkbox, Form, Header, Icon, Segment } from "semantic-ui-react";
|
|
8
8
|
import { useForm, Controller } from "react-hook-form";
|
|
9
|
+
import { DomainSelector } from "@truedat/core/components";
|
|
10
|
+
import { STRUCTURE_NOTES_QUERY } from "../api/queries";
|
|
9
11
|
import PendingStructureNotesTable from "./PendingStructureNotesTable";
|
|
10
12
|
|
|
11
|
-
const DomainDropdownSelector = React.lazy(() =>
|
|
12
|
-
import("@truedat/bg/taxonomy/components/DomainDropdownSelector")
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
export const STRUCTURE_NOTES = gql`
|
|
16
|
-
query STRUCTURE_NOTES($filter: StructureNotesFilter) {
|
|
17
|
-
structure_notes(filter: $filter) {
|
|
18
|
-
id
|
|
19
|
-
status
|
|
20
|
-
data_structure {
|
|
21
|
-
id
|
|
22
|
-
current_version {
|
|
23
|
-
id
|
|
24
|
-
name
|
|
25
|
-
path
|
|
26
|
-
version
|
|
27
|
-
}
|
|
28
|
-
system {
|
|
29
|
-
name
|
|
30
|
-
}
|
|
31
|
-
domains {
|
|
32
|
-
name
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
|
|
39
13
|
const STATUS = ["pending_approval", "draft", "rejected"];
|
|
40
14
|
|
|
41
15
|
export const PendingStructureNotes = ({ systems }) => {
|
|
42
16
|
const { formatMessage } = useIntl();
|
|
17
|
+
const [domainsLoading, setDomainsLoading] = useState(true);
|
|
43
18
|
const [filter, setFilter] = useState({
|
|
44
19
|
statuses: STATUS,
|
|
45
20
|
});
|
|
46
|
-
const { loading, error, data } = useQuery(
|
|
21
|
+
const { loading, error, data } = useQuery(STRUCTURE_NOTES_QUERY, {
|
|
47
22
|
variables: { filter },
|
|
48
23
|
fetchPolicy: "cache-and-network",
|
|
49
24
|
});
|
|
50
|
-
const items = loading || error ? [] : data?.
|
|
25
|
+
const items = loading || error ? [] : data?.structureNotes;
|
|
51
26
|
const { control } = useForm({
|
|
52
27
|
mode: "all",
|
|
53
28
|
defaultValues: {
|
|
@@ -66,7 +41,7 @@ export const PendingStructureNotes = ({ systems }) => {
|
|
|
66
41
|
</Header.Subheader>
|
|
67
42
|
</Header.Content>
|
|
68
43
|
</Header>
|
|
69
|
-
<Form>
|
|
44
|
+
<Form loading={domainsLoading}>
|
|
70
45
|
<Header
|
|
71
46
|
as="h5"
|
|
72
47
|
content={formatMessage({ id: "pendingStructureNotes.filters" })}
|
|
@@ -104,6 +79,24 @@ export const PendingStructureNotes = ({ systems }) => {
|
|
|
104
79
|
</Form.Field>
|
|
105
80
|
)}
|
|
106
81
|
/>
|
|
82
|
+
<Controller
|
|
83
|
+
control={control}
|
|
84
|
+
name="domain_ids"
|
|
85
|
+
render={({ field: { onChange, value } }) => (
|
|
86
|
+
<DomainSelector
|
|
87
|
+
label={formatMessage({ id: "domain.selector.label" })}
|
|
88
|
+
labels
|
|
89
|
+
action="publishStructureNote"
|
|
90
|
+
value={value}
|
|
91
|
+
onChange={(_e, { value }) => {
|
|
92
|
+
const domain_ids = _.isEmpty(value) ? [] : [value];
|
|
93
|
+
setFilter({ ...filter, domain_ids });
|
|
94
|
+
onChange(value);
|
|
95
|
+
}}
|
|
96
|
+
onLoad={() => setDomainsLoading(false)}
|
|
97
|
+
/>
|
|
98
|
+
)}
|
|
99
|
+
/>
|
|
107
100
|
<Controller
|
|
108
101
|
control={control}
|
|
109
102
|
name="system_ids"
|
|
@@ -129,20 +122,6 @@ export const PendingStructureNotes = ({ systems }) => {
|
|
|
129
122
|
/>
|
|
130
123
|
)}
|
|
131
124
|
/>
|
|
132
|
-
<Controller
|
|
133
|
-
control={control}
|
|
134
|
-
name="domain_ids"
|
|
135
|
-
render={({ field: { onChange, value } }) => (
|
|
136
|
-
<DomainDropdownSelector
|
|
137
|
-
value={value}
|
|
138
|
-
onChange={(_e, { value }) => {
|
|
139
|
-
const domain_ids = _.isNumber(value) ? [value] : [];
|
|
140
|
-
setFilter({ ...filter, domain_ids });
|
|
141
|
-
onChange(value);
|
|
142
|
-
}}
|
|
143
|
-
/>
|
|
144
|
-
)}
|
|
145
|
-
/>
|
|
146
125
|
</Form>
|
|
147
126
|
<PendingStructureNotesTable structureNotes={items} loading={loading} />
|
|
148
127
|
</Segment>
|
|
@@ -1,67 +1,56 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
5
5
|
import { Table, Header, Icon } from "semantic-ui-react";
|
|
6
6
|
import PendingStructureNoteRow from "./PendingStructureNoteRow";
|
|
7
7
|
|
|
8
8
|
const PendingStructureNotesTable = ({ structureNotes, loading }) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</Table>
|
|
55
|
-
)}
|
|
56
|
-
{_.isEmpty(structureNotes) && !loading && (
|
|
57
|
-
<Header as="h4">
|
|
58
|
-
<Icon name="search" />
|
|
59
|
-
<Header.Content>
|
|
60
|
-
<FormattedMessage id="pendingStructureNotes.search.results.empty" />
|
|
61
|
-
</Header.Content>
|
|
62
|
-
</Header>
|
|
63
|
-
)}
|
|
64
|
-
</>
|
|
9
|
+
const { formatMessage } = useIntl();
|
|
10
|
+
return loading ? null : _.isEmpty(structureNotes) ? (
|
|
11
|
+
<Header as="h4">
|
|
12
|
+
<Icon name="search" />
|
|
13
|
+
<Header.Content>
|
|
14
|
+
<FormattedMessage id="pendingStructureNotes.search.results.empty" />
|
|
15
|
+
</Header.Content>
|
|
16
|
+
</Header>
|
|
17
|
+
) : (
|
|
18
|
+
<Table selectable>
|
|
19
|
+
<Table.Header>
|
|
20
|
+
<Table.Row>
|
|
21
|
+
<Table.HeaderCell
|
|
22
|
+
content={formatMessage({
|
|
23
|
+
id: "pendingStructureNotes.props.structure",
|
|
24
|
+
})}
|
|
25
|
+
/>
|
|
26
|
+
<Table.HeaderCell
|
|
27
|
+
content={formatMessage({
|
|
28
|
+
id: "pendingStructureNotes.props.status",
|
|
29
|
+
})}
|
|
30
|
+
/>
|
|
31
|
+
<Table.HeaderCell
|
|
32
|
+
content={formatMessage({
|
|
33
|
+
id: "pendingStructureNotes.props.system",
|
|
34
|
+
})}
|
|
35
|
+
/>
|
|
36
|
+
<Table.HeaderCell
|
|
37
|
+
content={formatMessage({
|
|
38
|
+
id: "pendingStructureNotes.props.domains",
|
|
39
|
+
})}
|
|
40
|
+
/>
|
|
41
|
+
<Table.HeaderCell
|
|
42
|
+
content={formatMessage({
|
|
43
|
+
id: "pendingStructureNotes.props.path",
|
|
44
|
+
})}
|
|
45
|
+
/>
|
|
46
|
+
</Table.Row>
|
|
47
|
+
</Table.Header>
|
|
48
|
+
<Table.Body>
|
|
49
|
+
{structureNotes.map((structureNote, key) => (
|
|
50
|
+
<PendingStructureNoteRow key={key} structureNote={structureNote} />
|
|
51
|
+
))}
|
|
52
|
+
</Table.Body>
|
|
53
|
+
</Table>
|
|
65
54
|
);
|
|
66
55
|
};
|
|
67
56
|
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
STRUCTURE_EVENTS,
|
|
12
12
|
STRUCTURE_VERSION,
|
|
13
13
|
} from "@truedat/core/routes";
|
|
14
|
-
import DomainsLoader from "@truedat/bg/taxonomy/components/DomainsLoader";
|
|
15
14
|
import StructureCrumbs from "./StructureCrumbs";
|
|
16
15
|
import StructureLoader from "./StructureLoader";
|
|
17
16
|
import UserSearchFiltersLoader from "./UserSearchFiltersLoader";
|
|
@@ -122,16 +121,7 @@ export const StructuresRoutes = () => {
|
|
|
122
121
|
return (
|
|
123
122
|
<Route
|
|
124
123
|
path={STRUCTURES}
|
|
125
|
-
render={() =>
|
|
126
|
-
authorized ? (
|
|
127
|
-
<>
|
|
128
|
-
<AuthorizedRoutes />
|
|
129
|
-
<DomainsLoader actions="manage_structures_domain" />
|
|
130
|
-
</>
|
|
131
|
-
) : (
|
|
132
|
-
<Unauthorized />
|
|
133
|
-
)
|
|
134
|
-
}
|
|
124
|
+
render={() => (authorized ? <AuthorizedRoutes /> : <Unauthorized />)}
|
|
135
125
|
/>
|
|
136
126
|
);
|
|
137
127
|
};
|