@truedat/dd 4.36.7 → 4.37.1

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,12 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.37.0] 2022-01-25
4
+
5
+ ### Changed
6
+
7
+ - [TD-2564] `StructureSelectorInputField` now accepts `defaultFilters` prop,
8
+ removed `options` prop
9
+
3
10
  ## [4.36.5] 2022-01-20
4
11
 
5
12
  ### Added
6
13
 
7
14
  - [TD-4100] Long Alert error message CSV download link
8
15
 
9
-
10
16
  ## [4.36.3] 2022-01-18
11
17
 
12
18
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "4.36.7",
3
+ "version": "4.37.1",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -47,7 +47,7 @@
47
47
  "jest": "^27.0.6",
48
48
  "react": "^16.14.0",
49
49
  "react-dom": "^16.14.0",
50
- "redux-saga-test-plan": "^4.0.1",
50
+ "redux-saga-test-plan": "^4.0.4",
51
51
  "rimraf": "^3.0.2",
52
52
  "semantic-ui-react": "^2.0.3"
53
53
  },
@@ -84,9 +84,9 @@
84
84
  ]
85
85
  },
86
86
  "dependencies": {
87
- "@truedat/auth": "4.36.7",
88
- "@truedat/core": "4.36.7",
89
- "@truedat/df": "4.36.7",
87
+ "@truedat/auth": "4.37.1",
88
+ "@truedat/core": "4.37.1",
89
+ "@truedat/df": "4.37.1",
90
90
  "lodash": "^4.17.21",
91
91
  "path-to-regexp": "^1.7.0",
92
92
  "prop-types": "^15.7.2",
@@ -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": "f5b0b7da7d61e1e8fff39337fe411f4174055b73"
110
+ "gitHead": "36ffd7e86efe27f38c3ae1bb616eb9eb4d444d12"
111
111
  }
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import { bindActionCreators } from "redux";
4
3
  import { connect } from "react-redux";
5
4
  import { useIntl } from "react-intl";
6
5
  import { Button, Icon } from "semantic-ui-react";
