@truedat/bg 7.5.4 → 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.4",
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.4",
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.4",
90
- "@truedat/df": "7.5.4",
91
- "@truedat/lm": "7.5.4",
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": "e41d75322f4e11f804d9e834c21f6416c8586963"
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>
@@ -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
  />
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()];