@truedat/bg 6.4.2 → 6.5.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "6.4.2",
3
+ "version": "6.5.0",
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.4.2",
37
+ "@truedat/test": "6.5.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",
@@ -86,9 +86,9 @@
86
86
  ]
87
87
  },
88
88
  "dependencies": {
89
- "@truedat/core": "6.4.2",
90
- "@truedat/df": "6.4.2",
91
- "@truedat/lm": "6.4.2",
89
+ "@truedat/core": "6.5.0",
90
+ "@truedat/df": "6.5.0",
91
+ "@truedat/lm": "6.5.0",
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": "f87c5e68213975f46a32aa9dc085aeac66f75d9c"
114
+ "gitHead": "28aa11eed2113e0aa15b3510dc79b3c43f41ffe2"
115
115
  }
@@ -11,7 +11,7 @@ import { useSearchContext } from "@truedat/core/search/SearchContext";
11
11
  import { getConceptColumns } from "../selectors";
12
12
  import ConceptRow from "./ConceptRow";
13
13
 
14
- export const ConceptsTable = ({ columns }) => {
14
+ export const ConceptsTable = ({ columnsByScope }) => {
15
15
  const {
16
16
  searchData,
17
17
  loading,
@@ -23,6 +23,10 @@ export const ConceptsTable = ({ columns }) => {
23
23
 
24
24
  const concepts = searchData?.data;
25
25
  const { pathname } = useLocation();
26
+
27
+ const scope = _.last(pathname.split("/"));
28
+ const columns = columnsByScope[scope] || columnsByScope.concepts;
29
+
26
30
  const conceptColumns = columns.filter(
27
31
  (column) => pathname === CONCEPTS_PENDING || column.name != "status"
28
32
  );
@@ -84,11 +88,11 @@ export const ConceptsTable = ({ columns }) => {
84
88
  };
85
89
 
86
90
  ConceptsTable.propTypes = {
87
- columns: PropTypes.array,
91
+ columnsByScope: PropTypes.object,
88
92
  };
89
93
 
90
94
  const mapStateToProps = (state) => ({
91
- columns: getConceptColumns(state),
95
+ columnsByScope: getConceptColumns(state),
92
96
  });
93
97
 
94
98
  export default connect(mapStateToProps)(ConceptsTable);
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
3
  import { Concepts } from "../Concepts";
4
+ import { defaultConceptColumns } from "../../selectors";
4
5
 
5
6
  const data = {
6
7
  data: [
@@ -57,10 +58,17 @@ const messages = {
57
58
  },
58
59
  };
59
60
 
61
+ const state = {
62
+ conceptsColumns: {
63
+ concepts: [...defaultConceptColumns],
64
+ },
65
+ };
66
+
60
67
  describe("<Concepts />", () => {
61
68
  it("matches the latest snapshot", () => {
62
69
  const renderOpts = {
63
70
  messages,
71
+ state,
64
72
  };
65
73
 
66
74
  const header = "concepts.header.manage";
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
3
  import ConceptsPanel from "../ConceptsPanel";
4
+ import { defaultConceptColumns } from "../../selectors";
4
5
 
5
6
  const data = {
6
7
  data: [
@@ -56,8 +57,15 @@ const messages = {
56
57
  },
57
58
  };
58
59
 
60
+ const state = {
61
+ conceptsColumns: {
62
+ concepts: [...defaultConceptColumns],
63
+ },
64
+ };
65
+
59
66
  const renderOpts = {
60
67
  messages,
68
+ state,
61
69
  };
62
70
 
63
71
  describe("<ConceptsPanel />", () => {
@@ -3,6 +3,11 @@ import { render } from "@truedat/test/render";
3
3
  import { SearchContextProvider } from "@truedat/core/search/SearchContext";
4
4
  import { ConceptsTable } from "../ConceptsTable";
5
5
 
6
+ jest.mock("react-router-dom", () => ({
7
+ ...jest.requireActual("react-router-dom"),
8
+ useLocation: () => ({ pathname: "/concept/test" }),
9
+ }));
10
+
6
11
  const data = {
7
12
  data: [
8
13
  {
@@ -47,9 +52,13 @@ const searchProps = {
47
52
 
48
53
  describe("<ConceptsTable />", () => {
49
54
  it("matches the latest snapshot", () => {
50
- const columns = ["name", "status"].map((name) => ({ name }));
55
+ const defaultColumns = ["name", "status"].map((name) => ({ name }));
56
+ const columnsByScope = {
57
+ concepts: [...defaultColumns],
58
+ test: [...defaultColumns, { name: "type" }],
59
+ };
51
60
 
52
- const props = { columns };
61
+ const props = { columnsByScope };
53
62
  const { container } = render(
54
63
  <SearchContextProvider {...searchProps} defaultFilters={defaultFilters}>
55
64
  <ConceptsTable {...props} />
@@ -16,6 +16,11 @@ exports[`<ConceptsTable /> matches the latest snapshot 1`] = `
16
16
  >
17
17
  Term
18
18
  </th>
19
+ <th
20
+ class="disabled"
21
+ >
22
+ concepts.props.type
23
+ </th>
19
24
  </tr>
20
25
  </thead>
21
26
  <tbody
@@ -29,6 +34,9 @@ exports[`<ConceptsTable /> matches the latest snapshot 1`] = `
29
34
  >
30
35
  concept
31
36
  </td>
37
+ <td
38
+ class=""
39
+ />
32
40
  </tr>
33
41
  </tbody>
34
42
  </table>
@@ -14,7 +14,7 @@ const dateDecorator = (date) => (
14
14
  <Moment locale="es" date={date} format="YYYY-MM-DD HH:mm" />
15
15
  );
16
16
 
17
- const defaultConceptColumns = [
17
+ export const defaultConceptColumns = [
18
18
  { name: "name", sort: { name: "name.raw" }, width: 7 },
19
19
  {
20
20
  name: "domain",
@@ -55,5 +55,5 @@ const getColumns = (state) => state.conceptsColumns;
55
55
 
56
56
  export const getConceptColumns = createSelector(
57
57
  getColumns,
58
- _.defaultTo(defaultConceptColumns)
58
+ _.defaultTo({ concepts: defaultConceptColumns })
59
59
  );
@@ -1,4 +1,4 @@
1
- export { getConceptColumns } from "./getConceptColumns";
1
+ export { defaultConceptColumns, getConceptColumns } from "./getConceptColumns";
2
2
  export { getConceptDomainPath } from "./getConceptDomainPath";
3
3
  export {
4
4
  getConceptUploadEventColumns,