@truedat/dq 4.35.5 → 4.36.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 +6 -0
- package/package.json +4 -4
- package/src/components/NewRuleImplementation.js +115 -22
- package/src/components/__test_samples__/NewRuleImplementationProps.js +1917 -0
- package/src/components/__tests__/NewRuleImplementation.spec.js +8 -0
- package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +1129 -0
- package/src/components/ruleImplementationForm/DatasetForm.js +23 -4
- package/src/components/ruleImplementationForm/FiltersField.js +6 -2
- package/src/components/ruleImplementationForm/FiltersFormGroup.js +7 -1
- package/src/components/ruleImplementationForm/FiltersGrid.js +7 -2
- package/src/components/ruleImplementationForm/__tests__/__snapshots__/DataSetForm.spec.js.snap +33 -1
- package/src/messages/en.js +1 -0
- package/src/messages/es.js +1 -0
|
@@ -33,7 +33,7 @@ export const DatasetForm = ({
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const onChangeField = (index, value) => {
|
|
36
|
-
const structureAttrs = _.pick(["structure", "clauses"])(value);
|
|
36
|
+
const structureAttrs = _.pick(["structure", "clauses", "alias"])(value);
|
|
37
37
|
setStructure({
|
|
38
38
|
index,
|
|
39
39
|
value: {
|
|
@@ -45,8 +45,27 @@ export const DatasetForm = ({
|
|
|
45
45
|
const getStructureAttrs = (structure) =>
|
|
46
46
|
_.pick(["id", "name", "path", "system"])(structure);
|
|
47
47
|
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const hasChangedStructure = (index, value) =>
|
|
49
|
+
_.path("structure.id")(value) !==
|
|
50
|
+
_.path(`[${index}].structure.id`)(structures) && !_.isNil(value);
|
|
51
|
+
|
|
52
|
+
const getGlobalAliasIndex = () =>
|
|
53
|
+
_.max([
|
|
54
|
+
..._.flow(_.map("alias.index"), _.reject(_.isNil))(structures),
|
|
55
|
+
structures.length - 1,
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
const setAliasIndex = (value) => ({
|
|
59
|
+
...value,
|
|
60
|
+
alias: {
|
|
61
|
+
index: getGlobalAliasIndex() + 1,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const setStructure = ({ index, value: param_value }) => {
|
|
66
|
+
const structureChanged = hasChangedStructure(index, param_value);
|
|
67
|
+
const value = structureChanged ? setAliasIndex(param_value) : param_value;
|
|
68
|
+
if (index === 0 && structureChanged) {
|
|
50
69
|
setStructures([value ? { ...value } : {}]);
|
|
51
70
|
setImplementationFilterValues({ value: _.get("structure")(value) });
|
|
52
71
|
} else if (_.isNil(index))
|
|
@@ -91,7 +110,7 @@ export const DatasetForm = ({
|
|
|
91
110
|
onChangeField(index, value);
|
|
92
111
|
}}
|
|
93
112
|
onDelete={() => setStructure({ index })}
|
|
94
|
-
structures={
|
|
113
|
+
structures={structures}
|
|
95
114
|
selectedStructure={structure}
|
|
96
115
|
onClick={() => setSelector(index === selector ? -1 : index)}
|
|
97
116
|
systemRequired={false}
|
|
@@ -125,11 +125,15 @@ export const FiltersField = ({
|
|
|
125
125
|
onSelectField={(value, modifier) =>
|
|
126
126
|
onChange(
|
|
127
127
|
null,
|
|
128
|
-
_.pick(["data_structure_id", "name"])(value),
|
|
128
|
+
_.pick(["data_structure_id", "name", "parent_index"])(value),
|
|
129
129
|
modifier ? { name: modifier.name } : null
|
|
130
130
|
)
|
|
131
131
|
}
|
|
132
|
-
value={
|
|
132
|
+
value={
|
|
133
|
+
_.isNil(_.prop("parent_index")(value))
|
|
134
|
+
? _.prop("id")(value)
|
|
135
|
+
: `${_.prop("id")(value)}/${_.prop("parent_index")(value)}`
|
|
136
|
+
}
|
|
133
137
|
/>
|
|
134
138
|
{modifier && (
|
|
135
139
|
<FieldModifier
|
|
@@ -69,7 +69,13 @@ export const FiltersFormGroup = ({
|
|
|
69
69
|
parentStructures={parentStructures}
|
|
70
70
|
structureFields={structureFields}
|
|
71
71
|
onSelectField={(value) => onStructureChange(index, value)}
|
|
72
|
-
value={
|
|
72
|
+
value={
|
|
73
|
+
_.isNil(_.prop("parent_index")(clause?.structure))
|
|
74
|
+
? _.prop("id")(clause?.structure)
|
|
75
|
+
: `${_.prop("id")(clause?.structure)}/${_.prop(
|
|
76
|
+
"parent_index"
|
|
77
|
+
)(clause?.structure)}`
|
|
78
|
+
}
|
|
73
79
|
/>
|
|
74
80
|
)}
|
|
75
81
|
</Form.Field>
|
|
@@ -12,7 +12,11 @@ export const FiltersGrid = ({
|
|
|
12
12
|
scope,
|
|
13
13
|
}) => {
|
|
14
14
|
const [activeConditionIndex, setActiveConditionIndex] = useState();
|
|
15
|
-
const parentStructures = _.map(
|
|
15
|
+
const parentStructures = _.map((s) =>
|
|
16
|
+
_.isNil(_.prop("alias")(s))
|
|
17
|
+
? _.prop("structure")(s)
|
|
18
|
+
: { ..._.prop("structure")(s), alias: _.prop("alias")(s) }
|
|
19
|
+
)(structures);
|
|
16
20
|
const allOperators = _.flow(
|
|
17
21
|
_.values,
|
|
18
22
|
_.map(_.prop("operators")),
|
|
@@ -21,7 +25,7 @@ export const FiltersGrid = ({
|
|
|
21
25
|
|
|
22
26
|
const onStructureChange = (index, value) => {
|
|
23
27
|
const structure = {
|
|
24
|
-
..._.pick(["field_type", "name"])(value),
|
|
28
|
+
..._.pick(["field_type", "name", "parent_index"])(value),
|
|
25
29
|
id: value.data_structure_id,
|
|
26
30
|
};
|
|
27
31
|
setRowValue({
|
|
@@ -58,6 +62,7 @@ export const FiltersGrid = ({
|
|
|
58
62
|
id: value.data_structure_id || value.id,
|
|
59
63
|
name: value.name,
|
|
60
64
|
path: value.path,
|
|
65
|
+
parent_index: value.parent_index,
|
|
61
66
|
};
|
|
62
67
|
} else {
|
|
63
68
|
return { raw: value };
|
package/src/components/ruleImplementationForm/__tests__/__snapshots__/DataSetForm.spec.js.snap
CHANGED
|
@@ -31,7 +31,39 @@ exports[`<DatasetForm /> matches the latest snapshot 1`] = `
|
|
|
31
31
|
},
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
structures={
|
|
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
|
+
}
|
|
35
67
|
systemRequired={false}
|
|
36
68
|
/>
|
|
37
69
|
<lazy
|
package/src/messages/en.js
CHANGED
|
@@ -412,6 +412,7 @@ export default {
|
|
|
412
412
|
"ruleImplementation.props.status.deprecated": "Deprecated Implementation",
|
|
413
413
|
"ruleImplementation.props.structure": "Structure",
|
|
414
414
|
"ruleImplementation.props.structure.placeholder": "Search structure",
|
|
415
|
+
"ruleImplementation.props.structure.alias": "Alias",
|
|
415
416
|
"ruleImplementation.props.system": "System",
|
|
416
417
|
"ruleImplementation.props.system.placeholder": "System",
|
|
417
418
|
"ruleImplementation.props.type": "Type",
|
package/src/messages/es.js
CHANGED
|
@@ -425,6 +425,7 @@ export default {
|
|
|
425
425
|
"Esta Implementación está archivada",
|
|
426
426
|
"ruleImplementation.props.structure.placeholder": "Buscar estructura",
|
|
427
427
|
"ruleImplementation.props.structure": "Estructura",
|
|
428
|
+
"ruleImplementation.props.structure.alias": "Alias",
|
|
428
429
|
"ruleImplementation.props.system.placeholder": "Sistema de referencia",
|
|
429
430
|
"ruleImplementation.props.system": "Sistema",
|
|
430
431
|
"ruleImplementation.props.type.placeholder": "Tipo de regla",
|