@truedat/dd 5.9.9 → 5.10.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/BucketView.js +6 -1
- package/src/components/CatalogCustomViewCards.js +6 -22
- package/src/components/DictionaryRoutes.js +6 -1
- package/src/components/StructureItemRoot.js +6 -1
- package/src/components/StructuresRoutes.js +1 -1
- package/src/components/StructuresView.js +4 -11
- package/src/components/__tests__/CatalogCustomViewCards.spec.js +4 -7
- package/src/selectors/getStructureParent.js +6 -1
- package/src/utils/bucketNav.js +0 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.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": "5.
|
|
37
|
+
"@truedat/test": "5.10.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": "5.
|
|
92
|
-
"@truedat/core": "5.
|
|
93
|
-
"@truedat/df": "5.
|
|
91
|
+
"@truedat/auth": "5.10.1",
|
|
92
|
+
"@truedat/core": "5.10.1",
|
|
93
|
+
"@truedat/df": "5.10.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": "ba010e6013cc394e610c97786331a5d687ecac64"
|
|
119
119
|
}
|
|
@@ -7,7 +7,6 @@ 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";
|
|
11
10
|
import FilteredNav from "./FilteredNav";
|
|
12
11
|
import StructureCrumbs from "./StructureCrumbs";
|
|
13
12
|
import StructureGrantCart from "./StructureGrantCart";
|
|
@@ -15,6 +14,12 @@ import StructureSummary from "./StructureSummary";
|
|
|
15
14
|
import StructureTabPaneRoutes from "./StructureTabPaneRoutes";
|
|
16
15
|
import StructureTabRoutes from "./StructureTabRoutes";
|
|
17
16
|
|
|
17
|
+
const isBucketFilter = _.flow(
|
|
18
|
+
Object.keys,
|
|
19
|
+
// Both metadata and mutable_metadata are "metadata"
|
|
20
|
+
_.any((entry) => entry.startsWith("metadata", "note"))
|
|
21
|
+
);
|
|
22
|
+
|
|
18
23
|
const EmptyImage = () => (
|
|
19
24
|
<div
|
|
20
25
|
style={{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React
|
|
2
|
+
import React 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,10 +8,9 @@ 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";
|
|
12
11
|
|
|
13
12
|
const moveMissingBucketToTheEnd = (buckets) =>
|
|
14
|
-
_.sortBy(({ key }) => (key === "_missing"
|
|
13
|
+
_.sortBy(({ key }) => (key === "_missing" ? 1 : 0))(buckets);
|
|
15
14
|
|
|
16
15
|
const orderBuckets = (buckets) =>
|
|
17
16
|
_.flow(
|
|
@@ -19,13 +18,7 @@ const orderBuckets = (buckets) =>
|
|
|
19
18
|
moveMissingBucketToTheEnd
|
|
20
19
|
)(buckets);
|
|
21
20
|
|
|
22
|
-
export const CatalogCustomViewCards = ({
|
|
23
|
-
structureFilters,
|
|
24
|
-
fetchStructureFilters,
|
|
25
|
-
}) => {
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
fetchStructureFilters();
|
|
28
|
-
}, [fetchStructureFilters]);
|
|
21
|
+
export const CatalogCustomViewCards = ({ structureFilters }) => {
|
|
29
22
|
const { propertyPath } = useParams();
|
|
30
23
|
const groups = [];
|
|
31
24
|
|
|
@@ -50,7 +43,6 @@ export const CatalogCustomViewCards = ({
|
|
|
50
43
|
|
|
51
44
|
CatalogCustomViewCards.propTypes = {
|
|
52
45
|
structureFilters: PropTypes.object,
|
|
53
|
-
fetchStructureFilters: PropTypes.func,
|
|
54
46
|
};
|
|
55
47
|
|
|
56
48
|
export const CatalogCustomViewCard = ({
|
|
@@ -67,14 +59,8 @@ export const CatalogCustomViewCard = ({
|
|
|
67
59
|
return (
|
|
68
60
|
<Card link as={Link} to={`${linkTo.BUCKET_VIEW()}?${queryParams}`}>
|
|
69
61
|
<Card.Content className="extra-bottom-padding">
|
|
70
|
-
<Card.Header
|
|
71
|
-
|
|
72
|
-
>
|
|
73
|
-
{name === "_missing"
|
|
74
|
-
? formatMessage({ id: "missingBucket" })
|
|
75
|
-
: name === ""
|
|
76
|
-
? formatMessage({ id: "emptyBucket" })
|
|
77
|
-
: name}
|
|
62
|
+
<Card.Header style={name === "_missing" ? { color: "grey" } : null}>
|
|
63
|
+
{name === "_missing" ? formatMessage({ id: "missingBucket" }) : name}
|
|
78
64
|
</Card.Header>
|
|
79
65
|
{structures_count && (
|
|
80
66
|
<CatalogCustomViewCardPopup
|
|
@@ -109,6 +95,4 @@ const mapStateToProps = ({ structures, structureFilters }) => ({
|
|
|
109
95
|
structureFilters,
|
|
110
96
|
});
|
|
111
97
|
|
|
112
|
-
export default connect(mapStateToProps
|
|
113
|
-
fetchStructureFilters: fetchStructureFiltersRoutine,
|
|
114
|
-
})(CatalogCustomViewCards);
|
|
98
|
+
export default connect(mapStateToProps)(CatalogCustomViewCards);
|
|
@@ -59,7 +59,12 @@ export const DictionaryRoutes = () => {
|
|
|
59
59
|
const structuresActive = useActiveRoute(STRUCTURES);
|
|
60
60
|
const systemsActive = useActiveRoute(SYSTEMS);
|
|
61
61
|
const structureTypesActive = useActiveRoute(STRUCTURE_TYPES);
|
|
62
|
-
const
|
|
62
|
+
const customCatalogViewActive = useActiveRoute(BUCKETS_VIEW);
|
|
63
|
+
const active =
|
|
64
|
+
structuresActive ||
|
|
65
|
+
systemsActive ||
|
|
66
|
+
structureTypesActive ||
|
|
67
|
+
customCatalogViewActive;
|
|
63
68
|
|
|
64
69
|
return (
|
|
65
70
|
<>
|
|
@@ -6,7 +6,12 @@ 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
|
-
|
|
9
|
+
|
|
10
|
+
const isBucketFilter = _.flow(
|
|
11
|
+
Object.keys,
|
|
12
|
+
// Both metadata and mutable_metadata are "metadata"
|
|
13
|
+
_.any((entry) => entry.startsWith("metadata", "note"))
|
|
14
|
+
);
|
|
10
15
|
|
|
11
16
|
const filterParams = _.flow(
|
|
12
17
|
Object.entries,
|
|
@@ -49,7 +49,7 @@ const StructureImplementationsLoader = () => {
|
|
|
49
49
|
return (
|
|
50
50
|
<RuleImplementationsLoader
|
|
51
51
|
pageSize={1000}
|
|
52
|
-
defaultFilters={{
|
|
52
|
+
defaultFilters={{ linked_structures_ids: [id], status: ["published"] }}
|
|
53
53
|
/>
|
|
54
54
|
);
|
|
55
55
|
};
|
|
@@ -7,7 +7,6 @@ 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";
|
|
11
10
|
import { structureRowsSelector } from "../selectors";
|
|
12
11
|
import StructureSelectedFilters from "./StructureSelectedFilters";
|
|
13
12
|
import StructuresOptions from "./StructuresOptions";
|
|
@@ -56,15 +55,10 @@ const StructuresViewContent = ({
|
|
|
56
55
|
const history = useHistory();
|
|
57
56
|
return (
|
|
58
57
|
<>
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<StructureSelectedFilters />
|
|
64
|
-
<StructureDateFilter />
|
|
65
|
-
</>
|
|
66
|
-
) : null}
|
|
67
|
-
|
|
58
|
+
<StructuresOptions hasFilterApplied={hasFilterApplied} {...actions} />
|
|
59
|
+
<StructuresSearch />
|
|
60
|
+
<StructureSelectedFilters />
|
|
61
|
+
<StructureDateFilter />
|
|
68
62
|
{hasFilterApplied || embedded ? (
|
|
69
63
|
<StructuresSearchResults
|
|
70
64
|
structures={structures}
|
|
@@ -123,7 +117,6 @@ const isEmptyPath = (state, path) => _.flow(_.path(path), _.isEmpty)(state);
|
|
|
123
117
|
const mapStateToProps = (state) => ({
|
|
124
118
|
structures: structureRowsSelector(state),
|
|
125
119
|
actions: state.structuresActions,
|
|
126
|
-
fetchStructureFilters: fetchStructureFiltersRoutine,
|
|
127
120
|
loading: state.structuresLoading,
|
|
128
121
|
systemsLoading: state.systemsLoading,
|
|
129
122
|
hasFilterApplied:
|
|
@@ -24,8 +24,6 @@ const structureFilters = {
|
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const fetchStructureFilters = jest.fn();
|
|
28
|
-
|
|
29
27
|
const messages = {
|
|
30
28
|
es: {
|
|
31
29
|
...es,
|
|
@@ -40,11 +38,10 @@ jest.mock("react-router-dom", () => ({
|
|
|
40
38
|
|
|
41
39
|
describe("<CatalogCustomViewCard />", () => {
|
|
42
40
|
it("Shows a structure filter value and count inside each Card", () => {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
locale: "es",
|
|
46
|
-
|
|
47
|
-
});
|
|
41
|
+
const { getByRole } = render(
|
|
42
|
+
<CatalogCustomViewCards structureFilters={structureFilters} />,
|
|
43
|
+
{ locale: "es", messages }
|
|
44
|
+
);
|
|
48
45
|
const missingCard = getByRole("link", { name: /_missing/ });
|
|
49
46
|
expect(missingCard).toBeInTheDocument();
|
|
50
47
|
const databaseOneCard = getByRole("link", { name: /database_1/ });
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import { createSelector } from "reselect";
|
|
3
|
-
import { isBucketFilter } from "../utils/bucketNav";
|
|
4
3
|
|
|
5
4
|
const defaultName = "..";
|
|
6
5
|
|
|
6
|
+
const isBucketFilter = _.flow(
|
|
7
|
+
Object.keys,
|
|
8
|
+
// Both metadata and mutable_metadata are "metadata"
|
|
9
|
+
_.any((entry) => entry.startsWith("metadata", "note"))
|
|
10
|
+
);
|
|
11
|
+
|
|
7
12
|
const rootNavItem = (structure) =>
|
|
8
13
|
_.flow(
|
|
9
14
|
_.propOr({}, "system"),
|
package/src/utils/bucketNav.js
DELETED