@@ -24,11 +23,7 @@ export const StructureDeleteButton = ({ structure, deleteStructure }) => {
24
23
  content={formatMessage({
25
24
  id: "structure.actions.delete.confirmation.content",
26
25
  })}
27
- handleSubmit={() =>
28
- deleteStructure({
29
- id: structure.id,
30
- })
31
- }
26
+ onConfirm={() => deleteStructure({ id: structure.id })}
32
27
  onOpen={(e) => e.stopPropagation()}
33
28
  onClone={(e) => e.stopPropagation()}
34
29
  />
@@ -39,14 +34,11 @@ StructureDeleteButton.propTypes = {
39
34
  structure: PropTypes.object,
40
35
  deleteStructure: PropTypes.func,
41
36
  };
42
- const mapDispatchToProps = (dispatch) =>
43
- bindActionCreators({ deleteStructure }, dispatch);
44
37
 
45
38
  const mapStateToProps = ({ structure }) => ({
46
39
  structure,
47
40
  });
48
41
 
49
- export default connect(
50
- mapStateToProps,
51
- mapDispatchToProps
52
- )(StructureDeleteButton);
42
+ export default connect(mapStateToProps, { deleteStructure })(
43
+ StructureDeleteButton
44
+ );
@@ -9,7 +9,7 @@ import { ConfirmModal, GroupActions } from "@truedat/core/components";
9
9
  import { linkTo } from "@truedat/core/routes";
10
10
  import { doStructureNoteAction } from "../routines";
11
11
 
12
- export const ModalDelete = ({ modalOnClick, modalAction, modalIcon }) => (
12
+ export const ModalDelete = ({ modalOnConfirm, modalAction, modalIcon }) => (
13
13
  <ConfirmModal
14
14
  icon="trash"
15
15
  trigger={
@@ -34,11 +34,12 @@ export const ModalDelete = ({ modalOnClick, modalAction, modalIcon }) => (
34
34
  id={`structure.notes.actions.${modalAction}.confirmation.content`}
35
35
  />
36
36
  }
37
- handleSubmit={modalOnClick}
37
+ onConfirm={modalOnConfirm}
38
38
  />
39
39
  );
40
+
40
41
  ModalDelete.propTypes = {
41
- modalOnClick: PropTypes.func,
42
+ modalOnConfirm: PropTypes.func,
42
43
  modalText: PropTypes.object,
43
44
  modalAction: PropTypes.string,
44
45
  };
@@ -89,7 +90,7 @@ export const StructureNoteActions = ({
89
90
  return withModal(action)
90
91
  ? {
91
92
  ...baseAction,
92
- modalOnClick: () =>
93
+ modalOnConfirm: () =>
93
94
  doStructureNoteAction({
94
95
  action: data,
95
96
  dataStructureId: structure?.id,
@@ -15,7 +15,7 @@ export const StructureSelectorInputField = ({
15
15
  onDelete,
16
16
  onClick,
17
17
  joined,
18
- options: { defaultFilters },
18
+ defaultFilters,
19
19
  structures,
20
20
  selectedStructure,
21
21
  selectedSystem,
@@ -132,7 +132,7 @@ StructureSelectorInputField.propTypes = {
132
132
  onChangeField: PropTypes.func,
133
133
  onClick: PropTypes.func,
134
134
  onDelete: PropTypes.func,
135
- options: PropTypes.object.isRequired,
135
+ defaultFilters: PropTypes.object,
136
136
  structures: PropTypes.array,
137
137
  selectedStructure: PropTypes.object,
138
138
  selectedSystem: PropTypes.string,
@@ -65,9 +65,7 @@ export const StructureTagsCards = ({
65
65
  />
66
66
  )
67
67
  }
68
- handleSubmit={() =>
69
- deleteStructureTag({ id: structureTag.id })
70
- }
68
+ onConfirm={() => deleteStructureTag({ id: structureTag.id })}
71
69
  />
72
70
  </div>
73
71
  </Card.Content>
@@ -186,7 +186,7 @@ export class StructuresBulkUpdate extends React.Component {
186
186
  values={{ structures_count: structureCount }}
187
187
  />
188
188
  }
189
- handleSubmit={this.handleSubmit}
189
+ onConfirm={this.handleSubmit}
190
190
  />
191
191
  <HistoryBackButton
192
192
  content={<FormattedMessage id="actions.cancel" />}
@@ -11,12 +11,12 @@ describe("<StructureSelectorInputField />", () => {
11
11
  it("matches the latest snapshot", () => {
12
12
  const props = {
13
13
  selectedStructure: { id: "value" },
14
- options: { defaultFilters: {} },
14
+ defaultFilters: {},
15
15
  active: true,
16
16
  onClick: jest.fn(),
17
17
  onChange: jest.fn(),
18
18
  systems: [],
19
- systemRequired: true
19
+ systemRequired: true,
20
20
  };
21
21
  const wrapper = shallow(<StructureSelectorInputField {...props} />);
22
22
  expect(wrapper).toMatchSnapshot();
@@ -24,9 +24,9 @@ describe("<StructureSelectorInputField />", () => {
24
24
 
25
25
  it("clicking on input will call onClick with the input name", () => {
26
26
  const props = {
27
- options: { defaultFilters: {} },
27
+ defaultFilters: {},
28
28
  active: false,
29
- onClick: jest.fn()
29
+ onClick: jest.fn(),
30
30
  };
31
31
  const wrapper = shallow(<StructureSelectorInputField {...props} />);
32
32
 
@@ -37,9 +37,9 @@ describe("<StructureSelectorInputField />", () => {
37
37
 
38
38
  it("clicking on input will call onClick with empty string wehn active is true", () => {
39
39
  const props = {
40
- options: { defaultFilters: {} },
40
+ defaultFilters: {},
41
41
  active: true,
42
- onClick: jest.fn()
42
+ onClick: jest.fn(),
43
43
  };
44
44
  const wrapper = shallow(<StructureSelectorInputField {...props} />);
45
45
  expect(props.onClick.mock.calls.length).toBe(0);
@@ -52,28 +52,25 @@ describe("<StructureSelectorInputField />", () => {
52
52
  const fetchStructure = jest.fn();
53
53
  const props = {
54
54
  selectedStructure: { id: "value" },
55
- options: { defaultFilters: {} },
55
+ defaultFilters: {},
56
56
  active: true,
57
57
  onChange,
58
- fetchStructure
58
+ fetchStructure,
59
59
  };
60
60
  const wrapper = shallow(<StructureSelectorInputField {...props} />);
61
61
 
62
62
  const structure = { id: "test" };
63
63
 
64
- wrapper
65
- .find("Connect(StructureSelector)")
66
- .props()
67
- .onSelect(structure);
64
+ wrapper.find("Connect(StructureSelector)").props().onSelect(structure);
68
65
  expect(onChange.mock.calls.length).toBe(1);
69
66
  expect(onChange.mock.calls[0][0]).toEqual(structure);
70
67
  });
71
68
 
72
69
  it("if selectedSystem is empty the embedded FormInput is disabled", () => {
73
70
  const props = {
74
- options: { defaultFilters: {} },
71
+ defaultFilters: {},
75
72
  selectedSystem: "",
76
- systemRequired: true
73
+ systemRequired: true,
77
74
  };
78
75
  const wrapper = shallow(<StructureSelectorInputField {...props} />);
79
76
  expect(wrapper.find("FormInput").props().disabled).toBe(true);
@@ -46,13 +46,13 @@ exports[`<StructureTagsCards /> matches the latest snapshot 1`] = `
46
46
  }
47
47
  />
48
48
  }
49
- handleSubmit={[Function]}
50
49
  header={
51
50
  <Memo(MemoizedFormattedMessage)
52
51
  id="structureTags.actions.delete.confirmation.header"
53
52
  />
54
53
  }
55
54
  icon="trash"
55
+ onConfirm={[Function]}
56
56
  trigger={
57
57
  <Button
58
58
  as="button"
@@ -109,13 +109,13 @@ exports[`<StructureTagsCards /> matches the latest snapshot 1`] = `
109
109
  }
110
110
  />
111
111
  }
112
- handleSubmit={[Function]}
113
112
  header={
114
113
  <Memo(MemoizedFormattedMessage)
115
114
  id="structureTags.actions.delete.confirmation.header"
116
115
  />
117
116
  }
118
117
  icon="trash"
118
+ onConfirm={[Function]}
119
119
  trigger={
120
120
  <Button
121
121
  as="button"
@@ -81,12 +81,12 @@ exports[`<StructuresBulkUpdate /> matches the latest snapshot 1`] = `
81
81
  }
82
82
  />
83
83
  }
84
- handleSubmit={[Function]}
85
84
  header={
86
85
  <Memo(MemoizedFormattedMessage)
87
86
  id="structures.edit.bulk.confirmation.header"
88
87
  />
89
88
  }
89
+ onConfirm={[Function]}
90
90
  trigger={
91
91
  <Button
92
92
  as="button"
@@ -66,24 +66,24 @@ const ddMessage = (state = initialState, { type, payload }) => {
66
66
  const field = _.path("errors.field")(data);
67
67
  const messages = _.has("errors")(data)
68
68
  ? _.flow(
69
- _.propOr([], "errors"),
70
- _.toPairs,
71
- _.filter(([k, _v]) => k !== "row" && k !== "field"),
72
- _.map(([k, v]) =>
73
- _.map((e) => ({
74
- id: `structures.uploadStructures.failed.${k}.${e}`,
75
- fields: { row, field },
76
- defaultMessage: "structures.uploadStructures.failed.default",
77
- }))(v)
78
- ),
79
- _.flatten
80
- )(data)
69
+ _.propOr([], "errors"),
70
+ _.toPairs,
71
+ _.filter(([k, _v]) => k !== "row" && k !== "field"),
72
+ _.map(([k, v]) =>
73
+ _.map((e) => ({
74
+ id: `structures.uploadStructures.failed.${k}.${e}`,
75
+ fields: { row, field },
76
+ defaultMessage: "structures.uploadStructures.failed.default",
77
+ }))(v)
78
+ ),
79
+ _.flatten
80
+ )(data)
81
81
  : _.flow(_.path("error.message"), (m) => [
82
- {
83
- id: `structures.uploadStructures.failed.${m}`,
84
- defaultMessage: "structures.uploadStructures.failed.default",
85
- },
86
- ])(data);
82
+ {
83
+ id: `structures.uploadStructures.failed.${m}`,
84
+ defaultMessage: "structures.uploadStructures.failed.default",
85
+ },
86
+ ])(data);
87
87
  return {
88
88
  error: true,
89
89
  header: "structures.uploadStructures.failed.header",