@truedat/bg 6.6.0 → 6.6.2

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/bg",
3
- "version": "6.6.0",
3
+ "version": "6.6.2",
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.5",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "6.6.0",
37
+ "@truedat/test": "6.6.2",
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,9 +86,9 @@
86
86
  ]
87
87
  },
88
88
  "dependencies": {
89
- "@truedat/core": "6.6.0",
90
- "@truedat/df": "6.6.0",
91
- "@truedat/lm": "6.6.0",
89
+ "@truedat/core": "6.6.2",
90
+ "@truedat/df": "6.6.2",
91
+ "@truedat/lm": "6.6.2",
92
92
  "decode-uri-component": "^0.2.2",
93
93
  "file-saver": "^2.0.5",
94
94
  "moment": "^2.29.4",
@@ -111,5 +111,5 @@
111
111
  "react-dom": ">= 16.8.6 < 17",
112
112
  "semantic-ui-react": ">= 2.0.3 < 2.2"
113
113
  },
114
- "gitHead": "84d52d5067ff09b8d9c9b8a9bc8018c53a8e700c"
114
+ "gitHead": "b5defab13b213876e57046dc7d9885c6adc4a64d"
115
115
  }
@@ -4,18 +4,7 @@ import PropTypes from "prop-types";
4
4
  import { useIntl } from "react-intl";
5
5
  import { connect } from "react-redux";
6
6
  import { Header, Icon, Segment, Grid } from "semantic-ui-react";
7
- import {
8
- makeTagOptionsSelector,
9
- makeSearchQuerySelector,
10
- } from "@truedat/core/selectors";
11
-
12
- import {
13
- clearStructures,
14
- fetchStructures,
15
- clearStructureFilters,
16
- fetchStructureFilters,
17
- resetStructureFilters,
18
- } from "@truedat/dd/routines";
7
+ import { makeTagOptionsSelector } from "@truedat/core/selectors";
19
8
  import { createRelation, deleteRelation } from "@truedat/core/routines";
20
9
  import ConceptSelector from "../relations/components/ConceptSelector";
21
10
  import { pickConceptAttrs } from "../relations/components/ConceptRelationForm";
