@truedat/dq 4.37.4 → 4.37.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 +8 -0
- package/package.json +4 -4
- package/src/components/ExecutionDetails.js +17 -9
- package/src/components/RuleRoutes.js +2 -2
- package/src/components/__tests__/ExecutionDetails.spec.js +31 -24
- package/src/components/__tests__/RuleRoutes.spec.js +23 -0
- package/src/components/__tests__/__snapshots__/ExecutionDetails.spec.js.snap +2 -5
- package/src/components/__tests__/__snapshots__/RuleRoutes.spec.js.snap +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.37.5] 2022-02-06
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- [TD-4426]
|
|
8
|
+
- On `ExecutionDetails` decode detail fields with prefix `base64_`
|
|
9
|
+
- Option to create messages with `ruleResult.details.props.<field_name>` to replace detail key
|
|
10
|
+
|
|
3
11
|
## [4.37.4] 2022-02-04
|
|
4
12
|
|
|
5
13
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.37.
|
|
3
|
+
"version": "4.37.5",
|
|
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.37.
|
|
86
|
-
"@truedat/df": "4.37.
|
|
85
|
+
"@truedat/core": "4.37.5",
|
|
86
|
+
"@truedat/df": "4.37.5",
|
|
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": "98ff8669e99824ef1bdbd3d12035e6371029e4ca"
|
|
107
107
|
}
|
|
@@ -28,7 +28,7 @@ const GeneralInformation = ({ ruleImplementation, ruleResult }) => {
|
|
|
28
28
|
|
|
29
29
|
<Table.Row>
|
|
30
30
|
<Table.Cell>
|
|
31
|
-
{formatMessage({ id: "ruleResult.props.date" })}
|
|
31
|
+
{formatMessage({ id: "ruleResult.props.date" })}
|
|
32
32
|
</Table.Cell>
|
|
33
33
|
<Table.Cell>
|
|
34
34
|
<DateTime value={ruleResult.date} />
|
|
@@ -37,14 +37,14 @@ const GeneralInformation = ({ ruleImplementation, ruleResult }) => {
|
|
|
37
37
|
|
|
38
38
|
<Table.Row>
|
|
39
39
|
<Table.Cell>
|
|
40
|
-
{formatMessage({ id: "ruleResult.props.records" })}
|
|
40
|
+
{formatMessage({ id: "ruleResult.props.records" })}
|
|
41
41
|
</Table.Cell>
|
|
42
42
|
<Table.Cell>{formatNumber(ruleResult.records)}</Table.Cell>
|
|
43
43
|
</Table.Row>
|
|
44
44
|
|
|
45
45
|
<Table.Row>
|
|
46
46
|
<Table.Cell>
|
|
47
|
-
{formatMessage({ id: "ruleResult.props.errors" })}
|
|
47
|
+
{formatMessage({ id: "ruleResult.props.errors" })}
|
|
48
48
|
</Table.Cell>
|
|
49
49
|
<Table.Cell>{formatNumber(ruleResult.errors)}</Table.Cell>
|
|
50
50
|
</Table.Row>
|
|
@@ -58,13 +58,19 @@ GeneralInformation.propTypes = {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
const DetailRow = ({ details }) => {
|
|
61
|
+
const { formatMessage } = useIntl();
|
|
61
62
|
return _.flow(
|
|
62
63
|
_.keys,
|
|
63
64
|
_.map((key) => (
|
|
64
65
|
<Table.Row key={key}>
|
|
65
|
-
<Table.Cell>{key}</Table.Cell>
|
|
66
66
|
<Table.Cell>
|
|
67
|
-
{
|
|
67
|
+
{formatMessage({
|
|
68
|
+
id: `ruleResult.details.props.${key.replace(/^(base64_)/, "")}`,
|
|
69
|
+
defaultMessage: key.replace(/^(base64_)/, ""),
|
|
70
|
+
})}
|
|
71
|
+
</Table.Cell>
|
|
72
|
+
<Table.Cell>
|
|
73
|
+
{key === "Query" || key.startsWith("base64_")
|
|
68
74
|
? Buffer.from(details[key], "base64").toString()
|
|
69
75
|
: JSON.stringify(details[key], null, 2)}
|
|
70
76
|
</Table.Cell>
|
|
@@ -73,11 +79,13 @@ const DetailRow = ({ details }) => {
|
|
|
73
79
|
)(details);
|
|
74
80
|
};
|
|
75
81
|
|
|
76
|
-
|
|
82
|
+
DetailRow.propTypes = { details: PropTypes.object };
|
|
83
|
+
|
|
84
|
+
export const ExecutionDetails = ({ ruleImplementation, ruleResultId }) => {
|
|
77
85
|
const { formatMessage } = useIntl();
|
|
78
|
-
const { rule_result_id:
|
|
86
|
+
const { rule_result_id: paramsId } = useParams();
|
|
79
87
|
|
|
80
|
-
const result_id = _.defaultTo(_.toNumber(
|
|
88
|
+
const result_id = _.defaultTo(_.toNumber(paramsId))(ruleResultId);
|
|
81
89
|
|
|
82
90
|
const ruleResult = _.find(_.propEq("id", result_id))(
|
|
83
91
|
ruleImplementation.results
|
|
@@ -128,7 +136,7 @@ export const ExecutionDetails = ({ ruleImplementation, rule_result_id }) => {
|
|
|
128
136
|
|
|
129
137
|
ExecutionDetails.propTypes = {
|
|
130
138
|
ruleImplementation: PropTypes.object,
|
|
131
|
-
|
|
139
|
+
ruleResultId: PropTypes.number,
|
|
132
140
|
};
|
|
133
141
|
|
|
134
142
|
const mapStateToProps = (state) => ({
|
|
@@ -75,7 +75,7 @@ const ImplementationEventsLoader = () => {
|
|
|
75
75
|
return <EventsLoader resource_id={id} resource_type="implementation" />;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
const RuleRoutes = ({
|
|
78
|
+
export const RuleRoutes = ({
|
|
79
79
|
ruleLoaded,
|
|
80
80
|
ruleImplementationLoaded,
|
|
81
81
|
implementationStructures,
|
|
@@ -312,7 +312,7 @@ const RuleRoutes = ({
|
|
|
312
312
|
<RuleImplementationLoader />
|
|
313
313
|
{ruleLoaded && ruleImplementationLoaded && (
|
|
314
314
|
<RuleImplementation>
|
|
315
|
-
<ExecutionDetails
|
|
315
|
+
<ExecutionDetails ruleResultId={latest.id} />
|
|
316
316
|
</RuleImplementation>
|
|
317
317
|
)}
|
|
318
318
|
</Segment>
|
|
@@ -11,41 +11,48 @@ jest.mock("react-router-dom", () => ({
|
|
|
11
11
|
|
|
12
12
|
const renderOpts = {
|
|
13
13
|
messages: {
|
|
14
|
-
en:
|
|
14
|
+
en: {
|
|
15
|
+
...messages.en,
|
|
16
|
+
"ruleResult.details.props.test": "TestMessage",
|
|
17
|
+
},
|
|
15
18
|
},
|
|
16
19
|
};
|
|
17
20
|
|
|
18
|
-
describe("<
|
|
19
|
-
const rule = {
|
|
20
|
-
result_type: "percentage",
|
|
21
|
-
minimum: 50,
|
|
22
|
-
goal: 100,
|
|
23
|
-
};
|
|
24
|
-
const ruleImplementation = {
|
|
25
|
-
results: [{ foo: "bar", id: 100, details: { Query: "ImZvbyI=" } }],
|
|
26
|
-
};
|
|
27
|
-
const customColumns = [{ foo: "bar", name: "foo" }];
|
|
28
|
-
const props = {
|
|
29
|
-
rule,
|
|
30
|
-
ruleImplementation,
|
|
31
|
-
customColumns,
|
|
32
|
-
};
|
|
33
|
-
|
|
21
|
+
describe("<ExecutionDetails>", () => {
|
|
34
22
|
it("matches the lastest snapshot", () => {
|
|
23
|
+
const props = {
|
|
24
|
+
ruleImplementation: {
|
|
25
|
+
results: [{ foo: "bar", id: 100, details: { Query: "ImZvbyI=" } }],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
35
28
|
const { container } = render(<ExecutionDetails {...props} />, renderOpts);
|
|
36
29
|
expect(container).toMatchSnapshot();
|
|
37
30
|
});
|
|
38
31
|
|
|
32
|
+
it("decodes details with base64 prefix", () => {
|
|
33
|
+
const props = {
|
|
34
|
+
ruleImplementation: {
|
|
35
|
+
results: [
|
|
36
|
+
{
|
|
37
|
+
foo: "bar",
|
|
38
|
+
id: 100,
|
|
39
|
+
details: {
|
|
40
|
+
value: "valor",
|
|
41
|
+
base64_test: "QmFzZTY0X3ZhbHVl", //base64 for Base64_value
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
const { getByText } = render(<ExecutionDetails {...props} />, renderOpts);
|
|
48
|
+
expect(getByText("TestMessage")).toBeInTheDocument();
|
|
49
|
+
expect(getByText("Base64_value")).toBeInTheDocument();
|
|
50
|
+
});
|
|
51
|
+
|
|
39
52
|
it("without details", () => {
|
|
40
53
|
const propsWithoutDetails = {
|
|
41
|
-
...props,
|
|
42
54
|
ruleImplementation: {
|
|
43
|
-
|
|
44
|
-
results: {
|
|
45
|
-
..._.map((result) => _.omit(["details"])(result))(
|
|
46
|
-
props.ruleImplementation.results
|
|
47
|
-
),
|
|
48
|
-
},
|
|
55
|
+
results: [{ foo: "bar", id: 100 }],
|
|
49
56
|
},
|
|
50
57
|
};
|
|
51
58
|
const { container } = render(
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import { RuleRoutes } from "../RuleRoutes";
|
|
4
|
+
|
|
5
|
+
describe("<RuleRoutes>", () => {
|
|
6
|
+
const props = {
|
|
7
|
+
rule: {},
|
|
8
|
+
implementationStructures: [],
|
|
9
|
+
ruleLoaded: true,
|
|
10
|
+
template: {},
|
|
11
|
+
ruleImplementation: {},
|
|
12
|
+
ruleImplementationLoaded: true,
|
|
13
|
+
implementationStructuresLoaded: true,
|
|
14
|
+
systemsLoading: true,
|
|
15
|
+
templatesLoaded: true,
|
|
16
|
+
structuresAliasesLoading: true,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
it("matches the lastest snapshot", () => {
|
|
20
|
+
const { container } = render(<RuleRoutes {...props} />, {});
|
|
21
|
+
expect(container).toMatchSnapshot();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<
|
|
3
|
+
exports[`<ExecutionDetails> matches the lastest snapshot 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<table
|
|
6
6
|
class="ui table implementation-results medium"
|
|
@@ -47,7 +47,6 @@ exports[`<ExecutionDetetails> matches the lastest snapshot 1`] = `
|
|
|
47
47
|
class=""
|
|
48
48
|
>
|
|
49
49
|
Date
|
|
50
|
-
|
|
51
50
|
</td>
|
|
52
51
|
<td
|
|
53
52
|
class=""
|
|
@@ -60,7 +59,6 @@ exports[`<ExecutionDetetails> matches the lastest snapshot 1`] = `
|
|
|
60
59
|
class=""
|
|
61
60
|
>
|
|
62
61
|
Records
|
|
63
|
-
|
|
64
62
|
</td>
|
|
65
63
|
<td
|
|
66
64
|
class=""
|
|
@@ -73,7 +71,6 @@ exports[`<ExecutionDetetails> matches the lastest snapshot 1`] = `
|
|
|
73
71
|
class=""
|
|
74
72
|
>
|
|
75
73
|
Errors
|
|
76
|
-
|
|
77
74
|
</td>
|
|
78
75
|
<td
|
|
79
76
|
class=""
|
|
@@ -116,7 +113,7 @@ exports[`<ExecutionDetetails> matches the lastest snapshot 1`] = `
|
|
|
116
113
|
</div>
|
|
117
114
|
`;
|
|
118
115
|
|
|
119
|
-
exports[`<
|
|
116
|
+
exports[`<ExecutionDetails> without details 1`] = `
|
|
120
117
|
<div>
|
|
121
118
|
<div
|
|
122
119
|
class="ui message"
|