@truedat/bg 7.5.3 → 7.5.5

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": "7.5.3",
3
+ "version": "7.5.5",
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": "7.5.3",
37
+ "@truedat/test": "7.5.5",
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": "7.5.3",
90
- "@truedat/df": "7.5.3",
91
- "@truedat/lm": "7.5.3",
89
+ "@truedat/core": "7.5.5",
90
+ "@truedat/df": "7.5.5",
91
+ "@truedat/lm": "7.5.5",
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": "0493d9170268bd7cae7874b0f6d3b251f730e7a0"
114
+ "gitHead": "2a4343b3b2837540358b57d3d647408ab292aa21"
115
115
  }
@@ -2,7 +2,7 @@ import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
- import { Button } from "semantic-ui-react";
5
+ import { Button, Icon } from "semantic-ui-react";
6
6
  import { Link } from "react-router-dom";
7
7
  import { FormattedMessage } from "react-intl";
8
8
  import { ConfirmModal, GroupActions } from "@truedat/core/components";
@@ -51,8 +51,7 @@ const ModalDelete = ({
51
51
  icon="trash"
52
52
  trigger={
53
53
  <Button
54
- className="negative"
55
- icon="trash"
54
+ icon={<Icon name="trash alternate outline" color="red" />}
56
55
  content={<FormattedMessage id="actions.delete" />}
57
56
  />
58
57
  }
@@ -6,7 +6,6 @@ import { List, Header, Segment } from "semantic-ui-react";
6
6
  import { FormattedMessage } from "react-intl";
7
7
  import { getConceptDomainPath } from "../selectors";
8
8
  import DomainItem from "../../taxonomy/components/DomainItem";
9
- import DomainsConceptLoader from "../../taxonomy/components/DomainsConceptLoader";
10
9
  import ConceptManageDomainPopup from "./ConceptManageDomainPopup";
11
10
 
12
11
  export const ConceptTaxonomy = ({ domainPath }) =>
@@ -15,7 +14,6 @@ export const ConceptTaxonomy = ({ domainPath }) =>
15
14
  <Header as="h3" dividing>
16
15
  <FormattedMessage id="concepts.taxonomy" defaultMessage="Taxonomía" />
17
16
  </Header>
18
- <DomainsConceptLoader actions="manage_business_concepts_domain" />
19
17
  <ConceptManageDomainPopup conceptAction="concepts.actions.edit" />
20
18
 
21
19
  <List horizontal>
@@ -67,7 +67,7 @@ describe("<ConceptCrumbs />", () => {
67
67
  id: 456,
68
68
  },
69
69
  sidemenuGlossarySubscopes: [],
70
- templates: [{ name: "someType", subscope: "someSubscope" }],
70
+ allTemplates: [{ name: "someType", subscope: "someSubscope" }],
71
71
  },
72
72
  };
73
73
  const { container } = render(<ConceptCrumbs />, renderOpts);
@@ -85,7 +85,7 @@ describe("<ConceptCrumbs />", () => {
85
85
  id: 456,
86
86
  },
87
87
  sidemenuGlossarySubscopes: ["someSubscope"],
88
- templates: [{ name: "someType", subscope: "someSubscope" }],
88
+ allTemplates: [{ name: "someType", subscope: "someSubscope" }],
89
89
  },
90
90
  };
91
91
  const { container } = render(<ConceptCrumbs />, renderOpts);
@@ -120,7 +120,7 @@ describe("<ConceptCrumbs />", () => {
120
120
  business_concept_id: 123,
121
121
  id: 456,
122
122
  },
123
- templates: [{ name: "someType", subscope: "someSubscope" }],
123
+ allTemplates: [{ name: "someType", subscope: "someSubscope" }],
124
124
  },
125
125
  };
126
126
  const props = {
@@ -141,7 +141,7 @@ describe("<ConceptCrumbs />", () => {
141
141
  id: 456,
142
142
  },
143
143
  sidemenuGlossarySubscopes: ["someSubscope"],
144
- templates: [{ name: "someType", subscope: "someSubscope" }],
144
+ allTemplates: [{ name: "someType", subscope: "someSubscope" }],
145
145
  },
146
146
  };
