@truedat/qx 7.4.0 → 7.4.2
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 +4 -4
- package/src/api.js +3 -2
- package/src/components/qualityControls/EditQualityControl.js +9 -7
- package/src/components/qualityControls/NewDraftQualityControl.js +13 -8
- package/src/components/qualityControls/NewQualityControl.js +8 -6
- package/src/components/qualityControls/QualityBadge.js +85 -2
- package/src/components/qualityControls/QualityControlActions.js +53 -4
- package/src/components/qualityControls/QualityControlHeader.js +2 -2
- package/src/components/qualityControls/QualityControlHistory.js +6 -0
- package/src/components/qualityControls/QualityControlRoutes.js +3 -1
- package/src/components/qualityControls/QualityControlScores.js +4 -4
- package/src/components/qualityControls/QualityControls.js +4 -4
- package/src/components/qualityControls/QualityControlsTable.js +17 -4
- package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +2 -2
- package/src/components/qualityControls/__tests__/NewDraftQualityControl.spec.js +3 -3
- package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +2 -2
- package/src/components/qualityControls/__tests__/QualityBadge.spec.js +173 -2
- package/src/components/qualityControls/__tests__/QualityControlActions.spec.js +7 -2
- package/src/components/qualityControls/__tests__/QualityControlHeader.spec.js +7 -1
- package/src/components/qualityControls/__tests__/QualityControlRow.spec.js +1 -3
- package/src/components/qualityControls/__tests__/QualityControlScores.spec.js +1 -1
- package/src/components/qualityControls/__tests__/QualityControlTabs.spec.js +2 -2
- package/src/components/qualityControls/__tests__/QualityControls.spec.js +8 -8
- package/src/components/qualityControls/__tests__/QualityControlsTable.spec.js +4 -1
- package/src/components/qualityControls/__tests__/__fixtures__/qualityControlHelper.js +16 -11
- package/src/components/qualityControls/__tests__/__snapshots__/QualityBadge.spec.js.snap +32 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlActions.spec.js.snap +1 -3
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHeader.spec.js.snap +13 -4
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHistory.spec.js.snap +10 -2
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlRow.spec.js.snap +20 -2
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlScores.spec.js.snap +3 -3
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlTabs.spec.js.snap +3 -3
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControls.spec.js.snap +15 -1
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlsTable.spec.js.snap +25 -2
- package/src/components/qualityControls/qualityByControlMode.js +24 -7
- package/src/components/qualityControls/qualityControlScoresColumns.js +11 -4
- package/src/components/scores/QualityBar.js +23 -1
- package/src/components/scores/ScoreCrumbs.js +4 -1
- package/src/components/scores/ScoreGroup.js +2 -2
- package/src/components/scores/__tests__/QualityBar.spec.js +1 -1
- package/src/components/scores/__tests__/Score.spec.js +2 -2
- package/src/components/scores/__tests__/ScoreGroup.spec.js +1 -1
- package/src/components/scores/__tests__/__fixtures__/scoreHelper.js +1 -0
- package/src/components/scores/__tests__/__snapshots__/Score.spec.js.snap +1 -1
- package/src/components/scores/__tests__/__snapshots__/ScoreCrumbs.spec.js.snap +1 -1
- package/src/components/scores/__tests__/__snapshots__/ScoreGroup.spec.js.snap +1 -1
- package/src/hooks/useQualityControls.js +8 -5
|
@@ -164,6 +164,11 @@ exports[`<QualityControls /> matches the latest snapshot 1`] = `
|
|
|
164
164
|
>
|
|
165
165
|
status
|
|
166
166
|
</th>
|
|
167
|
+
<th
|
|
168
|
+
class="two wide disabled"
|
|
169
|
+
>
|
|
170
|
+
latest_score
|
|
171
|
+
</th>
|
|
167
172
|
<th
|
|
168
173
|
class="two wide"
|
|
169
174
|
>
|
|
@@ -181,7 +186,7 @@ exports[`<QualityControls /> matches the latest snapshot 1`] = `
|
|
|
181
186
|
class=""
|
|
182
187
|
>
|
|
183
188
|
<a
|
|
184
|
-
href="/qualityControls/8"
|
|
189
|
+
href="/qualityControls/8/version/1"
|
|
185
190
|
>
|
|
186
191
|
test
|
|
187
192
|
</a>
|
|
@@ -201,6 +206,15 @@ exports[`<QualityControls /> matches the latest snapshot 1`] = `
|
|
|
201
206
|
>
|
|
202
207
|
Published
|
|
203
208
|
</td>
|
|
209
|
+
<td
|
|
210
|
+
class=""
|
|
211
|
+
>
|
|
212
|
+
<i
|
|
213
|
+
aria-hidden="true"
|
|
214
|
+
class="green circle icon"
|
|
215
|
+
/>
|
|
216
|
+
100%
|
|
217
|
+
</td>
|
|
204
218
|
<td
|
|
205
219
|
class="center aligned"
|
|
206
220
|
>
|
package/src/components/qualityControls/__tests__/__snapshots__/QualityControlsTable.spec.js.snap
CHANGED
|
@@ -31,6 +31,11 @@ exports[`<QualityControlsTable /> matches the latest snapshot 1`] = `
|
|
|
31
31
|
>
|
|
32
32
|
status
|
|
33
33
|
</th>
|
|
34
|
+
<th
|
|
35
|
+
class="two wide disabled"
|
|
36
|
+
>
|
|
37
|
+
latest_score
|
|
38
|
+
</th>
|
|
34
39
|
<th
|
|
35
40
|
class="two wide descending sorted"
|
|
36
41
|
>
|
|
@@ -48,7 +53,7 @@ exports[`<QualityControlsTable /> matches the latest snapshot 1`] = `
|
|
|
48
53
|
class=""
|
|
49
54
|
>
|
|
50
55
|
<a
|
|
51
|
-
href="/qualityControls/8"
|
|
56
|
+
href="/qualityControls/8/version/1"
|
|
52
57
|
>
|
|
53
58
|
test
|
|
54
59
|
</a>
|
|
@@ -68,6 +73,15 @@ exports[`<QualityControlsTable /> matches the latest snapshot 1`] = `
|
|
|
68
73
|
>
|
|
69
74
|
Draft
|
|
70
75
|
</td>
|
|
76
|
+
<td
|
|
77
|
+
class=""
|
|
78
|
+
>
|
|
79
|
+
<i
|
|
80
|
+
aria-hidden="true"
|
|
81
|
+
class="green circle icon"
|
|
82
|
+
/>
|
|
83
|
+
100%
|
|
84
|
+
</td>
|
|
71
85
|
<td
|
|
72
86
|
class="center aligned"
|
|
73
87
|
>
|
|
@@ -85,7 +99,7 @@ exports[`<QualityControlsTable /> matches the latest snapshot 1`] = `
|
|
|
85
99
|
class=""
|
|
86
100
|
>
|
|
87
101
|
<a
|
|
88
|
-
href="/qualityControls/9"
|
|
102
|
+
href="/qualityControls/9/version/1"
|
|
89
103
|
>
|
|
90
104
|
Foo
|
|
91
105
|
</a>
|
|
@@ -105,6 +119,15 @@ exports[`<QualityControlsTable /> matches the latest snapshot 1`] = `
|
|
|
105
119
|
>
|
|
106
120
|
Draft
|
|
107
121
|
</td>
|
|
122
|
+
<td
|
|
123
|
+
class=""
|
|
124
|
+
>
|
|
125
|
+
<i
|
|
126
|
+
aria-hidden="true"
|
|
127
|
+
class="green circle icon"
|
|
128
|
+
/>
|
|
129
|
+
100%
|
|
130
|
+
</td>
|
|
108
131
|
<td
|
|
109
132
|
class="center aligned"
|
|
110
133
|
>
|
|
@@ -4,7 +4,7 @@ export default function qualityByControlMode(score) {
|
|
|
4
4
|
const controlMode = _.prop("quality_control.control_mode")(score);
|
|
5
5
|
const scoreCriteria = _.prop("quality_control.score_criteria")(score);
|
|
6
6
|
const scoreContent = _.prop("score_content")(score);
|
|
7
|
-
|
|
7
|
+
const noResultsMessage = _.prop("noResultsMessage")(score);
|
|
8
8
|
if (score.status === "FAILED") return { isFailed: true };
|
|
9
9
|
if (!scoreContent) return { isEmpty: true };
|
|
10
10
|
|
|
@@ -25,10 +25,17 @@ export default function qualityByControlMode(score) {
|
|
|
25
25
|
};
|
|
26
26
|
case "deviation":
|
|
27
27
|
const deviationRatio =
|
|
28
|
-
|
|
28
|
+
scoreContent.total_count == 0
|
|
29
|
+
? null
|
|
30
|
+
: (scoreContent.validation_count / scoreContent.total_count) * 100;
|
|
31
|
+
|
|
32
|
+
const deviationResult =
|
|
33
|
+
scoreContent.total_count == 0 ? noResultsMessage : `${deviationRatio}%`;
|
|
29
34
|
return {
|
|
30
35
|
color:
|
|
31
|
-
|
|
36
|
+
scoreContent.total_count == 0
|
|
37
|
+
? "grey"
|
|
38
|
+
: deviationRatio < scoreCriteria.goal
|
|
32
39
|
? "green"
|
|
33
40
|
: deviationRatio < scoreCriteria.maximum
|
|
34
41
|
? "yellow"
|
|
@@ -37,14 +44,24 @@ export default function qualityByControlMode(score) {
|
|
|
37
44
|
value1: scoreCriteria.goal,
|
|
38
45
|
label2: "quality_control.score_criteria.deviation.maximum",
|
|
39
46
|
value2: scoreCriteria.maximum,
|
|
40
|
-
text:
|
|
47
|
+
text: deviationResult,
|
|
41
48
|
};
|
|
42
49
|
case "percentage":
|
|
43
50
|
const percentageRatio =
|
|
44
|
-
|
|
51
|
+
scoreContent.total_count == 0
|
|
52
|
+
? null
|
|
53
|
+
: (scoreContent.validation_count / scoreContent.total_count) * 100;
|
|
54
|
+
|
|
55
|
+
const percentageResult =
|
|
56
|
+
scoreContent.total_count == 0
|
|
57
|
+
? noResultsMessage
|
|
58
|
+
: `${percentageRatio}%`;
|
|
59
|
+
|
|
45
60
|
return {
|
|
46
61
|
color:
|
|
47
|
-
|
|
62
|
+
scoreContent.total_count == 0
|
|
63
|
+
? "grey"
|
|
64
|
+
: percentageRatio > scoreCriteria.goal
|
|
48
65
|
? "green"
|
|
49
66
|
: percentageRatio > scoreCriteria.minimum
|
|
50
67
|
? "yellow"
|
|
@@ -53,7 +70,7 @@ export default function qualityByControlMode(score) {
|
|
|
53
70
|
value1: scoreCriteria.minimum,
|
|
54
71
|
label2: "quality_control.score_criteria.percentage.goal",
|
|
55
72
|
value2: scoreCriteria.goal,
|
|
56
|
-
text:
|
|
73
|
+
text: percentageResult,
|
|
57
74
|
};
|
|
58
75
|
|
|
59
76
|
default:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
3
4
|
import { Link } from "react-router-dom";
|
|
4
5
|
import { FormattedMessage } from "react-intl";
|
|
5
6
|
import { DateDecorator } from "@truedat/core/services/columnDecorators";
|
|
@@ -16,6 +17,11 @@ const ScoreLink = ({ id, execution_timestamp }) => (
|
|
|
16
17
|
</Link>
|
|
17
18
|
);
|
|
18
19
|
|
|
20
|
+
ScoreLink.propTypes = {
|
|
21
|
+
id: PropTypes.number,
|
|
22
|
+
execution_timestamp: PropTypes.string,
|
|
23
|
+
};
|
|
24
|
+
|
|
19
25
|
export default [
|
|
20
26
|
{
|
|
21
27
|
name: "execution_timestamp",
|
|
@@ -43,10 +49,11 @@ export default [
|
|
|
43
49
|
},
|
|
44
50
|
{
|
|
45
51
|
name: "quality_control_status",
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
fieldDecorator: (quality_control_status) =>
|
|
53
|
+
quality_control_status ? (
|
|
54
|
+
<FormattedMessage
|
|
55
|
+
id={`quality_control.status.${quality_control_status}`}
|
|
56
|
+
/>
|
|
50
57
|
) : null,
|
|
51
58
|
},
|
|
52
59
|
];
|
|
@@ -2,6 +2,7 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import React, { useContext } from "react";
|
|
3
3
|
import { Popup } from "semantic-ui-react";
|
|
4
4
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
5
|
+
import Moment from "react-moment";
|
|
5
6
|
import qualityByControlMode from "../qualityControls/qualityByControlMode";
|
|
6
7
|
import ScoreContext from "./ScoreContext";
|
|
7
8
|
|
|
@@ -16,9 +17,26 @@ export default function QualityBar() {
|
|
|
16
17
|
text: formatMessage({ id: "score.status.failed" }),
|
|
17
18
|
}
|
|
18
19
|
: quality.isEmpty
|
|
20
|
+
? {
|
|
21
|
+
color: "notExecutedDataset",
|
|
22
|
+
text: formatMessage({ id: "quality.result.no.data" }),
|
|
23
|
+
}
|
|
24
|
+
: score.score_content.total_count == 0
|
|
19
25
|
? {
|
|
20
26
|
color: "empyDataset",
|
|
21
|
-
text: formatMessage(
|
|
27
|
+
text: formatMessage(
|
|
28
|
+
{
|
|
29
|
+
id: "score.empty_dataset_date",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
date: (
|
|
33
|
+
<Moment
|
|
34
|
+
date={score.execution_timestamp}
|
|
35
|
+
format="YYYY-MM-DD HH:mm"
|
|
36
|
+
/>
|
|
37
|
+
),
|
|
38
|
+
}
|
|
39
|
+
),
|
|
22
40
|
}
|
|
23
41
|
: quality;
|
|
24
42
|
|
|
@@ -39,6 +57,10 @@ export default function QualityBar() {
|
|
|
39
57
|
className: "not-executed-color",
|
|
40
58
|
tooltip: "no_execution",
|
|
41
59
|
},
|
|
60
|
+
notExecutedDataset: {
|
|
61
|
+
className: "not-executed-color",
|
|
62
|
+
tooltip: "no_execution",
|
|
63
|
+
},
|
|
42
64
|
empyDataset: {
|
|
43
65
|
className: "empty-dataset-color",
|
|
44
66
|
tooltip: "no_content",
|
|
@@ -22,7 +22,10 @@ export default function ScoreCrumbs() {
|
|
|
22
22
|
|
|
23
23
|
<Breadcrumb.Section
|
|
24
24
|
as={Link}
|
|
25
|
-
to={linkTo.QUALITY_CONTROL_SCORES({
|
|
25
|
+
to={linkTo.QUALITY_CONTROL_SCORES({
|
|
26
|
+
id: qualityControl.id,
|
|
27
|
+
version: qualityControl.version,
|
|
28
|
+
})}
|
|
26
29
|
>
|
|
27
30
|
{qualityControl.name}
|
|
28
31
|
</Breadcrumb.Section>
|
|
@@ -14,8 +14,8 @@ const DynamicFormViewer = React.lazy(() =>
|
|
|
14
14
|
import("@truedat/df/components/DynamicFormViewer")
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
-
const QualityControlLink = ({ id, name }) => (
|
|
18
|
-
<Link to={linkTo.QUALITY_CONTROL({ id })}>{name}</Link>
|
|
17
|
+
const QualityControlLink = ({ id, name, version }) => (
|
|
18
|
+
<Link to={linkTo.QUALITY_CONTROL({ id, version })}>{name}</Link>
|
|
19
19
|
);
|
|
20
20
|
const COLUMNS = [
|
|
21
21
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { version } from "react";
|
|
3
3
|
import { render } from "@truedat/test/render";
|
|
4
4
|
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
5
5
|
import { useScoreShow } from "@truedat/qx/hooks/useScores";
|
|
@@ -7,7 +7,7 @@ import Score from "../Score";
|
|
|
7
7
|
|
|
8
8
|
jest.mock("react-router-dom", () => ({
|
|
9
9
|
...jest.requireActual("react-router-dom"),
|
|
10
|
-
useParams: () => ({ id: "8" }),
|
|
10
|
+
useParams: () => ({ id: "8", version: "1" }),
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
13
|
jest.mock("@truedat/qx/hooks/useScores", () => {
|
|
@@ -6,7 +6,7 @@ import ScoreGroup from "../ScoreGroup";
|
|
|
6
6
|
|
|
7
7
|
jest.mock("react-router-dom", () => ({
|
|
8
8
|
...jest.requireActual("react-router-dom"),
|
|
9
|
-
useParams: () => ({ id: "8" }),
|
|
9
|
+
useParams: () => ({ id: "8", version: "1" }),
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
12
|
jest.mock("@truedat/qx/hooks/useScoreGroups", () => {
|
|
@@ -9,17 +9,17 @@ import {
|
|
|
9
9
|
} from "@truedat/core/services/api";
|
|
10
10
|
import {
|
|
11
11
|
API_QUALITY_CONTROLS,
|
|
12
|
-
API_QUALITY_CONTROL,
|
|
13
12
|
API_QUALITY_CONTROL_DRAFT,
|
|
14
13
|
API_QUALITY_CONTROL_STATUS,
|
|
15
14
|
API_QUALITY_CONTROL_MAIN,
|
|
16
15
|
API_QUALITY_CONTROL_SEARCH,
|
|
17
16
|
API_QUALITY_CONTROL_FILTERS,
|
|
18
17
|
API_QUALITY_CONTROL_QUERIES,
|
|
18
|
+
API_QUALITY_CONTROL_VERSION,
|
|
19
19
|
} from "../api";
|
|
20
20
|
|
|
21
|
-
export const useQualityControl = (id) => {
|
|
22
|
-
const url = compile(
|
|
21
|
+
export const useQualityControl = (id, version) => {
|
|
22
|
+
const url = compile(API_QUALITY_CONTROL_VERSION)({ id, version });
|
|
23
23
|
const { data, error, mutate } = useSWR(url, apiJson);
|
|
24
24
|
return { data: data?.data, error, loading: !error && !data, mutate };
|
|
25
25
|
};
|
|
@@ -52,8 +52,11 @@ export const useQualityControlUpdateMain = (id) => {
|
|
|
52
52
|
|
|
53
53
|
export const useQualityControlDelete = (qualityControl) => {
|
|
54
54
|
const id = qualityControl?.id || 0;
|
|
55
|
-
const
|
|
56
|
-
|
|
55
|
+
const version = qualityControl?.version || 0;
|
|
56
|
+
const url = compile(API_QUALITY_CONTROL_VERSION)({ id, version });
|
|
57
|
+
return useSWRMutations(url, (url, { arg }) => apiJsonDelete(url, arg), {
|
|
58
|
+
revalidate: false,
|
|
59
|
+
});
|
|
57
60
|
};
|
|
58
61
|
|
|
59
62
|
export const useQualityControlsSearch = () => {
|