@truedat/qx 7.5.7 → 7.5.9
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/components/__tests__/__fixtures__/helper.js +6 -7
- package/src/components/common/expressions/__tests__/Expression.spec.js +3 -22
- package/src/components/common/expressions/__tests__/ShapeSelector.spec.js +6 -18
- package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +0 -5
- package/src/components/qualityControls/ControlProperties.js +4 -3
- package/src/components/qualityControls/ControlPropertiesView.js +5 -4
- package/src/components/qualityControls/QualityBadge.js +11 -2
- package/src/components/qualityControls/QualityControlEditor.js +1 -1
- package/src/components/qualityControls/ScoreCriteria.js +4 -0
- package/src/components/qualityControls/ScoreCriteriaView.js +34 -53
- package/src/components/qualityControls/__tests__/ControlProperties.spec.js +6 -6
- package/src/components/qualityControls/__tests__/ControlPropertiesView.spec.js +5 -5
- package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +15 -2
- package/src/components/qualityControls/__tests__/QualityBadge.spec.js +6 -6
- package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +1 -1
- package/src/components/qualityControls/__tests__/QualityControlQueryModal.spec.js +1 -1
- package/src/components/qualityControls/__tests__/ScoreCriteria.spec.js +3 -3
- package/src/components/qualityControls/__tests__/ScoreCriteriaView.spec.js +18 -2
- package/src/components/qualityControls/__tests__/__fixtures__/qualityControlHelper.js +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/ControlProperties.spec.js.snap +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/ControlPropertiesView.spec.js.snap +53 -53
- package/src/components/qualityControls/__tests__/__snapshots__/EditQualityControl.spec.js.snap +14 -1
- package/src/components/qualityControls/__tests__/__snapshots__/NewDraftQualityControl.spec.js.snap +14 -1
- package/src/components/qualityControls/__tests__/__snapshots__/NewQualityControl.spec.js.snap +14 -1
- package/src/components/qualityControls/__tests__/__snapshots__/QualityBadge.spec.js.snap +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControl.spec.js.snap +2 -4
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlEditor.spec.js.snap +28 -2
- package/src/components/qualityControls/__tests__/__snapshots__/ScoreCriteria.spec.js.snap +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/ScoreCriteriaView.spec.js.snap +2 -4
- package/src/components/qualityControls/__tests__/qualityByControlMode.spec.js +16 -16
- package/src/components/qualityControls/controlProperties/{ErrorCount.js → Count.js} +2 -2
- package/src/components/qualityControls/controlProperties/__tests__/{ErrorCount.spec.js → Count.spec.js} +3 -14
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/{ErrorCount.spec.js.snap → Count.spec.js.snap} +5 -5
- package/src/components/qualityControls/qualityByControlMode.js +29 -6
- package/src/components/qualityControls/scoreCriterias/Count.js +88 -0
- package/src/components/qualityControls/scoreCriterias/ErrorCount.js +1 -0
- package/src/components/qualityControls/scoreCriterias/__tests__/Count.spec.js +62 -0
- package/src/components/qualityControls/scoreCriterias/__tests__/ErrorCount.spec.js +16 -4
- package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/Count.spec.js.snap +58 -0
- package/src/components/scores/__tests__/MyScoreGroups.spec.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/qx",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.9",
|
|
4
4
|
"description": "Truedat Web Quality Experience package",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/react-hooks": "^8.0.1",
|
|
37
37
|
"@testing-library/user-event": "^13.2.1",
|
|
38
|
-
"@truedat/test": "7.5.
|
|
38
|
+
"@truedat/test": "7.5.9",
|
|
39
39
|
"babel-jest": "^28.1.0",
|
|
40
40
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
41
41
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
]
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@truedat/core": "7.5.
|
|
93
|
+
"@truedat/core": "7.5.9",
|
|
94
94
|
"prop-types": "^15.8.1",
|
|
95
95
|
"react-hook-form": "^7.45.4",
|
|
96
96
|
"react-intl": "^5.20.10",
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
"overrides": {
|
|
107
107
|
"jsdom": "26.0.0"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "03770e3241daa955de2e6e40fdaea91e3d147860"
|
|
110
110
|
}
|
|
@@ -59,17 +59,16 @@ export const messages = {
|
|
|
59
59
|
"quality_control.actions.execution.confirmation.content":
|
|
60
60
|
"This quality control will be executed. Are you sure?",
|
|
61
61
|
"quality_control.control_properties.empty": "Empty control properties",
|
|
62
|
-
"quality_control.
|
|
62
|
+
"quality_control.count.errors_resource.empty": "Empty Dataset",
|
|
63
63
|
"quality_control.control_mode.deviation": "Deviation",
|
|
64
|
-
"quality_control.control_mode.
|
|
64
|
+
"quality_control.control_mode.count": "count",
|
|
65
65
|
"quality_control.control_mode.percentage": "Percentage",
|
|
66
66
|
"quality_control.control_mode": "Control mode",
|
|
67
|
-
"quality_control.
|
|
67
|
+
"quality_control.count.errors_resource": "Dataset",
|
|
68
68
|
"quality_control.form.active": "Enable",
|
|
69
69
|
"quality_control.form.control_properties.ratio.resource": "Dataset",
|
|
70
70
|
"quality_control.form.control_properties.ratio.validation": "Validation",
|
|
71
|
-
"quality_control.form.control_properties.
|
|
72
|
-
"Dataset",
|
|
71
|
+
"quality_control.form.control_properties.count.errors_resource": "Dataset",
|
|
73
72
|
"quality_control.form.control_properties": "Implementation",
|
|
74
73
|
"quality_control.form.domain_ids": "Domains",
|
|
75
74
|
"quality_control.form.information": "Information",
|
|
@@ -83,8 +82,8 @@ export const messages = {
|
|
|
83
82
|
"quality_control.score_criteria.deviation.goal": "Goal",
|
|
84
83
|
"quality_control.score_criteria.deviation.maximum": "Threshold",
|
|
85
84
|
"quality_control.score_criteria.empty": "No result criteria defined",
|
|
86
|
-
"quality_control.score_criteria.
|
|
87
|
-
"quality_control.score_criteria.
|
|
85
|
+
"quality_control.score_criteria.count.goal": "Goal",
|
|
86
|
+
"quality_control.score_criteria.count.maximum": "Threshold",
|
|
88
87
|
"quality_control.score_criteria.percentage.goal": "Goal",
|
|
89
88
|
"quality_control.score_criteria.percentage.minimum": "Threshold",
|
|
90
89
|
"quality_control.score_criteria": "Result criteria",
|
|
@@ -21,19 +21,18 @@ const renderOpts = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
describe("<Expression />", () => {
|
|
24
|
-
it("matches the latest snapshot", () => {
|
|
25
|
-
const { container } = render(
|
|
24
|
+
it("matches the latest snapshot", async () => {
|
|
25
|
+
const { container, queryByText } = render(
|
|
26
26
|
<TestFormWrapper>
|
|
27
27
|
<Expression />
|
|
28
28
|
</TestFormWrapper>,
|
|
29
29
|
renderOpts
|
|
30
30
|
);
|
|
31
|
+
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
31
32
|
expect(container).toMatchSnapshot();
|
|
32
33
|
});
|
|
33
|
-
|
|
34
34
|
it("shape function expression", async () => {
|
|
35
35
|
const watcher = jest.fn();
|
|
36
|
-
|
|
37
36
|
const functions = [
|
|
38
37
|
{
|
|
39
38
|
name: "eq",
|
|
@@ -44,13 +43,11 @@ describe("<Expression />", () => {
|
|
|
44
43
|
],
|
|
45
44
|
},
|
|
46
45
|
];
|
|
47
|
-
|
|
48
46
|
const defaultValues = {
|
|
49
47
|
test: {
|
|
50
48
|
shape: "function",
|
|
51
49
|
},
|
|
52
50
|
};
|
|
53
|
-
|
|
54
51
|
const { container, getByRole, getAllByRole, queryByText } = render(
|
|
55
52
|
<TestFormWrapper
|
|
56
53
|
watcher={watcher}
|
|
@@ -63,13 +60,9 @@ describe("<Expression />", () => {
|
|
|
63
60
|
);
|
|
64
61
|
const listboxes = await waitFor(() => getAllByRole("listbox"));
|
|
65
62
|
const listbox = listboxes[0];
|
|
66
|
-
|
|
67
63
|
userEvent.click(listbox);
|
|
68
|
-
|
|
69
64
|
const option = await waitFor(() => getByRole("option", { name: /eq/i }));
|
|
70
|
-
|
|
71
65
|
userEvent.click(option);
|
|
72
|
-
|
|
73
66
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
74
67
|
test: {
|
|
75
68
|
shape: "function",
|
|
@@ -80,13 +73,10 @@ describe("<Expression />", () => {
|
|
|
80
73
|
},
|
|
81
74
|
});
|
|
82
75
|
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
83
|
-
|
|
84
76
|
expect(container).toMatchSnapshot();
|
|
85
77
|
});
|
|
86
|
-
|
|
87
78
|
it("shape constant expression", async () => {
|
|
88
79
|
const watcher = jest.fn();
|
|
89
|
-
|
|
90
80
|
const { container, getByRole, getAllByRole, queryByText } = render(
|
|
91
81
|
<TestFormWrapper watcher={watcher} context={{ type: "boolean" }}>
|
|
92
82
|
<Expression />
|
|
@@ -95,7 +85,6 @@ describe("<Expression />", () => {
|
|
|
95
85
|
);
|
|
96
86
|
userEvent.click(getAllByRole("listbox")[0]);
|
|
97
87
|
userEvent.click(getByRole("option", { name: /constant/i }));
|
|
98
|
-
|
|
99
88
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
100
89
|
test: {
|
|
101
90
|
shape: "constant",
|
|
@@ -104,21 +93,16 @@ describe("<Expression />", () => {
|
|
|
104
93
|
},
|
|
105
94
|
},
|
|
106
95
|
});
|
|
107
|
-
|
|
108
96
|
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument(), {
|
|
109
97
|
timeout: 10000,
|
|
110
98
|
});
|
|
111
|
-
|
|
112
99
|
expect(container).toMatchSnapshot();
|
|
113
100
|
});
|
|
114
|
-
|
|
115
101
|
it("shape param expression", async () => {
|
|
116
102
|
const watcher = jest.fn();
|
|
117
|
-
|
|
118
103
|
const defaultValues = {
|
|
119
104
|
params: [{ name: "param1", type: "boolean", id: 1 }],
|
|
120
105
|
};
|
|
121
|
-
|
|
122
106
|
const { container, getByRole, getAllByRole, queryByText } = render(
|
|
123
107
|
<TestFormWrapper
|
|
124
108
|
watcher={watcher}
|
|
@@ -131,16 +115,13 @@ describe("<Expression />", () => {
|
|
|
131
115
|
);
|
|
132
116
|
userEvent.click(getAllByRole("listbox")[0]);
|
|
133
117
|
userEvent.click(getByRole("option", { name: /param/i }));
|
|
134
|
-
|
|
135
118
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
136
119
|
params: [{ name: "param1", type: "boolean", id: 1 }],
|
|
137
120
|
test: { shape: "param", value: { id: undefined } },
|
|
138
121
|
});
|
|
139
|
-
|
|
140
122
|
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument(), {
|
|
141
123
|
timeout: 10000,
|
|
142
124
|
});
|
|
143
|
-
|
|
144
125
|
expect(container).toMatchSnapshot();
|
|
145
126
|
});
|
|
146
127
|
});
|
|
@@ -17,26 +17,27 @@ const renderOpts = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
describe("<ShapeSelector />", () => {
|
|
20
|
-
it("matches the latest snapshot", () => {
|
|
20
|
+
it("matches the latest snapshot", async () => {
|
|
21
21
|
const defaultValues = {
|
|
22
22
|
params: [{ name: "param1", type: "boolean", id: 1 }],
|
|
23
23
|
};
|
|
24
|
-
const { container } = render(
|
|
24
|
+
const { container, queryByText } = render(
|
|
25
25
|
<TestFormWrapper defaultValues={defaultValues}>
|
|
26
26
|
<ShapeSelector />
|
|
27
27
|
</TestFormWrapper>,
|
|
28
28
|
renderOpts
|
|
29
29
|
);
|
|
30
|
+
|
|
31
|
+
await waitFor(() =>
|
|
32
|
+
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
33
|
+
);
|
|
30
34
|
expect(container).toMatchSnapshot();
|
|
31
35
|
});
|
|
32
|
-
|
|
33
36
|
it("user interaction select param", async () => {
|
|
34
37
|
const watcher = jest.fn();
|
|
35
|
-
|
|
36
38
|
const defaultValues = {
|
|
37
39
|
params: [{ name: "param1", type: "boolean", id: 1 }],
|
|
38
40
|
};
|
|
39
|
-
|
|
40
41
|
const { container, queryByText, getByRole } = render(
|
|
41
42
|
<TestFormWrapper
|
|
42
43
|
watcher={watcher}
|
|
@@ -50,9 +51,7 @@ describe("<ShapeSelector />", () => {
|
|
|
50
51
|
await waitFor(() =>
|
|
51
52
|
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
52
53
|
);
|
|
53
|
-
|
|
54
54
|
userEvent.click(await getByRole("option", { name: /param/i }));
|
|
55
|
-
|
|
56
55
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
57
56
|
params: [
|
|
58
57
|
{
|
|
@@ -63,13 +62,10 @@ describe("<ShapeSelector />", () => {
|
|
|
63
62
|
],
|
|
64
63
|
test: { shape: "param", value: { isCondition: undefined } },
|
|
65
64
|
});
|
|
66
|
-
|
|
67
65
|
expect(container).toMatchSnapshot();
|
|
68
66
|
});
|
|
69
|
-
|
|
70
67
|
it("user interaction select constant", async () => {
|
|
71
68
|
const watcher = jest.fn();
|
|
72
|
-
|
|
73
69
|
const { container, queryByText, getByRole } = render(
|
|
74
70
|
<TestFormWrapper watcher={watcher} context={{ type: "boolean" }}>
|
|
75
71
|
<ShapeSelector />
|
|
@@ -79,19 +75,14 @@ describe("<ShapeSelector />", () => {
|
|
|
79
75
|
await waitFor(() =>
|
|
80
76
|
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
81
77
|
);
|
|
82
|
-
|
|
83
78
|
userEvent.click(await getByRole("option", { name: /constant/i }));
|
|
84
|
-
|
|
85
79
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
86
80
|
test: { shape: "constant", value: { isCondition: undefined } },
|
|
87
81
|
});
|
|
88
|
-
|
|
89
82
|
expect(container).toMatchSnapshot();
|
|
90
83
|
});
|
|
91
|
-
|
|
92
84
|
it("user interaction select function", async () => {
|
|
93
85
|
const watcher = jest.fn();
|
|
94
|
-
|
|
95
86
|
const { container, queryByText, getByRole } = render(
|
|
96
87
|
<TestFormWrapper watcher={watcher} context={{ type: "boolean" }}>
|
|
97
88
|
<ShapeSelector />
|
|
@@ -101,13 +92,10 @@ describe("<ShapeSelector />", () => {
|
|
|
101
92
|
await waitFor(() =>
|
|
102
93
|
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
103
94
|
);
|
|
104
|
-
|
|
105
95
|
userEvent.click(await getByRole("option", { name: /function/i }));
|
|
106
|
-
|
|
107
96
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
108
97
|
test: { shape: "function", value: { isCondition: undefined } },
|
|
109
98
|
});
|
|
110
|
-
|
|
111
99
|
expect(container).toMatchSnapshot();
|
|
112
100
|
});
|
|
113
101
|
});
|
|
@@ -46,7 +46,6 @@ describe("<SelectField />", () => {
|
|
|
46
46
|
);
|
|
47
47
|
expect(container).toMatchSnapshot();
|
|
48
48
|
});
|
|
49
|
-
|
|
50
49
|
it("matches the latest snapshot for group_by", async () => {
|
|
51
50
|
const { container, queryByText } = render(
|
|
52
51
|
<TestFormWrapper
|
|
@@ -75,7 +74,6 @@ describe("<SelectField />", () => {
|
|
|
75
74
|
);
|
|
76
75
|
expect(container).toMatchSnapshot();
|
|
77
76
|
});
|
|
78
|
-
|
|
79
77
|
it("handles delete", async () => {
|
|
80
78
|
const onDelete = jest.fn();
|
|
81
79
|
const { getByRole, getAllByRole } = render(
|
|
@@ -100,15 +98,12 @@ describe("<SelectField />", () => {
|
|
|
100
98
|
</TestFormWrapper>,
|
|
101
99
|
renderOpts
|
|
102
100
|
);
|
|
103
|
-
|
|
104
101
|
userEvent.hover(getAllByRole("textbox")[0]);
|
|
105
102
|
userEvent.unhover(getAllByRole("textbox")[0]);
|
|
106
103
|
userEvent.hover(getAllByRole("textbox")[0]);
|
|
107
|
-
|
|
108
104
|
await act(async () => {
|
|
109
105
|
userEvent.click(getByRole("button", { name: /delete/i }));
|
|
110
106
|
});
|
|
111
|
-
|
|
112
107
|
expect(onDelete).toHaveBeenCalledTimes(1);
|
|
113
108
|
});
|
|
114
109
|
});
|
|
@@ -2,7 +2,7 @@ import React, { useContext } from "react";
|
|
|
2
2
|
import { useFormContext } from "react-hook-form";
|
|
3
3
|
import { Segment } from "semantic-ui-react";
|
|
4
4
|
import QxContext from "@truedat/qx/components/QxContext";
|
|
5
|
-
import
|
|
5
|
+
import Count from "./controlProperties/Count";
|
|
6
6
|
import Ratio from "./controlProperties/Ratio";
|
|
7
7
|
|
|
8
8
|
export default function ControlProperties() {
|
|
@@ -12,8 +12,9 @@ export default function ControlProperties() {
|
|
|
12
12
|
const { control_mode: controlMode, source_id: sourceId } = watch();
|
|
13
13
|
|
|
14
14
|
const componentForMode = {
|
|
15
|
-
|
|
15
|
+
count: <Count />,
|
|
16
16
|
deviation: <Ratio />,
|
|
17
|
+
error_count: <Ratio />,
|
|
17
18
|
percentage: <Ratio />,
|
|
18
19
|
};
|
|
19
20
|
|
|
@@ -28,7 +29,7 @@ export default function ControlProperties() {
|
|
|
28
29
|
|
|
29
30
|
export const defaultForMode = (controlMode) => {
|
|
30
31
|
switch (controlMode) {
|
|
31
|
-
case "
|
|
32
|
+
case "count":
|
|
32
33
|
return { errors_resource: null };
|
|
33
34
|
default:
|
|
34
35
|
return {
|
|
@@ -14,8 +14,9 @@ export default function ControlPropertiesView({ qualityControl }) {
|
|
|
14
14
|
deviation: (
|
|
15
15
|
<ControlPropertiesRatio controlProperties={control_properties} />
|
|
16
16
|
),
|
|
17
|
+
count: <ControlPropertiesCount controlProperties={control_properties} />,
|
|
17
18
|
error_count: (
|
|
18
|
-
<
|
|
19
|
+
<ControlPropertiesRatio controlProperties={control_properties} />
|
|
19
20
|
),
|
|
20
21
|
};
|
|
21
22
|
|
|
@@ -78,11 +79,11 @@ const ControlPropertiesRatio = ({ controlProperties }) => (
|
|
|
78
79
|
</List>
|
|
79
80
|
);
|
|
80
81
|
|
|
81
|
-
const
|
|
82
|
+
const ControlPropertiesCount = ({ controlProperties }) => (
|
|
82
83
|
<List>
|
|
83
84
|
<List.Item>
|
|
84
85
|
<List.Header>
|
|
85
|
-
<FormattedMessage id="quality_control.
|
|
86
|
+
<FormattedMessage id="quality_control.count.errors_resource" />
|
|
86
87
|
</List.Header>
|
|
87
88
|
<List.Content>
|
|
88
89
|
{controlProperties.errors_resource ? (
|
|
@@ -97,7 +98,7 @@ const ControlPropertiesErrorCount = ({ controlProperties }) => (
|
|
|
97
98
|
</Label>
|
|
98
99
|
</List.Description>
|
|
99
100
|
) : (
|
|
100
|
-
<FormattedMessage id="quality_control.
|
|
101
|
+
<FormattedMessage id="quality_control.count.errors_resource.empty" />
|
|
101
102
|
)}
|
|
102
103
|
</List.Content>
|
|
103
104
|
</List.Item>
|
|
@@ -76,11 +76,20 @@ export const QualityBadgeForSearch = ({
|
|
|
76
76
|
value2: criteria.maximum,
|
|
77
77
|
text: `${latestScore.result}%`,
|
|
78
78
|
}
|
|
79
|
-
:
|
|
79
|
+
: controlMode == "error_count"
|
|
80
|
+
? {
|
|
80
81
|
color: color,
|
|
81
82
|
label1: "quality_control.score_criteria.error_count.goal",
|
|
82
|
-
value1: criteria
|
|
83
|
+
value1: criteria.goal,
|
|
83
84
|
label2: "quality_control.score_criteria.error_count.maximum",
|
|
85
|
+
value2: criteria.maximum,
|
|
86
|
+
text: latestScore?.result,
|
|
87
|
+
}
|
|
88
|
+
: {
|
|
89
|
+
color: color,
|
|
90
|
+
label1: "quality_control.score_criteria.count.goal",
|
|
91
|
+
value1: criteria?.goal,
|
|
92
|
+
label2: "quality_control.score_criteria.count.maximum",
|
|
84
93
|
value2: criteria?.maximum,
|
|
85
94
|
text: latestScore?.result,
|
|
86
95
|
};
|
|
@@ -70,7 +70,7 @@ export default function QualityControlEditor({
|
|
|
70
70
|
key: v,
|
|
71
71
|
value: v,
|
|
72
72
|
text: formatMessage({ id: `quality_control.control_mode.${v}` }),
|
|
73
|
-
}))(["percentage", "deviation", "error_count"]);
|
|
73
|
+
}))(["percentage", "deviation", "error_count", "count"]);
|
|
74
74
|
|
|
75
75
|
return (
|
|
76
76
|
<Fragment>
|
|
@@ -5,6 +5,7 @@ import QxContext from "@truedat/qx/components/QxContext";
|
|
|
5
5
|
|
|
6
6
|
import Deviation from "./scoreCriterias/Deviation";
|
|
7
7
|
import ErrorCount from "./scoreCriterias/ErrorCount";
|
|
8
|
+
import Count from "./scoreCriterias/Count";
|
|
8
9
|
import Percentage from "./scoreCriterias/Percentage";
|
|
9
10
|
|
|
10
11
|
export default function ScoreCriteria() {
|
|
@@ -15,6 +16,7 @@ export default function ScoreCriteria() {
|
|
|
15
16
|
|
|
16
17
|
const scoreCriteriaForMode = {
|
|
17
18
|
deviation: <Deviation />,
|
|
19
|
+
count: <Count />,
|
|
18
20
|
error_count: <ErrorCount />,
|
|
19
21
|
percentage: <Percentage />,
|
|
20
22
|
};
|
|
@@ -32,6 +34,8 @@ export const defaultForMode = (controlMode) => {
|
|
|
32
34
|
switch (controlMode) {
|
|
33
35
|
case "deviation":
|
|
34
36
|
return { goal: null, maximum: null };
|
|
37
|
+
case "count":
|
|
38
|
+
return { goal: null, maximum: null };
|
|
35
39
|
case "error_count":
|
|
36
40
|
return { goal: null, maximum: null };
|
|
37
41
|
case "percentage":
|
|
@@ -5,10 +5,32 @@ import { Header, Icon, Segment, List } from "semantic-ui-react";
|
|
|
5
5
|
|
|
6
6
|
export default function ScoreCriteriaView({ qualityControl }) {
|
|
7
7
|
const { score_criteria, control_mode } = qualityControl;
|
|
8
|
+
|
|
8
9
|
const scoreCriteriaForMode = {
|
|
9
|
-
percentage:
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
percentage: (
|
|
11
|
+
<ScoreCriteriaContent
|
|
12
|
+
goal={`${score_criteria?.goal}%`}
|
|
13
|
+
threshold={`${score_criteria?.minimum}%`}
|
|
14
|
+
/>
|
|
15
|
+
),
|
|
16
|
+
deviation: (
|
|
17
|
+
<ScoreCriteriaContent
|
|
18
|
+
goal={`${score_criteria?.goal}%`}
|
|
19
|
+
threshold={`${score_criteria?.maximum}%`}
|
|
20
|
+
/>
|
|
21
|
+
),
|
|
22
|
+
error_count: (
|
|
23
|
+
<ScoreCriteriaContent
|
|
24
|
+
goal={score_criteria?.goal}
|
|
25
|
+
threshold={score_criteria?.maximum}
|
|
26
|
+
/>
|
|
27
|
+
),
|
|
28
|
+
count: (
|
|
29
|
+
<ScoreCriteriaContent
|
|
30
|
+
goal={score_criteria?.goal}
|
|
31
|
+
threshold={score_criteria?.maximum}
|
|
32
|
+
/>
|
|
33
|
+
),
|
|
12
34
|
};
|
|
13
35
|
|
|
14
36
|
return (
|
|
@@ -30,53 +52,11 @@ export default function ScoreCriteriaView({ qualityControl }) {
|
|
|
30
52
|
);
|
|
31
53
|
}
|
|
32
54
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<Icon name="circle" color="green" />
|
|
37
|
-
<List.Content>
|
|
38
|
-
<List.Header>
|
|
39
|
-
<FormattedMessage id="quality.goal" />
|
|
40
|
-
</List.Header>
|
|
41
|
-
<List.Description>{scoreCriteria.goal}%</List.Description>
|
|
42
|
-
</List.Content>
|
|
43
|
-
</List.Item>
|
|
44
|
-
<List.Item>
|
|
45
|
-
<Icon name="circle" color="yellow" />
|
|
46
|
-
<List.Content>
|
|
47
|
-
<List.Header>
|
|
48
|
-
<FormattedMessage id="quality.threshold" />
|
|
49
|
-
</List.Header>
|
|
50
|
-
<List.Description>{scoreCriteria.minimum}%</List.Description>
|
|
51
|
-
</List.Content>
|
|
52
|
-
</List.Item>
|
|
53
|
-
</List>
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const ScoreCriteriaDeviation = ({ scoreCriteria }) => (
|
|
57
|
-
<List>
|
|
58
|
-
<List.Item>
|
|
59
|
-
<Icon name="circle" color="green" />
|
|
60
|
-
<List.Content>
|
|
61
|
-
<List.Header>
|
|
62
|
-
<FormattedMessage id="quality.goal" />
|
|
63
|
-
</List.Header>
|
|
64
|
-
<List.Description>{scoreCriteria.goal}%</List.Description>
|
|
65
|
-
</List.Content>
|
|
66
|
-
</List.Item>
|
|
67
|
-
<List.Item>
|
|
68
|
-
<Icon name="circle" color="yellow" />
|
|
69
|
-
<List.Content>
|
|
70
|
-
<List.Header>
|
|
71
|
-
<FormattedMessage id="quality.threshold" />
|
|
72
|
-
</List.Header>
|
|
73
|
-
<List.Description>{scoreCriteria.maximum}%</List.Description>
|
|
74
|
-
</List.Content>
|
|
75
|
-
</List.Item>
|
|
76
|
-
</List>
|
|
77
|
-
);
|
|
55
|
+
ScoreCriteriaView.propTypes = {
|
|
56
|
+
qualityControl: PropTypes.object,
|
|
57
|
+
};
|
|
78
58
|
|
|
79
|
-
const
|
|
59
|
+
const ScoreCriteriaContent = ({ goal, threshold }) => (
|
|
80
60
|
<List>
|
|
81
61
|
<List.Item>
|
|
82
62
|
<Icon name="circle" color="green" />
|
|
@@ -84,7 +64,7 @@ const ScoreCriteriaErrorCount = ({ scoreCriteria }) => (
|
|
|
84
64
|
<List.Header>
|
|
85
65
|
<FormattedMessage id="quality.goal" />
|
|
86
66
|
</List.Header>
|
|
87
|
-
<List.Description>{
|
|
67
|
+
<List.Description>{goal}</List.Description>
|
|
88
68
|
</List.Content>
|
|
89
69
|
</List.Item>
|
|
90
70
|
<List.Item>
|
|
@@ -93,12 +73,13 @@ const ScoreCriteriaErrorCount = ({ scoreCriteria }) => (
|
|
|
93
73
|
<List.Header>
|
|
94
74
|
<FormattedMessage id="quality.threshold" />
|
|
95
75
|
</List.Header>
|
|
96
|
-
<List.Description>{
|
|
76
|
+
<List.Description>{threshold}</List.Description>
|
|
97
77
|
</List.Content>
|
|
98
78
|
</List.Item>
|
|
99
79
|
</List>
|
|
100
80
|
);
|
|
101
81
|
|
|
102
|
-
|
|
103
|
-
|
|
82
|
+
ScoreCriteriaContent.propTypes = {
|
|
83
|
+
goal: PropTypes.string,
|
|
84
|
+
threshold: PropTypes.string,
|
|
104
85
|
};
|
|
@@ -48,13 +48,13 @@ describe("<ControlProperties />", () => {
|
|
|
48
48
|
expect(container).toMatchSnapshot();
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
it("matches the latest snapshot with
|
|
52
|
-
const
|
|
51
|
+
it("matches the latest snapshot with count", async () => {
|
|
52
|
+
const countDefaultValues = {
|
|
53
53
|
...defaultValues,
|
|
54
|
-
control_mode: "
|
|
54
|
+
control_mode: "count",
|
|
55
55
|
};
|
|
56
56
|
const { container } = render(
|
|
57
|
-
<TestFormWrapper defaultValues={
|
|
57
|
+
<TestFormWrapper defaultValues={countDefaultValues}>
|
|
58
58
|
<ControlProperties />
|
|
59
59
|
</TestFormWrapper>,
|
|
60
60
|
renderOpts
|
|
@@ -67,8 +67,8 @@ describe("<ControlProperties />", () => {
|
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
describe("defaultForMode", () => {
|
|
70
|
-
it("returns correct default for '
|
|
71
|
-
const result = defaultForMode("
|
|
70
|
+
it("returns correct default for 'count' control mode", () => {
|
|
71
|
+
const result = defaultForMode("count");
|
|
72
72
|
expect(result).toEqual({ errors_resource: null });
|
|
73
73
|
});
|
|
74
74
|
|
|
@@ -20,10 +20,10 @@ describe("<ControlPropertiesView />", () => {
|
|
|
20
20
|
expect(container).toMatchSnapshot();
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
it("matches the latest snapshot for
|
|
24
|
-
const
|
|
23
|
+
it("matches the latest snapshot for count", async () => {
|
|
24
|
+
const countQualityControl = {
|
|
25
25
|
...qualityControl,
|
|
26
|
-
control_mode: "
|
|
26
|
+
control_mode: "count",
|
|
27
27
|
control_properties: {
|
|
28
28
|
errors_resource: {
|
|
29
29
|
id: 11859650,
|
|
@@ -33,7 +33,7 @@ describe("<ControlPropertiesView />", () => {
|
|
|
33
33
|
};
|
|
34
34
|
const { container } = render(
|
|
35
35
|
<TestFormWrapper>
|
|
36
|
-
<ControlPropertiesView qualityControl={
|
|
36
|
+
<ControlPropertiesView qualityControl={countQualityControl} />
|
|
37
37
|
</TestFormWrapper>,
|
|
38
38
|
renderOpts
|
|
39
39
|
);
|
|
@@ -58,7 +58,7 @@ describe("<ControlPropertiesView />", () => {
|
|
|
58
58
|
<ControlPropertiesView
|
|
59
59
|
qualityControl={{
|
|
60
60
|
...qualityControl,
|
|
61
|
-
control_mode: "
|
|
61
|
+
control_mode: "count",
|
|
62
62
|
control_properties: { errors_resource: null },
|
|
63
63
|
}}
|
|
64
64
|
/>
|
|
@@ -65,6 +65,11 @@ const referenceDatasetsMock = {
|
|
|
65
65
|
name: "dataset1",
|
|
66
66
|
headers: ["campo1", "campo2"],
|
|
67
67
|
},
|
|
68
|
+
{
|
|
69
|
+
id: "8",
|
|
70
|
+
name: "patito",
|
|
71
|
+
headers: ["pasto1", "pasto2"],
|
|
72
|
+
},
|
|
68
73
|
],
|
|
69
74
|
loading: false,
|
|
70
75
|
},
|
|
@@ -190,6 +195,13 @@ describe("<NewQualityControl />", () => {
|
|
|
190
195
|
userEvent.click(getByText(/Reference datasets/));
|
|
191
196
|
userEvent.click(getByRole("option", { name: /dataset1/i }));
|
|
192
197
|
|
|
198
|
+
await waitFor(() =>
|
|
199
|
+
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
200
|
+
);
|
|
201
|
+
await waitFor(() =>
|
|
202
|
+
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
203
|
+
);
|
|
204
|
+
|
|
193
205
|
userEvent.click(getAllByRole("option", { name: /campo1/i })[0]);
|
|
194
206
|
userEvent.click(getByRole("option", { name: /eq/i }));
|
|
195
207
|
userEvent.click(getAllByRole("option", { name: /campo2/i })[1]);
|
|
@@ -314,9 +326,10 @@ describe("<NewQualityControl />", () => {
|
|
|
314
326
|
|
|
315
327
|
// Select a source
|
|
316
328
|
userEvent.click(getByText(/Select source/));
|
|
329
|
+
|
|
317
330
|
userEvent.click(getByRole("option", { name: /external_source_id/i }));
|
|
318
331
|
|
|
319
|
-
userEvent.click(getByRole("option", { name:
|
|
332
|
+
userEvent.click(getByRole("option", { name: /^count$/i }));
|
|
320
333
|
|
|
321
334
|
// Fill in the 'Goal' field
|
|
322
335
|
userEvent.type(getByPlaceholderText("Goal"), "25");
|
|
@@ -348,7 +361,7 @@ describe("<NewQualityControl />", () => {
|
|
|
348
361
|
domain_ids: ["2"],
|
|
349
362
|
df_type: "template1",
|
|
350
363
|
source_id: 181,
|
|
351
|
-
control_mode: "
|
|
364
|
+
control_mode: "count",
|
|
352
365
|
dynamic_content: {},
|
|
353
366
|
control_properties: {
|
|
354
367
|
errors_resource: {
|