@truedat/dq 4.56.3 → 4.56.4
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 +5 -5
- package/src/components/ConditionSummary.js +35 -18
- package/src/components/__tests__/NewRuleImplementation.spec.js +24 -0
- package/src/components/__tests__/__snapshots__/ConditionSummary.spec.js.snap +1 -3
- package/src/components/__tests__/__snapshots__/ImplementationSummary.spec.js.snap +1 -2
- package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +5 -9
- package/src/components/ruleImplementationForm/FieldModifier.js +1 -0
- package/src/components/ruleImplementationForm/FiltersField.js +1 -0
- package/src/components/ruleImplementationForm/FiltersGrid.js +18 -7
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.56.
|
|
3
|
+
"version": "4.56.4",
|
|
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.56.
|
|
37
|
+
"@truedat/test": "4.56.4",
|
|
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",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"@apollo/client": "^3.7.0",
|
|
96
|
-
"@truedat/core": "4.56.
|
|
97
|
-
"@truedat/df": "4.56.
|
|
96
|
+
"@truedat/core": "4.56.4",
|
|
97
|
+
"@truedat/df": "4.56.4",
|
|
98
98
|
"graphql": "^15.5.3",
|
|
99
99
|
"path-to-regexp": "^1.7.0",
|
|
100
100
|
"prop-types": "^15.8.1",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"react-dom": ">= 16.8.6 < 17",
|
|
115
115
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "f327860aa80db650f562d53dc22218307f43e0ac"
|
|
118
118
|
}
|
|
@@ -9,26 +9,31 @@ import { linkTo } from "@truedat/core/routes";
|
|
|
9
9
|
|
|
10
10
|
const concatValues = (values, link) => _.join(link)(values);
|
|
11
11
|
|
|
12
|
-
const LinkToStructure = ({ value }) =>
|
|
12
|
+
const LinkToStructure = ({ value, aliasArray }) =>
|
|
13
13
|
value?.id ? (
|
|
14
14
|
<Link to={linkTo.STRUCTURE({ id: value.id })}>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
<div className="highlighted">
|
|
16
|
+
{qualifySqlIdentifier({ aliasArray, value })}
|
|
17
|
+
</div>{" "}
|
|
18
18
|
</Link>
|
|
19
19
|
) : (
|
|
20
20
|
<span>{value.name}</span>
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
LinkToStructure.propTypes = {
|
|
24
|
+
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
25
|
+
aliasArray: PropTypes.array,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const FormattedLink = ({ value, aliasArray, operator = {} }) => {
|
|
24
29
|
switch (operator?.value_type) {
|
|
25
30
|
case "field":
|
|
26
|
-
return <LinkToStructure value={value} />;
|
|
31
|
+
return <LinkToStructure value={value} aliasArray={aliasArray} />;
|
|
27
32
|
case "field_list":
|
|
28
33
|
return (
|
|
29
34
|
<>
|
|
30
35
|
{_.map.convert({ cap: false })((v, i) => (
|
|
31
|
-
<LinkToStructure key={i} value={v} />
|
|
36
|
+
<LinkToStructure key={i} value={v} aliasArray={aliasArray} />
|
|
32
37
|
))(value)}
|
|
33
38
|
</>
|
|
34
39
|
);
|
|
@@ -49,6 +54,7 @@ const FormattedLink = ({ value, operator = {} }) => {
|
|
|
49
54
|
FormattedLink.propTypes = {
|
|
50
55
|
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
51
56
|
operator: PropTypes.object,
|
|
57
|
+
aliasArray: PropTypes.array,
|
|
52
58
|
};
|
|
53
59
|
|
|
54
60
|
const nilOrEmpty = (v) => _.isNil(v) || v === "";
|
|
@@ -101,7 +107,7 @@ export const getValues = ({ value = [], operator = {}, value_modifier }) => {
|
|
|
101
107
|
? valuesFromKeys(
|
|
102
108
|
defaultOrValue,
|
|
103
109
|
["name"],
|
|
104
|
-
["path", "id", "type", "parent_index"],
|
|
110
|
+
["path", "metadata", "id", "type", "parent_index"],
|
|
105
111
|
value_modifier
|
|
106
112
|
)
|
|
107
113
|
: valuesFromKeys(defaultOrValue, ["raw"], [], value_modifier);
|
|
@@ -124,12 +130,15 @@ OperatorMessage.propTypes = {
|
|
|
124
130
|
operator: PropTypes.object,
|
|
125
131
|
};
|
|
126
132
|
|
|
133
|
+
const qualifySqlIdentifier = ({ aliasArray, value }) =>
|
|
134
|
+
_.flow(
|
|
135
|
+
_.find({ index: value?.parent_index }),
|
|
136
|
+
_.propOr(null, "text"),
|
|
137
|
+
_.defaultTo(value?.metadata?.table || _.last(value?.path)),
|
|
138
|
+
(qualifier) => (qualifier ? `(${qualifier}).${value?.name}` : value?.name)
|
|
139
|
+
)(aliasArray);
|
|
140
|
+
|
|
127
141
|
const ConditionCell = ({ row, alias, validationPopulationCondition }) => {
|
|
128
|
-
const alias_text =
|
|
129
|
-
_.flow(
|
|
130
|
-
_.find({ index: row.structure?.parent_index }),
|
|
131
|
-
_.propOr(null, "text")
|
|
132
|
-
)(alias) || (row.structure ? _.last(row.structure.path) : null);
|
|
133
142
|
const values = getValues(row);
|
|
134
143
|
const operator = _.prop("operator")(row);
|
|
135
144
|
const { formatMessage } = useIntl();
|
|
@@ -154,8 +163,10 @@ const ConditionCell = ({ row, alias, validationPopulationCondition }) => {
|
|
|
154
163
|
})}
|
|
155
164
|
>
|
|
156
165
|
<span className="highlighted">
|
|
157
|
-
{
|
|
158
|
-
|
|
166
|
+
{qualifySqlIdentifier({
|
|
167
|
+
aliasArray: alias,
|
|
168
|
+
value: row.structure,
|
|
169
|
+
})}
|
|
159
170
|
</span>
|
|
160
171
|
</Link>
|
|
161
172
|
</>
|
|
@@ -190,8 +201,10 @@ const ConditionCell = ({ row, alias, validationPopulationCondition }) => {
|
|
|
190
201
|
})}
|
|
191
202
|
>
|
|
192
203
|
<span className="highlighted">
|
|
193
|
-
{
|
|
194
|
-
|
|
204
|
+
{qualifySqlIdentifier({
|
|
205
|
+
aliasArray: alias,
|
|
206
|
+
value: row,
|
|
207
|
+
})}
|
|
195
208
|
</span>
|
|
196
209
|
</Link>
|
|
197
210
|
) : (
|
|
@@ -214,7 +227,11 @@ const ConditionCell = ({ row, alias, validationPopulationCondition }) => {
|
|
|
214
227
|
<Table.Cell width={5}>
|
|
215
228
|
{_.map.convert({ cap: false })((value, i) => (
|
|
216
229
|
<Fragment key={i}>
|
|
217
|
-
<FormattedLink
|
|
230
|
+
<FormattedLink
|
|
231
|
+
value={value}
|
|
232
|
+
operator={operator}
|
|
233
|
+
aliasArray={alias}
|
|
234
|
+
/>
|
|
218
235
|
{i + 1 < _.size(values) && (
|
|
219
236
|
<span>
|
|
220
237
|
{" "}
|
|
@@ -266,6 +266,18 @@ describe("<NewRuleImplementation> NewRuleImplementation doSubmit", () => {
|
|
|
266
266
|
fields: [
|
|
267
267
|
{
|
|
268
268
|
id: 11127109,
|
|
269
|
+
metadata: {
|
|
270
|
+
data_type_class: "string",
|
|
271
|
+
database: "xe",
|
|
272
|
+
default: "None",
|
|
273
|
+
host: "localhost",
|
|
274
|
+
nullable: false,
|
|
275
|
+
order: "4",
|
|
276
|
+
precision: "25",
|
|
277
|
+
schema: "HR",
|
|
278
|
+
table: "EMPLOYEES",
|
|
279
|
+
type: "VARCHAR2",
|
|
280
|
+
},
|
|
269
281
|
name: "EMAIL",
|
|
270
282
|
parent_index: 4,
|
|
271
283
|
path: undefined,
|
|
@@ -273,6 +285,18 @@ describe("<NewRuleImplementation> NewRuleImplementation doSubmit", () => {
|
|
|
273
285
|
},
|
|
274
286
|
{
|
|
275
287
|
id: 11127116,
|
|
288
|
+
metadata: {
|
|
289
|
+
data_type_class: "string",
|
|
290
|
+
database: "xe",
|
|
291
|
+
default: "None",
|
|
292
|
+
host: "localhost",
|
|
293
|
+
nullable: true,
|
|
294
|
+
order: "5",
|
|
295
|
+
precision: "20",
|
|
296
|
+
schema: "HR",
|
|
297
|
+
table: "EMPLOYEES",
|
|
298
|
+
type: "VARCHAR2",
|
|
299
|
+
},
|
|
276
300
|
name: "PHONE_NUMBER",
|
|
277
301
|
parent_index: 4,
|
|
278
302
|
path: undefined,
|
|
@@ -629,9 +629,7 @@ exports[`<NewRuleImplementation /> calculate aliases when not informed 1`] = `
|
|
|
629
629
|
<span
|
|
630
630
|
class="highlighted"
|
|
631
631
|
>
|
|
632
|
-
(table2).
|
|
633
|
-
|
|
634
|
-
"descripcion"
|
|
632
|
+
(table2).descripcion
|
|
635
633
|
</span>
|
|
636
634
|
</a>
|
|
637
635
|
</td>
|
|
@@ -650,11 +648,11 @@ exports[`<NewRuleImplementation /> calculate aliases when not informed 1`] = `
|
|
|
650
648
|
<a
|
|
651
649
|
href="/structures/4814767"
|
|
652
650
|
>
|
|
653
|
-
<
|
|
651
|
+
<div
|
|
654
652
|
class="highlighted"
|
|
655
653
|
>
|
|
656
|
-
|
|
657
|
-
</
|
|
654
|
+
(FS).external
|
|
655
|
+
</div>
|
|
658
656
|
|
|
659
657
|
</a>
|
|
660
658
|
</td>
|
|
@@ -719,9 +717,7 @@ exports[`<NewRuleImplementation /> calculate aliases when not informed 1`] = `
|
|
|
719
717
|
<span
|
|
720
718
|
class="highlighted"
|
|
721
719
|
>
|
|
722
|
-
(FS).
|
|
723
|
-
|
|
724
|
-
"agent"
|
|
720
|
+
(FS).agent
|
|
725
721
|
</span>
|
|
726
722
|
</a>
|
|
727
723
|
</td>
|
|
@@ -25,7 +25,9 @@ export const FiltersGrid = ({
|
|
|
25
25
|
|
|
26
26
|
const onStructureChange = (index, value) => {
|
|
27
27
|
const structure = {
|
|
28
|
-
..._.pick(["field_type", "name", "parent_index", "type"])(
|
|
28
|
+
..._.pick(["field_type", "name", "parent_index", "type", "metadata"])(
|
|
29
|
+
value
|
|
30
|
+
),
|
|
29
31
|
id: value.data_structure_id,
|
|
30
32
|
};
|
|
31
33
|
setRowValue({
|
|
@@ -56,12 +58,21 @@ export const FiltersGrid = ({
|
|
|
56
58
|
});
|
|
57
59
|
};
|
|
58
60
|
|
|
59
|
-
const composeFieldValue = (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
const composeFieldValue = ({
|
|
62
|
+
data_structure_id,
|
|
63
|
+
id,
|
|
64
|
+
name,
|
|
65
|
+
path,
|
|
66
|
+
metadata,
|
|
67
|
+
parent_index,
|
|
68
|
+
type,
|
|
69
|
+
}) => ({
|
|
70
|
+
id: data_structure_id || id,
|
|
71
|
+
name,
|
|
72
|
+
path,
|
|
73
|
+
metadata,
|
|
74
|
+
parent_index,
|
|
75
|
+
type,
|
|
65
76
|
});
|
|
66
77
|
|
|
67
78
|
const composeValue = (value_type, value) => {
|