@truedat/bg 4.46.8 → 4.46.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.46.11] 2022-06-20
4
+
5
+ ### Fixed
6
+
7
+ - [TD-4720] The button to create concepts does not appear
8
+
9
+ ## [4.46.10] 2022-06-20
10
+
11
+ ### Fixed
12
+
13
+ - [TD-4938] Avoid creating empty objects in `mapStateToProps`
14
+
3
15
  ## [4.46.4] 2022-06-16
4
16
 
5
17
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "4.46.8",
3
+ "version": "4.46.11",
4
4
  "description": "Truedat Web Business Glossary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.4",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.46.8",
37
+ "@truedat/test": "4.46.10",
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",
@@ -86,8 +86,8 @@
86
86
  ]
87
87
  },
88
88
  "dependencies": {
89
- "@truedat/core": "4.46.8",
90
- "@truedat/df": "4.46.8",
89
+ "@truedat/core": "4.46.10",
90
+ "@truedat/df": "4.46.10",
91
91
  "file-saver": "^2.0.5",
92
92
  "moment": "^2.24.0",
93
93
  "path-to-regexp": "^1.7.0",
@@ -107,5 +107,5 @@
107
107
  "react-dom": ">= 16.8.6 < 17",
108
108
  "semantic-ui-react": ">= 0.88.2 < 2.1"
109
109
  },
110
- "gitHead": "44f3e7aea8153415f773f7b4f9137c11ad128b1d"
110
+ "gitHead": "b12ba8595f57dc897ae1d4ed354578a7e23e49aa"
111
111
  }
@@ -1,14 +1,19 @@
1
- import React from "react";
2
- import { Route, Switch } from "react-router-dom";
3
- import { CONCEPTS } from "@truedat/core/routes";
4
- import ConceptFiltersDefault from "./ConceptFiltersDefault";
5
- import ConceptFiltersPublished from "./ConceptFiltersPublished";
1
+ import { bindActionCreators } from "redux";
2
+ import { connect } from "react-redux";
3
+ import { AvailableFilters } from "@truedat/core/components";
4
+ import { addConceptFilter, resetConceptFilters } from "../routines";
5
+ import { getConceptAvailableFilters } from "../selectors";
6
6
 
7
- export const ConceptFilters = () => (
8
- <Switch>
9
- <Route exact path={CONCEPTS} render={() => <ConceptFiltersPublished />} />
10
- <Route render={() => <ConceptFiltersDefault />} />
11
- </Switch>
12
- );
7
+ const mapStateToProps = (state) => ({
8
+ filters: getConceptAvailableFilters(state),
9
+ disabled: state.conceptFiltersLoading,
10
+ loading: state.conceptFiltersLoading,
11
+ });
13
12
 
14
- export default ConceptFilters;
13
+ const mapDispatchToProps = (dispatch) =>
14
+ bindActionCreators(
15
+ { addFilter: addConceptFilter, resetFilters: resetConceptFilters },
16
+ dispatch
17
+ );
18
+
19
+ export default connect(mapStateToProps, mapDispatchToProps)(AvailableFilters);
@@ -4,6 +4,8 @@ import { FiltersLoader } from "@truedat/core/components";
4
4
  import { makeActiveFiltersSelector } from "@truedat/core/selectors";
5
5
  import { clearConceptFilters, fetchConceptFilters } from "../routines";
6
6
 
7
+ const EMPTY = {};
8
+
7
9
  const mapDispatchToProps = (dispatch) =>
8
10
  bindActionCreators(
9
11
  { clearFilters: clearConceptFilters, fetchFilters: fetchConceptFilters },
@@ -17,7 +19,7 @@ const makeMapStateToProps = () => {
17
19
  const mapStateToProps = (state, props) => ({
18
20
  selectedFilter: state.conceptSelectedFilter,
19
21
  filters: activeFiltersSelector(state, props),
20
- defaultFilters: props?.defaultFilters || {},
22
+ defaultFilters: props?.defaultFilters || EMPTY,
21
23
  });
22
24
  return mapStateToProps;
23
25
  };
@@ -81,12 +81,14 @@ ConceptHeader.propTypes = {
81
81
  template: PropTypes.object,
82
82
  };
83
83
 
84
+ const EMPTY = {};
85
+
84
86
  const mapStateToProps = ({ concept, conceptActions, conceptPermissions }) => ({
85
87
  share: _.prop("share")(conceptPermissions),
86
88
  concept,
87
89
  setConfidentialConcept: _.prop("set_confidential")(conceptActions),
88
- domain: concept.domain || {},
89
- template: concept.template || {},
90
+ domain: concept.domain || EMPTY,
91
+ template: concept.template || EMPTY,
90
92
  });
91
93
 
92
94
  export default connect(mapStateToProps)(ConceptHeader);
@@ -44,22 +44,25 @@ export const ConceptRoutes = ({ concept, conceptLoaded, templatesLoaded }) => {
44
44
  "business_glossary_view",
45
45
  "business_glossary_management",
46
46
  ]);
