@truedat/qx 7.0.8 → 7.1.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 +13 -4
- package/src/api.js +29 -20
- package/src/components/QxRoutes.js +18 -16
- package/src/components/__tests__/__fixtures__/helper.js +187 -0
- package/src/components/common/TestFormWrapper.js +38 -0
- package/src/components/common/__tests__/ResourceSelector.spec.js +18 -7
- package/src/components/common/__tests__/__snapshots__/ResourceSelector.spec.js.snap +0 -12
- package/src/components/common/expressions/__tests__/Condition.spec.js +4 -1
- package/src/components/common/expressions/__tests__/FunctionArgs.spec.js +18 -5
- package/src/components/common/expressions/__tests__/ShapeSelector.spec.js +4 -4
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionArgs.spec.js.snap +10 -2
- package/src/components/common/resourceSelectors/__tests__/DataStructureSelector.spec.js +6 -3
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataStructureSelector.spec.js.snap +0 -12
- package/src/components/dataViews/__tests__/DataViewEditor.spec.js +83 -53
- package/src/components/dataViews/__tests__/DataViews.spec.js +14 -1
- package/src/components/dataViews/__tests__/__snapshots__/DataViewEditor.spec.js.snap +93 -4
- package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +13 -6
- package/src/components/functions/__tests__/FunctionEditor.spec.js +2 -34
- package/src/components/functions/__tests__/FunctionParams.spec.js +4 -17
- package/src/components/functions/__tests__/Functions.spec.js +2 -34
- package/src/components/functions/__tests__/__snapshots__/FunctionEditor.spec.js.snap +48 -48
- package/src/components/functions/__tests__/__snapshots__/FunctionParams.spec.js.snap +4 -4
- package/src/components/functions/__tests__/__snapshots__/Functions.spec.js.snap +4 -4
- package/src/components/qualityControls/ControlProperties.js +43 -0
- package/src/components/qualityControls/ControlPropertiesView.js +109 -0
- package/src/components/qualityControls/EditQualityControl.js +5 -21
- package/src/components/qualityControls/IconPopup.js +28 -0
- package/src/components/qualityControls/NewDraftQualityControl.js +4 -13
- package/src/components/qualityControls/NewQualityControl.js +10 -25
- package/src/components/qualityControls/QualityBadge.js +33 -0
- package/src/components/qualityControls/QualityControl.js +11 -53
- package/src/components/qualityControls/QualityControlActions.js +133 -46
- package/src/components/qualityControls/QualityControlEditor.js +114 -135
- package/src/components/qualityControls/QualityControlHeader.js +29 -7
- package/src/components/qualityControls/QualityControlHistory.js +6 -12
- package/src/components/qualityControls/QualityControlQueryModal.js +8 -5
- package/src/components/qualityControls/QualityControlRoutes.js +51 -96
- package/src/components/qualityControls/QualityControlRow.js +21 -2
- package/src/components/qualityControls/QualityControlScores.js +140 -0
- package/src/components/qualityControls/QualityControlTabs.js +24 -23
- package/src/components/qualityControls/QualityControls.js +142 -59
- package/src/components/qualityControls/QualityControlsLabelResults.js +51 -0
- package/src/components/qualityControls/QualityControlsTable.js +69 -43
- package/src/components/qualityControls/ScoreCriteria.js +40 -0
- package/src/components/qualityControls/{ResultCriteria.js → ScoreCriteriaView.js} +26 -42
- package/src/components/qualityControls/__tests__/ControlProperties.spec.js +86 -0
- package/src/components/qualityControls/__tests__/ControlPropertiesView.spec.js +86 -0
- package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +219 -0
- package/src/components/qualityControls/__tests__/IconPopup.spec.js +33 -0
- package/src/components/qualityControls/__tests__/NewDraftQualityControl.spec.js +253 -0
- package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +384 -0
- package/src/components/qualityControls/__tests__/QualityBadge.spec.js +30 -0
- package/src/components/qualityControls/__tests__/QualityControl.spec.js +47 -0
- package/src/components/qualityControls/__tests__/QualityControlActions.spec.js +192 -0
- package/src/components/qualityControls/__tests__/QualityControlCrumbs.spec.js +18 -0
- package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +296 -0
- package/src/components/qualityControls/__tests__/QualityControlHeader.spec.js +68 -0
- package/src/components/qualityControls/__tests__/QualityControlHistory.spec.js +21 -0
- package/src/components/qualityControls/__tests__/QualityControlQueryModal.spec.js +77 -0
- package/src/components/qualityControls/__tests__/QualityControlRow.spec.js +91 -0
- package/src/components/qualityControls/__tests__/QualityControlScores.spec.js +139 -0
- package/src/components/qualityControls/__tests__/QualityControlTabs.spec.js +20 -0
- package/src/components/qualityControls/__tests__/QualityControls.spec.js +202 -0
- package/src/components/qualityControls/__tests__/QualityControlsLabelResults.spec.js +83 -0
- package/src/components/qualityControls/__tests__/QualityControlsTable.spec.js +38 -0
- package/src/components/qualityControls/__tests__/ScoreCriteria.spec.js +77 -0
- package/src/components/qualityControls/__tests__/ScoreCriteriaView.spec.js +62 -0
- package/src/components/qualityControls/__tests__/__fixtures__/qualityControlHelper.js +281 -0
- package/src/components/qualityControls/__tests__/__snapshots__/ControlProperties.spec.js.snap +151 -0
- package/src/components/qualityControls/__tests__/__snapshots__/ControlPropertiesView.spec.js.snap +290 -0
- package/src/components/qualityControls/__tests__/__snapshots__/EditQualityControl.spec.js.snap +672 -0
- package/src/components/qualityControls/__tests__/__snapshots__/IconPopup.spec.js.snap +10 -0
- package/src/components/qualityControls/__tests__/__snapshots__/NewDraftQualityControl.spec.js.snap +648 -0
- package/src/components/qualityControls/__tests__/__snapshots__/NewQualityControl.spec.js.snap +336 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityBadge.spec.js.snap +11 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControl.spec.js.snap +255 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlActions.spec.js.snap +85 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlCrumbs.spec.js.snap +25 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlEditor.spec.js.snap +930 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHeader.spec.js.snap +127 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHistory.spec.js.snap +75 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlQueryModal.spec.js.snap +27 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlRow.spec.js.snap +113 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlScores.spec.js.snap +161 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlTabs.spec.js.snap +28 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControls.spec.js.snap +219 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlsLabelResults.spec.js.snap +11 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlsTable.spec.js.snap +121 -0
- package/src/components/qualityControls/__tests__/__snapshots__/ScoreCriteria.spec.js.snap +186 -0
- package/src/components/qualityControls/__tests__/__snapshots__/ScoreCriteriaView.spec.js.snap +76 -0
- package/src/components/qualityControls/__tests__/qualityByControlMode.spec.js +248 -0
- package/src/components/qualityControls/controlProperties/ErrorCount.js +56 -0
- package/src/components/qualityControls/controlProperties/Ratio.js +79 -0
- package/src/components/qualityControls/controlProperties/__tests__/ErrorCount.spec.js +82 -0
- package/src/components/qualityControls/controlProperties/__tests__/Ratio.spec.js +115 -0
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/ErrorCount.spec.js.snap +62 -0
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/Ratio.spec.js.snap +143 -0
- package/src/components/qualityControls/qualityByControlMode.js +62 -0
- package/src/components/qualityControls/qualityControlScoresColumns.js +52 -0
- package/src/components/qualityControls/{resultCriterias → scoreCriterias}/Deviation.js +6 -6
- package/src/components/qualityControls/{resultCriterias/ErrorsNumber.js → scoreCriterias/ErrorCount.js} +7 -7
- package/src/components/qualityControls/{resultCriterias → scoreCriterias}/Percentage.js +6 -6
- package/src/components/qualityControls/scoreCriterias/__tests__/Deviation.spec.js +75 -0
- package/src/components/qualityControls/scoreCriterias/__tests__/ErrorCount.spec.js +63 -0
- package/src/components/qualityControls/scoreCriterias/__tests__/Percentage.spec.js +61 -0
- package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/Deviation.spec.js.snap +58 -0
- package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/ErrorCount.spec.js.snap +58 -0
- package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/Percentage.spec.js.snap +58 -0
- package/src/components/{executions/ExecutionGroupsHeader.js → scores/MyScoreGroups.js} +5 -3
- package/src/components/scores/QualityBar.js +73 -0
- package/src/components/scores/Score.js +32 -0
- package/src/components/scores/ScoreContext.js +3 -0
- package/src/components/scores/ScoreCrumbs.js +40 -0
- package/src/components/scores/ScoreDetails.js +67 -0
- package/src/components/scores/ScoreEvents.js +59 -0
- package/src/components/scores/ScoreGroup.js +83 -0
- package/src/components/scores/ScoreGroupBreadcrumbs.js +25 -0
- package/src/components/{qualityControls/ExecutionForm.js → scores/ScoreGroupForm.js} +11 -13
- package/src/components/scores/ScoreGroupLink.js +18 -0
- package/src/components/scores/ScoreGroupMessage.js +25 -0
- package/src/components/{qualityControls/ExecutionPopup.js → scores/ScoreGroupPopup.js} +13 -22
- package/src/components/scores/ScoreGroupsTable.js +113 -0
- package/src/components/scores/ScoreRoutes.js +32 -0
- package/src/components/{executions/ExecutionStatusDecorator.js → scores/ScoreStatusDecorator.js} +10 -8
- package/src/components/scores/ScoreTabs.js +32 -0
- package/src/components/scores/__tests__/MyScoreGroups.spec.js +31 -0
- package/src/components/scores/__tests__/QualityBar.spec.js +55 -0
- package/src/components/scores/__tests__/Score.spec.js +41 -0
- package/src/components/scores/__tests__/ScoreCrumbs.spec.js +39 -0
- package/src/components/scores/__tests__/ScoreDetails.spec.js +38 -0
- package/src/components/scores/__tests__/ScoreEvents.spec.js +24 -0
- package/src/components/scores/__tests__/ScoreGroup.spec.js +43 -0
- package/src/components/scores/__tests__/ScoreGroupBreadcrumbs.spec.js +16 -0
- package/src/components/scores/__tests__/ScoreGroupForm.spec.js +78 -0
- package/src/components/scores/__tests__/ScoreGroupLink.spec.js +16 -0
- package/src/components/scores/__tests__/ScoreGroupMessage.spec.js +20 -0
- package/src/components/scores/__tests__/ScoreGroupPopup.spec.js +59 -0
- package/src/components/scores/__tests__/ScoreGroupsTable.spec.js +40 -0
- package/src/components/scores/__tests__/ScoreStatusDecorator.spec.js +21 -0
- package/src/components/scores/__tests__/ScoreTabs.spec.js +27 -0
- package/src/components/scores/__tests__/__fixtures__/scoreHelper.js +182 -0
- package/src/components/scores/__tests__/__snapshots__/MyScoreGroups.spec.js.snap +154 -0
- package/src/components/scores/__tests__/__snapshots__/QualityBar.spec.js.snap +24 -0
- package/src/components/scores/__tests__/__snapshots__/Score.spec.js.snap +92 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreCrumbs.spec.js.snap +39 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreDetails.spec.js.snap +156 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreEvents.spec.js.snap +167 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroup.spec.js.snap +103 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupBreadcrumbs.spec.js.snap +29 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupForm.spec.js.snap +145 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupLink.spec.js.snap +15 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupMessage.spec.js.snap +43 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupPopup.spec.js.snap +11 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupsTable.spec.js.snap +147 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreStatusDecorator.spec.js.snap +71 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreTabs.spec.js.snap +43 -0
- package/src/components/scores/index.js +15 -0
- package/src/hooks/useQualityControls.js +3 -9
- package/src/hooks/useScoreGroups.js +23 -0
- package/src/hooks/useScores.js +22 -0
- package/src/styles/Expression.less +16 -0
- package/src/styles/scores.less +63 -0
- package/src/components/executions/ExecutionGroupBreadcrumbs.js +0 -25
- package/src/components/executions/ExecutionGroupContent.js +0 -42
- package/src/components/executions/ExecutionGroupLink.js +0 -18
- package/src/components/executions/ExecutionGroupMessage.js +0 -27
- package/src/components/executions/ExecutionGroupsTable.js +0 -101
- package/src/components/executions/executionGroupDetail.js +0 -87
- package/src/components/qualityControls/ResultType.js +0 -57
package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/Ratio.spec.js.snap
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<Ratio /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="required field"
|
|
7
|
+
>
|
|
8
|
+
<label>
|
|
9
|
+
Dataset
|
|
10
|
+
</label>
|
|
11
|
+
<div
|
|
12
|
+
aria-expanded="false"
|
|
13
|
+
class="ui selection dropdown"
|
|
14
|
+
role="listbox"
|
|
15
|
+
tabindex="0"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
aria-atomic="true"
|
|
19
|
+
aria-live="polite"
|
|
20
|
+
class="divider default text"
|
|
21
|
+
role="alert"
|
|
22
|
+
>
|
|
23
|
+
Resource type
|
|
24
|
+
</div>
|
|
25
|
+
<i
|
|
26
|
+
aria-hidden="true"
|
|
27
|
+
class="dropdown icon"
|
|
28
|
+
/>
|
|
29
|
+
<div
|
|
30
|
+
class="menu transition"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
aria-checked="false"
|
|
34
|
+
aria-selected="true"
|
|
35
|
+
class="selected item"
|
|
36
|
+
role="option"
|
|
37
|
+
style="pointer-events: all;"
|
|
38
|
+
>
|
|
39
|
+
<span
|
|
40
|
+
class="text"
|
|
41
|
+
>
|
|
42
|
+
Data structures
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
<div
|
|
46
|
+
aria-checked="false"
|
|
47
|
+
aria-selected="false"
|
|
48
|
+
class="item"
|
|
49
|
+
role="option"
|
|
50
|
+
style="pointer-events: all;"
|
|
51
|
+
>
|
|
52
|
+
<span
|
|
53
|
+
class="text"
|
|
54
|
+
>
|
|
55
|
+
Reference datasets
|
|
56
|
+
</span>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
<div
|
|
62
|
+
class="vertical-space"
|
|
63
|
+
>
|
|
64
|
+
<div
|
|
65
|
+
class="field"
|
|
66
|
+
>
|
|
67
|
+
<label>
|
|
68
|
+
Validation
|
|
69
|
+
</label>
|
|
70
|
+
<div
|
|
71
|
+
class="ui horizontal divider"
|
|
72
|
+
>
|
|
73
|
+
<button
|
|
74
|
+
class="ui mini button"
|
|
75
|
+
>
|
|
76
|
+
Add group
|
|
77
|
+
</button>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
exports[`<Ratio /> matches the latest snapshot when there is not resource 1`] = `
|
|
85
|
+
<div>
|
|
86
|
+
<div
|
|
87
|
+
class="required field"
|
|
88
|
+
>
|
|
89
|
+
<label>
|
|
90
|
+
Dataset
|
|
91
|
+
</label>
|
|
92
|
+
<div
|
|
93
|
+
aria-expanded="false"
|
|
94
|
+
class="ui selection dropdown"
|
|
95
|
+
role="listbox"
|
|
96
|
+
tabindex="0"
|
|
97
|
+
>
|
|
98
|
+
<div
|
|
99
|
+
aria-atomic="true"
|
|
100
|
+
aria-live="polite"
|
|
101
|
+
class="divider default text"
|
|
102
|
+
role="alert"
|
|
103
|
+
>
|
|
104
|
+
Resource type
|
|
105
|
+
</div>
|
|
106
|
+
<i
|
|
107
|
+
aria-hidden="true"
|
|
108
|
+
class="dropdown icon"
|
|
109
|
+
/>
|
|
110
|
+
<div
|
|
111
|
+
class="menu transition"
|
|
112
|
+
>
|
|
113
|
+
<div
|
|
114
|
+
aria-checked="false"
|
|
115
|
+
aria-selected="true"
|
|
116
|
+
class="selected item"
|
|
117
|
+
role="option"
|
|
118
|
+
style="pointer-events: all;"
|
|
119
|
+
>
|
|
120
|
+
<span
|
|
121
|
+
class="text"
|
|
122
|
+
>
|
|
123
|
+
Data structures
|
|
124
|
+
</span>
|
|
125
|
+
</div>
|
|
126
|
+
<div
|
|
127
|
+
aria-checked="false"
|
|
128
|
+
aria-selected="false"
|
|
129
|
+
class="item"
|
|
130
|
+
role="option"
|
|
131
|
+
style="pointer-events: all;"
|
|
132
|
+
>
|
|
133
|
+
<span
|
|
134
|
+
class="text"
|
|
135
|
+
>
|
|
136
|
+
Reference datasets
|
|
137
|
+
</span>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
`;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
|
|
3
|
+
export default function qualityByControlMode(score) {
|
|
4
|
+
const controlMode = _.prop("quality_control.control_mode")(score);
|
|
5
|
+
const scoreCriteria = _.prop("quality_control.score_criteria")(score);
|
|
6
|
+
const scoreContent = _.prop("score_content")(score);
|
|
7
|
+
|
|
8
|
+
if (score.status === "FAILED") return { isFailed: true };
|
|
9
|
+
if (!scoreContent) return { isEmpty: true };
|
|
10
|
+
|
|
11
|
+
switch (controlMode) {
|
|
12
|
+
case "error_count":
|
|
13
|
+
return {
|
|
14
|
+
color:
|
|
15
|
+
scoreContent.error_count < scoreCriteria.goal
|
|
16
|
+
? "green"
|
|
17
|
+
: scoreContent.error_count < scoreCriteria.maximum
|
|
18
|
+
? "yellow"
|
|
19
|
+
: "red",
|
|
20
|
+
label1: "quality_control.score_criteria.error_count.goal",
|
|
21
|
+
value1: scoreCriteria.goal,
|
|
22
|
+
label2: "quality_control.score_criteria.error_count.maximum",
|
|
23
|
+
value2: scoreCriteria.maximum,
|
|
24
|
+
text: scoreContent.error_count,
|
|
25
|
+
};
|
|
26
|
+
case "deviation":
|
|
27
|
+
const deviationRatio =
|
|
28
|
+
(scoreContent.validation_count / scoreContent.total_count) * 100;
|
|
29
|
+
return {
|
|
30
|
+
color:
|
|
31
|
+
deviationRatio < scoreCriteria.goal
|
|
32
|
+
? "green"
|
|
33
|
+
: deviationRatio < scoreCriteria.maximum
|
|
34
|
+
? "yellow"
|
|
35
|
+
: "red",
|
|
36
|
+
label1: "quality_control.score_criteria.deviation.goal",
|
|
37
|
+
value1: scoreCriteria.goal,
|
|
38
|
+
label2: "quality_control.score_criteria.deviation.maximum",
|
|
39
|
+
value2: scoreCriteria.maximum,
|
|
40
|
+
text: `${deviationRatio}%`,
|
|
41
|
+
};
|
|
42
|
+
case "percentage":
|
|
43
|
+
const percentageRatio =
|
|
44
|
+
(scoreContent.validation_count / scoreContent.total_count) * 100;
|
|
45
|
+
return {
|
|
46
|
+
color:
|
|
47
|
+
percentageRatio > scoreCriteria.goal
|
|
48
|
+
? "green"
|
|
49
|
+
: percentageRatio > scoreCriteria.minimum
|
|
50
|
+
? "yellow"
|
|
51
|
+
: "red",
|
|
52
|
+
label1: "quality_control.score_criteria.percentage.minimum",
|
|
53
|
+
value1: scoreCriteria.minimum,
|
|
54
|
+
label2: "quality_control.score_criteria.percentage.goal",
|
|
55
|
+
value2: scoreCriteria.goal,
|
|
56
|
+
text: `${percentageRatio}%`,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
default:
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Link } from "react-router-dom";
|
|
4
|
+
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { DateDecorator } from "@truedat/core/services/columnDecorators";
|
|
6
|
+
import { linkTo } from "@truedat/core/routes";
|
|
7
|
+
import QualityBadge from "./QualityBadge";
|
|
8
|
+
|
|
9
|
+
const ScoreLink = ({ id, execution_timestamp }) => (
|
|
10
|
+
<Link to={linkTo.SCORE({ id })}>
|
|
11
|
+
{execution_timestamp ? (
|
|
12
|
+
<DateDecorator date={execution_timestamp} />
|
|
13
|
+
) : (
|
|
14
|
+
<FormattedMessage id={`score.not_executed`} />
|
|
15
|
+
)}
|
|
16
|
+
</Link>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default [
|
|
20
|
+
{
|
|
21
|
+
name: "execution_timestamp",
|
|
22
|
+
fieldSelector: _.identity,
|
|
23
|
+
fieldDecorator: ScoreLink,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "status",
|
|
27
|
+
fieldDecorator: (status) => (
|
|
28
|
+
<FormattedMessage id={`score.status.${status}`} />
|
|
29
|
+
),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "quality",
|
|
33
|
+
fieldSelector: (score) => ({ score }),
|
|
34
|
+
fieldDecorator: QualityBadge,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "control_mode",
|
|
38
|
+
fieldSelector: ({ quality_control: { control_mode } }) => control_mode,
|
|
39
|
+
|
|
40
|
+
fieldDecorator: (controlMode) => (
|
|
41
|
+
<FormattedMessage id={`quality_control.control_mode.${controlMode}`} />
|
|
42
|
+
),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "quality_control_status",
|
|
46
|
+
fieldSelector: ({ quality_control: { status } }) => status,
|
|
47
|
+
fieldDecorator: (status) =>
|
|
48
|
+
status ? (
|
|
49
|
+
<FormattedMessage id={`quality_control.status.${status}`} />
|
|
50
|
+
) : null,
|
|
51
|
+
},
|
|
52
|
+
];
|
|
@@ -33,7 +33,7 @@ export default function Deviation() {
|
|
|
33
33
|
}) => (
|
|
34
34
|
<FieldLabel
|
|
35
35
|
label={formatMessage({
|
|
36
|
-
id: "quality_control.
|
|
36
|
+
id: "quality_control.score_criteria.deviation.goal",
|
|
37
37
|
})}
|
|
38
38
|
required
|
|
39
39
|
error={error?.message}
|
|
@@ -41,12 +41,12 @@ export default function Deviation() {
|
|
|
41
41
|
<Form.Input
|
|
42
42
|
autoComplete="off"
|
|
43
43
|
placeholder={formatMessage({
|
|
44
|
-
id: "quality_control.
|
|
44
|
+
id: "quality_control.score_criteria.deviation.goal",
|
|
45
45
|
})}
|
|
46
46
|
error={!!error}
|
|
47
47
|
onBlur={onBlur}
|
|
48
48
|
onChange={(_e, { value }) => onChange(value)}
|
|
49
|
-
value={value}
|
|
49
|
+
value={value || ""}
|
|
50
50
|
/>
|
|
51
51
|
</FieldLabel>
|
|
52
52
|
)}
|
|
@@ -66,7 +66,7 @@ export default function Deviation() {
|
|
|
66
66
|
}) => (
|
|
67
67
|
<FieldLabel
|
|
68
68
|
label={formatMessage({
|
|
69
|
-
id: "quality_control.
|
|
69
|
+
id: "quality_control.score_criteria.deviation.maximum",
|
|
70
70
|
})}
|
|
71
71
|
required
|
|
72
72
|
error={error?.message}
|
|
@@ -74,12 +74,12 @@ export default function Deviation() {
|
|
|
74
74
|
<Form.Input
|
|
75
75
|
autoComplete="off"
|
|
76
76
|
placeholder={formatMessage({
|
|
77
|
-
id: "quality_control.
|
|
77
|
+
id: "quality_control.score_criteria.deviation.maximum",
|
|
78
78
|
})}
|
|
79
79
|
error={!!error}
|
|
80
80
|
onBlur={onBlur}
|
|
81
81
|
onChange={(_e, { value }) => onChange(value)}
|
|
82
|
-
value={value}
|
|
82
|
+
value={value || ""}
|
|
83
83
|
/>
|
|
84
84
|
</FieldLabel>
|
|
85
85
|
)}
|
|
@@ -6,7 +6,7 @@ import QxContext from "@truedat/qx/components/QxContext";
|
|
|
6
6
|
import { FieldLabel } from "@truedat/core/components";
|
|
7
7
|
import { numberRules } from "@truedat/core/services/formRules";
|
|
8
8
|
|
|
9
|
-
export default function
|
|
9
|
+
export default function ErrorCount() {
|
|
10
10
|
const { formatMessage } = useIntl();
|
|
11
11
|
const { field } = useContext(QxContext);
|
|
12
12
|
const { control, watch } = useFormContext();
|
|
@@ -33,7 +33,7 @@ export default function ErrorsNumber() {
|
|
|
33
33
|
}) => (
|
|
34
34
|
<FieldLabel
|
|
35
35
|
label={formatMessage({
|
|
36
|
-
id: "quality_control.
|
|
36
|
+
id: "quality_control.score_criteria.error_count.goal",
|
|
37
37
|
})}
|
|
38
38
|
required
|
|
39
39
|
error={error?.message}
|
|
@@ -41,12 +41,12 @@ export default function ErrorsNumber() {
|
|
|
41
41
|
<Form.Input
|
|
42
42
|
autoComplete="off"
|
|
43
43
|
placeholder={formatMessage({
|
|
44
|
-
id: "quality_control.
|
|
44
|
+
id: "quality_control.score_criteria.error_count.goal",
|
|
45
45
|
})}
|
|
46
46
|
error={!!error}
|
|
47
47
|
onBlur={onBlur}
|
|
48
48
|
onChange={(_e, { value }) => onChange(value)}
|
|
49
|
-
value={value}
|
|
49
|
+
value={value || ""}
|
|
50
50
|
/>
|
|
51
51
|
</FieldLabel>
|
|
52
52
|
)}
|
|
@@ -65,7 +65,7 @@ export default function ErrorsNumber() {
|
|
|
65
65
|
}) => (
|
|
66
66
|
<FieldLabel
|
|
67
67
|
label={formatMessage({
|
|
68
|
-
id: "quality_control.
|
|
68
|
+
id: "quality_control.score_criteria.error_count.maximum",
|
|
69
69
|
})}
|
|
70
70
|
required
|
|
71
71
|
error={error?.message}
|
|
@@ -73,12 +73,12 @@ export default function ErrorsNumber() {
|
|
|
73
73
|
<Form.Input
|
|
74
74
|
autoComplete="off"
|
|
75
75
|
placeholder={formatMessage({
|
|
76
|
-
id: "quality_control.
|
|
76
|
+
id: "quality_control.score_criteria.error_count.maximum",
|
|
77
77
|
})}
|
|
78
78
|
error={!!error}
|
|
79
79
|
onBlur={onBlur}
|
|
80
80
|
onChange={(_e, { value }) => onChange(value)}
|
|
81
|
-
value={value}
|
|
81
|
+
value={value || ""}
|
|
82
82
|
/>
|
|
83
83
|
</FieldLabel>
|
|
84
84
|
)}
|
|
@@ -33,7 +33,7 @@ export default function Percentage() {
|
|
|
33
33
|
}) => (
|
|
34
34
|
<FieldLabel
|
|
35
35
|
label={formatMessage({
|
|
36
|
-
id: "quality_control.
|
|
36
|
+
id: "quality_control.score_criteria.percentage.minimum",
|
|
37
37
|
})}
|
|
38
38
|
required
|
|
39
39
|
error={error?.message}
|
|
@@ -41,12 +41,12 @@ export default function Percentage() {
|
|
|
41
41
|
<Form.Input
|
|
42
42
|
autoComplete="off"
|
|
43
43
|
placeholder={formatMessage({
|
|
44
|
-
id: "quality_control.
|
|
44
|
+
id: "quality_control.score_criteria.percentage.minimum",
|
|
45
45
|
})}
|
|
46
46
|
error={!!error}
|
|
47
47
|
onBlur={onBlur}
|
|
48
48
|
onChange={(_e, { value }) => onChange(value)}
|
|
49
|
-
value={value}
|
|
49
|
+
value={value || ""}
|
|
50
50
|
/>
|
|
51
51
|
</FieldLabel>
|
|
52
52
|
)}
|
|
@@ -66,7 +66,7 @@ export default function Percentage() {
|
|
|
66
66
|
}) => (
|
|
67
67
|
<FieldLabel
|
|
68
68
|
label={formatMessage({
|
|
69
|
-
id: "quality_control.
|
|
69
|
+
id: "quality_control.score_criteria.percentage.goal",
|
|
70
70
|
})}
|
|
71
71
|
required
|
|
72
72
|
error={error?.message}
|
|
@@ -74,12 +74,12 @@ export default function Percentage() {
|
|
|
74
74
|
<Form.Input
|
|
75
75
|
autoComplete="off"
|
|
76
76
|
placeholder={formatMessage({
|
|
77
|
-
id: "quality_control.
|
|
77
|
+
id: "quality_control.score_criteria.percentage.goal",
|
|
78
78
|
})}
|
|
79
79
|
error={!!error}
|
|
80
80
|
onBlur={onBlur}
|
|
81
81
|
onChange={(_e, { value }) => onChange(value)}
|
|
82
|
-
value={value}
|
|
82
|
+
value={value || ""}
|
|
83
83
|
/>
|
|
84
84
|
</FieldLabel>
|
|
85
85
|
)}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import { waitFor } from "@testing-library/react";
|
|
4
|
+
import { fireEvent } from "@testing-library/react";
|
|
5
|
+
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
6
|
+
import Deviation from "../Deviation";
|
|
7
|
+
|
|
8
|
+
const messages = {
|
|
9
|
+
en: {
|
|
10
|
+
"form.validation.must_be_a_number": "Must be a number",
|
|
11
|
+
"form.validation.must_be_less_than_or_equal": "Must be less than x",
|
|
12
|
+
"form.validation.must_be_greater_than_or_equal": "Must be greater than y",
|
|
13
|
+
"form.validation.empty_required": "Required field is empty",
|
|
14
|
+
"quality_control.score_criteria.deviation.goal": "Goal",
|
|
15
|
+
"quality_control.score_criteria.deviation.maximum": "Threshold",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const renderOpts = {
|
|
20
|
+
messages,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe("<Deviation />", () => {
|
|
24
|
+
it("matches the latest snapshot", async () => {
|
|
25
|
+
const { container } = render(
|
|
26
|
+
<TestFormWrapper>
|
|
27
|
+
<Deviation />
|
|
28
|
+
</TestFormWrapper>,
|
|
29
|
+
renderOpts
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(container).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("should update the goal and maximum fields correctly", async () => {
|
|
36
|
+
const defaultValues = { "testField.goal": "", "testField.maximum": "" };
|
|
37
|
+
|
|
38
|
+
const { getByPlaceholderText, queryByText } = render(
|
|
39
|
+
<TestFormWrapper defaultValues={defaultValues}>
|
|
40
|
+
<Deviation />
|
|
41
|
+
</TestFormWrapper>,
|
|
42
|
+
renderOpts
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const goalInput = getByPlaceholderText("Goal");
|
|
46
|
+
|
|
47
|
+
const thresholdInput = getByPlaceholderText("Threshold");
|
|
48
|
+
|
|
49
|
+
fireEvent.change(goalInput, { target: { value: "10" } });
|
|
50
|
+
fireEvent.change(thresholdInput, { target: { value: "20" } });
|
|
51
|
+
await waitFor(() =>
|
|
52
|
+
expect(queryByText(/Must be greater than y/i)).not.toBeInTheDocument()
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("Show alert if thresholdInput is less than goal", async () => {
|
|
57
|
+
const { getByPlaceholderText, queryByText } = render(
|
|
58
|
+
<TestFormWrapper>
|
|
59
|
+
<Deviation />
|
|
60
|
+
</TestFormWrapper>,
|
|
61
|
+
renderOpts
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const goalInput = getByPlaceholderText("Goal");
|
|
65
|
+
|
|
66
|
+
const thresholdInput = getByPlaceholderText("Threshold");
|
|
67
|
+
|
|
68
|
+
fireEvent.change(goalInput, { target: { value: "10" } });
|
|
69
|
+
fireEvent.change(thresholdInput, { target: { value: "1" } });
|
|
70
|
+
|
|
71
|
+
await waitFor(() =>
|
|
72
|
+
expect(queryByText(/Must be greater than y/i)).toBeInTheDocument()
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import { waitFor } from "@testing-library/react";
|
|
4
|
+
import { fireEvent } from "@testing-library/react";
|
|
5
|
+
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
6
|
+
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
7
|
+
import ErrorCount from "../ErrorCount";
|
|
8
|
+
|
|
9
|
+
const renderOpts = { messages };
|
|
10
|
+
|
|
11
|
+
describe("<ErrorCount />", () => {
|
|
12
|
+
it("matches the latest snapshot", async () => {
|
|
13
|
+
const { container } = render(
|
|
14
|
+
<TestFormWrapper>
|
|
15
|
+
<ErrorCount />
|
|
16
|
+
</TestFormWrapper>,
|
|
17
|
+
renderOpts
|
|
18
|
+
);
|
|
19
|
+
expect(container).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("should update the goal and maximum fields correctly", async () => {
|
|
23
|
+
const defaultValues = { "testField.goal": "", "testField.maximum": "" };
|
|
24
|
+
|
|
25
|
+
const { getByPlaceholderText, queryByText } = render(
|
|
26
|
+
<TestFormWrapper defaultValues={defaultValues}>
|
|
27
|
+
<ErrorCount />
|
|
28
|
+
</TestFormWrapper>,
|
|
29
|
+
renderOpts
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const goalInput = getByPlaceholderText("Goal");
|
|
33
|
+
|
|
34
|
+
const thresholdInput = getByPlaceholderText("Threshold");
|
|
35
|
+
|
|
36
|
+
fireEvent.change(goalInput, { target: { value: "10" } });
|
|
37
|
+
fireEvent.change(thresholdInput, { target: { value: "20" } });
|
|
38
|
+
|
|
39
|
+
await waitFor(() =>
|
|
40
|
+
expect(queryByText(/Must be greater than y/i)).not.toBeInTheDocument()
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("Show alert if thresholdInput is less than goal", async () => {
|
|
45
|
+
const { getByPlaceholderText, queryByText } = render(
|
|
46
|
+
<TestFormWrapper>
|
|
47
|
+
<ErrorCount />
|
|
48
|
+
</TestFormWrapper>,
|
|
49
|
+
renderOpts
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const goalInput = getByPlaceholderText("Goal");
|
|
53
|
+
|
|
54
|
+
const thresholdInput = getByPlaceholderText("Threshold");
|
|
55
|
+
|
|
56
|
+
fireEvent.change(goalInput, { target: { value: "10" } });
|
|
57
|
+
fireEvent.change(thresholdInput, { target: { value: "1" } });
|
|
58
|
+
|
|
59
|
+
await waitFor(() =>
|
|
60
|
+
expect(queryByText(/Must be greater than 10/i)).toBeInTheDocument()
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import { waitFor } from "@testing-library/react";
|
|
4
|
+
import { fireEvent } from "@testing-library/react";
|
|
5
|
+
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
6
|
+
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
7
|
+
import Percentage from "../Percentage";
|
|
8
|
+
|
|
9
|
+
const renderOpts = { messages };
|
|
10
|
+
|
|
11
|
+
describe("<Percentage />", () => {
|
|
12
|
+
it("matches the latest snapshot", async () => {
|
|
13
|
+
const { container } = render(
|
|
14
|
+
<TestFormWrapper>
|
|
15
|
+
<Percentage />
|
|
16
|
+
</TestFormWrapper>,
|
|
17
|
+
renderOpts
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
expect(container).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("should update the goal and maximum fields correctly", async () => {
|
|
24
|
+
const { getByPlaceholderText, queryByText } = render(
|
|
25
|
+
<TestFormWrapper>
|
|
26
|
+
<Percentage />
|
|
27
|
+
</TestFormWrapper>,
|
|
28
|
+
renderOpts
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const goalInput = getByPlaceholderText("Goal");
|
|
32
|
+
|
|
33
|
+
const thresholdInput = getByPlaceholderText("Threshold");
|
|
34
|
+
|
|
35
|
+
fireEvent.change(goalInput, { target: { value: "20" } });
|
|
36
|
+
fireEvent.change(thresholdInput, { target: { value: "10" } });
|
|
37
|
+
await waitFor(() =>
|
|
38
|
+
expect(queryByText(/Must be less than 10/i)).not.toBeInTheDocument()
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("Show alert if thresholdInput is more than goal", async () => {
|
|
43
|
+
const { getByPlaceholderText, queryByText } = render(
|
|
44
|
+
<TestFormWrapper>
|
|
45
|
+
<Percentage />
|
|
46
|
+
</TestFormWrapper>,
|
|
47
|
+
renderOpts
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const goalInput = getByPlaceholderText("Goal");
|
|
51
|
+
|
|
52
|
+
const thresholdInput = getByPlaceholderText("Threshold");
|
|
53
|
+
|
|
54
|
+
fireEvent.change(goalInput, { target: { value: "10" } });
|
|
55
|
+
fireEvent.change(thresholdInput, { target: { value: "20" } });
|
|
56
|
+
|
|
57
|
+
await waitFor(() =>
|
|
58
|
+
expect(queryByText(/Must be less than 10/i)).toBeInTheDocument()
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
});
|
package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/Deviation.spec.js.snap
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<Deviation /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="field"
|
|
7
|
+
>
|
|
8
|
+
<label
|
|
9
|
+
class="field-label"
|
|
10
|
+
>
|
|
11
|
+
Goal
|
|
12
|
+
<span>
|
|
13
|
+
*
|
|
14
|
+
</span>
|
|
15
|
+
</label>
|
|
16
|
+
<div
|
|
17
|
+
class="field"
|
|
18
|
+
>
|
|
19
|
+
<div
|
|
20
|
+
class="ui input"
|
|
21
|
+
>
|
|
22
|
+
<input
|
|
23
|
+
autocomplete="off"
|
|
24
|
+
placeholder="Goal"
|
|
25
|
+
type="text"
|
|
26
|
+
value=""
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div
|
|
32
|
+
class="field"
|
|
33
|
+
>
|
|
34
|
+
<label
|
|
35
|
+
class="field-label"
|
|
36
|
+
>
|
|
37
|
+
Threshold
|
|
38
|
+
<span>
|
|
39
|
+
*
|
|
40
|
+
</span>
|
|
41
|
+
</label>
|
|
42
|
+
<div
|
|
43
|
+
class="field"
|
|
44
|
+
>
|
|
45
|
+
<div
|
|
46
|
+
class="ui input"
|
|
47
|
+
>
|
|
48
|
+
<input
|
|
49
|
+
autocomplete="off"
|
|
50
|
+
placeholder="Threshold"
|
|
51
|
+
type="text"
|
|
52
|
+
value=""
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
`;
|