@truedat/dq 4.28.8 → 4.29.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/package.json +5 -5
- package/src/components/ImplementationSummary.js +49 -47
- package/src/components/NewRuleImplementation.js +67 -62
- package/src/components/ruleImplementationForm/FieldModifier.js +26 -16
- package/src/components/ruleImplementationForm/FiltersField.js +25 -23
- package/src/components/ruleImplementationForm/FiltersFormGroup.js +41 -25
- package/src/components/ruleImplementationForm/FiltersGrid.js +17 -19
- package/src/components/ruleImplementationForm/FiltersGroup.js +6 -5
- package/src/components/ruleImplementationForm/PopulationForm.js +3 -3
- package/src/components/ruleImplementationForm/RuleImplementationForm.js +38 -31
- package/src/components/ruleImplementationForm/ValueConditions.js +6 -6
- package/src/components/ruleImplementationForm/operators.js +19 -22
- package/src/selectors/getRuleImplementationOperators.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.29.0",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@babel/plugin-transform-modules-commonjs": "^7.15.0",
|
|
32
32
|
"@babel/preset-env": "^7.15.0",
|
|
33
33
|
"@babel/preset-react": "^7.14.5",
|
|
34
|
-
"@truedat/test": "4.
|
|
34
|
+
"@truedat/test": "4.29.0",
|
|
35
35
|
"babel-jest": "^27.0.6",
|
|
36
36
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
37
37
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -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.29.0",
|
|
86
|
+
"@truedat/df": "4.29.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": "42028609748cd7f1686ea783264a9cdfa7b0ca8f"
|
|
107
107
|
}
|
|
@@ -11,7 +11,7 @@ const defaults = [
|
|
|
11
11
|
"implementationKey",
|
|
12
12
|
"dataset",
|
|
13
13
|
"population",
|
|
14
|
-
"validations"
|
|
14
|
+
"validations",
|
|
15
15
|
];
|
|
16
16
|
|
|
17
17
|
const concatValues = (values, link) => _.join(link)(values);
|
|
@@ -36,24 +36,25 @@ const FormattedLink = ({ value, operator = {} }) =>
|
|
|
36
36
|
|
|
37
37
|
FormattedLink.propTypes = {
|
|
38
38
|
value: PropTypes.object,
|
|
39
|
-
operator: PropTypes.object
|
|
39
|
+
operator: PropTypes.object,
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const path = ({ name, path = [] }) => concatValues([...path, name], " > ");
|
|
43
43
|
|
|
44
|
-
const empty = rows =>
|
|
44
|
+
const empty = (rows) =>
|
|
45
|
+
rows && _.every((r) => _.isEmpty(r) || _.isNil(r))(rows);
|
|
45
46
|
|
|
46
|
-
const nilOrEmpty = v => _.isNil(v) || v === "";
|
|
47
|
+
const nilOrEmpty = (v) => _.isNil(v) || v === "";
|
|
47
48
|
|
|
48
49
|
const filterNilOrEmpties = (values, keys) =>
|
|
49
|
-
_.filter(v => _.every(k => !nilOrEmpty(_.prop(k)(v.kv)))(keys))(values);
|
|
50
|
+
_.filter((v) => _.every((k) => !nilOrEmpty(_.prop(k)(v.kv)))(keys))(values);
|
|
50
51
|
|
|
51
52
|
const valuesFromKeys = (values, keys, optionalKeys, value_modifier) =>
|
|
52
53
|
_.flow(
|
|
53
|
-
_.map(v => {
|
|
54
|
+
_.map((v) => {
|
|
54
55
|
return { kv: _.pick(keys)(v), optv: _.pick(optionalKeys)(v) };
|
|
55
56
|
}),
|
|
56
|
-
v => filterNilOrEmpties(v, keys),
|
|
57
|
+
(v) => filterNilOrEmpties(v, keys),
|
|
57
58
|
_.map.convert({ cap: false })((v, i) => {
|
|
58
59
|
return { ...v.kv, ...v.optv, modifier: _.nth(i)(value_modifier) };
|
|
59
60
|
})
|
|
@@ -102,7 +103,7 @@ const GeneralSummary = ({ executable, implementationKey }) => (
|
|
|
102
103
|
|
|
103
104
|
GeneralSummary.propTypes = {
|
|
104
105
|
executable: PropTypes.bool,
|
|
105
|
-
implementationKey: PropTypes.string
|
|
106
|
+
implementationKey: PropTypes.string,
|
|
106
107
|
};
|
|
107
108
|
|
|
108
109
|
const DatasetSummary = ({ rows }) =>
|
|
@@ -129,7 +130,7 @@ const DatasetSummary = ({ rows }) =>
|
|
|
129
130
|
<Table.Cell key={i}>
|
|
130
131
|
<Link
|
|
131
132
|
to={linkTo.STRUCTURE({
|
|
132
|
-
id: _.pathOr("", "structure.id")(row)
|
|
133
|
+
id: _.pathOr("", "structure.id")(row),
|
|
133
134
|
})}
|
|
134
135
|
>
|
|
135
136
|
<span key={i} className="highlighted">{`"${path(
|
|
@@ -146,7 +147,7 @@ const DatasetSummary = ({ rows }) =>
|
|
|
146
147
|
);
|
|
147
148
|
|
|
148
149
|
DatasetSummary.propTypes = {
|
|
149
|
-
rows: PropTypes.array
|
|
150
|
+
rows: PropTypes.array,
|
|
150
151
|
};
|
|
151
152
|
|
|
152
153
|
const OperatorMessage = ({ operator }) =>
|
|
@@ -155,12 +156,12 @@ const OperatorMessage = ({ operator }) =>
|
|
|
155
156
|
id={`ruleImplementation.operator.${_.prop("name")(operator)}`}
|
|
156
157
|
defaultMessage={_.prop("name")(operator)}
|
|
157
158
|
>
|
|
158
|
-
{message => <span className="highlighted">{`"${message}"`}</span>}
|
|
159
|
+
{(message) => <span className="highlighted">{`"${message}"`}</span>}
|
|
159
160
|
</FormattedMessage>
|
|
160
161
|
) : null;
|
|
161
162
|
|
|
162
163
|
OperatorMessage.propTypes = {
|
|
163
|
-
operator: PropTypes.object
|
|
164
|
+
operator: PropTypes.object,
|
|
164
165
|
};
|
|
165
166
|
|
|
166
167
|
const ConditionCell = ({ row }) => {
|
|
@@ -173,7 +174,7 @@ const ConditionCell = ({ row }) => {
|
|
|
173
174
|
<>
|
|
174
175
|
<Link
|
|
175
176
|
to={linkTo.STRUCTURE({
|
|
176
|
-
id: _.path("structure.id")(row)
|
|
177
|
+
id: _.path("structure.id")(row),
|
|
177
178
|
})}
|
|
178
179
|
>
|
|
179
180
|
<span className="highlighted">{`"${_.pathOr(
|
|
@@ -181,22 +182,25 @@ const ConditionCell = ({ row }) => {
|
|
|
181
182
|
"structure.name"
|
|
182
183
|
)(row)}"`}</span>
|
|
183
184
|
</Link>
|
|
184
|
-
{row?.modifier &&
|
|
185
|
-
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
185
|
+
{row?.modifier && (
|
|
186
|
+
<>
|
|
187
|
+
<div className="smaller">
|
|
188
|
+
<FormattedMessage
|
|
189
|
+
id={`filtersGrid.field.modifier.${row.modifier.name}`}
|
|
190
|
+
defaultMessage={row.modifier.name}
|
|
191
|
+
/>
|
|
192
|
+
</div>
|
|
191
193
|
{_.flow(
|
|
192
194
|
_.prop("modifier.params"),
|
|
193
195
|
_.toPairs,
|
|
194
|
-
_.map(([key, value]) =>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
_.map(([key, value]) => (
|
|
197
|
+
<div key={key} className="smaller">
|
|
198
|
+
{value}
|
|
199
|
+
</div>
|
|
200
|
+
))
|
|
198
201
|
)(row)}
|
|
199
|
-
|
|
202
|
+
</>
|
|
203
|
+
)}
|
|
200
204
|
</>
|
|
201
205
|
)}
|
|
202
206
|
</Table.Cell>
|
|
@@ -213,22 +217,25 @@ const ConditionCell = ({ row }) => {
|
|
|
213
217
|
<FormattedMessage id="summary.link.and" />{" "}
|
|
214
218
|
</span>
|
|
215
219
|
)}
|
|
216
|
-
{value?.modifier &&
|
|
217
|
-
|
|
218
|
-
<
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
{value?.modifier && (
|
|
221
|
+
<>
|
|
222
|
+
<div className="smaller">
|
|
223
|
+
<FormattedMessage
|
|
224
|
+
id={`filtersGrid.field.modifier.${value.modifier.name}`}
|
|
225
|
+
defaultMessage={value.modifier.name}
|
|
226
|
+
/>
|
|
227
|
+
</div>
|
|
223
228
|
{_.flow(
|
|
224
229
|
_.prop("modifier.params"),
|
|
225
230
|
_.toPairs,
|
|
226
|
-
_.map(([key, value]) =>
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
231
|
+
_.map(([key, value]) => (
|
|
232
|
+
<div key={key} className="smaller">
|
|
233
|
+
{value}
|
|
234
|
+
</div>
|
|
235
|
+
))
|
|
230
236
|
)(value)}
|
|
231
|
-
|
|
237
|
+
</>
|
|
238
|
+
)}
|
|
232
239
|
</Fragment>
|
|
233
240
|
))(values)}
|
|
234
241
|
</Table.Cell>
|
|
@@ -237,7 +244,7 @@ const ConditionCell = ({ row }) => {
|
|
|
237
244
|
};
|
|
238
245
|
|
|
239
246
|
ConditionCell.propTypes = {
|
|
240
|
-
row: PropTypes.object
|
|
247
|
+
row: PropTypes.object,
|
|
241
248
|
};
|
|
242
249
|
|
|
243
250
|
const ConditionSummary = ({ rows, type, icon }) =>
|
|
@@ -277,18 +284,13 @@ const ConditionSummary = ({ rows, type, icon }) =>
|
|
|
277
284
|
ConditionSummary.propTypes = {
|
|
278
285
|
icon: PropTypes.string,
|
|
279
286
|
rows: PropTypes.array,
|
|
280
|
-
type: PropTypes.string
|
|
287
|
+
type: PropTypes.string,
|
|
281
288
|
};
|
|
282
289
|
|
|
283
290
|
export const ImplementationSummary = ({ ruleImplementation, activeSteps }) => {
|
|
284
291
|
const steps = _.isEmpty(activeSteps) ? defaults : activeSteps;
|
|
285
|
-
const {
|
|
286
|
-
|
|
287
|
-
implementationKey,
|
|
288
|
-
dataset,
|
|
289
|
-
population,
|
|
290
|
-
validations
|
|
291
|
-
} = _.pick(steps)(ruleImplementation);
|
|
292
|
+
const { executable, implementationKey, dataset, population, validations } =
|
|
293
|
+
_.pick(steps)(ruleImplementation);
|
|
292
294
|
return (
|
|
293
295
|
<>
|
|
294
296
|
{(_.includes("implementationKey")(steps) ||
|
|
@@ -317,7 +319,7 @@ export const ImplementationSummary = ({ ruleImplementation, activeSteps }) => {
|
|
|
317
319
|
|
|
318
320
|
ImplementationSummary.propTypes = {
|
|
319
321
|
activeSteps: PropTypes.array,
|
|
320
|
-
ruleImplementation: PropTypes.object
|
|
322
|
+
ruleImplementation: PropTypes.object,
|
|
321
323
|
};
|
|
322
324
|
|
|
323
325
|
export default ImplementationSummary;
|
|
@@ -8,7 +8,7 @@ import { getFieldType } from "@truedat/core/services/fieldType";
|
|
|
8
8
|
import { applyTemplate } from "@truedat/df/utils";
|
|
9
9
|
import {
|
|
10
10
|
createRuleImplementation,
|
|
11
|
-
updateRuleImplementation
|
|
11
|
+
updateRuleImplementation,
|
|
12
12
|
} from "../routines";
|
|
13
13
|
import { getRuleImplementationOperators } from "../selectors/getRuleImplementationOperators";
|
|
14
14
|
import RuleImplementationForm from "./ruleImplementationForm/RuleImplementationForm";
|
|
@@ -19,7 +19,7 @@ const TemplateLoader = React.lazy(() =>
|
|
|
19
19
|
import("@truedat/df/templates/components/TemplateLoader")
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
const updateDatasetKey = data =>
|
|
22
|
+
const updateDatasetKey = (data) =>
|
|
23
23
|
_.reduce.convert({ cap: false })(
|
|
24
24
|
(acc, value, key) =>
|
|
25
25
|
["structure"].includes(key)
|
|
@@ -30,13 +30,18 @@ const updateDatasetKey = data =>
|
|
|
30
30
|
|
|
31
31
|
const updateConditionValue = (acc, value, key) => {
|
|
32
32
|
if (key === "structure") return _.set(key, _.pick(["id"])(value))(acc);
|
|
33
|
-
if (key === "modifier")
|
|
34
|
-
_.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
if (key === "modifier")
|
|
34
|
+
return _.set(
|
|
35
|
+
key,
|
|
36
|
+
_.isNil(value) ? null : _.pick(["name", "params"])(value)
|
|
37
|
+
)(acc);
|
|
38
|
+
if (key === "value_modifier")
|
|
39
|
+
return _.set(
|
|
40
|
+
key,
|
|
41
|
+
_.every(_.isNil)(value)
|
|
42
|
+
? []
|
|
43
|
+
: _.map((v) => _.pick(["name", "params"])(v))(value)
|
|
44
|
+
)(acc);
|
|
40
45
|
if (key === "operator")
|
|
41
46
|
return _.set(
|
|
42
47
|
key,
|
|
@@ -47,7 +52,7 @@ const updateConditionValue = (acc, value, key) => {
|
|
|
47
52
|
if (key == "value")
|
|
48
53
|
return _.set(
|
|
49
54
|
key,
|
|
50
|
-
_.map(v => (_.has("id")(v) ? _.pick(["id"])(v) : _.pick(["raw"])(v)))(
|
|
55
|
+
_.map((v) => (_.has("id")(v) ? _.pick(["id"])(v) : _.pick(["raw"])(v)))(
|
|
51
56
|
value
|
|
52
57
|
)
|
|
53
58
|
)(acc);
|
|
@@ -56,28 +61,30 @@ const updateConditionValue = (acc, value, key) => {
|
|
|
56
61
|
return acc;
|
|
57
62
|
};
|
|
58
63
|
|
|
59
|
-
const updateConditionKey = condition =>
|
|
64
|
+
const updateConditionKey = (condition) =>
|
|
60
65
|
_.reduce.convert({ cap: false })(
|
|
61
66
|
(acc, value, key) => updateConditionValue(acc, value, key),
|
|
62
67
|
{}
|
|
63
68
|
)(condition);
|
|
64
69
|
|
|
65
|
-
const datasetAttributes = dataset =>
|
|
70
|
+
const datasetAttributes = (dataset) =>
|
|
66
71
|
_.flow(
|
|
67
72
|
_.map(_.pickAll(["structure", "clauses", "join_type"])),
|
|
68
73
|
_.map(updateDatasetKey)
|
|
69
74
|
)(dataset);
|
|
70
75
|
|
|
71
|
-
const conditionAttributes = condition =>
|
|
76
|
+
const conditionAttributes = (condition) =>
|
|
72
77
|
_.flow(
|
|
73
|
-
_.map(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
_.map(
|
|
79
|
+
_.pickAll([
|
|
80
|
+
"structure",
|
|
81
|
+
"modifier",
|
|
82
|
+
"operator",
|
|
83
|
+
"value",
|
|
84
|
+
"value_modifier",
|
|
85
|
+
"population",
|
|
86
|
+
])
|
|
87
|
+
),
|
|
81
88
|
_.map(updateConditionKey)
|
|
82
89
|
)(condition);
|
|
83
90
|
|
|
@@ -99,7 +106,7 @@ const fieldTypeFromStructure = (row, structures, operators, scope) => {
|
|
|
99
106
|
operator,
|
|
100
107
|
modifier,
|
|
101
108
|
value_modifier,
|
|
102
|
-
structure: { ...structure, field_type }
|
|
109
|
+
structure: { ...structure, field_type },
|
|
103
110
|
};
|
|
104
111
|
return updatedRow;
|
|
105
112
|
};
|
|
@@ -110,9 +117,9 @@ const withNestedPopulation = (row, siblings, operators, scope) => {
|
|
|
110
117
|
? row
|
|
111
118
|
: {
|
|
112
119
|
...row,
|
|
113
|
-
population: _.map(populationRow =>
|
|
120
|
+
population: _.map((populationRow) =>
|
|
114
121
|
fieldTypeFromStructure(populationRow, siblings, operators, scope)
|
|
115
|
-
)(population)
|
|
122
|
+
)(population),
|
|
116
123
|
};
|
|
117
124
|
};
|
|
118
125
|
|
|
@@ -131,7 +138,7 @@ const addFieldType = (
|
|
|
131
138
|
) => {
|
|
132
139
|
const fields = _.flow(_.values, _.flatten)(structuresFields);
|
|
133
140
|
const siblings = _.flow(_.values, _.flatten)(structuresSiblings);
|
|
134
|
-
const rows = _.map(row =>
|
|
141
|
+
const rows = _.map((row) =>
|
|
135
142
|
rowFieldType(row, fields, siblings, operators, scope)
|
|
136
143
|
)(_.prop(implementationPropertyName)(ruleImplementationProps));
|
|
137
144
|
return _.isEmpty(rows) ? [] : rows;
|
|
@@ -148,17 +155,17 @@ const enrichOperator = (operators, scope, field_type, operator) => {
|
|
|
148
155
|
_.flow(
|
|
149
156
|
_.prop(field_type),
|
|
150
157
|
_.prop("operators"),
|
|
151
|
-
_.filter(operator => inScope(operator, scope))
|
|
158
|
+
_.filter((operator) => inScope(operator, scope))
|
|
152
159
|
)(operators)
|
|
153
160
|
)(
|
|
154
161
|
_.flow(
|
|
155
162
|
_.prop("any"),
|
|
156
163
|
_.prop("operators"),
|
|
157
|
-
_.filter(operator => inScope(operator, scope))
|
|
164
|
+
_.filter((operator) => inScope(operator, scope))
|
|
158
165
|
)(operators)
|
|
159
166
|
);
|
|
160
167
|
const op_extra = _.find(
|
|
161
|
-
op =>
|
|
168
|
+
(op) =>
|
|
162
169
|
_.propEq("name", operator.name)(op) &&
|
|
163
170
|
_.propEq("value_type", operator.value_type)(op)
|
|
164
171
|
)(type_operators);
|
|
@@ -178,7 +185,7 @@ export const NewRuleImplementation = ({
|
|
|
178
185
|
structuresSiblings,
|
|
179
186
|
operators,
|
|
180
187
|
template,
|
|
181
|
-
applyTemplate
|
|
188
|
+
applyTemplate,
|
|
182
189
|
}) => {
|
|
183
190
|
const [ruleImplementation, setRuleImplementation] = useState(
|
|
184
191
|
edition
|
|
@@ -209,10 +216,10 @@ export const NewRuleImplementation = ({
|
|
|
209
216
|
operators
|
|
210
217
|
),
|
|
211
218
|
rawContent: {
|
|
212
|
-
..._.prop("raw_content")(ruleImplementationProps)
|
|
219
|
+
..._.prop("raw_content")(ruleImplementationProps),
|
|
213
220
|
},
|
|
214
221
|
dfName: _.prop("df_name")(ruleImplementationProps),
|
|
215
|
-
dfContent: ruleImplementationProps.df_content
|
|
222
|
+
dfContent: ruleImplementationProps.df_content,
|
|
216
223
|
}
|
|
217
224
|
: {
|
|
218
225
|
executable: true,
|
|
@@ -226,14 +233,14 @@ export const NewRuleImplementation = ({
|
|
|
226
233
|
source_id: null,
|
|
227
234
|
dataset: "",
|
|
228
235
|
population: "",
|
|
229
|
-
validations: ""
|
|
236
|
+
validations: "",
|
|
230
237
|
},
|
|
231
238
|
dfName: "",
|
|
232
|
-
dfContent: {}
|
|
239
|
+
dfContent: {},
|
|
233
240
|
}
|
|
234
241
|
);
|
|
235
242
|
|
|
236
|
-
const setDataset = dataset => {
|
|
243
|
+
const setDataset = (dataset) => {
|
|
237
244
|
//remove invalid references of fields in validations and populations after dataset edition
|
|
238
245
|
const datasetStructures = _.map(_.path("structure.id"))(dataset);
|
|
239
246
|
const all_fields = _.flow(
|
|
@@ -243,11 +250,11 @@ export const NewRuleImplementation = ({
|
|
|
243
250
|
_.map(_.prop("data_structure_id"))
|
|
244
251
|
)(structuresFields);
|
|
245
252
|
|
|
246
|
-
const belongsToDataset = structureId => {
|
|
253
|
+
const belongsToDataset = (structureId) => {
|
|
247
254
|
return _.includes(structureId)(all_fields);
|
|
248
255
|
};
|
|
249
256
|
|
|
250
|
-
const valueInDataset = val => {
|
|
257
|
+
const valueInDataset = (val) => {
|
|
251
258
|
return (
|
|
252
259
|
_.pathEq("operator.value_type_filter", "any")(val) ||
|
|
253
260
|
_.isNil(_.path("value[0].id")(val)) ||
|
|
@@ -257,14 +264,14 @@ export const NewRuleImplementation = ({
|
|
|
257
264
|
|
|
258
265
|
const validations_within_dataset = _.flow(
|
|
259
266
|
_.prop("validations"),
|
|
260
|
-
_.filter(val => belongsToDataset(_.path("structure.id")(val))),
|
|
261
|
-
_.filter(val => valueInDataset(val))
|
|
267
|
+
_.filter((val) => belongsToDataset(_.path("structure.id")(val))),
|
|
268
|
+
_.filter((val) => valueInDataset(val))
|
|
262
269
|
)(ruleImplementation);
|
|
263
270
|
|
|
264
271
|
const population_within_dataset = _.flow(
|
|
265
272
|
_.prop("population"),
|
|
266
|
-
_.filter(val => belongsToDataset(_.path("structure.id")(val))),
|
|
267
|
-
_.filter(val => valueInDataset(val))
|
|
273
|
+
_.filter((val) => belongsToDataset(_.path("structure.id")(val))),
|
|
274
|
+
_.filter((val) => valueInDataset(val))
|
|
268
275
|
)(ruleImplementation);
|
|
269
276
|
|
|
270
277
|
setRuleImplementation({
|
|
@@ -275,28 +282,28 @@ export const NewRuleImplementation = ({
|
|
|
275
282
|
: population_within_dataset,
|
|
276
283
|
validations: _.isEmpty(validations_within_dataset)
|
|
277
284
|
? [{}]
|
|
278
|
-
: validations_within_dataset
|
|
285
|
+
: validations_within_dataset,
|
|
279
286
|
});
|
|
280
287
|
};
|
|
281
288
|
|
|
282
289
|
const onChange = (prop, value) =>
|
|
283
290
|
setRuleImplementation({ ...ruleImplementation, [prop]: value });
|
|
284
291
|
|
|
285
|
-
const setPopulation = population => {
|
|
292
|
+
const setPopulation = (population) => {
|
|
286
293
|
setRuleImplementation({ ...ruleImplementation, population });
|
|
287
294
|
};
|
|
288
295
|
|
|
289
|
-
const setValidations = validations => {
|
|
296
|
+
const setValidations = (validations) => {
|
|
290
297
|
setRuleImplementation({ ...ruleImplementation, validations });
|
|
291
298
|
};
|
|
292
299
|
|
|
293
|
-
const setImplementationKey = implementationKey =>
|
|
300
|
+
const setImplementationKey = (implementationKey) =>
|
|
294
301
|
setRuleImplementation({ ...ruleImplementation, implementationKey });
|
|
295
302
|
|
|
296
|
-
const setImplementationType = implementationType =>
|
|
303
|
+
const setImplementationType = (implementationType) =>
|
|
297
304
|
setRuleImplementation({ ...ruleImplementation, implementationType });
|
|
298
305
|
|
|
299
|
-
const setImplementationRawContent = rawContent =>
|
|
306
|
+
const setImplementationRawContent = (rawContent) =>
|
|
300
307
|
setRuleImplementation({ ...ruleImplementation, rawContent });
|
|
301
308
|
|
|
302
309
|
useEffect(() => {
|
|
@@ -330,13 +337,12 @@ export const NewRuleImplementation = ({
|
|
|
330
337
|
? {
|
|
331
338
|
executable: ruleImplementation.executable,
|
|
332
339
|
implementation_key: _.prop("implementationKey")(ruleImplementation),
|
|
333
|
-
implementation_type:
|
|
334
|
-
ruleImplementation
|
|
335
|
-
),
|
|
340
|
+
implementation_type:
|
|
341
|
+
_.prop("implementationType")(ruleImplementation),
|
|
336
342
|
df_name,
|
|
337
343
|
df_content: dfContent,
|
|
338
344
|
rule_id: rule.id,
|
|
339
|
-
raw_content: { ...raw_content, source }
|
|
345
|
+
raw_content: { ...raw_content, source },
|
|
340
346
|
}
|
|
341
347
|
: {
|
|
342
348
|
executable: ruleImplementation.executable,
|
|
@@ -344,23 +350,22 @@ export const NewRuleImplementation = ({
|
|
|
344
350
|
population: conditionAttributes(population),
|
|
345
351
|
validations: conditionAttributes(validations),
|
|
346
352
|
implementation_key: _.prop("implementationKey")(ruleImplementation),
|
|
347
|
-
implementation_type:
|
|
348
|
-
ruleImplementation
|
|
349
|
-
),
|
|
353
|
+
implementation_type:
|
|
354
|
+
_.prop("implementationType")(ruleImplementation),
|
|
350
355
|
df_name,
|
|
351
356
|
df_content: dfContent,
|
|
352
|
-
rule_id: rule.id
|
|
357
|
+
rule_id: rule.id,
|
|
353
358
|
};
|
|
354
359
|
|
|
355
360
|
clone || !edition
|
|
356
361
|
? createRuleImplementation({
|
|
357
|
-
rule_implementation
|
|
362
|
+
rule_implementation,
|
|
358
363
|
})
|
|
359
364
|
: updateRuleImplementation({
|
|
360
365
|
rule_implementation: {
|
|
361
366
|
...rule_implementation,
|
|
362
|
-
id: ruleImplementation.id
|
|
363
|
-
}
|
|
367
|
+
id: ruleImplementation.id,
|
|
368
|
+
},
|
|
364
369
|
});
|
|
365
370
|
};
|
|
366
371
|
|
|
@@ -451,14 +456,14 @@ NewRuleImplementation.propTypes = {
|
|
|
451
456
|
operators: PropTypes.object,
|
|
452
457
|
template: PropTypes.object,
|
|
453
458
|
applyTemplate: PropTypes.func,
|
|
454
|
-
sources: PropTypes.array
|
|
459
|
+
sources: PropTypes.array,
|
|
455
460
|
};
|
|
456
461
|
|
|
457
|
-
const mapStateToProps = state => ({
|
|
462
|
+
const mapStateToProps = (state) => ({
|
|
458
463
|
rule: state.rule,
|
|
459
464
|
ruleImplementationProps: {
|
|
460
465
|
...state.ruleImplementation,
|
|
461
|
-
raw_content: state.ruleImplementationRaw
|
|
466
|
+
raw_content: state.ruleImplementationRaw,
|
|
462
467
|
},
|
|
463
468
|
ruleImplementationRaw: state.ruleImplementationRaw,
|
|
464
469
|
sources: state.sources,
|
|
@@ -469,10 +474,10 @@ const mapStateToProps = state => ({
|
|
|
469
474
|
),
|
|
470
475
|
operators: getRuleImplementationOperators(state),
|
|
471
476
|
template: _.defaultTo({})(state.template),
|
|
472
|
-
applyTemplate: applyTemplate(state.template)
|
|
477
|
+
applyTemplate: applyTemplate(state.template),
|
|
473
478
|
});
|
|
474
479
|
|
|
475
480
|
export default connect(mapStateToProps, {
|
|
476
481
|
createRuleImplementation,
|
|
477
|
-
updateRuleImplementation
|
|
482
|
+
updateRuleImplementation,
|
|
478
483
|
})(NewRuleImplementation);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getOr } from "lodash/fp";
|
|
2
|
-
import React from
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { Form, Icon } from "semantic-ui-react";
|
|
5
5
|
|
|
@@ -7,35 +7,45 @@ export default function FieldModifier({
|
|
|
7
7
|
modifier,
|
|
8
8
|
value,
|
|
9
9
|
onChange,
|
|
10
|
-
removable=false,
|
|
10
|
+
removable = false,
|
|
11
11
|
}) {
|
|
12
12
|
const { formatMessage } = useIntl();
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
<div className={"flex-row-align-end"}>
|
|
16
16
|
<Form.Field>
|
|
17
|
-
<label>
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
<label>
|
|
18
|
+
{formatMessage({ id: `filtersGrid.field.modifier.${modifier.name}` })}
|
|
19
|
+
</label>
|
|
20
|
+
{getOr(
|
|
21
|
+
[],
|
|
22
|
+
"params"
|
|
23
|
+
)(modifier).map((param, key) => (
|
|
24
|
+
<input
|
|
20
25
|
key={key}
|
|
21
|
-
placeholder={formatMessage({
|
|
26
|
+
placeholder={formatMessage({
|
|
27
|
+
id: `filtersGrid.field.modifier.${modifier.name}.${param.name}`,
|
|
28
|
+
})}
|
|
22
29
|
value={getOr("", `params.${param.name}`)(value)}
|
|
23
|
-
onChange={({target}) => {
|
|
30
|
+
onChange={({ target }) => {
|
|
24
31
|
onChange({
|
|
25
32
|
...value,
|
|
26
33
|
params: {
|
|
27
34
|
...getOr({}, "params")(value),
|
|
28
|
-
[param.name]: target.value
|
|
29
|
-
}
|
|
30
|
-
})
|
|
35
|
+
[param.name]: target.value,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}}
|
|
31
39
|
/>
|
|
32
|
-
)}
|
|
40
|
+
))}
|
|
33
41
|
</Form.Field>
|
|
34
|
-
{removable &&
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
{removable && (
|
|
43
|
+
<Icon
|
|
44
|
+
name="x"
|
|
45
|
+
className="selectable force-margin-bottom"
|
|
46
|
+
onClick={() => onChange(null)}
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
39
49
|
</div>
|
|
40
50
|
);
|
|
41
51
|
}
|