@truedat/dq 4.47.4 → 4.47.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/CHANGELOG.md +7 -1
- package/package.json +5 -5
- package/src/components/ConditionSummary.js +63 -21
- package/src/components/NewRuleImplementation.js +17 -7
- package/src/components/__test_samples__/newRuleImplementationLoader.js +1238 -0
- package/src/components/__tests__/NewRuleImplementation.spec.js +281 -2
- package/src/components/ruleImplementationForm/FiltersField.js +31 -11
- package/src/components/ruleImplementationForm/FiltersFormGroup.js +1 -1
- package/src/components/ruleImplementationForm/FiltersGrid.js +18 -6
- package/src/components/ruleImplementationForm/FiltersGroup.js +3 -3
- package/src/components/ruleImplementationForm/InformationForm.js +2 -0
- package/src/components/ruleImplementationForm/RuleImplementationForm.js +1 -1
- package/src/components/ruleImplementationForm/__tests__/__snapshots__/FiltersFormGroup.spec.js.snap +7 -1
- package/src/components/ruleImplementationForm/__tests__/__snapshots__/FiltersGroup.spec.js.snap +8 -1
- package/src/components/ruleImplementationForm/__tests__/__snapshots__/ValueConditions.spec.js.snap +7 -1
- package/src/messages/en.js +2 -1
- package/src/messages/es.js +2 -1
- package/src/selectors/getRuleImplementationOperators.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.47.5] 2022-06-30
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- [TD-4894] Multiple column operator in implementation creation
|
|
8
|
+
|
|
3
9
|
## [4.47.4] 2022-06-29
|
|
4
10
|
|
|
5
11
|
- [TD-4921] Add implementation workflow events
|
|
@@ -20,7 +26,7 @@
|
|
|
20
26
|
|
|
21
27
|
## [4.46.12] 2022-06-20
|
|
22
28
|
|
|
23
|
-
###
|
|
29
|
+
### Removed
|
|
24
30
|
|
|
25
31
|
- [TD-4894] Multiple column operator in implementation creation
|
|
26
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.47.
|
|
3
|
+
"version": "4.47.5",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.16.4",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.47.
|
|
37
|
+
"@truedat/test": "4.47.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",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@apollo/client": "^3.6.4",
|
|
91
|
-
"@truedat/core": "4.47.
|
|
92
|
-
"@truedat/df": "4.47.
|
|
91
|
+
"@truedat/core": "4.47.5",
|
|
92
|
+
"@truedat/df": "4.47.5",
|
|
93
93
|
"axios": "^0.19.2",
|
|
94
94
|
"graphql": "^15.5.3",
|
|
95
95
|
"path-to-regexp": "^1.7.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"react-dom": ">= 16.8.6 < 17",
|
|
111
111
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "1265272aa7b8fcb415592916f0e557ae226befe3"
|
|
114
114
|
}
|
|
@@ -8,43 +8,85 @@ import { linkTo } from "@truedat/core/routes";
|
|
|
8
8
|
|
|
9
9
|
const concatValues = (values, link) => _.join(link)(values);
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const LinkToStructure = ({ value }) =>
|
|
12
|
+
value?.id ? (
|
|
13
13
|
<Link to={linkTo.STRUCTURE({ id: value.id })}>
|
|
14
14
|
<span className="highlighted">{`"${
|
|
15
15
|
!_.isEmpty(value.path) ? path(value) : value.name
|
|
16
16
|
}"`}</span>{" "}
|
|
17
17
|
</Link>
|
|
18
|
-
) :
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
) : null;
|
|
19
|
+
|
|
20
|
+
const FormattedLink = ({ value, operator = {} }) => {
|
|
21
|
+
switch (operator?.value_type) {
|
|
22
|
+
case "field":
|
|
23
|
+
return <LinkToStructure value={value} />;
|
|
24
|
+
case "field_list":
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
{_.map.convert({ cap: false })((v, i) => (
|
|
28
|
+
<LinkToStructure key={i} value={v} />
|
|
29
|
+
))(value)}
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
|
+
default:
|
|
33
|
+
return (
|
|
34
|
+
<span className="highlighted">
|
|
35
|
+
<FormattedMessage
|
|
36
|
+
id={`ruleImplementation.filtersField.${value.raw}`}
|
|
37
|
+
defaultMessage={`"${
|
|
38
|
+
_.isArray(value.raw) ? _.join(", ")(value.raw) : value.raw
|
|
39
|
+
}"`}
|
|
40
|
+
></FormattedMessage>
|
|
41
|
+
</span>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
28
45
|
|
|
29
46
|
FormattedLink.propTypes = {
|
|
30
|
-
value: PropTypes.object,
|
|
47
|
+
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
31
48
|
operator: PropTypes.object,
|
|
32
49
|
};
|
|
33
50
|
|
|
34
51
|
const nilOrEmpty = (v) => _.isNil(v) || v === "";
|
|
35
52
|
|
|
36
|
-
const filterNilOrEmpties = (values, keys) =>
|
|
37
|
-
|
|
53
|
+
const filterNilOrEmpties = (values, keys) => {
|
|
54
|
+
if ("kv" in values) {
|
|
55
|
+
return _.every((k) => !nilOrEmpty(values.kv[k]))(keys) ? values : null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return _.flow(
|
|
59
|
+
_.map((v) => filterNilOrEmpties(v, keys)),
|
|
60
|
+
_.filter((v) => !!v)
|
|
61
|
+
)(values);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const pick = (value, keys, optionalKeys) => ({
|
|
65
|
+
kv: _.pick(keys)(value),
|
|
66
|
+
optv: _.pick(optionalKeys)(value),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const convert = (v, index, value_modifier) => {
|
|
70
|
+
if (_.has("kv")(v)) {
|
|
71
|
+
return { ...v.kv, ...v.optv, modifier: _.nth(index)(value_modifier) };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return _.map.convert({ cap: false })((v, i) => {
|
|
75
|
+
return convert(v, i, value_modifier);
|
|
76
|
+
})(v);
|
|
77
|
+
};
|
|
38
78
|
|
|
39
79
|
const valuesFromKeys = (values, keys, optionalKeys, value_modifier) =>
|
|
40
80
|
_.flow(
|
|
41
|
-
_.map((
|
|
42
|
-
return
|
|
81
|
+
_.map((value) => {
|
|
82
|
+
return Array.isArray(value?.fields)
|
|
83
|
+
? _.map((innerValue) => pick(innerValue, keys, optionalKeys))(
|
|
84
|
+
value?.fields
|
|
85
|
+
)
|
|
86
|
+
: pick(value, keys, optionalKeys);
|
|
43
87
|
}),
|
|
44
88
|
(v) => filterNilOrEmpties(v, keys),
|
|
45
|
-
|
|
46
|
-
return { ...v.kv, ...v.optv, modifier: _.nth(i)(value_modifier) };
|
|
47
|
-
})
|
|
89
|
+
(v) => convert(v, 0, value_modifier)
|
|
48
90
|
)(values);
|
|
49
91
|
|
|
50
92
|
export const empty = (rows) =>
|
|
@@ -52,7 +94,7 @@ export const empty = (rows) =>
|
|
|
52
94
|
|
|
53
95
|
export const getValues = ({ value = [], operator = {}, value_modifier }) => {
|
|
54
96
|
const defaultOrValue = value || [];
|
|
55
|
-
return
|
|
97
|
+
return ["field", "field_list"].includes(operator?.value_type)
|
|
56
98
|
? valuesFromKeys(defaultOrValue, ["id", "name"], ["path"], value_modifier)
|
|
57
99
|
: valuesFromKeys(defaultOrValue, ["raw"], [], value_modifier);
|
|
58
100
|
};
|
|
@@ -25,6 +25,19 @@ const updateDatasetKey = (data) =>
|
|
|
25
25
|
{}
|
|
26
26
|
)(data);
|
|
27
27
|
|
|
28
|
+
// object either field, raw value, list of fields, list of raw values
|
|
29
|
+
const updateValueKeyContent = (object) => {
|
|
30
|
+
if (object?.id || object?.raw || object?.fields) {
|
|
31
|
+
return object?.id
|
|
32
|
+
? _.pick(["id", "parent_index"])(object)
|
|
33
|
+
: _.pick(["raw", "fields"])(object);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (object || []).map((v) => {
|
|
37
|
+
return updateValueKeyContent(v);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
28
41
|
const updateConditionValue = (acc, value, key) => {
|
|
29
42
|
if (key === "structure") {
|
|
30
43
|
return _.set(key, _.pick(["id", "parent_index"])(value))(acc);
|
|
@@ -48,13 +61,9 @@ const updateConditionValue = (acc, value, key) => {
|
|
|
48
61
|
_.pick(["name", "value_type", "value_type_filter"])(value)
|
|
49
62
|
)
|
|
50
63
|
)(acc);
|
|
51
|
-
if (key == "value")
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
_.map((v) =>
|
|
55
|
-
_.has("id")(v) ? _.pick(["id", "parent_index"])(v) : _.pick(["raw"])(v)
|
|
56
|
-
)(value)
|
|
57
|
-
)(acc);
|
|
64
|
+
if (key == "value") {
|
|
65
|
+
return { ...acc, value: updateValueKeyContent(value) };
|
|
66
|
+
}
|
|
58
67
|
if (key === "population") return _.set(key, conditionAttributes(value))(acc);
|
|
59
68
|
|
|
60
69
|
return acc;
|
|
@@ -103,6 +112,7 @@ const fieldTypeFromStructure = (row, structures, operators, scope) => {
|
|
|
103
112
|
field_type,
|
|
104
113
|
_.prop("operator")(row)
|
|
105
114
|
);
|
|
115
|
+
|
|
106
116
|
const updatedRow = {
|
|
107
117
|
...row,
|
|
108
118
|
operator,
|