147
147
  const props = {
@@ -11,9 +11,6 @@ exports[`<ConceptTaxonomy /> matches the latest snapshot 1`] = `
11
11
  id="concepts.taxonomy"
12
12
  />
13
13
  </Header>
14
- <Connect(DomainsConceptLoader)
15
- actions="manage_business_concepts_domain"
16
- />
17
14
  <Connect(ConceptManageDomainPopup)
18
15
  conceptAction="concepts.actions.edit"
19
16
  />
@@ -4,7 +4,7 @@ describe("getConceptSubscope", () => {
4
4
  it("returns the subscope string if concept type matches a template", () => {
5
5
  const state = {
6
6
  concept: { id: 123, type: "someType" },
7
- templates: [{ name: "someType", subscope: "someSubscope" }],
7
+ allTemplates: [{ name: "someType", subscope: "someSubscope" }],
8
8
  };
9
9
  const result = getConceptSubscope(state);
10
10
  expect(result).toBe("someSubscope");
@@ -13,7 +13,7 @@ describe("getConceptSubscope", () => {
13
13
  it("returns null if concept exists but no template matches its type", () => {
14
14
  const state = {
15
15
  concept: { id: 123, type: "otherType" },
16
- templates: [{ name: "someType", subscope: "someSubscope" }],
16
+ allTemplates: [{ name: "someType", subscope: "someSubscope" }],
17
17
  };
18
18
  const result = getConceptSubscope(state);
19
19
  expect(result).toBeNull();
@@ -22,14 +22,14 @@ describe("getConceptSubscope", () => {
22
22
  it("returns undefined if concept is missing or has no id", () => {
23
23
  const stateA = {
24
24
  concept: undefined, // No concept at all
25
- templates: [{ name: "someType", subscope: "someSubscope" }],
25
+ allTemplates: [{ name: "someType", subscope: "someSubscope" }],
26
26
  };
27
27
  const resultA = getConceptSubscope(stateA);
28
28
  expect(resultA).toBeUndefined();
29
29
 
30
30
  const stateB = {
31
31
  concept: {}, // Concept object but no id
32
- templates: [{ name: "someType", subscope: "someSubscope" }],
32
+ allTemplates: [{ name: "someType", subscope: "someSubscope" }],
33
33
  };
34
34
  const resultB = getConceptSubscope(stateB);
35
35
  expect(resultB).toBeUndefined();
@@ -11,7 +11,7 @@ describe("getConceptVersionPath selector (no mocks)", () => {
11
11
  status: "published",
12
12
  },
13
13
  // No matching template => the sub-scope will be null
14
- templates: [{ name: "SomeOtherType", subscope: "someScope" }],
14
+ allTemplates: [{ name: "SomeOtherType", subscope: "someScope" }],
15
15
  sidemenuGlossarySubscopes: undefined,
16
16
  };
17
17
 
@@ -31,7 +31,7 @@ describe("getConceptVersionPath selector (no mocks)", () => {
31
31
  status: "published",
32
32
  // no 'id' property
33
33
  },
34
- templates: [{ name: "Foo", subscope: "myScope" }],
34
+ allTemplates: [{ name: "Foo", subscope: "myScope" }],
35
35
  sidemenuGlossarySubscopes: ["myScope"],
36
36
  };
37
37
 
@@ -53,7 +53,7 @@ describe("getConceptVersionPath selector (no mocks)", () => {
53
53
  status: "draft",
54
54
  type: "Foo",
55
55
  },
56
- templates: [{ name: "Foo", subscope: "myScope" }],
56
+ allTemplates: [{ name: "Foo", subscope: "myScope" }],
57
57
  sidemenuGlossarySubscopes: ["otherScope"],
58
58
  };
59
59
 
@@ -78,7 +78,7 @@ describe("getConceptVersionPath selector (no mocks)", () => {
78
78
  status: "deprecated",
79
79
  type: "Foo",
80
80
  },
81
- templates: [{ name: "Foo", subscope: "myScope" }],
81
+ allTemplates: [{ name: "Foo", subscope: "myScope" }],
82
82
  sidemenuGlossarySubscopes: ["anotherScope"],
83
83
  };
84
84
 
@@ -103,7 +103,7 @@ describe("getConceptVersionPath selector (no mocks)", () => {
103
103
  status: "published",
104
104
  type: "SideMenuScope",
105
105
  },
106
- templates: [{ name: "SideMenuScope", subscope: "someSubscope" }],
106
+ allTemplates: [{ name: "SideMenuScope", subscope: "someSubscope" }],
107
107
  sidemenuGlossarySubscopes: ["someSubscope"],
108
108
  };
109
109
 
@@ -125,7 +125,7 @@ describe("getConceptVersionPath selector (no mocks)", () => {
125
125
  status: "draft",
126
126
  type: "SideMenuScope",
127
127
  },
128
- templates: [{ name: "SideMenuScope", subscope: "subscopeA" }],
128
+ allTemplates: [{ name: "SideMenuScope", subscope: "subscopeA" }],
129
129
  sidemenuGlossarySubscopes: ["subscopeA"],
130
130
  };
131
131
 
@@ -149,7 +149,7 @@ describe("getConceptVersionPath selector (no mocks)", () => {
149
149
  status: "published",
150
150
  type: "SideMenuScope",
151
151
  },
152
- templates: [{ name: "SideMenuScope", subscope: "subscopeA" }],
152
+ allTemplates: [{ name: "SideMenuScope", subscope: "subscopeA" }],
153
153
  sidemenuGlossarySubscopes: ["subscopeA"],
154
154
  };
155
155
 
@@ -170,7 +170,7 @@ describe("getConceptVersionPath selector (no mocks)", () => {
170
170
  status: "published",
171
171
  type: "NoSubscope",
172
172
  },
173
- templates: [{ name: "NoSubscope", subscope: null }],
173
+ allTemplates: [{ name: "NoSubscope", subscope: null }],
174
174
  sidemenuGlossarySubscopes: ["subscopeA"],
175
175
  };
176
176
 
@@ -2,7 +2,7 @@ import { createSelector } from "reselect";
2
2
  import _ from "lodash/fp";
3
3
 
4
4
  export const getConcept = _.prop("concept");
5
- export const getTemplates = _.prop("templates");
5
+ export const getTemplates = _.prop("allTemplates");
6
6
 
7
7
  export const getConceptSubscope = createSelector(
8
8
  [getConcept, getTemplates],
package/src/sagas.js CHANGED
@@ -1,4 +1,3 @@
1
1
  import conceptSagas from "./concepts/sagas";
2
- import taxonomySagas from "./taxonomy/sagas";
3
2
 
4
- export default [...conceptSagas, ...taxonomySagas];
3
+ export default [...conceptSagas];
@@ -2,7 +2,7 @@ import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { Link } from "react-router-dom";
5
- import { Button } from "semantic-ui-react";
5
+ import { Button, Icon } from "semantic-ui-react";
6
6
  import { FormattedMessage, useIntl } from "react-intl";
7
7
  import { ConfirmModal, GroupActions } from "@truedat/core/components";
8
8
 
@@ -36,9 +36,8 @@ const ModalDelete = ({ onConfirm }) => {
36
36
  onConfirm={onConfirm}
37
37
  trigger={
38
38
  <Button
39
- negative
40
39
  content={formatMessage({ id: "actions.delete" })}
41
- icon="trash"
40
+ icon={<Icon name="trash alternate outline" color="red" />}
42
41
  />
43
42
  }
44
43
  />
@@ -53,7 +52,7 @@ const withDelete = (actions, onConfirm) => [
53
52
  ...actions,
54
53
  {
55
54
  key: "delete",
56
- icon: "trash",
55
+ icon: "trash alternate outline",
57
56
  value: "delete",
58
57
  as: ModalDelete,
59
58
  onConfirm,
@@ -50,11 +50,11 @@ exports[`<DomainActions /> matches the latest snapshot 1`] = `
50
50
  EditDomain
51
51
  </a>
52
52
  <button
53
- class="ui negative button"
53
+ class="ui button"
54
54
  >
55
55
  <i
56
56
  aria-hidden="true"
57
- class="trash icon"
57
+ class="red trash alternate outline icon"
58
58
  />
59
59
  ActionDelete
60
60
  </button>
@@ -1,5 +1,3 @@
1
1
  import { createRoutine } from "redux-saga-routines";
2
2
 
3
- export const fetchDomainsConcept = createRoutine("FETCH_CONCEPT_DOMAINS");
4
- export const clearDomainsConcept = createRoutine("CLEAR_DOMAINS");
5
3
  export const filterDomains = createRoutine("FILTER_DOMAINS");
@@ -1,43 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import { connect } from "react-redux";
4
- import { Loading } from "@truedat/core/components";
5
- import { clearDomainsConcept, fetchDomainsConcept } from "../routines";
6
-
7
- export class DomainsConceptLoader extends React.Component {
8
- static propTypes = {
9
- actions: PropTypes.string,
10
- clearDomainsConcept: PropTypes.func,
11
- fetchDomainsConcept: PropTypes.func,
12
- filter: PropTypes.string,
13
- domainsConceptLoading: PropTypes.bool,
14
- };
15
-
16
- componentDidMount() {
17
- const { fetchDomainsConcept, actions, filter } = this.props;
18
- fetchDomainsConcept({ actions, filter });
19
- }
20
-
21
- componentWillUnmount() {
22
- const { clearDomainsConcept } = this.props;
23
- clearDomainsConcept();
24
- }
25
-
26
- render() {
27
- const { domainsConceptLoading } = this.props;
28
- if (domainsConceptLoading) {
29
- return <Loading />;
30
- } else {
31
- return null;
32
- }
33
- }
34
- }
35
-
36
- const mapStateToProps = ({ domainsConceptLoading }) => ({
37
- domainsConceptLoading,
38
- });
39
-
40
- export default connect(mapStateToProps, {
41
- clearDomainsConcept,
42
- fetchDomainsConcept,
43
- })(DomainsConceptLoader);
@@ -1,38 +0,0 @@
1
- import React from "react";
2
- import { mount } from "enzyme";
3
- import { DomainsConceptLoader } from "../DomainsConceptLoader";
4
-
5
- const getProps = () => ({
6
- clearDomainsConcept: jest.fn(),
7
- domainsConceptLoading: false,
8
- fetchDomainsConcept: jest.fn(),
9
- actions: "create_ingest",
10
- filter: "all",
11
- });
12
-
13
- describe("<DomainsConceptLoader />", () => {
14
- it("calls fetchDomainsConcept when component mounts but not when it unmounts", () => {
15
- const props = getProps();
16
- const wrapper = mount(<DomainsConceptLoader {...props} />);
17
- expect(props.fetchDomainsConcept).toHaveBeenCalledTimes(1);
18
- wrapper.unmount();
19
- expect(props.fetchDomainsConcept).toHaveBeenCalledTimes(1);
20
- });
21
-
22
- it("calls clearDomainsConcept and clearDomainDefaultFilters when component unmounts but not when it mounts", () => {
23
- const props = getProps();
24
- const wrapper = mount(<DomainsConceptLoader {...props} />);
25
- expect(props.clearDomainsConcept).toHaveBeenCalledTimes(0);
26
- wrapper.unmount();
27
- expect(props.clearDomainsConcept).toHaveBeenCalledTimes(1);
28
- });
29
-
30
- it("renders Loading when domainLoading is true", () => {
31
- const props = getProps();
32
-
33
- const wrapper = mount(
34
- <DomainsConceptLoader {...{ ...props, domainsConceptLoading: true }} />
35
- );
36
- expect(wrapper.find("Loading").length).toBe(1);
37
- });
38
- });
@@ -1,93 +0,0 @@
1
- import { testSaga } from "redux-saga-test-plan";
2
- import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
3
- import {
4
- fetchDomainsConceptRequestSaga,
5
- fetchDomainsConceptSaga,
6
- } from "../fetchDomainsConcept";
7
- import { fetchDomainsConcept } from "../../routines";
8
- import { API_DOMAINS } from "../../api";
9
-
10
- describe("sagas: fetchDomainsConceptRequestSaga", () => {
11
- it("should invoke fetchDomainsConceptSaga on trigger", () => {
12
- expect(() => {
13
- testSaga(fetchDomainsConceptRequestSaga)
14
- .next()
15
- .takeLatest(fetchDomainsConcept.TRIGGER, fetchDomainsConceptSaga)
16
- .finish()
17
- .isDone();
18
- }).not.toThrow();
19
- });
20
-
21
- it("should throw exception if an unhandled action is received", () => {
22
- expect(() => {
23
- testSaga(fetchDomainsConceptRequestSaga)
24
- .next()
25
- .takeLatest("FOO", fetchDomainsConceptSaga);
26
- }).toThrow();
27
- });
28
- });
29
-
30
- describe("sagas: fetchDomainsConceptSaga", () => {
31
- const data = {
32
- collection: [
33
- { id: 1, name: "Top domain", description: "Desc" },
34
- { id: 2, name: "Child domain", description: "Desc2", parent_id: 2 },
35
- ],
36
- };
37
-
38
- it("should put a success action when a response is returned", () => {
39
- const actions = undefined;
40
- expect(() => {
41
- testSaga(fetchDomainsConceptSaga, {})
42
- .next()
43
- .put(fetchDomainsConcept.request())
44
- .next()
45
- .call(apiJson, API_DOMAINS, JSON_OPTS)
46
- .next({ data })
47
- .put(fetchDomainsConcept.success({ data, actions }))
48
- .next()
49
- .put(fetchDomainsConcept.fulfill())
50
- .next()
51
- .isDone();
52
- }).not.toThrow();
53
- });
54
-
55
- it("should handle actions in the payload", () => {
56
- const actions = "show";
57
- const filter = "foo";
58
- const payload = { actions, filter };
59
- const json_opts = { params: { actions, filter }, ...JSON_OPTS };
60
- expect(() => {
61
- testSaga(fetchDomainsConceptSaga, { payload })
62
- .next()
63
- .put(fetchDomainsConcept.request(payload))
64
- .next()
65
- .call(apiJson, API_DOMAINS, json_opts)
66
- .next({ data })
67
- .put(fetchDomainsConcept.success({ data, actions }))
68
- .next()
69
- .put(fetchDomainsConcept.fulfill())
70
- .next()
71
- .isDone();
72
- }).not.toThrow();
73
- });
74
-
75
- it("should put a failure action when the call throws an error", () => {
76
- const message = "Request failed";
77
- const error = { message };
78
-
79
- expect(() => {
80
- testSaga(fetchDomainsConceptSaga, {})
81
- .next()
82
- .put(fetchDomainsConcept.request())
83
- .next()
84
- .call(apiJson, API_DOMAINS, JSON_OPTS)
85
- .throw(error)
86
- .put(fetchDomainsConcept.failure(message))
87
- .next()
88
- .put(fetchDomainsConcept.fulfill())
89
- .next()
90
- .isDone();
91
- }).not.toThrow();
92
- });
93
- });
@@ -1,37 +0,0 @@
1
- import _ from "lodash/fp";
2
- import { call, put, takeLatest } from "redux-saga/effects";
3
- import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
4
- import { fetchDomainsConcept } from "../routines";
5
- import { API_DOMAINS } from "../api";
6
-
7
- export function* fetchDomainsConceptSaga({ payload }) {
8
- try {
9
- const { actions, filter } = payload || {};
10
- const json_opts = actions
11
- ? {
12
- ...JSON_OPTS,
13
- params: {
14
- actions: _.flow(_.castArray, _.join(","))(actions),
15
- filter,
16
- },
17
- }
18
- : JSON_OPTS;
19
- const url = API_DOMAINS;
20
- yield put(fetchDomainsConcept.request(payload));
21
- const { data } = yield call(apiJson, url, json_opts);
22
- yield put(fetchDomainsConcept.success({ data, actions }));
23
- } catch (error) {
24
- if (error.response) {
25
- const { status, data } = error.response;
26
- yield put(fetchDomainsConcept.failure({ status, data }));
27
- } else {
28
- yield put(fetchDomainsConcept.failure(error.message));
29
- }
30
- } finally {
31
- yield put(fetchDomainsConcept.fulfill());
32
- }
33
- }
34
-
35
- export function* fetchDomainsConceptRequestSaga() {
36
- yield takeLatest(fetchDomainsConcept.TRIGGER, fetchDomainsConceptSaga);
37
- }
@@ -1,5 +0,0 @@
1
- import { fetchDomainsConceptRequestSaga } from "./fetchDomainsConcept";
2
-
3
- export { fetchDomainsConceptRequestSaga };
4
-
5
- export default [fetchDomainsConceptRequestSaga()];