@@ -58,12 +47,6 @@ export const ConceptsLinksManagement = ({
58
47
  tagStructureOptions,
59
48
  tagConceptOptions,
60
49
  selectedRelationTags,
61
- clearStructures,
62
- clearStructureFilters,
63
- fetchStructureFilters,
64
- resetStructureFilters,
65
- fetchStructures,
66
- structurePayload,
67
50
  }) => {
68
51
  const { formatMessage } = useIntl();
69
52
  const [selectedLinkType, setSelectedLinkType] = useState("structures");
@@ -117,14 +100,6 @@ export const ConceptsLinksManagement = ({
117
100
  setSelectedSourceConcept(selectedSourceConcept);
118
101
  setSelectedStructure(null);
119
102
  setSelectedTargetConcept(null);
120
-
121
- if (selectedLinkType == "structures") {
122
- clearStructures();
123
- clearStructureFilters();
124
- fetchStructureFilters();
125
- resetStructureFilters();
126
- fetchStructures({ ...structurePayload, size: 7, page: 0 });
127
- }
128
103
  };
129
104
 
130
105
  const handleTargetConceptSelected = (concept) => {
@@ -300,12 +275,6 @@ ConceptsLinksManagement.propTypes = {
300
275
  header: PropTypes.string,
301
276
  icon: PropTypes.string,
302
277
  subheader: PropTypes.string,
303
- structurePayload: PropTypes.object,
304
- fetchStructures: PropTypes.func,
305
- clearStructures: PropTypes.func,
306
- clearStructureFilters: PropTypes.func,
307
- fetchStructureFilters: PropTypes.func,
308
- resetStructureFilters: PropTypes.func,
309
278
  createRelation: PropTypes.func,
310
279
  deleteRelation: PropTypes.func,
311
280
  selectedRelationTags: PropTypes.array,
@@ -317,14 +286,8 @@ ConceptsLinksManagement.propTypes = {
317
286
  const makeMapStateToProps = () => {
318
287
  const getTagStructureOptions = makeTagOptionsSelector("data_field");
319
288
  const getTagConceptOptions = makeTagOptionsSelector("business_concept");
320
- const structureSearchQuerySelector = makeSearchQuerySelector(
321
- "structureQuery",
322
- "structureActiveFilters",
323
- "structureDateFilter"
324
- );
325
- const mapStateToProps = (state, props) => ({
289
+ const mapStateToProps = (state) => ({
326
290
  selectedRelationTags: state.selectedRelationTags,
327
- structurePayload: structureSearchQuerySelector(state, props),
328
291
  tagStructureOptions: getTagStructureOptions(state),
329
292
  tagConceptOptions: getTagConceptOptions(state),
330
293
  conceptLinks: state.relations,
@@ -336,9 +299,4 @@ const makeMapStateToProps = () => {
336
299
  export default connect(makeMapStateToProps, {
337
300
  createRelation,
338
301
  deleteRelation,
339
- fetchStructures,
340
- clearStructures,
341
- clearStructureFilters,
342
- fetchStructureFilters,
343
- resetStructureFilters,
344
302
  })(ConceptsLinksManagement);
@@ -49,6 +49,7 @@ export const ConceptsPanel = ({ defaultFilters, actions, filtersGroup }) => {
49
49
  userFiltersType: "business_concept_user_filters",
50
50
  omitFilters: ["current", "domain_ids"],
51
51
  translations,
52
+ pageSize: 20,
52
53
  filtersGroup,
53
54
  };
54
55
 
@@ -65,7 +66,7 @@ ConceptsPanel.propTypes = {
65
66
  };
66
67
 
67
68
  const mapStateToProps = (state) => ({
68
- filtersGroup: state.conceptFiltersGroup || [],
69
+ filtersGroup: state?.conceptFiltersGroup,
69
70
  });
70
71
 
71
72
  export default connect(mapStateToProps)(ConceptsPanel);
@@ -30,8 +30,6 @@ const useSearch = () => ({
30
30
  }),
31
31
  });
32
32
 
33
- const defaultFilters = {};
34
-
35
33
  const searchProps = {
36
34
  initialSortColumn: "name.raw",
37
35
  initialSortDirection: "ascending",
@@ -67,7 +65,7 @@ describe("<ConceptsActions />", () => {
67
65
 
68
66
  it("matches the latest snapshot", () => {
69
67
  const { container } = render(
70
- <SearchContextProvider {...searchProps} defaultFilters={defaultFilters}>
68
+ <SearchContextProvider {...searchProps}>
71
69
  <ConceptsActions {...props} />
72
70
  </SearchContextProvider>,
73
71
  renderOpts
@@ -27,7 +27,7 @@ jest.mock("@truedat/bg/concepts/hooks/useConcepts", () => {
27
27
  trigger: () => ({
28
28
  then: (callback) =>
29
29
  callback({
30
- data: [],
30
+ data: {},
31
31
  }),
32
32
  }),
33
33
  }),
@@ -50,6 +50,15 @@ const searchProps = {
50
50
  translations: jest.fn(),
51
51
  };
52
52
 
53
+ const renderOpts = {
54
+ messages: {
55
+ en: {
56
+ "concepts.props.type": "Type",
57
+ "concepts.props.name": "Term",
58
+ },
59
+ },
60
+ };
61
+
53
62
  describe("<ConceptsTable />", () => {
54
63
  it("matches the latest snapshot", () => {
55
64
  const defaultColumns = ["name", "status"].map((name) => ({ name }));
@@ -62,7 +71,8 @@ describe("<ConceptsTable />", () => {
62
71
  const { container } = render(
63
72
  <SearchContextProvider {...searchProps} defaultFilters={defaultFilters}>
64
73
  <ConceptsTable {...props} />
65
- </SearchContextProvider>
74
+ </SearchContextProvider>,
75
+ renderOpts
66
76
  );
67
77
  expect(container).toMatchSnapshot();
68
78
  });
@@ -128,15 +128,15 @@ exports[`<ConceptsLinksManagement /> matches the latest snapshot 1`] = `
128
128
  <div
129
129
  class="ui action left icon input"
130
130
  >
131
+ <i
132
+ aria-hidden="true"
133
+ class="search link icon"
134
+ />
131
135
  <input
132
136
  placeholder="Search concepts..."
133
137
  type="text"
134
138
  value=""
135
139
  />
136
- <i
137
- aria-hidden="true"
138
- class="search link icon"
139
- />
140
140
  <div
141
141
  aria-busy="false"
142
142
  aria-disabled="false"
@@ -29,15 +29,15 @@ exports[`<Concepts /> matches the latest snapshot 1`] = `
29
29
  <div
30
30
  class="ui action left icon input"
31
31
  >
32
+ <i
33
+ aria-hidden="true"
34
+ class="search link icon"
35
+ />
32
36
  <input
33
37
  placeholder="Search concepts..."
34
38
  type="text"
35
39
  value=""
36
40
  />
37
- <i
38
- aria-hidden="true"
39
- class="search link icon"
40
- />
41
41
  <div
42
42
  aria-busy="false"
43
43
  aria-disabled="false"
@@ -5,15 +5,15 @@ exports[`<ConceptsPanel /> matches latest snapshot 1`] = `
5
5
  <div
6
6
  class="ui action left icon input"
7
7
  >
8
+ <i
9
+ aria-hidden="true"
10
+ class="search link icon"
11
+ />
8
12
  <input
9
13
  placeholder="Search concepts..."
10
14
  type="text"
11
15
  value=""
12
16
  />
13
- <i
14
- aria-hidden="true"
15
- class="search link icon"
16
- />
17
17
  <div
18
18
  aria-busy="false"
19
19
  aria-disabled="false"
@@ -19,7 +19,7 @@ exports[`<ConceptsTable /> matches the latest snapshot 1`] = `
19
19
  <th
20
20
  class="disabled"
21
21
  >
22
- concepts.props.type
22
+ Type
23
23
  </th>
24
24
  </tr>
25
25
  </thead>
@@ -183,8 +183,13 @@ export const ConceptSelector = (props) => {
183
183
  );
184
184
  };
185
185
 
186
+ ConceptSelector.propTypes = {
187
+ defaultFilters: PropTypes.object,
188
+ filtersGroup: PropTypes.array,
189
+ };
190
+
186
191
  const mapStateToProps = (state) => ({
187
- filtersGroup: state.conceptFiltersGroup || [],
192
+ filtersGroup: state?.conceptFiltersGroup,
188
193
  });
189
194
 
190
195
  export default connect(mapStateToProps)(ConceptSelector);
@@ -70,7 +70,7 @@ const messages = {
70
70
  "search.save_filters": "save filters",
71
71
  "search.clear_filters": "clear filters",
72
72
  "search.applied_filters": "apply filters",
73
- "search.placeholder": "Search concepts...",
73
+ "search.placeholder": "Search...",
74
74
  },
75
75
  };
76
76
  const renderOpts = { messages };
@@ -18,15 +18,15 @@ exports[`<ConceptRelationForm /> matches the latest snapshot 1`] = `
18
18
  <div
19
19
  class="ui action left icon input"
20
20
  >
21
+ <i
22
+ aria-hidden="true"
23
+ class="search link icon"
24
+ />
21
25
  <input
22
26
  placeholder="Search concepts..."
23
27
  type="text"
24
28
  value=""
25
29
  />
26
- <i
27
- aria-hidden="true"
28
- class="search link icon"
29
- />
30
30
  <div
31
31
  aria-busy="false"
32
32
  aria-disabled="false"
@@ -11,15 +11,15 @@ exports[`<ConceptSelector /> matches the latest snapshot 1`] = `
11
11
  <div
12
12
  class="ui action left icon input"
13
13
  >
14
- <input
15
- placeholder="Search concepts..."
16
- type="text"
17
- value=""
18
- />
19
14
  <i
20
15
  aria-hidden="true"
21
16
  class="search link icon"
22
17
  />
18
+ <input
19
+ placeholder="Search..."
20
+ type="text"
21
+ value=""
22
+ />
23
23
  <div
24
24
  aria-busy="false"
25
25
  aria-disabled="false"
@@ -72,14 +72,7 @@ export const Domain = ({ hasChildren, domain, domainLoading }) => {
72
72
  exact
73
73
  path={DOMAIN_STRUCTURES}
74
74
  render={() =>
75
- ddAuthorized ? (
76
- <>
77
- <UserSearchFiltersLoader scope="data_structure" />
78
- <DomainStructures />
79
- </>
80
- ) : (
81
- <Unauthorized />
82
- )
75
+ ddAuthorized ? <DomainStructures /> : <Unauthorized />
83
76
  }
84
77
  />
85
78
  <Route
@@ -1,21 +1,13 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { connect } from "react-redux";
4
- import StructureFiltersLoader from "@truedat/dd/components/StructureFiltersLoader";
5
- import StructuresLoader from "@truedat/dd/components/StructuresLoader";
6
4
  import StructuresView from "@truedat/dd/components/StructuresView";
7
5
 
8
6
  export const DomainStructures = ({ domain = {} }) => {
9
7
  const defaultFilters = {
10
8
  taxonomy: [domain.id],
11
9
  };
12
- return (
13
- <>
14
- <StructureFiltersLoader defaultFilters={defaultFilters} />
15
- <StructuresLoader defaultFilters={defaultFilters} />
16
- <StructuresView embedded />
17
- </>
18
- );
10
+ return <StructuresView embedded defaultFilters={defaultFilters} />;
19
11
  };
20
12
 
21
13
  DomainStructures.propTypes = {
@@ -1,12 +1,83 @@
1
1
  import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
+ import SearchContextWrapper from "@truedat/core/components/common/SearchContextWrapper";
3
4
  import DomainStructures from "../DomainStructures";
4
5
 
6
+ jest.mock("@truedat/dd/hooks/useStructures", () => {
7
+ const originalModule = jest.requireActual("@truedat/dd/hooks/useStructures");
8
+
9
+ return {
10
+ __esModule: true,
11
+ ...originalModule,
12
+ useDataStructureFilters: () => ({
13
+ trigger: () => ({
14
+ then: (callback) =>
15
+ callback({
16
+ data: { data: {} },
17
+ }),
18
+ }),
19
+ }),
20
+ useDataStructureSearch: () => ({
21
+ trigger: () => ({
22
+ then: (callback) =>
23
+ callback({
24
+ data: { data: [] },
25
+ headers: {},
26
+ }),
27
+ }),
28
+ }),
29
+ };
30
+ });
31
+
5
32
  describe("<DomainStructures />", () => {
6
- const renderOpts = { state: { domain: { id: 1, name: "domain" } } };
33
+ const renderOpts = {
34
+ messages: {
35
+ en: {
36
+ "search.placeholder": "Search...",
37
+ "structures.loading.header": "Loading structures...",
38
+ "structures.actions.download.tooltip": "Download structures metadata",
39
+ "structures.actions.download.popup":
40
+ "You must search or filter to download structures",
41
+ "structures.actions.editableDownload.tooltip":
42
+ "Download editable structures metadata",
43
+ "structures.props.deleted_at": "Deleted",
44
+ "structures.props.inserted_at": "Inserted",
45
+ "structures.props.description": "Description",
46
+ "structures.props.path": "Path",
47
+ "structures.props.metadata": "Metadata",
48
+ "structures.props.system": "System",
49
+ "structures.props.domain": "Domain",
50
+ "structures.props.group": "Group",
51
+ "structures.props.external_id": "External Id",
52
+ "structures.props.link_to_structure": "Link to structure",
53
+ "structures.props.alias_name": "Alias",
54
+ "structures.props.tech_name": "Technical Name",
55
+ "structures.props.type": "Type",
56
+ "structure.type.undefined.text": "text",
57
+ "structure.updated_at": "updated_at",
58
+ "search.placeholder": "Search...",
59
+ "structure.group": "Group",
60
+ "structure.system": "System",
61
+ "structure.name": "Name",
62
+ "structures.retrieved.results": "Results",
63
+ "structures.loading.header": "Header",
64
+ "structure.relation.relation_type_name": "type",
65
+ "structure.type": "type",
66
+ "structures.not_found.header": "Header",
67
+ "structures.not_found.body":
68
+ "No structures have been found matching these filters.",
69
+ },
70
+ },
71
+ state: { domain: { id: 1, name: "domain" } },
72
+ };
7
73
 
8
74
  it("matches the latest snapshot", () => {
9
- const { container } = render(<DomainStructures />, renderOpts);
75
+ const { container } = render(
76
+ <SearchContextWrapper>
77
+ <DomainStructures />
78
+ </SearchContextWrapper>,
79
+ renderOpts
80
+ );
10
81
  expect(container).toMatchSnapshot();
11
82
  });
12
83
  });
@@ -67,7 +67,7 @@ exports[`<DomainStructures /> matches the latest snapshot 1`] = `
67
67
  class="search link icon"
68
68
  />
69
69
  <input
70
- placeholder="Search structures..."
70
+ placeholder="Search..."
71
71
  type="text"
72
72
  value=""
73
73
  />
@@ -80,6 +80,8 @@ exports[`<DomainStructures /> matches the latest snapshot 1`] = `
80
80
  />
81
81
  </button>
82
82
  <div
83
+ aria-busy="false"
84
+ aria-disabled="false"
83
85
  aria-expanded="false"
84
86
  class="ui button floating labeled scrolling dropdown icon"
85
87
  role="listbox"
@@ -105,7 +107,7 @@ exports[`<DomainStructures /> matches the latest snapshot 1`] = `
105
107
  role="option"
106
108
  >
107
109
  <em>
108
- (reset all filters)
110
+ (reset filters)
109
111
  </em>
110
112
  </div>
111
113
  </div>
@@ -119,6 +121,7 @@ exports[`<DomainStructures /> matches the latest snapshot 1`] = `
119
121
  >
120
122
  <div
121
123
  class="ui inverted dimmer"
124
+ style=""
122
125
  >
123
126
  <div
124
127
  class="content"
@@ -141,7 +144,7 @@ exports[`<DomainStructures /> matches the latest snapshot 1`] = `
141
144
  <div
142
145
  class="header"
143
146
  >
144
- Nothing found...
147
+ Header
145
148
  </div>
146
149
  No structures have been found matching these filters.
147
150
  </div>