@truedat/dq 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.
Files changed (27) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +5 -5
  3. package/src/components/Implementations.js +3 -11
  4. package/src/components/NewRuleImplementation.js +12 -13
  5. package/src/components/RuleActions.js +1 -1
  6. package/src/components/RuleImplementation.js +1 -1
  7. package/src/components/RuleImplementationsDownload.js +2 -1
  8. package/src/components/RuleResultRow.js +1 -1
  9. package/src/components/__tests__/RuleImplementationEvents.spec.js +2 -3
  10. package/src/components/__tests__/__snapshots__/RuleImplementationEvents.spec.js.snap +2 -2
  11. package/src/components/ruleImplementationForm/DatasetForm.js +9 -26
  12. package/src/components/ruleImplementationForm/FiltersField.js +2 -12
  13. package/src/components/ruleImplementationForm/__tests__/DataSetForm.spec.js +19 -59
  14. package/src/components/ruleImplementationForm/__tests__/FiltersField.spec.js +4 -18
  15. package/src/components/ruleImplementationForm/__tests__/__snapshots__/DataSetForm.spec.js.snap +7 -147
  16. package/src/components/ruleImplementationForm/__tests__/__snapshots__/FiltersField.spec.js.snap +7 -12
  17. package/src/messages/en.js +2 -0
  18. package/src/messages/es.js +2 -0
  19. package/src/reducers/index.js +0 -2
  20. package/src/routines.js +0 -3
  21. package/src/selectors/__tests__/datasetDefaultFiltersSelector.spec.js +17 -0
  22. package/src/selectors/datasetDefaultFiltersSelector.js +8 -0
  23. package/src/selectors/index.js +1 -1
  24. package/src/reducers/__tests__/ruleImplementationFilterValues.spec.js +0 -36
  25. package/src/reducers/ruleImplementationFilterValues.js +0 -20
  26. package/src/selectors/__tests__/getRuleImplementationFormFilters.spec.js +0 -22
  27. package/src/selectors/getRuleImplementationFormFilters.js +0 -19
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.37.1] 2022-02-02
4
+
5
+ ### Changed
6
+
7
+ - [TD-4152] Include aditional information on implementations download
8
+
9
+ ## [4.37.0] 2022-01-25
10
+
11
+ ### Changed
12
+
13
+ - [TD-2564] `DatasetForm` now has a configurable `defaultFilters` prop
14
+ - Simplified `DatasetForm` and `FiltersField` components by removing obscure
15
+ code for installation-specific custom filters
16
+
3
17
  ## [4.36.4] 2022-01-19
4
18
 
5
19
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "4.36.7",
3
+ "version": "4.37.1",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -44,7 +44,7 @@
44
44
  "jest": "^27.0.6",
45
45
  "react": "^16.14.0",
46
46
  "react-dom": "^16.14.0",
47
- "redux-saga-test-plan": "^4.0.1",
47
+ "redux-saga-test-plan": "^4.0.4",
48
48
  "rimraf": "^3.0.2",
49
49
  "semantic-ui-react": "^2.0.3"
50
50
  },
@@ -82,8 +82,8 @@
82
82
  },
83
83
  "dependencies": {
84
84
  "@apollo/client": "^3.4.10",
85
- "@truedat/core": "4.36.7",
86
- "@truedat/df": "4.36.7",
85
+ "@truedat/core": "4.37.1",
86
+ "@truedat/df": "4.37.1",
87
87
  "axios": "^0.19.2",
88
88
  "graphql": "^15.5.3",
89
89
  "path-to-regexp": "^1.7.0",
@@ -103,5 +103,5 @@
103
103
  "react-dom": ">= 16.8.6 < 17",
104
104
  "semantic-ui-react": ">= 0.88.2 < 2.1"
105
105
  },
106
- "gitHead": "f5b0b7da7d61e1e8fff39337fe411f4174055b73"
106
+ "gitHead": "36ffd7e86efe27f38c3ae1bb616eb9eb4d444d12"
107
107
  }