47
- const conceptsActive = useActiveRoutes([CONCEPTS, CONCEPTS_PENDING]);
48
47
  return (
49
48
  <>
50
- <Route render={() => (conceptsActive ? <ConceptsLoader /> : null)} />
51
49
  <Route
52
50
  exact
53
51
  path={CONCEPTS_PENDING}
54
52
  render={() =>
55
53
  authorized ? (
56
54
  <>
57
- <ConceptUserFiltersLoader />
58
55
  <ConceptFiltersLoader
59
56
  defaultFilters={{
60
57
  status: ["pending_approval", "draft", "rejected"],
61
58
  }}
62
59
  />
60
+ <ConceptsLoader
61
+ defaultFilters={{
62
+ status: ["pending_approval", "draft", "rejected"],
63
+ }}
64
+ />
65
+ <ConceptUserFiltersLoader />
63
66
  <Concepts
64
67
  header="concepts.header.manage"
65
68
  subheader="concepts.subheader.manage"
@@ -77,81 +80,84 @@ export const ConceptRoutes = ({ concept, conceptLoaded, templatesLoaded }) => {
77
80
  path={CONCEPTS}
78
81
  render={() =>
79
82
  authorized ? (
80
- <>
81
- <Switch>
82
- <Route
83
- exact
84
- path={CONCEPTS}
85
- render={() => (
86
- <>
87
- <ConceptUserFiltersLoader />
88
- <ConceptFiltersLoader
89
- defaultFilters={{
90
- status: ["published"],
91
- }}
92
- />
93
- <Concepts
94
- header="concepts.header"
95
- subheader="concepts.subheader.view"
96
- icon="tags"
83
+ <Switch>
84
+ <Route
85
+ exact
86
+ path={CONCEPTS}
87
+ render={() => (
88
+ <>
89
+ <ConceptFiltersLoader
90
+ defaultFilters={{
91
+ status: ["published"],
92
+ }}
93
+ />
94
+ <ConceptsLoader
95
+ defaultFilters={{
96
+ status: ["published"],
97
+ }}
98
+ />
99
+ <ConceptUserFiltersLoader />
100
+ <Concepts
101
+ header="concepts.header"
102
+ subheader="concepts.subheader.view"
103
+ icon="tags"
104
+ />
105
+ </>
106
+ )}
107
+ />
108
+ <Route
109
+ exact
110
+ path={CONCEPTS_BULK_UPDATE}
111
+ render={() => (
112
+ <>
113
+ <DomainsLoader />
114
+ <ConceptCrumbs conceptAction="actions.update" />
115
+ <TemplatesLoader scope="bg" />
116
+ {templatesLoaded && <ConceptsBulkUpdate />}
117
+ </>
118
+ )}
119
+ />
120
+ <Route
121
+ exact
122
+ path={CONCEPTS_NEW}
123
+ render={() => (
124
+ <>
125
+ <DomainsLoader actions="create_business_concept" />
126
+ <ConceptCrumbs conceptAction="concepts.actions.create" />
127
+ <ConceptForm />
128
+ </>
129
+ )}
130
+ />
131
+ <Route
132
+ exact
133
+ path={CONCEPT_EDIT}
134
+ render={() => (
135
+ <>
136
+ <ConceptCrumbs conceptAction="concepts.actions.edit" />
137
+ <TemplatesLoader scope="bg" />
138
+ <ConceptLoader />
139
+ {conceptLoaded && templatesLoaded && <ConceptEdit />}
140
+ </>
141
+ )}
142
+ />
143
+ <Route
144
+ path={CONCEPT_VERSION}
145
+ render={() => (
146
+ <>
147
+ <ConceptLoader />
148
+ <DomainsLoader />
149
+ {conceptLoaded && <ConceptSubscriptionLoader />}
150
+ <RelationTagsLoader />
151
+ {conceptLoaded && (
152
+ <RelationsGraphLoader
153
+ resource_id={_.prop("business_concept_id")(concept)}
97
154
  />
98
- </>
99
- )}
100
- />
101
- <Route
102
- exact
103
- path={CONCEPTS_BULK_UPDATE}
104
- render={() => (
105
- <>
106
- <DomainsLoader />
107
- <ConceptCrumbs conceptAction="actions.update" />
108
- <TemplatesLoader scope="bg" />
109
- {templatesLoaded && <ConceptsBulkUpdate />}
110
- </>
111
- )}
112
- />
113
- <Route
114
- exact
115
- path={CONCEPTS_NEW}
116
- render={() => (
117
- <>
118
- <DomainsLoader actions="create_business_concept" />
119
- <ConceptCrumbs conceptAction="concepts.actions.create" />
120
- <ConceptForm />
121
- </>
122
- )}
123
- />
124
- <Route
125
- exact
126
- path={CONCEPT_EDIT}
127
- render={() => (
128
- <>
129
- <ConceptCrumbs conceptAction="concepts.actions.edit" />
130
- <TemplatesLoader scope="bg" />
131
- <ConceptLoader />
132
- {conceptLoaded && templatesLoaded && <ConceptEdit />}
133
- </>
134
- )}
135
- />
136
- <Route
137
- path={CONCEPT_VERSION}
138
- render={() => (
139
- <>
140
- <ConceptLoader />
141
- <DomainsLoader />
142
- {conceptLoaded && <ConceptSubscriptionLoader />}
143
- <RelationTagsLoader />
144
- {conceptLoaded && (
145
- <RelationsGraphLoader
146
- resource_id={_.prop("business_concept_id")(concept)}
147
- />
148
- )}
149
- {conceptLoaded && <Concept />}
150
- </>
151
- )}
152
- />
153
- </Switch>
154
- </>
155
+ )}
156
+ {conceptLoaded && <Concept />}
157
+ </>
158
+ )}
159
+ />
160
+ </Switch>
155
161
  ) : (
156
162
  <Unauthorized />
157
163
  )
@@ -20,7 +20,6 @@ const staticLabels = [
20
20
  ];
21
21
 
22
22
  export const ConceptsActions = ({
23
- create,
24
23
  createUrl,
25
24
  conceptsDownloading,
26
25
  downloadConcepts,
@@ -34,7 +33,7 @@ export const ConceptsActions = ({
34
33
  )(staticLabels);
35
34
  return hidden ? null : (
36
35
  <div>
37
- {create && createUrl && (
36
+ {createUrl ? (
38
37
  <Button
39
38
  floated="right"
40
39
  primary
@@ -42,7 +41,7 @@ export const ConceptsActions = ({
42
41
  to={createUrl}
43
42
  content={formatMessage({ id: "concepts.actions.create" })}
44
43
  />
45
- )}
44
+ ) : null}
46
45
  <Button
47
46
  floated="right"
48
47
  secondary
@@ -62,7 +61,6 @@ export const ConceptsActions = ({
62
61
  ConceptsActions.propTypes = {
63
62
  conceptsDownloading: PropTypes.bool,
64
63
  hidden: PropTypes.bool,
65
- create: PropTypes.bool,
66
64
  createUrl: PropTypes.string,
67
65
  downloadConcepts: PropTypes.func,
68
66
  upload: PropTypes.bool,
@@ -8,7 +8,7 @@ export const getConceptAvailableFilters = createSelector(
8
8
  [getConceptFilters, getConceptSelectedFilters],
9
9
  (conceptFilters, conceptSelectedFilters) =>
10
10
  _.flow(
11
- _.omitBy(values => _.size(values) < 2),
11
+ _.omitBy((values) => _.size(values) < 2),
12
12
  _.keys,
13
13
  _.without(conceptSelectedFilters)
14
14
  )(conceptFilters)
@@ -1,19 +0,0 @@
1
- import { bindActionCreators } from "redux";
2
- import { connect } from "react-redux";
3
- import { AvailableFilters } from "@truedat/core/components";
4
- import { addConceptFilter, resetConceptFilters } from "../routines";
5
- import { getConceptAvailableFilters } from "../selectors";
6
-
7
- const mapStateToProps = (state) => ({
8
- filters: getConceptAvailableFilters(state),
9
- disabled: state.conceptFiltersLoading,
10
- loading: state.conceptFiltersLoading,
11
- });
12
-
13
- const mapDispatchToProps = (dispatch) =>
14
- bindActionCreators(
15
- { addFilter: addConceptFilter, resetFilters: resetConceptFilters },
16
- dispatch
17
- );
18
-
19
- export default connect(mapStateToProps, mapDispatchToProps)(AvailableFilters);
@@ -1,20 +0,0 @@
1
- import _ from "lodash/fp";
2
- import { connect } from "react-redux";
3
- import { bindActionCreators } from "redux";
4
- import { AvailableFilters } from "@truedat/core/components";
5
- import { addConceptFilter, resetConceptFilters } from "../routines";
6
- import { getConceptAvailableFilters } from "../selectors";
7
-
8
- const mapStateToProps = (state) => ({
9
- filters: _.flow(getConceptAvailableFilters, _.without(["status"]))(state),
10
- disabled: state.conceptFiltersLoading,
11
- loading: state.conceptFiltersLoading,
12
- });
13
-
14
- const mapDispatchToProps = (dispatch) =>
15
- bindActionCreators(
16
- { addFilter: addConceptFilter, resetFilters: resetConceptFilters },
17
- dispatch
18
- );
19
-
20
- export default connect(mapStateToProps, mapDispatchToProps)(AvailableFilters);