@truedat/dd 5.8.5 → 5.9.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/api/mutations.js +28 -0
- package/src/api/queries.js +20 -0
- package/src/api.js +4 -0
- package/src/components/BucketView.js +92 -0
- package/src/components/CatalogCustomViewCards.js +89 -0
- package/src/components/CatalogViewConfigForm.js +130 -0
- package/src/components/CatalogViewConfigs.js +124 -0
- package/src/components/DictionaryRoutes.js +40 -9
- package/src/components/FilteredNav.js +47 -5
- package/src/components/StructureCrumbs.js +43 -15
- package/src/components/StructureItem.js +24 -2
- package/src/components/StructureItemRoot.js +34 -5
- package/src/components/StructureItems.js +3 -2
- package/src/components/StructureNav.js +1 -1
- package/src/components/StructureTabs.js +104 -102
- package/src/components/StructureTags.js +2 -2
- package/src/components/StructureView.js +56 -37
- package/src/components/StructuresRoutes.js +57 -49
- package/src/components/StructuresView.js +5 -0
- package/src/components/SystemCards.js +1 -0
- package/src/components/SystemFilteredNav.js +1 -1
- package/src/components/SystemStructures.js +40 -22
- package/src/components/SystemsRoutes.js +3 -3
- package/src/components/__tests__/BucketView.spec.js +49 -0
- package/src/components/__tests__/CatalogCustomViewCards.spec.js +56 -0
- package/src/components/__tests__/CatalogViewConfigForm.spec.js +75 -0
- package/src/components/__tests__/CatalogViewConfigs.spec.js +75 -0
- package/src/components/__tests__/FilteredNav.spec.js +73 -22
- package/src/components/__tests__/GrantApprovalRuleDeleteButton.spec.js +2 -2
- package/src/components/__tests__/StructureItemRoot.spec.js +5 -4
- package/src/components/__tests__/StructureNav.spec.js +3 -0
- package/src/components/__tests__/StructureStructureLinks.spec.js +1 -1
- package/src/components/__tests__/StructureView.spec.js +60 -12
- package/src/components/__tests__/StructuresView.spec.js +60 -15
- package/src/components/__tests__/SystemFilteredNav.spec.js +7 -1
- package/src/components/__tests__/SystemStructures.spec.js +5 -0
- package/src/components/__tests__/__snapshots__/DictionaryRoutes.spec.js.snap +21 -1
- package/src/components/__tests__/__snapshots__/StructureCrumbs.spec.js.snap +4 -4
- package/src/components/__tests__/__snapshots__/StructuresRoutes.spec.js.snap +7 -1
- package/src/components/__tests__/__snapshots__/SystemStructures.spec.js.snap +1 -3
- package/src/components/index.js +2 -0
- package/src/hooks/useBucketStructures.js +10 -0
- package/src/messages/en.js +3 -0
- package/src/messages/es.js +3 -0
- package/src/reducers/bucketFilter.js +15 -0
- package/src/reducers/index.js +4 -1
- package/src/reducers/navFilter.js +14 -0
- package/src/reducers/structure.js +24 -1
- package/src/reducers/structureRedirect.js +7 -0
- package/src/routines.js +4 -0
- package/src/sagas/deleteCatalogViewConfig.js +37 -0
- package/src/sagas/index.js +6 -0
- package/src/sagas/upsertCatalogViewConfig.js +45 -0
- package/src/selectors/getStructureParent.js +17 -5
- package/src/components/__tests__/__snapshots__/FilteredNav.spec.js.snap +0 -23
- package/src/components/__tests__/__snapshots__/StructureView.spec.js.snap +0 -37
- package/src/components/__tests__/__snapshots__/StructuresView.spec.js.snap +0 -70
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React, { useState } from "react";
|
|
2
|
+
import React, { useState, useEffect } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { lowerDeburrTrim } from "@truedat/core/services/sort";
|
|
6
|
-
import {
|
|
6
|
+
import { Loader } from "semantic-ui-react";
|
|
7
|
+
import { useBucketStructures } from "../hooks/useBucketStructures";
|
|
8
|
+
import { clearNavFilter as clearNavFilterRoutine } from "../routines";
|
|
9
|
+
import { getStructureParent } from "../selectors";
|
|
7
10
|
import StructureNav from "./StructureNav";
|
|
8
11
|
import StructureSearch from "./StructureSearch";
|
|
9
12
|
|
|
10
|
-
export const FilteredNav = ({
|
|
13
|
+
export const FilteredNav = ({
|
|
14
|
+
childStructures,
|
|
15
|
+
parentStructure,
|
|
16
|
+
totalStructures,
|
|
17
|
+
}) => {
|
|
11
18
|
const [searchValue, setSearchValue] = useState("");
|
|
12
19
|
const onChange = (searchValue) => setSearchValue(searchValue);
|
|
13
20
|
|
|
@@ -24,6 +31,7 @@ export const FilteredNav = ({ childStructures, parentStructure }) => {
|
|
|
24
31
|
<StructureNav
|
|
25
32
|
childStructures={filteredStructures(childStructures)}
|
|
26
33
|
parentStructure={parentStructure}
|
|
34
|
+
totalChildStructures={totalStructures}
|
|
27
35
|
/>
|
|
28
36
|
</>
|
|
29
37
|
);
|
|
@@ -32,11 +40,45 @@ export const FilteredNav = ({ childStructures, parentStructure }) => {
|
|
|
32
40
|
FilteredNav.propTypes = {
|
|
33
41
|
childStructures: PropTypes.array,
|
|
34
42
|
parentStructure: PropTypes.object,
|
|
43
|
+
totalStructures: PropTypes.number,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const FilteredNavLoader = ({ structure, filter, parentStructure }) => {
|
|
47
|
+
const { trigger, data, error } = useBucketStructures();
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const parentFilter = _.isObject(structure)
|
|
51
|
+
? {
|
|
52
|
+
parent_id: _.isEmpty(structure.children)
|
|
53
|
+
? _.pathOr("", "parents[0].data_structure_id")(structure)
|
|
54
|
+
: _.pathOr("", "id")(structure),
|
|
55
|
+
}
|
|
56
|
+
: { parent_id: "" };
|
|
57
|
+
|
|
58
|
+
trigger({ ...filter, ...parentFilter });
|
|
59
|
+
}, [trigger, structure, filter]);
|
|
60
|
+
|
|
61
|
+
return !data && !error ? (
|
|
62
|
+
<Loader />
|
|
63
|
+
) : (
|
|
64
|
+
<FilteredNav
|
|
65
|
+
childStructures={data.data.data}
|
|
66
|
+
parentStructure={parentStructure}
|
|
67
|
+
totalStructures={data.headers["x-total-count"]}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
FilteredNavLoader.propTypes = {
|
|
73
|
+
filter: PropTypes.object,
|
|
74
|
+
structure: PropTypes.object,
|
|
75
|
+
parentStructure: PropTypes.object,
|
|
35
76
|
};
|
|
36
77
|
|
|
37
78
|
const mapStateToProps = (state) => ({
|
|
38
79
|
parentStructure: getStructureParent(state),
|
|
39
|
-
childStructures: getSortedStructureChildren(state),
|
|
40
80
|
});
|
|
41
81
|
|
|
42
|
-
export default connect(mapStateToProps
|
|
82
|
+
export default connect(mapStateToProps, {
|
|
83
|
+
clearNavFilter: clearNavFilterRoutine,
|
|
84
|
+
})(FilteredNavLoader);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { useContext } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { Breadcrumb } from "semantic-ui-react";
|
|
5
5
|
import { connect } from "react-redux";
|
|
@@ -16,24 +16,51 @@ export const StructuresCrumb = () => (
|
|
|
16
16
|
</>
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
</Breadcrumb.Section>
|
|
28
|
-
<Breadcrumb.Divider icon="right angle" />
|
|
29
|
-
</>
|
|
19
|
+
const filterQueryParams = _.flow(
|
|
20
|
+
Object.entries,
|
|
21
|
+
_.first,
|
|
22
|
+
([propertyPath, propertyValue]) => ({
|
|
23
|
+
propertyPath,
|
|
24
|
+
propertyValue,
|
|
25
|
+
}),
|
|
26
|
+
(queryParams) => new URLSearchParams(queryParams)
|
|
30
27
|
);
|
|
31
28
|
|
|
29
|
+
export const SystemCrumb = ({ id, name, navFilter }) => {
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
{_.isEmpty(navFilter) || navFilter?.system_id ? (
|
|
33
|
+
<Breadcrumb.Section
|
|
34
|
+
as={Link}
|
|
35
|
+
to={linkTo.SYSTEM_STRUCTURES({ id })}
|
|
36
|
+
active={false}
|
|
37
|
+
>
|
|
38
|
+
{name}
|
|
39
|
+
</Breadcrumb.Section>
|
|
40
|
+
) : (
|
|
41
|
+
<Breadcrumb.Section
|
|
42
|
+
as={Link}
|
|
43
|
+
to={`${linkTo.BUCKET_VIEW()}?${filterQueryParams(navFilter)}`}
|
|
44
|
+
active={false}
|
|
45
|
+
>
|
|
46
|
+
{JSON.stringify(navFilter)}
|
|
47
|
+
</Breadcrumb.Section>
|
|
48
|
+
)}
|
|
49
|
+
<Breadcrumb.Divider icon="right angle" />
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
32
54
|
SystemCrumb.propTypes = {
|
|
33
55
|
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
34
56
|
name: PropTypes.string,
|
|
35
57
|
};
|
|
36
58
|
|
|
59
|
+
const SystemCrumbConnected = connect(
|
|
60
|
+
({ navFilter }) => ({ navFilter }),
|
|
61
|
+
null
|
|
62
|
+
)(SystemCrumb);
|
|
63
|
+
|
|
37
64
|
export const AncestorCrumb = ({ name, id }) => (
|
|
38
65
|
<>
|
|
39
66
|
<Breadcrumb.Section as={Link} to={linkTo.STRUCTURE({ id })} active={false}>
|
|
@@ -82,11 +109,11 @@ export const StructureCrumbs = ({
|
|
|
82
109
|
name,
|
|
83
110
|
version,
|
|
84
111
|
isStructureCrumbActive,
|
|
85
|
-
}) =>
|
|
86
|
-
name ? (
|
|
112
|
+
}) => {
|
|
113
|
+
return name ? (
|
|
87
114
|
<Breadcrumb>
|
|
88
115
|
<StructuresCrumb />
|
|
89
|
-
{_.isEmpty(system) ? null : <
|
|
116
|
+
{_.isEmpty(system) ? null : <SystemCrumbConnected {...system} />}
|
|
90
117
|
{_.isEmpty(ancestry)
|
|
91
118
|
? null
|
|
92
119
|
: _.map(({ data_structure_id, name }) => (
|
|
@@ -110,6 +137,7 @@ export const StructureCrumbs = ({
|
|
|
110
137
|
)}
|
|
111
138
|
</Breadcrumb>
|
|
112
139
|
) : null;
|
|
140
|
+
};
|
|
113
141
|
|
|
114
142
|
StructureCrumbs.propTypes = {
|
|
115
143
|
ancestry: PropTypes.array,
|
|
@@ -13,8 +13,26 @@ const getIcon = (formatMessage, type) =>
|
|
|
13
13
|
defaultMessage: "question circle outline",
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const filterQueryParams = _.flow(
|
|
17
|
+
Object.entries,
|
|
18
|
+
_.first,
|
|
19
|
+
([propertyPath, propertyValue]) => ({
|
|
20
|
+
propertyPath,
|
|
21
|
+
propertyValue,
|
|
22
|
+
}),
|
|
23
|
+
(queryParams) => new URLSearchParams(queryParams)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const StructureItem = ({
|
|
27
|
+
name,
|
|
28
|
+
id,
|
|
29
|
+
type,
|
|
30
|
+
active,
|
|
31
|
+
deleted_at,
|
|
32
|
+
navFilter,
|
|
33
|
+
}) => {
|
|
17
34
|
const { formatMessage } = useIntl();
|
|
35
|
+
|
|
18
36
|
return (
|
|
19
37
|
<List.Item
|
|
20
38
|
as={active ? "a" : Link}
|
|
@@ -24,6 +42,8 @@ export const StructureItem = ({ name, id, type, active, deleted_at }) => {
|
|
|
24
42
|
? undefined
|
|
25
43
|
: type == "system" && id
|
|
26
44
|
? linkTo.SYSTEM_STRUCTURES({ id })
|
|
45
|
+
: type == "bucket"
|
|
46
|
+
? `${linkTo.BUCKET_VIEW()}?${filterQueryParams(navFilter)}`
|
|
27
47
|
: id
|
|
28
48
|
? linkTo.STRUCTURE({ id })
|
|
29
49
|
: STRUCTURES
|
|
@@ -45,10 +65,11 @@ StructureItem.propTypes = {
|
|
|
45
65
|
id: PropTypes.number,
|
|
46
66
|
name: PropTypes.string,
|
|
47
67
|
type: PropTypes.string,
|
|
68
|
+
navFilter: PropTypes.object,
|
|
48
69
|
};
|
|
49
70
|
|
|
50
71
|
export const mapStateToProps = (
|
|
51
|
-
{ structure },
|
|
72
|
+
{ structure, navFilter },
|
|
52
73
|
{ data_structure_id, id: structureId, type, name, alias }
|
|
53
74
|
) => {
|
|
54
75
|
const id = data_structure_id || structureId;
|
|
@@ -57,6 +78,7 @@ export const mapStateToProps = (
|
|
|
57
78
|
active:
|
|
58
79
|
type !== "system" && _.isFinite(id) && _.propEq("id", id)(structure),
|
|
59
80
|
name: _.defaultTo(name)(alias),
|
|
81
|
+
navFilter,
|
|
60
82
|
};
|
|
61
83
|
};
|
|
62
84
|
|
|
@@ -1,13 +1,36 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
1
2
|
import React from "react";
|
|
3
|
+
import { connect } from "react-redux";
|
|
2
4
|
import { FormattedMessage } from "react-intl";
|
|
3
5
|
import { useHistory } from "react-router-dom";
|
|
6
|
+
import PropTypes from "prop-types";
|
|
4
7
|
import { List } from "semantic-ui-react";
|
|
5
|
-
import { STRUCTURES } from "@truedat/core/routes";
|
|
8
|
+
import { STRUCTURES, linkTo } from "@truedat/core/routes";
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
const isBucketFilter = _.flow(
|
|
11
|
+
Object.keys,
|
|
12
|
+
// Both metadata and mutable_metadata are "metadata"
|
|
13
|
+
_.any((entry) => entry.startsWith("metadata", "note"))
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
const filterParams = _.flow(
|
|
17
|
+
Object.entries,
|
|
18
|
+
_.first,
|
|
19
|
+
([propertyPath, propertyValue]) => ({
|
|
20
|
+
propertyPath,
|
|
21
|
+
propertyValue,
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const StructureItemRoot = ({ navFilter }) => {
|
|
8
26
|
const history = useHistory();
|
|
27
|
+
const url = isBucketFilter(navFilter)
|
|
28
|
+
? linkTo.BUCKETS_VIEW({
|
|
29
|
+
propertyPath: filterParams(navFilter)?.propertyPath,
|
|
30
|
+
})
|
|
31
|
+
: STRUCTURES;
|
|
9
32
|
return (
|
|
10
|
-
<List.Item onClick={() => history.push(
|
|
33
|
+
<List.Item onClick={() => history.push(url)}>
|
|
11
34
|
<List.Icon name="angle double left" verticalAlign="middle" />
|
|
12
35
|
<List.Content>
|
|
13
36
|
<FormattedMessage id="structure.navigation.home" />
|
|
@@ -19,6 +42,12 @@ export const StructureItemRoot = () => {
|
|
|
19
42
|
);
|
|
20
43
|
};
|
|
21
44
|
|
|
22
|
-
|
|
45
|
+
const mapStateToProps = ({ navFilter }) => ({
|
|
46
|
+
navFilter,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
StructureItemRoot.propTypes = {
|
|
50
|
+
navFilter: PropTypes.object,
|
|
51
|
+
};
|
|
23
52
|
|
|
24
|
-
export default StructureItemRoot;
|
|
53
|
+
export default connect(mapStateToProps, null)(StructureItemRoot);
|
|
@@ -2,10 +2,11 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import StructureItem from "./StructureItem";
|
|
4
4
|
|
|
5
|
-
export const StructureItems = ({ structures }) =>
|
|
6
|
-
structures.map((structure, index) => (
|
|
5
|
+
export const StructureItems = ({ bucketChildStructures, structures }) => {
|
|
6
|
+
return (bucketChildStructures || structures).map((structure, index) => (
|
|
7
7
|
<StructureItem key={index} {...structure} />
|
|
8
8
|
));
|
|
9
|
+
};
|
|
9
10
|
|
|
10
11
|
StructureItems.propTypes = {
|
|
11
12
|
structures: PropTypes.array,
|
|
@@ -42,108 +42,110 @@ export const StructureTabs = ({
|
|
|
42
42
|
version,
|
|
43
43
|
}) => {
|
|
44
44
|
const { formatMessage } = useIntl();
|
|
45
|
-
const items = _.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
45
|
+
const items = !_.isEmpty(structure)
|
|
46
|
+
? _.filter("content")([
|
|
47
|
+
{
|
|
48
|
+
active: activeTab === "fields",
|
|
49
|
+
as: Link,
|
|
50
|
+
to: structureLink(structure, version),
|
|
51
|
+
content: fields ? formatMessage({ id: "tabs.dd.fields" }) : false,
|
|
52
|
+
key: "fields",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
active: activeTab === "children",
|
|
56
|
+
as: Link,
|
|
57
|
+
to: linkTo.STRUCTURE_CHILDREN(structure),
|
|
58
|
+
content: children ? formatMessage({ id: "tabs.dd.children" }) : false,
|
|
59
|
+
key: "children",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
active: activeTab === "notes",
|
|
63
|
+
as: Link,
|
|
64
|
+
to: linkTo.STRUCTURE_NOTES(structure),
|
|
65
|
+
content: notes ? formatMessage({ id: "tabs.dd.notes" }) : false,
|
|
66
|
+
key: "notes",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
active: activeTab === "parents",
|
|
70
|
+
as: Link,
|
|
71
|
+
to: linkTo.STRUCTURE_PARENTS(structure),
|
|
72
|
+
content: parents ? formatMessage({ id: "tabs.dd.parents" }) : false,
|
|
73
|
+
key: "parents",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
active: activeTab === "grants",
|
|
77
|
+
as: Link,
|
|
78
|
+
to: linkTo.STRUCTURE_GRANTS(structure),
|
|
79
|
+
content: grants ? formatMessage({ id: "tabs.dd.grants" }) : false,
|
|
80
|
+
key: "grants",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
active: activeTab === "metadata",
|
|
84
|
+
as: Link,
|
|
85
|
+
to: linkTo.STRUCTURE_METADATA(structure),
|
|
86
|
+
content: metadata ? formatMessage({ id: "tabs.dd.metadata" }) : false,
|
|
87
|
+
key: "metadata",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
active: activeTab === "profile",
|
|
91
|
+
as: Link,
|
|
92
|
+
to: linkTo.STRUCTURE_PROFILE(structure),
|
|
93
|
+
content: profile ? formatMessage({ id: "tabs.dd.profile" }) : false,
|
|
94
|
+
key: "profile",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
active: activeTab === "rules",
|
|
98
|
+
as: Link,
|
|
99
|
+
to: linkTo.STRUCTURE_RULES(structure),
|
|
100
|
+
content: rules ? formatMessage({ id: "tabs.dd.rules" }) : false,
|
|
101
|
+
key: "rules",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
active: activeTab === "links",
|
|
105
|
+
as: Link,
|
|
106
|
+
to: linkTo.STRUCTURE_LINKS(structure),
|
|
107
|
+
content: links ? formatMessage({ id: "tabs.dd.links" }) : false,
|
|
108
|
+
key: "links",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
active: activeTab === "structureLinks",
|
|
112
|
+
as: Link,
|
|
113
|
+
to: linkTo.STRUCTURE_STRUCTURE_LINKS(structure),
|
|
114
|
+
content: structureLinks
|
|
115
|
+
? formatMessage({ id: "tabs.dd.structureLinks" })
|
|
116
|
+
: false,
|
|
117
|
+
key: "structureLinks",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
active: activeTab === "lineage",
|
|
121
|
+
as: Link,
|
|
122
|
+
to: linkTo.STRUCTURE_LINEAGE(structure),
|
|
123
|
+
content: lineage ? formatMessage({ id: "tabs.dd.lineage" }) : false,
|
|
124
|
+
key: "lineage",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
active: activeTab === "impact",
|
|
128
|
+
as: Link,
|
|
129
|
+
to: linkTo.STRUCTURE_IMPACT(structure),
|
|
130
|
+
content: impact ? formatMessage({ id: "tabs.dd.impact" }) : false,
|
|
131
|
+
key: "impact",
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
active: activeTab === "versions",
|
|
135
|
+
as: Link,
|
|
136
|
+
to: versionsLink(structure, version),
|
|
137
|
+
content: versions ? formatMessage({ id: "tabs.dd.versions" }) : false,
|
|
138
|
+
key: "versions",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
active: activeTab === "events",
|
|
142
|
+
as: Link,
|
|
143
|
+
to: linkTo.STRUCTURE_EVENTS(structure),
|
|
144
|
+
content: events ? formatMessage({ id: "tabs.dd.audit" }) : false,
|
|
145
|
+
key: "events",
|
|
146
|
+
},
|
|
147
|
+
])
|
|
148
|
+
: null;
|
|
147
149
|
return (
|
|
148
150
|
<>
|
|
149
151
|
<Menu attached="top" secondary pointing tabular items={items} />
|
|
@@ -44,10 +44,10 @@ StructureTags.propTypes = {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
export const StructureTagsLoader = () => {
|
|
47
|
-
const { id } = useParams();
|
|
47
|
+
const { id, structureId } = useParams();
|
|
48
48
|
const { loading, error, data } = useQuery(STRUCTURE_TAGS_QUERY, {
|
|
49
49
|
fetchPolicy: "cache-and-network",
|
|
50
|
-
variables: { id },
|
|
50
|
+
variables: { id: id || structureId },
|
|
51
51
|
});
|
|
52
52
|
if (error) return null;
|
|
53
53
|
if (loading) return <Loading />;
|
|
@@ -3,6 +3,7 @@ import React from "react";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Grid, Segment } from "semantic-ui-react";
|
|
6
|
+
import { useParams } from "react-router-dom";
|
|
6
7
|
import FilteredNav from "./FilteredNav";
|
|
7
8
|
import StructureCrumbs from "./StructureCrumbs";
|
|
8
9
|
import StructureGrantCart from "./StructureGrantCart";
|
|
@@ -11,43 +12,54 @@ import StructureTabPaneRoutes from "./StructureTabPaneRoutes";
|
|
|
11
12
|
import StructureTabRoutes from "./StructureTabRoutes";
|
|
12
13
|
|
|
13
14
|
export const StructureView = ({
|
|
15
|
+
navFilter,
|
|
14
16
|
structureLoading,
|
|
15
17
|
structure,
|
|
16
18
|
showGrantRequestCart,
|
|
17
|
-
}) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<Grid
|
|
27
|
-
<Grid.
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
</
|
|
31
|
-
</Grid.
|
|
32
|
-
<Grid.
|
|
33
|
-
<Segment>
|
|
34
|
-
<StructureSummary />
|
|
35
|
-
<StructureTabRoutes />
|
|
36
|
-
<StructureTabPaneRoutes />
|
|
37
|
-
</Segment>
|
|
38
|
-
</Grid.Column>
|
|
39
|
-
{showGrantRequestCart && (
|
|
19
|
+
}) => {
|
|
20
|
+
const { id: url_structure_id } = useParams();
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Segment loading={structureLoading} className="structures">
|
|
24
|
+
{structure &&
|
|
25
|
+
structure.id &&
|
|
26
|
+
structure.id === url_structure_id &&
|
|
27
|
+
!structureLoading ? (
|
|
28
|
+
<Grid>
|
|
29
|
+
<Grid.Row>
|
|
30
|
+
<Grid.Column width={16}>
|
|
31
|
+
<StructureCrumbs />
|
|
32
|
+
</Grid.Column>
|
|
33
|
+
</Grid.Row>
|
|
34
|
+
<Grid.Row stretched>
|
|
40
35
|
<Grid.Column width={4}>
|
|
41
|
-
<
|
|
36
|
+
<Segment id="filter-nav-container">
|
|
37
|
+
<FilteredNav filter={navFilter} structure={structure} />
|
|
38
|
+
</Segment>
|
|
42
39
|
</Grid.Column>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
<Grid.Column width={showGrantRequestCart ? 8 : 12}>
|
|
41
|
+
<Segment>
|
|
42
|
+
<StructureSummary />
|
|
43
|
+
<StructureTabRoutes />
|
|
44
|
+
<StructureTabPaneRoutes />
|
|
45
|
+
</Segment>
|
|
46
|
+
</Grid.Column>
|
|
47
|
+
{showGrantRequestCart && (
|
|
48
|
+
<Grid.Column width={4}>
|
|
49
|
+
<StructureGrantCart />
|
|
50
|
+
</Grid.Column>
|
|
51
|
+
)}
|
|
52
|
+
</Grid.Row>
|
|
53
|
+
</Grid>
|
|
54
|
+
) : (
|
|
55
|
+
<p>NADA</p>
|
|
56
|
+
)}
|
|
57
|
+
</Segment>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
49
60
|
|
|
50
61
|
StructureView.propTypes = {
|
|
62
|
+
navFilter: PropTypes.object,
|
|
51
63
|
structureLoading: PropTypes.bool,
|
|
52
64
|
structure: PropTypes.object,
|
|
53
65
|
showGrantRequestCart: PropTypes.bool,
|
|
@@ -57,12 +69,19 @@ const mapStateToProps = ({
|
|
|
57
69
|
structureLoading,
|
|
58
70
|
structure,
|
|
59
71
|
grantRequestsCart,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
navFilter,
|
|
73
|
+
}) => {
|
|
74
|
+
return {
|
|
75
|
+
navFilter,
|
|
76
|
+
structureLoading,
|
|
77
|
+
structure,
|
|
78
|
+
showGrantRequestCart:
|
|
79
|
+
!grantRequestsCart.modificationGrant &&
|
|
80
|
+
_.flow(
|
|
81
|
+
_.pathOr([], "structures"),
|
|
82
|
+
_.negate(_.isEmpty)
|
|
83
|
+
)(grantRequestsCart),
|
|
84
|
+
};
|
|
85
|
+
};
|
|
67
86
|
|
|
68
87
|
export default connect(mapStateToProps)(StructureView);
|