@truedat/dd 6.6.0 → 6.6.1
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/CatalogCustomViewCards.js +9 -32
- package/src/components/DictionaryRoutes.js +1 -9
- package/src/components/GrantRemovalDirectButton.js +1 -3
- package/src/components/GrantRequestCancel.js +1 -1
- package/src/components/GrantRoutes.js +1 -14
- package/src/components/StructureGrantListButton.js +4 -4
- package/src/components/StructureSelector.js +70 -44
- package/src/components/StructureStructureForm.js +1 -1
- package/src/components/StructuresBulkUpdate.js +10 -14
- package/src/components/StructuresDownloadOption.js +31 -27
- package/src/components/StructuresEditableDownloadOption.js +12 -7
- package/src/components/StructuresGrantRequestView.js +55 -24
- package/src/components/StructuresLabelResults.js +5 -11
- package/src/components/StructuresPagination.js +13 -15
- package/src/components/StructuresRoutes.js +2 -18
- package/src/components/StructuresTable.js +79 -115
- package/src/components/StructuresUpdateOption.js +77 -9
- package/src/components/StructuresView.js +67 -52
- package/src/components/__tests__/CatalogCustomViewCards.spec.js +44 -7
- package/src/components/__tests__/StructureGrantListButton.spec.js +27 -17
- package/src/components/__tests__/StructureSelector.spec.js +70 -25
- package/src/components/__tests__/StructureStructureForm.spec.js +92 -60
- package/src/components/__tests__/StructureStructureLinks.spec.js +1 -1
- package/src/components/__tests__/StructuresBulkUpdate.spec.js +26 -14
- package/src/components/__tests__/StructuresDownloadOption.spec.js +38 -5
- package/src/components/__tests__/StructuresEditableDownloadOption.spec.js +20 -8
- package/src/components/__tests__/StructuresGrantRequestView.spec.js +43 -15
- package/src/components/__tests__/StructuresLabelResults.spec.js +37 -10
- package/src/components/__tests__/StructuresOptions.spec.js +62 -1
- package/src/components/__tests__/StructuresSearchResults.spec.js +67 -12
- package/src/components/__tests__/StructuresTable.spec.js +77 -88
- package/src/components/__tests__/StructuresUpdateOption.spec.js +53 -6
- package/src/components/__tests__/StructuresView.spec.js +126 -31
- package/src/components/__tests__/__snapshots__/StructureSelector.spec.js.snap +206 -42
- package/src/components/__tests__/__snapshots__/StructuresDownloadOption.spec.js.snap +17 -0
- package/src/components/__tests__/__snapshots__/StructuresGrantRequestView.spec.js.snap +68 -5
- package/src/components/__tests__/__snapshots__/StructuresLabelResults.spec.js.snap +7 -12
- package/src/components/__tests__/__snapshots__/StructuresSearchResults.spec.js.snap +72 -27
- package/src/components/__tests__/__snapshots__/StructuresTable.spec.js.snap +226 -153
- package/src/components/__tests__/__snapshots__/StructuresUpdateOption.spec.js.snap +3 -3
- package/src/components/index.js +0 -8
- package/src/hooks/useStructures.js +6 -6
- package/src/reducers/__tests__/selectedUserSearchFilter.spec.js +2 -23
- package/src/reducers/__tests__/structureQuery.spec.js +1 -63
- package/src/reducers/index.js +0 -18
- package/src/reducers/previousStructureQuery.js +3 -6
- package/src/reducers/selectedUserSearchFilter.js +1 -10
- package/src/reducers/structureQuery.js +1 -33
- package/src/routines.js +1 -15
- package/src/sagas/__tests__/bulkUpdateStructures.spec.js +7 -7
- package/src/sagas/__tests__/downloadEditableStructures.spec.js +1 -6
- package/src/sagas/__tests__/downloadStructures.spec.js +2 -7
- package/src/sagas/__tests__/fetchStructures.spec.js +4 -4
- package/src/sagas/bulkUpdateStructures.js +6 -4
- package/src/sagas/downloadEditableStructures.js +2 -3
- package/src/sagas/downloadStructures.js +2 -3
- package/src/sagas/index.js +0 -3
- package/src/selectors/__tests__/getGrantSelectedFilters.spec.js +1 -1
- package/src/selectors/__tests__/structureColumnsSelector.spec.js +5 -19
- package/src/selectors/__tests__/templateNamesSelector.spec.js +19 -0
- package/src/selectors/index.js +1 -8
- package/src/selectors/structureColumnsSelector.js +6 -46
- package/src/selectors/templateNamesSelector.js +7 -0
- package/src/utils/structureCustomTranslations.js +19 -0
- package/src/components/StructureDateFilter.js +0 -32
- package/src/components/StructureFilters.js +0 -19
- package/src/components/StructureFiltersLoader.js +0 -32
- package/src/components/StructureSelectedFilters.js +0 -94
- package/src/components/__tests__/StructureDateFilter.spec.js +0 -11
- package/src/components/__tests__/__snapshots__/StructureDateFilter.spec.js.snap +0 -13
- package/src/reducers/__tests__/structureActiveFilters.spec.js +0 -100
- package/src/reducers/__tests__/structureDateFilter.spec.js +0 -57
- package/src/reducers/__tests__/structureFilters.spec.js +0 -37
- package/src/reducers/__tests__/structureUserFilters.spec.js +0 -76
- package/src/reducers/__tests__/structuresActions.spec.js +0 -38
- package/src/reducers/__tests__/structuresLoading.spec.js +0 -26
- package/src/reducers/structureActiveFilters.js +0 -58
- package/src/reducers/structureCount.js +0 -20
- package/src/reducers/structureDateFilter.js +0 -33
- package/src/reducers/structureFilters.js +0 -21
- package/src/reducers/structureFiltersLoading.js +0 -14
- package/src/reducers/structureSelectedFilter.js +0 -34
- package/src/reducers/structuresActions.js +0 -18
- package/src/reducers/structuresLoading.js +0 -14
- package/src/reducers/structuresPageSize.js +0 -15
- package/src/sagas/fetchStructureFilters.js +0 -29
- package/src/selectors/__tests__/bulkUpdateDisabledSelector.spec.js +0 -72
- package/src/selectors/__tests__/getStructureAvailableFilters.spec.js +0 -15
- package/src/selectors/__tests__/getStructureSelectedFilterActiveValues.spec.js +0 -20
- package/src/selectors/__tests__/getStructureSelectedFilterValues.spec.js +0 -15
- package/src/selectors/__tests__/getStructureSelectedFilters.spec.js +0 -15
- package/src/selectors/bulkUpdateDisabledSelector.js +0 -46
- package/src/selectors/getPreviousStructureQuery.js +0 -2
- package/src/selectors/getStructureAvailableFilters.js +0 -15
- package/src/selectors/getStructureFilterTypes.js +0 -7
- package/src/selectors/getStructureSelectedFilterActiveValues.js +0 -9
- package/src/selectors/getStructureSelectedFilterValues.js +0 -12
- package/src/selectors/getStructureSelectedFilters.js +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "6.6.
|
|
3
|
+
"version": "6.6.1",
|
|
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.6.
|
|
37
|
+
"@truedat/test": "6.6.1",
|
|
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.6.
|
|
92
|
-
"@truedat/core": "6.6.
|
|
93
|
-
"@truedat/df": "6.6.
|
|
91
|
+
"@truedat/auth": "6.6.1",
|
|
92
|
+
"@truedat/core": "6.6.1",
|
|
93
|
+
"@truedat/df": "6.6.1",
|
|
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": "2fa84eee80136fa3bd394c04153e6f16d2e5a1e0"
|
|
119
119
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { connect } from "react-redux";
|
|
5
4
|
import { Link, useParams } from "react-router-dom";
|
|
6
5
|
import { Card, Label } from "semantic-ui-react";
|
|
7
6
|
import { useIntl } from "react-intl";
|
|
8
7
|
import { FormattedNumber, FormattedMessage } from "react-intl";
|
|
9
8
|
import { CardGroupsAccordion } from "@truedat/core/components";
|
|
10
9
|
import { linkTo } from "@truedat/core/routes";
|
|
11
|
-
import {
|
|
10
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
12
11
|
import { Loading } from "@truedat/core/components";
|
|
13
12
|
|
|
14
13
|
const moveMissingBucketToTheEnd = (buckets) =>
|
|
@@ -20,15 +19,13 @@ const orderBuckets = (buckets) =>
|
|
|
20
19
|
moveMissingBucketToTheEnd
|
|
21
20
|
)(buckets);
|
|
22
21
|
|
|
23
|
-
export
|
|
24
|
-
fetchStructureFilters,
|
|
25
|
-
structureFilters,
|
|
26
|
-
structureFiltersLoading,
|
|
27
|
-
}) => {
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
fetchStructureFilters();
|
|
30
|
-
}, [fetchStructureFilters]);
|
|
22
|
+
export default function CatalogCustomViewCards() {
|
|
31
23
|
const { propertyPath } = useParams();
|
|
24
|
+
const {
|
|
25
|
+
loadingFilters: structureFiltersLoading,
|
|
26
|
+
allFilters: structureFilters,
|
|
27
|
+
} = useSearchContext();
|
|
28
|
+
|
|
32
29
|
const groups = [];
|
|
33
30
|
const emptyMessageId = "catalogViewConfig.empty";
|
|
34
31
|
|
|
@@ -53,13 +50,7 @@ export const CatalogCustomViewCards = ({
|
|
|
53
50
|
))(orderBuckets(structureFilters[propertyPath]?.buckets))}
|
|
54
51
|
</Card.Group>
|
|
55
52
|
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
CatalogCustomViewCards.propTypes = {
|
|
59
|
-
fetchStructureFilters: PropTypes.func,
|
|
60
|
-
structureFilters: PropTypes.object,
|
|
61
|
-
structureFiltersLoading: PropTypes.bool,
|
|
62
|
-
};
|
|
53
|
+
}
|
|
63
54
|
|
|
64
55
|
export const CatalogCustomViewCard = ({
|
|
65
56
|
name,
|
|
@@ -111,17 +102,3 @@ export const CatalogCustomViewCardPopup = ({ structures_count }) => {
|
|
|
111
102
|
CatalogCustomViewCardPopup.propTypes = {
|
|
112
103
|
structures_count: PropTypes.number,
|
|
113
104
|
};
|
|
114
|
-
|
|
115
|
-
const mapStateToProps = ({
|
|
116
|
-
structures,
|
|
117
|
-
structureFilters,
|
|
118
|
-
structureFiltersLoading,
|
|
119
|
-
}) => ({
|
|
120
|
-
structures,
|
|
121
|
-
structureFilters,
|
|
122
|
-
structureFiltersLoading,
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
export default connect(mapStateToProps, {
|
|
126
|
-
fetchStructureFilters: fetchStructureFiltersRoutine,
|
|
127
|
-
})(CatalogCustomViewCards);
|
|
@@ -26,8 +26,6 @@ import ProfileExecutionLoader from "./ProfileExecutionLoader";
|
|
|
26
26
|
import ProfileGroupLoader from "./ProfileGroupLoader";
|
|
27
27
|
import ProfileGroup from "./ProfileGroup";
|
|
28
28
|
import ReferenceDatasetRoutes from "./ReferenceDatasetRoutes";
|
|
29
|
-
import StructureFiltersLoader from "./StructureFiltersLoader";
|
|
30
|
-
import StructuresLoader from "./StructuresLoader";
|
|
31
29
|
import StructuresRoutes from "./StructuresRoutes";
|
|
32
30
|
import StructuresUploadEvents from "./StructuresUploadEvents";
|
|
33
31
|
import StructureTypesLoader from "./StructureTypesLoader";
|
|
@@ -46,13 +44,7 @@ const TemplatesLoader = React.lazy(() =>
|
|
|
46
44
|
);
|
|
47
45
|
|
|
48
46
|
const Loaders = () => {
|
|
49
|
-
return
|
|
50
|
-
<>
|
|
51
|
-
<StructuresLoader />
|
|
52
|
-
<StructureFiltersLoader />
|
|
53
|
-
<TemplatesLoader scope="dd" />
|
|
54
|
-
</>
|
|
55
|
-
);
|
|
47
|
+
return <TemplatesLoader scope="dd" />;
|
|
56
48
|
};
|
|
57
49
|
|
|
58
50
|
export const DictionaryRoutes = () => {
|
|
@@ -6,7 +6,6 @@ import { ConfirmModal } from "@truedat/core/components";
|
|
|
6
6
|
import { Button } from "semantic-ui-react";
|
|
7
7
|
|
|
8
8
|
export const GrantRemovalDirectButton = ({
|
|
9
|
-
actions,
|
|
10
9
|
grant,
|
|
11
10
|
requestGrantRemoval,
|
|
12
11
|
onConfirm,
|
|
@@ -69,7 +68,7 @@ export const GrantRemovalDirectButton = ({
|
|
|
69
68
|
id: `grant.actions.${action}.confirmation.content`,
|
|
70
69
|
})}
|
|
71
70
|
onConfirm={() => {
|
|
72
|
-
removeGrant(payload)
|
|
71
|
+
removeGrant(payload);
|
|
73
72
|
}}
|
|
74
73
|
onOpen={(e) => e.stopPropagation()}
|
|
75
74
|
onClose={(e) => e.stopPropagation()}
|
|
@@ -78,7 +77,6 @@ export const GrantRemovalDirectButton = ({
|
|
|
78
77
|
};
|
|
79
78
|
|
|
80
79
|
GrantRemovalDirectButton.propTypes = {
|
|
81
|
-
actions: PropTypes.object,
|
|
82
80
|
grant: PropTypes.object,
|
|
83
81
|
requestGrantRemoval: PropTypes.func,
|
|
84
82
|
onConfirm: PropTypes.func,
|
|
@@ -35,9 +35,6 @@ import GrantsLoader from "./GrantsLoader";
|
|
|
35
35
|
import MyGrantRequests from "./MyGrantRequests";
|
|
36
36
|
import StructureGrantCartCheckout from "./StructureGrantCartCheckout";
|
|
37
37
|
import StructuresGrantRequestView from "./StructuresGrantRequestView";
|
|
38
|
-
import StructuresLoader from "./StructuresLoader";
|
|
39
|
-
import StructureFiltersLoader from "./StructureFiltersLoader";
|
|
40
|
-
import UserSearchFiltersLoader from "./UserSearchFiltersLoader";
|
|
41
38
|
import GrantRequestsFiltersLoader from "./GrantRequestsFiltersLoader";
|
|
42
39
|
|
|
43
40
|
const TemplatesLoader = React.lazy(() =>
|
|
@@ -121,17 +118,7 @@ export const GrantRoutes = ({ grantRequestLoaded }) => {
|
|
|
121
118
|
field: "classes._grantable",
|
|
122
119
|
},
|
|
123
120
|
};
|
|
124
|
-
return
|
|
125
|
-
<>
|
|
126
|
-
<StructuresLoader
|
|
127
|
-
defaultFilters={defaultFilters}
|
|
128
|
-
withGrantRequests
|
|
129
|
-
/>
|
|
130
|
-
<StructureFiltersLoader defaultFilters={defaultFilters} />
|
|
131
|
-
<UserSearchFiltersLoader scope="data_structure" />
|
|
132
|
-
<StructuresGrantRequestView />
|
|
133
|
-
</>
|
|
134
|
-
);
|
|
121
|
+
return <StructuresGrantRequestView defaultFilters={defaultFilters} />;
|
|
135
122
|
}}
|
|
136
123
|
/>
|
|
137
124
|
<Route
|
|
@@ -2,6 +2,7 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
5
6
|
import StructureGrantRequestButton from "./StructureGrantRequestButton";
|
|
6
7
|
import StructureGrantDropdown from "./StructureGrantDropdown";
|
|
7
8
|
|
|
@@ -11,8 +12,9 @@ export const StructureGrantListButton = ({
|
|
|
11
12
|
authorized_dropdown,
|
|
12
13
|
authorized_request,
|
|
13
14
|
requested,
|
|
14
|
-
previousStructureQuery,
|
|
15
15
|
}) => {
|
|
16
|
+
const { filterParams: previousStructureQuery } = useSearchContext();
|
|
17
|
+
|
|
16
18
|
const grant = _.flow(_.prop("my_grants"), _.first)(structure);
|
|
17
19
|
const grantRequest = _.prop("my_grant_request")(structure);
|
|
18
20
|
|
|
@@ -49,11 +51,10 @@ StructureGrantListButton.propTypes = {
|
|
|
49
51
|
authorized_dropdown: PropTypes.bool,
|
|
50
52
|
authorized_request: PropTypes.bool,
|
|
51
53
|
requested: PropTypes.bool,
|
|
52
|
-
previousStructureQuery: PropTypes.object,
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
const mapStateToProps = (
|
|
56
|
-
{ structureGrantPopup, grantRequestsCart
|
|
57
|
+
{ structureGrantPopup, grantRequestsCart },
|
|
57
58
|
{ structure }
|
|
58
59
|
) => ({
|
|
59
60
|
structureGrantPopup,
|
|
@@ -70,7 +71,6 @@ const mapStateToProps = (
|
|
|
70
71
|
false,
|
|
71
72
|
"request_grant"
|
|
72
73
|
)(structure.user_permissions),
|
|
73
|
-
previousStructureQuery,
|
|
74
74
|
structure: {
|
|
75
75
|
...structure,
|
|
76
76
|
id: structure.id + "",
|
|
@@ -3,31 +3,30 @@ import React, { useState, useEffect } from "react";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Segment } from "semantic-ui-react";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
6
|
+
import SearchWidget from "@truedat/core/search/SearchWidget";
|
|
7
|
+
import {
|
|
8
|
+
SearchContextProvider,
|
|
9
|
+
useSearchContext,
|
|
10
|
+
} from "@truedat/core/search/SearchContext";
|
|
11
|
+
import translations from "../utils/structureCustomTranslations";
|
|
12
|
+
import {
|
|
13
|
+
useDataStructureFilters,
|
|
14
|
+
useDataStructureSearch,
|
|
15
|
+
} from "../hooks/useStructures";
|
|
14
16
|
import StructuresSearchResults from "./StructuresSearchResults";
|
|
15
17
|
|
|
16
|
-
export
|
|
17
|
-
columns,
|
|
18
|
+
export function StructureSelectorContent({
|
|
18
19
|
overwriteColumns,
|
|
19
|
-
defaultFilters,
|
|
20
|
-
loading,
|
|
21
|
-
structures,
|
|
22
|
-
structuresRows,
|
|
23
20
|
selectedStructure: structure,
|
|
24
21
|
onSelect,
|
|
25
|
-
pageSize = 7,
|
|
26
22
|
links,
|
|
27
23
|
placeToTop,
|
|
28
|
-
|
|
29
|
-
}) => {
|
|
24
|
+
}) {
|
|
30
25
|
const [selectedStructure, setSelectedStructure] = useState(null);
|
|
26
|
+
const { searchData, loading } = useSearchContext();
|
|
27
|
+
|
|
28
|
+
const structures = searchData?.data;
|
|
29
|
+
|
|
31
30
|
useEffect(() => {
|
|
32
31
|
setSelectedStructure(structure);
|
|
33
32
|
}, [structure]);
|
|
@@ -37,25 +36,14 @@ export const StructureSelector = ({
|
|
|
37
36
|
setSelectedStructure(structure);
|
|
38
37
|
onSelect && onSelect(selectedStructure);
|
|
39
38
|
};
|
|
40
|
-
|
|
41
39
|
return (
|
|
42
40
|
<Segment>
|
|
43
|
-
<
|
|
44
|
-
withDataFields
|
|
45
|
-
pageSize={pageSize}
|
|
46
|
-
defaultFilters={defaultFilters}
|
|
47
|
-
/>
|
|
48
|
-
<StructureTypesLoader />
|
|
49
|
-
<StructureFiltersLoader defaultFilters={defaultFilters} />
|
|
50
|
-
<StructuresSearch />
|
|
51
|
-
<StructureSelectedFilters />
|
|
52
|
-
<StructureDateFilter />
|
|
53
|
-
<UserSearchFiltersLoader scope="data_structure" />
|
|
41
|
+
<SearchWidget dateFilter />
|
|
54
42
|
<StructuresSearchResults
|
|
55
|
-
columns={
|
|
43
|
+
columns={overwriteColumns}
|
|
56
44
|
loading={loading}
|
|
57
45
|
size="small"
|
|
58
|
-
structures={
|
|
46
|
+
structures={structures}
|
|
59
47
|
onSelect={handleSelect}
|
|
60
48
|
selectedStructure={selectedStructure}
|
|
61
49
|
links={links}
|
|
@@ -63,28 +51,66 @@ export const StructureSelector = ({
|
|
|
63
51
|
/>
|
|
64
52
|
</Segment>
|
|
65
53
|
);
|
|
66
|
-
}
|
|
54
|
+
}
|
|
67
55
|
|
|
68
|
-
|
|
69
|
-
columns: PropTypes.array,
|
|
56
|
+
StructureSelectorContent.propTypes = {
|
|
70
57
|
overwriteColumns: PropTypes.array,
|
|
71
|
-
defaultFilters: PropTypes.object,
|
|
72
|
-
loading: PropTypes.bool,
|
|
73
58
|
onSelect: PropTypes.func,
|
|
74
|
-
pageSize: PropTypes.number,
|
|
75
59
|
selectedStructure: PropTypes.object,
|
|
76
|
-
structures: PropTypes.array,
|
|
77
|
-
structuresRows: PropTypes.array,
|
|
78
60
|
links: PropTypes.array,
|
|
79
61
|
placeToTop: PropTypes.bool,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const StructureSelector = (props) => {
|
|
65
|
+
const defaultFilters = _.propOr({}, "defaultFilters")(props);
|
|
66
|
+
const filtersGroup = _.propOr([], "filtersGroup")(props);
|
|
67
|
+
const pageSize = _.prop("pageSize")(props);
|
|
68
|
+
const withGrantRequests = _.prop("withGrantRequests")(props);
|
|
69
|
+
const withDataFields = _.prop("withDataFields")(props);
|
|
70
|
+
|
|
71
|
+
const enrichSearchPayload = {
|
|
72
|
+
my_grant_requests: !!withGrantRequests,
|
|
73
|
+
with_data_fields: !!withDataFields,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const searchProps = {
|
|
77
|
+
initialSortColumn: "name.raw",
|
|
78
|
+
initialSortDirection: "ascending",
|
|
79
|
+
useSearch: useDataStructureSearch,
|
|
80
|
+
useFilters: useDataStructureFilters,
|
|
81
|
+
pageSize,
|
|
82
|
+
userFiltersType: "user_search_filters",
|
|
83
|
+
userFilterScope: "data_structure",
|
|
84
|
+
translations,
|
|
85
|
+
filtersGroup,
|
|
86
|
+
defaultFilters,
|
|
87
|
+
enrichSearchPayload,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<>
|
|
92
|
+
<SearchContextProvider {...searchProps}>
|
|
93
|
+
<StructureSelectorContent {...props} />
|
|
94
|
+
</SearchContextProvider>
|
|
95
|
+
</>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
StructureSelector.propTypes = {
|
|
100
|
+
pageSize: PropTypes.number,
|
|
101
|
+
filtersGroup: PropTypes.array,
|
|
102
|
+
defaultFilters: PropTypes.object,
|
|
103
|
+
withGrantRequests: PropTypes.bool,
|
|
80
104
|
withDataFields: PropTypes.bool,
|
|
105
|
+
selectedStructure: PropTypes.object,
|
|
106
|
+
onSelect: PropTypes.func,
|
|
107
|
+
overwriteColumns: PropTypes.array,
|
|
108
|
+
links: PropTypes.array,
|
|
109
|
+
placeToTop: PropTypes.bool,
|
|
81
110
|
};
|
|
82
111
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
structures: state.structures,
|
|
86
|
-
structuresRows: structureRowsSelector(state, props),
|
|
87
|
-
loading: state.structuresLoading,
|
|
112
|
+
const mapStateToProps = (state) => ({
|
|
113
|
+
filtersGroup: state?.structureFiltersGroup,
|
|
88
114
|
});
|
|
89
115
|
|
|
90
116
|
export default connect(mapStateToProps)(StructureSelector);
|
|
@@ -22,7 +22,7 @@ export const StructureStructureForm = ({
|
|
|
22
22
|
const { handleSubmit, control, formState } = useForm({
|
|
23
23
|
mode: "all",
|
|
24
24
|
defaultValues: {
|
|
25
|
-
sourceStructureId: sourceStructure
|
|
25
|
+
sourceStructureId: sourceStructure?.id,
|
|
26
26
|
targetStructureId: null,
|
|
27
27
|
labelIds: [],
|
|
28
28
|
},
|
|
@@ -28,14 +28,15 @@ const DynamicForm = React.lazy(() =>
|
|
|
28
28
|
const isEmptyValue = (value) => !_.isNumber(value) && _.isEmpty(value);
|
|
29
29
|
|
|
30
30
|
export const StructuresBulkUpdate = ({
|
|
31
|
-
structureFilters,
|
|
32
31
|
structureTypes,
|
|
33
|
-
|
|
32
|
+
previousStructureQuery,
|
|
34
33
|
bulkUpdateStructures,
|
|
35
34
|
bulkUpdateStructuresLoading,
|
|
36
|
-
publishAllowed,
|
|
37
35
|
}) => {
|
|
38
36
|
const [content, setContent] = useState({});
|
|
37
|
+
const { searchParams, structureCount, allFilters, actions } =
|
|
38
|
+
previousStructureQuery;
|
|
39
|
+
const publishAllowed = !!actions?.autoPublish;
|
|
39
40
|
|
|
40
41
|
const findTemplateName = (name) =>
|
|
41
42
|
_.flow(_.find({ name }), _.prop("template.name"))(structureTypes);
|
|
@@ -49,7 +50,7 @@ export const StructuresBulkUpdate = ({
|
|
|
49
50
|
],
|
|
50
51
|
[_.stubTrue, _.constant("")],
|
|
51
52
|
])
|
|
52
|
-
)(
|
|
53
|
+
)(allFilters);
|
|
53
54
|
|
|
54
55
|
const domainIds = _.flow(
|
|
55
56
|
_.prop("taxonomy.values"),
|
|
@@ -58,7 +59,7 @@ export const StructuresBulkUpdate = ({
|
|
|
58
59
|
[(domains) => _.size(domains) == 1, _.identity],
|
|
59
60
|
[_.stubTrue, _.constant(null)],
|
|
60
61
|
])
|
|
61
|
-
)(
|
|
62
|
+
)(allFilters);
|
|
62
63
|
|
|
63
64
|
const { data, loading } = useTemplate({ name: templateName, domainIds });
|
|
64
65
|
const template = _.prop("template")(data);
|
|
@@ -87,6 +88,7 @@ export const StructuresBulkUpdate = ({
|
|
|
87
88
|
update_attributes: { df_content: parsedContent },
|
|
88
89
|
structureCount,
|
|
89
90
|
autoPublish,
|
|
91
|
+
searchParams,
|
|
90
92
|
});
|
|
91
93
|
};
|
|
92
94
|
|
|
@@ -178,26 +180,20 @@ export const StructuresBulkUpdate = ({
|
|
|
178
180
|
};
|
|
179
181
|
|
|
180
182
|
StructuresBulkUpdate.propTypes = {
|
|
181
|
-
structureFilters: PropTypes.object,
|
|
182
183
|
structureTypes: PropTypes.array,
|
|
183
|
-
structureCount: PropTypes.number,
|
|
184
184
|
bulkUpdateStructures: PropTypes.func,
|
|
185
185
|
bulkUpdateStructuresLoading: PropTypes.bool,
|
|
186
|
-
|
|
186
|
+
previousStructureQuery: PropTypes.object,
|
|
187
187
|
};
|
|
188
188
|
|
|
189
189
|
const mapStateToProps = ({
|
|
190
|
-
structureFilters,
|
|
191
190
|
structureTypes,
|
|
192
|
-
structureCount,
|
|
193
191
|
bulkUpdateStructuresLoading,
|
|
194
|
-
|
|
192
|
+
previousStructureQuery,
|
|
195
193
|
}) => ({
|
|
196
|
-
structureFilters,
|
|
197
194
|
structureTypes,
|
|
198
|
-
structureCount,
|
|
199
195
|
bulkUpdateStructuresLoading,
|
|
200
|
-
|
|
196
|
+
previousStructureQuery,
|
|
201
197
|
});
|
|
202
198
|
|
|
203
199
|
export default connect(mapStateToProps, { bulkUpdateStructures })(
|
|
@@ -4,6 +4,7 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Dropdown } from "semantic-ui-react";
|
|
6
6
|
import { useIntl } from "react-intl";
|
|
7
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
7
8
|
import { downloadStructures } from "../routines";
|
|
8
9
|
|
|
9
10
|
const staticLabels = [
|
|
@@ -23,53 +24,56 @@ const staticLabels = [
|
|
|
23
24
|
];
|
|
24
25
|
|
|
25
26
|
export const StructuresDownloadOption = ({
|
|
26
|
-
structures,
|
|
27
27
|
structuresDownloading,
|
|
28
|
-
structuresLoading,
|
|
29
28
|
downloadStructures,
|
|
30
29
|
hasFilterApplied,
|
|
31
30
|
}) => {
|
|
32
31
|
const { formatMessage, locale } = useIntl();
|
|
32
|
+
|
|
33
|
+
const {
|
|
34
|
+
searchData,
|
|
35
|
+
loading: structuresLoading,
|
|
36
|
+
filterParams: searchParams,
|
|
37
|
+
} = useSearchContext();
|
|
38
|
+
|
|
39
|
+
const structures = searchData?.data;
|
|
40
|
+
|
|
33
41
|
const headerLabels = _.flow(
|
|
34
42
|
_.map((l) => [l, formatMessage({ id: `structures.props.${l}` })]),
|
|
35
43
|
_.fromPairs
|
|
36
44
|
)(staticLabels);
|
|
37
45
|
const isDisabled = _.isEmpty(structures) || !hasFilterApplied;
|
|
38
|
-
return (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
46
|
+
return !structuresLoading ? (
|
|
47
|
+
<Dropdown.Item
|
|
48
|
+
icon="download"
|
|
49
|
+
content={
|
|
50
|
+
<>
|
|
51
|
+
<span>
|
|
52
|
+
{formatMessage({ id: "structures.actions.download.tooltip" })}
|
|
53
|
+
</span>
|
|
54
|
+
{isDisabled && (
|
|
55
|
+
<p className="menu-item-description">
|
|
56
|
+
{formatMessage({ id: "structures.actions.download.popup" })}
|
|
57
|
+
</p>
|
|
58
|
+
)}
|
|
59
|
+
</>
|
|
60
|
+
}
|
|
61
|
+
onClick={() =>
|
|
62
|
+
downloadStructures({ headerLabels, lang: locale, searchParams })
|
|
63
|
+
}
|
|
64
|
+
disabled={isDisabled || structuresDownloading}
|
|
65
|
+
/>
|
|
66
|
+
) : null;
|
|
59
67
|
};
|
|
60
68
|
|
|
61
69
|
StructuresDownloadOption.propTypes = {
|
|
62
70
|
structuresDownloading: PropTypes.bool,
|
|
63
|
-
structuresLoading: PropTypes.bool,
|
|
64
71
|
downloadStructures: PropTypes.func,
|
|
65
|
-
structures: PropTypes.array,
|
|
66
72
|
hasFilterApplied: PropTypes.bool,
|
|
67
73
|
};
|
|
68
74
|
|
|
69
75
|
const mapStateToProps = (state) => ({
|
|
70
76
|
structuresDownloading: state.structuresDownloading,
|
|
71
|
-
structuresLoading: state.structuresLoading,
|
|
72
|
-
structures: state.structures,
|
|
73
77
|
});
|
|
74
78
|
|
|
75
79
|
export default connect(mapStateToProps, { downloadStructures })(
|
|
@@ -4,16 +4,23 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Dropdown } from "semantic-ui-react";
|
|
6
6
|
import { useIntl } from "react-intl";
|
|
7
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
7
8
|
import { downloadEditableStructures } from "../routines";
|
|
8
9
|
|
|
9
10
|
export const StructuresEditableDownloadOption = ({
|
|
10
|
-
structures,
|
|
11
11
|
structuresEditableDownloading,
|
|
12
|
-
structuresLoading,
|
|
13
12
|
downloadEditableStructures,
|
|
14
13
|
hasFilterApplied,
|
|
15
14
|
}) => {
|
|
16
15
|
const { formatMessage, locale } = useIntl();
|
|
16
|
+
const {
|
|
17
|
+
searchData,
|
|
18
|
+
loading: structuresLoading,
|
|
19
|
+
filterParams: searchParams,
|
|
20
|
+
} = useSearchContext();
|
|
21
|
+
|
|
22
|
+
const structures = searchData?.data;
|
|
23
|
+
|
|
17
24
|
const isDisabled = _.isEmpty(structures) || !hasFilterApplied;
|
|
18
25
|
return (
|
|
19
26
|
!structuresLoading && (
|
|
@@ -33,7 +40,9 @@ export const StructuresEditableDownloadOption = ({
|
|
|
33
40
|
)}
|
|
34
41
|
</>
|
|
35
42
|
}
|
|
36
|
-
onClick={() =>
|
|
43
|
+
onClick={() =>
|
|
44
|
+
downloadEditableStructures({ lang: locale, searchParams })
|
|
45
|
+
}
|
|
37
46
|
disabled={isDisabled || structuresEditableDownloading}
|
|
38
47
|
/>
|
|
39
48
|
)
|
|
@@ -41,17 +50,13 @@ export const StructuresEditableDownloadOption = ({
|
|
|
41
50
|
};
|
|
42
51
|
|
|
43
52
|
StructuresEditableDownloadOption.propTypes = {
|
|
44
|
-
structures: PropTypes.object,
|
|
45
53
|
structuresEditableDownloading: PropTypes.bool,
|
|
46
|
-
structuresLoading: PropTypes.bool,
|
|
47
54
|
downloadEditableStructures: PropTypes.func,
|
|
48
55
|
hasFilterApplied: PropTypes.bool,
|
|
49
56
|
};
|
|
50
57
|
|
|
51
58
|
const mapStateToProps = (state) => ({
|
|
52
59
|
structuresEditableDownloading: state.structuresEditableDownloading,
|
|
53
|
-
structuresLoading: state.structuresLoading,
|
|
54
|
-
structures: state.structures,
|
|
55
60
|
});
|
|
56
61
|
|
|
57
62
|
export default connect(mapStateToProps, { downloadEditableStructures })(
|