@truedat/dd 5.10.1 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/src/components/BucketView.js +1 -6
- package/src/components/CatalogCustomViewCards.js +22 -6
- package/src/components/StructureItemRoot.js +1 -6
- package/src/components/StructuresView.js +11 -4
- package/src/components/__tests__/CatalogCustomViewCards.spec.js +7 -4
- package/src/selectors/getStructureParent.js +1 -6
- package/src/utils/bucketNav.js +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.11.0",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.16.5",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "5.
|
|
37
|
+
"@truedat/test": "5.11.0",
|
|
38
38
|
"babel-jest": "^28.1.0",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@apollo/client": "^3.7.1",
|
|
91
|
-
"@truedat/auth": "5.
|
|
92
|
-
"@truedat/core": "5.
|
|
93
|
-
"@truedat/df": "5.
|
|
91
|
+
"@truedat/auth": "5.11.0",
|
|
92
|
+
"@truedat/core": "5.11.0",
|
|
93
|
+
"@truedat/df": "5.11.0",
|
|
94
94
|
"lodash": "^4.17.21",
|
|
95
95
|
"moment": "^2.29.4",
|
|
96
96
|
"path-to-regexp": "^1.7.0",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"react-dom": ">= 16.8.6 < 17",
|
|
116
116
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "ad93d26b0d6eb4481e562a5c793540bcdf964940"
|
|
119
119
|
}
|
|
@@ -7,6 +7,7 @@ import { useParams, useLocation } from "react-router-dom";
|
|
|
7
7
|
import searchImage from "assets/searching.png";
|
|
8
8
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
9
9
|
import { saveNavFilter as saveNavFilterRoutine } from "../routines";
|
|
10
|
+
import { isBucketFilter } from "../utils/bucketNav";
|
|
10
11
|
import FilteredNav from "./FilteredNav";
|
|
11
12
|
import StructureCrumbs from "./StructureCrumbs";
|
|
12
13
|
import StructureGrantCart from "./StructureGrantCart";
|
|
@@ -14,12 +15,6 @@ import StructureSummary from "./StructureSummary";
|
|
|
14
15
|
import StructureTabPaneRoutes from "./StructureTabPaneRoutes";
|
|
15
16
|
import StructureTabRoutes from "./StructureTabRoutes";
|
|
16
17
|
|
|
17
|
-
const isBucketFilter = _.flow(
|
|
18
|
-
Object.keys,
|
|
19
|
-
// Both metadata and mutable_metadata are "metadata"
|
|
20
|
-
_.any((entry) => entry.startsWith("metadata", "note"))
|
|
21
|
-
);
|
|
22
|
-
|
|
23
18
|
const EmptyImage = () => (
|
|
24
19
|
<div
|
|
25
20
|
style={{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { useEffect } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Link, useParams } from "react-router-dom";
|
|
@@ -8,9 +8,10 @@ import { useIntl } from "react-intl";
|
|
|
8
8
|
import { FormattedNumber } from "react-intl";
|
|
9
9
|
import { CardGroupsAccordion } from "@truedat/core/components";
|
|
10
10
|
import { linkTo } from "@truedat/core/routes";
|
|
11
|
+
import { fetchStructureFilters as fetchStructureFiltersRoutine } from "@truedat/dd/routines";
|
|
11
12
|
|
|
12
13
|
const moveMissingBucketToTheEnd = (buckets) =>
|
|
13
|
-
_.sortBy(({ key }) => (key === "_missing" ? 1 : 0))(buckets);
|
|
14
|
+
_.sortBy(({ key }) => (key === "_missing" || key === "" ? 1 : 0))(buckets);
|
|
14
15
|
|
|
15
16
|
const orderBuckets = (buckets) =>
|
|
16
17
|
_.flow(
|
|
@@ -18,7 +19,13 @@ const orderBuckets = (buckets) =>
|
|
|
18
19
|
moveMissingBucketToTheEnd
|
|
19
20
|
)(buckets);
|
|
20
21
|
|
|
21
|
-
export const CatalogCustomViewCards = ({
|
|
22
|
+
export const CatalogCustomViewCards = ({
|
|
23
|
+
structureFilters,
|
|
24
|
+
fetchStructureFilters,
|
|
25
|
+
}) => {
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
fetchStructureFilters();
|
|
28
|
+
}, [fetchStructureFilters]);
|
|
22
29
|
const { propertyPath } = useParams();
|
|
23
30
|
const groups = [];
|
|
24
31
|
|
|
@@ -43,6 +50,7 @@ export const CatalogCustomViewCards = ({ structureFilters }) => {
|
|
|
43
50
|
|
|
44
51
|
CatalogCustomViewCards.propTypes = {
|
|
45
52
|
structureFilters: PropTypes.object,
|
|
53
|
+
fetchStructureFilters: PropTypes.func,
|
|
46
54
|
};
|
|
47
55
|
|
|
48
56
|
export const CatalogCustomViewCard = ({
|
|
@@ -59,8 +67,14 @@ export const CatalogCustomViewCard = ({
|
|
|
59
67
|
return (
|
|
60
68
|
<Card link as={Link} to={`${linkTo.BUCKET_VIEW()}?${queryParams}`}>
|
|
61
69
|
<Card.Content className="extra-bottom-padding">
|
|
62
|
-
<Card.Header
|
|
63
|
-
{name === "_missing" ?
|
|
70
|
+
<Card.Header
|
|
71
|
+
style={name === "_missing" || name === "" ? { color: "grey" } : null}
|
|
72
|
+
>
|
|
73
|
+
{name === "_missing"
|
|
74
|
+
? formatMessage({ id: "missingBucket" })
|
|
75
|
+
: name === ""
|
|
76
|
+
? formatMessage({ id: "emptyBucket" })
|
|
77
|
+
: name}
|
|
64
78
|
</Card.Header>
|
|
65
79
|
{structures_count && (
|
|
66
80
|
<CatalogCustomViewCardPopup
|
|
@@ -95,4 +109,6 @@ const mapStateToProps = ({ structures, structureFilters }) => ({
|
|
|
95
109
|
structureFilters,
|
|
96
110
|
});
|
|
97
111
|
|
|
98
|
-
export default connect(mapStateToProps
|
|
112
|
+
export default connect(mapStateToProps, {
|
|
113
|
+
fetchStructureFilters: fetchStructureFiltersRoutine,
|
|
114
|
+
})(CatalogCustomViewCards);
|
|
@@ -6,12 +6,7 @@ import { useHistory } from "react-router-dom";
|
|
|
6
6
|
import PropTypes from "prop-types";
|
|
7
7
|
import { List } from "semantic-ui-react";
|
|
8
8
|
import { STRUCTURES, linkTo } from "@truedat/core/routes";
|
|
9
|
-
|
|
10
|
-
const isBucketFilter = _.flow(
|
|
11
|
-
Object.keys,
|
|
12
|
-
// Both metadata and mutable_metadata are "metadata"
|
|
13
|
-
_.any((entry) => entry.startsWith("metadata", "note"))
|
|
14
|
-
);
|
|
9
|
+
import { isBucketFilter } from "../utils/bucketNav";
|
|
15
10
|
|
|
16
11
|
const filterParams = _.flow(
|
|
17
12
|
Object.entries,
|
|
@@ -7,6 +7,7 @@ import { Header, Icon, Segment, Divider } from "semantic-ui-react";
|
|
|
7
7
|
import { FormattedMessage } from "react-intl";
|
|
8
8
|
import { linkTo } from "@truedat/core/routes";
|
|
9
9
|
import { BUCKETS_VIEW } from "@truedat/core/routes";
|
|
10
|
+
import { fetchStructureFilters as fetchStructureFiltersRoutine } from "@truedat/dd/routines";
|
|
10
11
|
import { structureRowsSelector } from "../selectors";
|
|
11
12
|
import StructureSelectedFilters from "./StructureSelectedFilters";
|
|
12
13
|
import StructuresOptions from "./StructuresOptions";
|
|
@@ -55,10 +56,15 @@ const StructuresViewContent = ({
|
|
|
55
56
|
const history = useHistory();
|
|
56
57
|
return (
|
|
57
58
|
<>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
{!customView ? (
|
|
60
|
+
<>
|
|
61
|
+
<StructuresOptions hasFilterApplied={hasFilterApplied} {...actions} />
|
|
62
|
+
<StructuresSearch />
|
|
63
|
+
<StructureSelectedFilters />
|
|
64
|
+
<StructureDateFilter />
|
|
65
|
+
</>
|
|
66
|
+
) : null}
|
|
67
|
+
|
|
62
68
|
{hasFilterApplied || embedded ? (
|
|
63
69
|
<StructuresSearchResults
|
|
64
70
|
structures={structures}
|
|
@@ -117,6 +123,7 @@ const isEmptyPath = (state, path) => _.flow(_.path(path), _.isEmpty)(state);
|
|
|
117
123
|
const mapStateToProps = (state) => ({
|
|
118
124
|
structures: structureRowsSelector(state),
|
|
119
125
|
actions: state.structuresActions,
|
|
126
|
+
fetchStructureFilters: fetchStructureFiltersRoutine,
|
|
120
127
|
loading: state.structuresLoading,
|
|
121
128
|
systemsLoading: state.systemsLoading,
|
|
122
129
|
hasFilterApplied:
|
|
@@ -24,6 +24,8 @@ const structureFilters = {
|
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const fetchStructureFilters = jest.fn();
|
|
28
|
+
|
|
27
29
|
const messages = {
|
|
28
30
|
es: {
|
|
29
31
|
...es,
|
|
@@ -38,10 +40,11 @@ jest.mock("react-router-dom", () => ({
|
|
|
38
40
|
|
|
39
41
|
describe("<CatalogCustomViewCard />", () => {
|
|
40
42
|
it("Shows a structure filter value and count inside each Card", () => {
|
|
41
|
-
const {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const props = { structureFilters, fetchStructureFilters };
|
|
44
|
+
const { getByRole } = render(<CatalogCustomViewCards {...props} />, {
|
|
45
|
+
locale: "es",
|
|
46
|
+
messages,
|
|
47
|
+
});
|
|
45
48
|
const missingCard = getByRole("link", { name: /_missing/ });
|
|
46
49
|
expect(missingCard).toBeInTheDocument();
|
|
47
50
|
const databaseOneCard = getByRole("link", { name: /database_1/ });
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import { createSelector } from "reselect";
|
|
3
|
+
import { isBucketFilter } from "../utils/bucketNav";
|
|
3
4
|
|
|
4
5
|
const defaultName = "..";
|
|
5
6
|
|
|
6
|
-
const isBucketFilter = _.flow(
|
|
7
|
-
Object.keys,
|
|
8
|
-
// Both metadata and mutable_metadata are "metadata"
|
|
9
|
-
_.any((entry) => entry.startsWith("metadata", "note"))
|
|
10
|
-
);
|
|
11
|
-
|
|
12
7
|
const rootNavItem = (structure) =>
|
|
13
8
|
_.flow(
|
|
14
9
|
_.propOr({}, "system"),
|