@@ -28,12 +28,7 @@ export const ActionsCell = ({
28
28
  content={formatMessage({
29
29
  id: `ruleImplementation.actions.restore.confirmation.content`,
30
30
  })}
31
- handleSubmit={() =>
32
- handleStatusChange(id, {
33
- restore: true,
34
- deleted,
35
- })
36
- }
31
+ onConfirm={() => handleStatusChange(id, { restore: true, deleted })}
37
32
  onOpen={(e) => e.stopPropagation()}
38
33
  onClose={(e) => e.stopPropagation()}
39
34
  />
@@ -63,11 +58,8 @@ export const ActionsCell = ({
63
58
  ),
64
59
  }
65
60
  )}
66
- handleSubmit={() =>
67
- handleStatusChange(id, {
68
- softDelete: active,
69
- deleted,
70
- })
61
+ onConfirm={() =>
62
+ handleStatusChange(id, { softDelete: active, deleted })
71
63
  }
72
64
  onOpen={(e) => e.stopPropagation()}
73
65
  onClose={(e) => e.stopPropagation()}
@@ -510,19 +510,7 @@ export const NewRuleImplementation = ({
510
510
  <Divider hidden />
511
511
  </Grid.Row>
512
512
  <Grid.Row stretched>
513
- {ruleImplementation.implementationType != "raw" && (
514
- <RuleImplementationForm
515
- ruleImplementation={ruleImplementation}
516
- setStructures={setDataset}
517
- setPopulation={setPopulation}
518
- setValidations={setValidations}
519
- operators={operators}
520
- setImplementationKey={setImplementationKey}
521
- onChange={onChange}
522
- handleSubmit={doSubmit}
523
- />
524
- )}
525
- {ruleImplementation.implementationType == "raw" && (
513
+ {ruleImplementation.implementationType == "raw" ? (
526
514
  <RuleImplementationRawForm
527
515
  mode={clone ? "clone" : edition ? "edition" : ""}
528
516
  implementationKey={_.prop("implementationKey")(
@@ -535,6 +523,17 @@ export const NewRuleImplementation = ({
535
523
  onChange={onChange}
536
524
  handleSubmit={doSubmit}
537
525
  />
526
+ ) : (
527
+ <RuleImplementationForm
528
+ ruleImplementation={ruleImplementation}
529
+ setStructures={setDataset}
530
+ setPopulation={setPopulation}
531
+ setValidations={setValidations}
532
+ operators={operators}
533
+ setImplementationKey={setImplementationKey}
534
+ onChange={onChange}
535
+ handleSubmit={doSubmit}
536
+ />
538
537
  )}
539
538
  </Grid.Row>
540
539
  </Grid.Column>
@@ -26,7 +26,7 @@ const ModalDelete = ({ deleteRule, id }) => (
26
26
  values={{ name: <i>{name}</i> }}
27
27
  />
28
28
  }
29
- handleSubmit={() => deleteRule({ id })}
29
+ onConfirm={() => deleteRule({ id })}
30
30
  />
31
31
  );
32
32
 
@@ -127,7 +127,7 @@ const OptionModal = ({
127
127
  }
128
128
  header={formatMessage({ id: headerMessage })}
129
129
  content={formatMessage({ id: contentMessage })}
130
- handleSubmit={() =>
130
+ onConfirm={() =>
131
131
  setRuleImplementationStatus({
132
132
  ruleId: rule.id,
133
133
  id: ruleImplementation.id,
@@ -10,7 +10,8 @@ const staticHeaderLabels = [
10
10
  "implementation_key",
11
11
  "implementation_type",
12
12
  "rule",
13
- "template",
13
+ "rule_template",
14
+ "implementation_template",
14
15
  "goal",
15
16
  "minimum",
16
17
  "business_concept",
@@ -79,7 +79,7 @@ export const RuleResultRow = ({
79
79
  content={formatMessage({
80
80
  id: "rule_result.actions.delete.confirmation.content",
81
81
  })}
82
- handleSubmit={() =>
82
+ onConfirm={() =>
83
83
  deleteRuleResult({
84
84
  id: ruleResult.id,
85
85
  rule_id: rule.id,
@@ -24,9 +24,8 @@ describe("<RuleImplementationEvents />", () => {
24
24
  const renderOpts = {
25
25
  messages: {
26
26
  en: {
27
- "ruleImplementations.events.field_restored": "implementation restored",
28
- "ruleImplementations.events.field_deprecated":
29
- "implementation deprecated",
27
+ "ruleImplementations.events.action_deprecated": "deprecated",
28
+ "ruleImplementations.events.action_restored": "restored",
30
29
  },
31
30
  },
32
31
  };
@@ -34,7 +34,7 @@ exports[`<RuleImplementationEvents /> matches the latest snapshot 1`] = `
34
34
  <div
35
35
  class="text extra"
36
36
  >
37
- ruleImplementations.events.action_restored
37
+ restored
38
38
  </div>
39
39
  </div>
40
40
  </div>
@@ -64,7 +64,7 @@ exports[`<RuleImplementationEvents /> matches the latest snapshot 1`] = `
64
64
  <div
65
65
  class="text extra"
66
66
  >
67
- ruleImplementations.events.action_deprecated
67
+ deprecated
68
68
  </div>
69
69
  </div>
70
70
  </div>
@@ -5,8 +5,7 @@ import { connect } from "react-redux";
5
5
  import { useIntl } from "react-intl";
6
6
  import { dropAt, replaceAt } from "@truedat/core/services/arrays";
7
7
  import { Button } from "semantic-ui-react";
8
- import { setImplementationFilterValues } from "../../routines";
9
- import { getRuleImplementationFormFilters } from "../../selectors";
8
+ import { datasetDefaultFiltersSelector } from "../../selectors";
10
9
  import "../../styles/ruleImplementationForm/DatasetForm.less";
11
10
 
12
11
  const StructureSelectorInputField = React.lazy(() =>
@@ -14,10 +13,9 @@ const StructureSelectorInputField = React.lazy(() =>
14
13
  );
15
14
 
16
15
  export const DatasetForm = ({
17
- customFilters,
16
+ defaultFilters,
18
17
  structures,
19
18
  selector,
20
- setImplementationFilterValues,
21
19
  setStructures,
22
20
  setSelector,
23
21
  }) => {
@@ -66,12 +64,9 @@ export const DatasetForm = ({
66
64
  const setStructure = ({ index, value: param_value }) => {
67
65
  const structureChanged = hasChangedStructure(index, param_value);
68
66
  const value = structureChanged ? setAliasIndex(param_value) : param_value;
69
- if (index === 0 && structureChanged) {
70
- setStructures([value ? { ...value } : {}]);
71
- setImplementationFilterValues({ value: _.get("structure")(value) });
72
- } else if (_.isNil(index))
67
+ if (_.isNil(index)) {
73
68
  setStructures([...structures, value ? { ...value } : {}]);
74
- else if (value) {
69
+ } else if (value) {
75
70
  const mergedValue = { ..._.nth(index)(structures), ...value };
76
71
  setStructures(replaceAt(index, mergedValue)(structures));
77
72
  } else setStructures(deleteStructure(index, structures));
@@ -88,13 +83,6 @@ export const DatasetForm = ({
88
83
  return dropAt(index)(structures);
89
84
  };
90
85
 
91
- const buildDefaultFilters = (i) => {
92
- const defaultFilters = { "class.raw": [""] };
93
- return i == 0
94
- ? { defaultFilters }
95
- : { defaultFilters: { ...defaultFilters, ...customFilters } };
96
- };
97
-
98
86
  return (
99
87
  <>
100
88
  {structures.map((structure, index) => (
@@ -102,7 +90,7 @@ export const DatasetForm = ({
102
90
  active={index === selector}
103
91
  joined={index > 0}
104
92
  key={index}
105
- options={buildDefaultFilters(index)}
93
+ defaultFilters={defaultFilters}
106
94
  onChange={(value) => {
107
95
  setSelector(-1);
108
96
  onChange(index, { structure: value });
@@ -125,27 +113,22 @@ export const DatasetForm = ({
125
113
  setStructure({ value: { join_type: "inner" } });
126
114
  }}
127
115
  >
128
- {formatMessage({
129
- id: "dataset.form.button.add_structure",
130
- })}
116
+ {formatMessage({ id: "dataset.form.button.add_structure" })}
131
117
  </Button>
132
118
  </>
133
119
  );
134
120
  };
135
121
 
136
122
  DatasetForm.propTypes = {
137
- customFilters: PropTypes.object,
123
+ defaultFilters: PropTypes.object,
138
124
  structures: PropTypes.array,
139
125
  selector: PropTypes.number,
140
126
  setStructures: PropTypes.func,
141
127
  setSelector: PropTypes.func,
142
- setImplementationFilterValues: PropTypes.func,
143
128
  };
144
129
 
145
130
  const mapStateToProps = (state) => ({
146
- customFilters: getRuleImplementationFormFilters(state),
131
+ defaultFilters: datasetDefaultFiltersSelector(state),
147
132
  });
148
133
 
149
- export default connect(mapStateToProps, { setImplementationFilterValues })(
150
- DatasetForm
151
- );
134
+ export default connect(mapStateToProps)(DatasetForm);
@@ -1,8 +1,6 @@
1
1
  import _ from "lodash/fp";
2
2
  import React, { useState } from "react";
3
- import { connect } from "react-redux";
4
3
  import PropTypes from "prop-types";
5
- import { getRuleImplementationFormFilters } from "../../selectors";
6
4
  import { getStructureFields } from "../../selectors/getStructureFields";
7
5
  import DateField from "./DateField";
8
6
  import DateTimeField from "./DateTimeField";
@@ -36,7 +34,6 @@ const reducedStructureColumns = [
36
34
  ];
37
35
 
38
36
  export const FiltersField = ({
39
- customFilters,
40
37
  parentStructures,
41
38
  label,
42
39
  operator,
@@ -97,9 +94,7 @@ export const FiltersField = ({
97
94
  <StructureSelectorInputField
98
95
  active={active}
99
96
  joined={false}
100
- options={{
101
- defaultFilters: { "class.raw": ["field"], ...customFilters },
102
- }}
97
+ defaultFilters={{ "class.raw": ["field"] }}
103
98
  onChange={(value) => {
104
99
  onChange(null, {
105
100
  data_structure_id: _.prop("id")(value),
@@ -159,7 +154,6 @@ export const FiltersField = ({
159
154
  };
160
155
 
161
156
  FiltersField.propTypes = {
162
- customFilters: PropTypes.object,
163
157
  label: PropTypes.string,
164
158
  parentStructures: PropTypes.array,
165
159
  operator: PropTypes.object,
@@ -171,8 +165,4 @@ FiltersField.propTypes = {
171
165
  typeCastModifiers: PropTypes.array,
172
166
  };
173
167
 
174
- const mapStateToProps = (state) => ({
175
- customFilters: getRuleImplementationFormFilters(state),
176
- });
177
-
178
- export default connect(mapStateToProps)(FiltersField);
168
+ export default FiltersField;
@@ -1,76 +1,36 @@
1
- import React from "react";
2
- import { intl } from "@truedat/test/intl-stub";
3
- import { shallow } from "enzyme";
4
- import { DatasetForm } from "../DatasetForm";
1
+ import React, { Suspense } from "react";
2
+ import { waitFor } from "@testing-library/react";
3
+ import { render } from "@truedat/test/render";
4
+ import DatasetForm from "../DatasetForm";
5
5
 
6
- // workaround for enzyme issue with React.useContext
7
- // see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
8
- jest.spyOn(React, "useContext").mockImplementation(() => intl);
6
+ const renderOpts = {
7
+ messages: { en: { "dataset.form.button.add_structure": "add_structure" } },
8
+ };
9
9
 
10
10
  describe("<DatasetForm />", () => {
11
11
  const setStructures = jest.fn();
12
12
  const setSelector = jest.fn();
13
13
  const selector = -1;
14
14
  const setImplementationKey = jest.fn();
15
- const setImplementationFilterValues = jest.fn();
16
15
  const implementationKey = "Impl";
17
- const structures = [
18
- {
19
- structure: {
20
- id: 1,
21
- name: "strcuture1",
22
- path: [],
23
- system: { name: "system" }
24
- }
25
- },
26
- {
27
- join_type: "inner",
28
- structure: {
29
- id: 2,
30
- name: "structure2",
31
- path: [],
32
- system: { name: "system" }
33
- },
34
- clauses: [{ id: 100 }, { id: 200 }]
35
- }
36
- ];
16
+ const structures = [1, 2];
37
17
 
38
- const customFilters = { "foo.bar": ["baz"] };
39
18
  const props = {
40
19
  implementationKey,
41
- customFilters,
42
- structures,
43
- setStructures,
44
- setSelector,
45
20
  selector,
46
- setImplementationFilterValues,
47
- setImplementationKey
21
+ setImplementationKey,
22
+ setSelector,
23
+ setStructures,
24
+ structures,
48
25
  };
49
26
 
50
27
  it("matches the latest snapshot", () => {
51
- const wrapper = shallow(<DatasetForm {...props} />);
52
- expect(wrapper).toMatchSnapshot();
53
- });
54
-
55
- it("renders all StructureSelectorInputField", () => {
56
- const wrapper = shallow(<DatasetForm {...props} />);
57
- const selectors = wrapper.find("lazy");
58
- expect(selectors).toHaveLength(structures.length);
59
- });
60
-
61
- it("all custom filter props are correct", () => {
62
- const wrapper = shallow(<DatasetForm {...props} />);
63
- const selectors = wrapper.find("lazy");
64
- expect(selectors.first().prop("options")).toEqual({
65
- defaultFilters: {
66
- "class.raw": [""]
67
- }
68
- });
69
- expect(selectors.last().prop("options")).toEqual({
70
- defaultFilters: {
71
- "class.raw": [""],
72
- "foo.bar": ["baz"]
73
- }
74
- });
28
+ const { container } = render(
29
+ <Suspense fallback={null}>
30
+ <DatasetForm {...props} />
31
+ </Suspense>,
32
+ renderOpts
33
+ );
34
+ expect(container).toMatchSnapshot();
75
35
  });
76
36
  });
@@ -17,42 +17,28 @@ describe("<FiltersField />", () => {
17
17
  id: 1,
18
18
  name: "structure1",
19
19
  path: ["structure1"],
20
- system: { external_id: "oracle_test", id: 29, name: "Oracle" }
21
- }
20
+ system: { external_id: "oracle_test", id: 29, name: "Oracle" },
21
+ },
22
22
  ];
23
23
 
24
- const customFilters = { "foo.bar": ["baz"] };
25
24
  const operator = {
26
25
  group: "references",
27
26
  name: "references",
28
27
  value_type: "field",
29
28
  value_type_filter: "any",
30
- scope: "validation"
29
+ scope: "validation",
31
30
  };
32
31
  const props = {
33
- customFilters,
34
32
  parentStructures,
35
33
  fieldType,
36
34
  onChange,
37
35
  name,
38
36
  operator,
39
- value
37
+ value,
40
38
  };
41
39
 
42
40
  it("matches the latest snapshot", () => {
43
41
  const wrapper = shallow(<FiltersField {...props} />);
44
42
  expect(wrapper).toMatchSnapshot();
45
43
  });
46
-
47
- it("renders StructureSelectorInputField with valid props", () => {
48
- const wrapper = shallow(<FiltersField {...props} />);
49
- const selectors = wrapper.find("lazy");
50
- expect(selectors).toHaveLength(1);
51
- expect(selectors.first().prop("options")).toEqual({
52
- defaultFilters: {
53
- "class.raw": ["field"],
54
- "foo.bar": ["baz"]
55
- }
56
- });
57
- });
58
44
  });
@@ -1,153 +1,13 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<DatasetForm /> matches the latest snapshot 1`] = `
4
- <Fragment>
5
- <lazy
6
- active={false}
7
- joined={false}
8
- key="0"
9
- onChange={[Function]}
10
- onChangeField={[Function]}
11
- onClick={[Function]}
12
- onDelete={[Function]}
13
- options={
14
- Object {
15
- "defaultFilters": Object {
16
- "class.raw": Array [
17
- "",
18
- ],
19
- },
20
- }
21
- }
22
- selectedStructure={
23
- Object {
24
- "structure": Object {
25
- "id": 1,
26
- "name": "strcuture1",
27
- "path": Array [],
28
- "system": Object {
29
- "name": "system",
30
- },
31
- },
32
- }
33
- }
34
- structures={
35
- Array [
36
- Object {
37
- "structure": Object {
38
- "id": 1,
39
- "name": "strcuture1",
40
- "path": Array [],
41
- "system": Object {
42
- "name": "system",
43
- },
44
- },
45
- },
46
- Object {
47
- "clauses": Array [
48
- Object {
49
- "id": 100,
50
- },
51
- Object {
52
- "id": 200,
53
- },
54
- ],
55
- "join_type": "inner",
56
- "structure": Object {
57
- "id": 2,
58
- "name": "structure2",
59
- "path": Array [],
60
- "system": Object {
61
- "name": "system",
62
- },
63
- },
64
- },
65
- ]
66
- }
67
- systemRequired={false}
68
- />
69
- <lazy
70
- active={false}
71
- joined={true}
72
- key="1"
73
- onChange={[Function]}
74
- onChangeField={[Function]}
75
- onClick={[Function]}
76
- onDelete={[Function]}
77
- options={
78
- Object {
79
- "defaultFilters": Object {
80
- "class.raw": Array [
81
- "",
82
- ],
83
- "foo.bar": Array [
84
- "baz",
85
- ],
86
- },
87
- }
88
- }
89
- selectedStructure={
90
- Object {
91
- "clauses": Array [
92
- Object {
93
- "id": 100,
94
- },
95
- Object {
96
- "id": 200,
97
- },
98
- ],
99
- "join_type": "inner",
100
- "structure": Object {
101
- "id": 2,
102
- "name": "structure2",
103
- "path": Array [],
104
- "system": Object {
105
- "name": "system",
106
- },
107
- },
108
- }
109
- }
110
- structures={
111
- Array [
112
- Object {
113
- "structure": Object {
114
- "id": 1,
115
- "name": "strcuture1",
116
- "path": Array [],
117
- "system": Object {
118
- "name": "system",
119
- },
120
- },
121
- },
122
- Object {
123
- "clauses": Array [
124
- Object {
125
- "id": 100,
126
- },
127
- Object {
128
- "id": 200,
129
- },
130
- ],
131
- "join_type": "inner",
132
- "structure": Object {
133
- "id": 2,
134
- "name": "structure2",
135
- "path": Array [],
136
- "system": Object {
137
- "name": "system",
138
- },
139
- },
140
- },
141
- ]
142
- }
143
- systemRequired={false}
144
- />
145
- <Button
146
- as="button"
4
+ <div>
5
+ <button
6
+ class="ui button"
147
7
  id="add-structure-button"
148
- onClick={[Function]}
8
+ style="display: none;"
149
9
  >
150
- dataset.form.button.add_structure
151
- </Button>
152
- </Fragment>
10
+ add_structure
11
+ </button>
12
+ </div>
153
13
  `;
@@ -3,23 +3,18 @@
3
3
  exports[`<FiltersField /> matches the latest snapshot 1`] = `
4
4
  <lazy
5
5
  active={false}
6
+ defaultFilters={
7
+ Object {
8
+ "class.raw": Array [
9
+ "field",
10
+ ],
11
+ }
12
+ }
6
13
  fieldWidth={15}
7
14
  joined={false}
8
15
  onChange={[Function]}
9
16
  onClick={[Function]}
10
17
  onDelete={[Function]}
11
- options={
12
- Object {
13
- "defaultFilters": Object {
14
- "class.raw": Array [
15
- "field",
16
- ],
17
- "foo.bar": Array [
18
- "baz",
19
- ],
20
- },
21
- }
22
- }
23
18
  selectedStructure={
24
19
  Object {
25
20
  "structure": "1",
@@ -497,6 +497,8 @@ export default {
497
497
  "ruleImplementations.props.result": "Quality",
498
498
  "ruleImplementations.props.rule": "Rule",
499
499
  "ruleImplementations.props.template": "Template",
500
+ "ruleImplementations.props.rule_template": "Rule template",
501
+ "ruleImplementations.props.implementation_template": "Implementation template",
500
502
  "ruleImplementations.retrieved.results": "{count} implementations found",
501
503
  "ruleImplementations.search.results.empty": "No implementations found",
502
504
  "ruleImplementations.searching": "Searching implementations",
@@ -511,6 +511,8 @@ export default {
511
511
  "ruleImplementations.props.rule": "Regla",
512
512
  "ruleImplementations.props.status": "Estado",
513
513
  "ruleImplementations.props.template": "Plantilla",
514
+ "ruleImplementations.props.rule_template": "Plantilla de regla",
515
+ "ruleImplementations.props.implementation_template": "Plantilla de implementación",
514
516
  "ruleImplementations.retrieved.results":
515
517
  "{count} implementaciones encontradas",
516
518
  "ruleImplementations.search.results.empty":
@@ -17,7 +17,6 @@ import { ruleImplementation } from "./ruleImplementation";
17
17
  import { ruleImplementationCount } from "./ruleImplementationCount";
18
18
  import { ruleImplementationCreating } from "./ruleImplementationCreating";
19
19
  import { ruleImplementationFilters } from "./ruleImplementationFilters";
20
- import { ruleImplementationFilterValues } from "./ruleImplementationFilterValues";
21
20
  import { ruleImplementationLoading } from "./ruleImplementationLoading";
22
21
  import { ruleImplementationQuery } from "./ruleImplementationQuery";
23
22
  import { ruleImplementationRaw } from "./ruleImplementationRaw";
@@ -65,7 +64,6 @@ export {
65
64
  ruleImplementationCount,
66
65
  ruleImplementationCreating,
67
66
  ruleImplementationFilters,
68
- ruleImplementationFilterValues,
69
67
  ruleImplementationLoading,
70
68
  ruleImplementationQuery,
71
69
  ruleImplementationRaw,
package/src/routines.js CHANGED
@@ -48,9 +48,6 @@ export const updateDeletionQuery = createRoutine("UPDATE_DELETION_QUERY");
48
48
  export const uploadRules = createRoutine("UPLOAD_RULES");
49
49
  export const uploadImplementations = createRoutine("UPLOAD_IMPLEMENTATIONS");
50
50
  export const clearStructure = createRoutine("CLEAR_STRUCTURE");
51
- export const setImplementationFilterValues = createRoutine(
52
- "SET_IMPLEMENTATION_FILTER_VALUES"
53
- );
54
51
  export const searchRuleImplementations = createRoutine(
55
52
  "SEARCH_RULE_IMPLEMENTATIONS"
56
53
  );
@@ -0,0 +1,17 @@
1
+ import {
2
+ datasetDefaultFiltersSelector,
3
+ defaultFilters,
4
+ } from "../datasetDefaultFiltersSelector";
5
+
6
+ describe("datasetDefaultFiltersSelector", () => {
7
+ it("returns datasetDefaultFilters if present the state", () => {
8
+ const datasetDefaultFilters = { "class.raw": ["foo", "bar"] };
9
+ const state = { datasetDefaultFilters };
10
+ expect(datasetDefaultFiltersSelector(state)).toBe(datasetDefaultFilters);
11
+ });
12
+
13
+ it("returns the default value if datasetDefaultFilters is not present in the state", () => {
14
+ const state = {};
15
+ expect(datasetDefaultFiltersSelector(state)).toBe(defaultFilters);
16
+ });
17
+ });
@@ -0,0 +1,8 @@
1
+ import _ from "lodash/fp";
2
+
3
+ export const defaultFilters = { "class.raw": ["table"] };
4
+
5
+ export const datasetDefaultFiltersSelector = _.propOr(
6
+ defaultFilters,
7
+ "datasetDefaultFilters"
8
+ );
@@ -1,3 +1,4 @@
1
+ export { datasetDefaultFiltersSelector } from "./datasetDefaultFiltersSelector";
1
2
  export { getImplementationsExecution } from "./getImplementationsExecution";
2
3
  export { getRuleAvailableFilters } from "./getRuleAvailableFilters";
3
4
  export { getRuleSelectedFilters } from "./getRuleSelectedFilters";
@@ -22,7 +23,6 @@ export {
22
23
  defaultImplementationColumns,
23
24
  } from "./getRuleImplementationColumns";
24
25
  export { getPreviousRuleImplementationQuery } from "./getPreviousRuleImplementationQuery";
25
- export { getRuleImplementationFormFilters } from "./getRuleImplementationFormFilters";
26
26
  export { getRuleImplementationAvailableFilters } from "./getRuleImplementationAvailableFilters";
27
27
  export { getRuleImplementationSelectedFilters } from "./getRuleImplementationSelectedFilters";
28
28
  export { getRuleImplementationSelectedFilterValues } from "./getRuleImplementationSelectedFilterValues";
@@ -1,36 +0,0 @@
1
- import { clearRule, setImplementationFilterValues } from "../../routines";
2
- import { ruleImplementationFilterValues } from "..";
3
-
4
- const fooState = { foo: "bar" };
5
- const value = { system: { name: "Whatever" } };
6
-
7
- describe("reducers: ruleImplementationFilterValues", () => {
8
- const initialState = null;
9
-
10
- it("should provide the initial state", () => {
11
- expect(ruleImplementationFilterValues(undefined, {})).toEqual(initialState);
12
- });
13
-
14
- it("should handle the setImplementationFilterValues.TRIGGER action", () => {
15
- expect(
16
- ruleImplementationFilterValues(fooState, {
17
- type: setImplementationFilterValues.TRIGGER,
18
- payload: { value }
19
- })
20
- ).toEqual(value);
21
- });
22
-
23
- it("should handle the clearRule.TRIGGER action", () => {
24
- expect(
25
- ruleImplementationFilterValues(fooState, {
26
- type: clearRule.TRIGGER
27
- })
28
- ).toEqual(null);
29
- });
30
-
31
- it("should ignore unknown actions", () => {
32
- expect(ruleImplementationFilterValues(fooState, { type: "FOO" })).toBe(
33
- fooState
34
- );
35
- });
36
- });
@@ -1,20 +0,0 @@
1
- import { clearRule, setImplementationFilterValues } from "../routines";
2
-
3
- /** @type {string} */
4
- export const initialState = null;
5
-
6
- export const ruleImplementationFilterValues = (
7
- state = initialState,
8
- { type, payload }
9
- ) => {
10
- switch (type) {
11
- case setImplementationFilterValues.TRIGGER: {
12
- const { value } = payload;
13
- return value;
14
- }
15
- case clearRule.TRIGGER:
16
- return initialState;
17
- default:
18
- return state;
19
- }
20
- };
@@ -1,22 +0,0 @@
1
- import { getRuleImplementationFormFilters } from "..";
2
-
3
- const ruleImplementationFormFilters = [
4
- { name: "system.name", filter: "system.name.raw", values: v => [v] }
5
- ];
6
-
7
- const ruleImplementationFilterValues = { system: { name: "foo" } };
8
-
9
- describe("selectors: getRuleImplementationFormFilters", () => {
10
- it("should return null when params do not exists", () => {
11
- const res = getRuleImplementationFormFilters({});
12
- expect(res).toMatchObject({});
13
- });
14
-
15
- it("should return default filters", () => {
16
- const res = getRuleImplementationFormFilters({
17
- ruleImplementationFormFilters,
18
- ruleImplementationFilterValues
19
- });
20
- expect(res).toMatchObject({ "system.name.raw": ["foo"] });
21
- });
22
- });
@@ -1,19 +0,0 @@
1
- import _ from "lodash/fp";
2
- import { createSelector } from "reselect";
3
-
4
- export const getRuleImplementationFormFilters = createSelector(
5
- [
6
- _.prop("ruleImplementationFilterValues"),
7
- _.prop("ruleImplementationFormFilters")
8
- ],
9
- (ruleImplementationFilterValues, ruleImplementationFormFilters) =>
10
- ruleImplementationFilterValues && ruleImplementationFormFilters
11
- ? _.reduce(
12
- (acc, { name, filter, values }) => ({
13
- ...acc,
14
- [filter]: values(_.path(name)(ruleImplementationFilterValues))
15
- }),
16
- {}
17
- )(ruleImplementationFormFilters)
18
- : {}
19
- );