@truedat/dq 4.36.9 → 4.37.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/CHANGELOG.md +8 -0
- package/package.json +4 -4
- package/src/components/__tests__/RuleImplementationEvents.spec.js +2 -3
- package/src/components/__tests__/__snapshots__/RuleImplementationEvents.spec.js.snap +2 -2
- package/src/components/ruleImplementationForm/DatasetForm.js +9 -26
- package/src/components/ruleImplementationForm/FiltersField.js +2 -12
- package/src/components/ruleImplementationForm/__tests__/DataSetForm.spec.js +19 -59
- package/src/components/ruleImplementationForm/__tests__/FiltersField.spec.js +4 -18
- package/src/components/ruleImplementationForm/__tests__/__snapshots__/DataSetForm.spec.js.snap +7 -147
- package/src/components/ruleImplementationForm/__tests__/__snapshots__/FiltersField.spec.js.snap +7 -12
- package/src/reducers/index.js +0 -2
- package/src/routines.js +0 -3
- package/src/selectors/__tests__/datasetDefaultFiltersSelector.spec.js +17 -0
- package/src/selectors/datasetDefaultFiltersSelector.js +8 -0
- package/src/selectors/index.js +1 -1
- package/src/reducers/__tests__/ruleImplementationFilterValues.spec.js +0 -36
- package/src/reducers/ruleImplementationFilterValues.js +0 -20
- package/src/selectors/__tests__/getRuleImplementationFormFilters.spec.js +0 -22
- package/src/selectors/getRuleImplementationFormFilters.js +0 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.37.0] 2022-01-25
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- [TD-2564] `DatasetForm` now has a configurable `defaultFilters` prop
|
|
8
|
+
- Simplified `DatasetForm` and `FiltersField` components by removing obscure
|
|
9
|
+
code for installation-specific custom filters
|
|
10
|
+
|
|
3
11
|
## [4.36.4] 2022-01-19
|
|
4
12
|
|
|
5
13
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.37.0",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@apollo/client": "^3.4.10",
|
|
85
|
-
"@truedat/core": "4.
|
|
86
|
-
"@truedat/df": "4.
|
|
85
|
+
"@truedat/core": "4.37.0",
|
|
86
|
+
"@truedat/df": "4.37.0",
|
|
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": "
|
|
106
|
+
"gitHead": "a2584d116d738be9a237f26c617e1400d4a24803"
|
|
107
107
|
}
|
|
@@ -24,9 +24,8 @@ describe("<RuleImplementationEvents />", () => {
|
|
|
24
24
|
const renderOpts = {
|
|
25
25
|
messages: {
|
|
26
26
|
en: {
|
|
27
|
-
"ruleImplementations.events.
|
|
28
|
-
"ruleImplementations.events.
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
131
|
+
defaultFilters: datasetDefaultFiltersSelector(state),
|
|
147
132
|
});
|
|
148
133
|
|
|
149
|
-
export default connect(mapStateToProps
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
47
|
-
|
|
21
|
+
setImplementationKey,
|
|
22
|
+
setSelector,
|
|
23
|
+
setStructures,
|
|
24
|
+
structures,
|
|
48
25
|
};
|
|
49
26
|
|
|
50
27
|
it("matches the latest snapshot", () => {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
});
|
package/src/components/ruleImplementationForm/__tests__/__snapshots__/DataSetForm.spec.js.snap
CHANGED
|
@@ -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
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
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
|
-
|
|
8
|
+
style="display: none;"
|
|
149
9
|
>
|
|
150
|
-
|
|
151
|
-
</
|
|
152
|
-
</
|
|
10
|
+
add_structure
|
|
11
|
+
</button>
|
|
12
|
+
</div>
|
|
153
13
|
`;
|
package/src/components/ruleImplementationForm/__tests__/__snapshots__/FiltersField.spec.js.snap
CHANGED
|
@@ -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",
|
package/src/reducers/index.js
CHANGED
|
@@ -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
|
+
});
|
package/src/selectors/index.js
CHANGED
|
@@ -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
|
-
);
|