@truedat/dd 5.9.8 → 5.9.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "5.9.8",
3
+ "version": "5.9.9",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -88,9 +88,9 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@apollo/client": "^3.7.1",
91
- "@truedat/auth": "5.9.8",
92
- "@truedat/core": "5.9.8",
93
- "@truedat/df": "5.9.8",
91
+ "@truedat/auth": "5.9.9",
92
+ "@truedat/core": "5.9.9",
93
+ "@truedat/df": "5.9.9",
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": "ea466759ff38b111f12c743f430779586c28f37d"
118
+ "gitHead": "2ddb4ed85ae36cd265dda7cfe831ea516c8b864d"
119
119
  }
@@ -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,6 +8,7 @@ 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
14
  _.sortBy(({ key }) => (key === "_missing" || key === "" ? 1 : 0))(buckets);
@@ -18,7 +19,13 @@ const orderBuckets = (buckets) =>
18
19
  moveMissingBucketToTheEnd
19
20
  )(buckets);
20
21
 
21
- export const CatalogCustomViewCards = ({ structureFilters }) => {
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 = ({
@@ -101,4 +109,6 @@ const mapStateToProps = ({ structures, structureFilters }) => ({
101
109
  structureFilters,
102
110
  });
103
111
 
104
- export default connect(mapStateToProps)(CatalogCustomViewCards);
112
+ export default connect(mapStateToProps, {
113
+ fetchStructureFilters: fetchStructureFiltersRoutine,
114
+ })(CatalogCustomViewCards);
@@ -59,12 +59,7 @@ export const DictionaryRoutes = () => {
59
59
  const structuresActive = useActiveRoute(STRUCTURES);
60
60
  const systemsActive = useActiveRoute(SYSTEMS);
61
61
  const structureTypesActive = useActiveRoute(STRUCTURE_TYPES);
62
- const customCatalogViewActive = useActiveRoute(BUCKETS_VIEW);
63
- const active =
64
- structuresActive ||
65
- systemsActive ||
66
- structureTypesActive ||
67
- customCatalogViewActive;
62
+ const active = structuresActive || systemsActive || structureTypesActive;
68
63
 
69
64
  return (
70
65
  <>
@@ -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
- <StructuresOptions hasFilterApplied={hasFilterApplied} {...actions} />
59
- <StructuresSearch />
60
- <StructureSelectedFilters />
61
- <StructureDateFilter />
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 { getByRole } = render(
42
- <CatalogCustomViewCards structureFilters={structureFilters} />,
43
- { locale: "es", messages }
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/ });