@truedat/qx 7.5.7 → 7.5.10
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 +45 -64
- package/src/components/QxRoutes.js +38 -19
- package/src/components/__tests__/QxRoutes.spec.js +73 -0
- package/src/components/__tests__/__fixtures__/helper.js +6 -7
- package/src/components/__tests__/__snapshots__/QxRoutes.spec.js.snap +60 -0
- package/src/components/common/ClauseViewer.js +6 -6
- package/src/components/common/DescriptionInput.js +0 -1
- package/src/components/common/ResourceSelector.js +2 -3
- package/src/components/common/TestFormWrapper.js +2 -13
- package/src/components/common/TypeSelector.js +0 -1
- package/src/components/common/__tests__/DescriptionInput.spec.js +12 -21
- package/src/components/common/__tests__/ResourceSelector.spec.js +42 -87
- package/src/components/common/__tests__/TypeSelector.spec.js +0 -1
- package/src/components/common/__tests__/__snapshots__/ResourceSelector.spec.js.snap +32 -22
- package/src/components/common/expressions/Clauses.js +5 -6
- package/src/components/common/expressions/Condition.js +8 -9
- package/src/components/common/expressions/ConstantSelector.js +2 -2
- package/src/components/common/expressions/Expression.js +2 -2
- package/src/components/common/expressions/FieldSelector.js +2 -2
- package/src/components/common/expressions/FunctionArgs.js +5 -6
- package/src/components/common/expressions/FunctionSelector.js +2 -2
- package/src/components/common/expressions/ParamSelector.js +2 -2
- package/src/components/common/expressions/ShapeSelector.js +7 -16
- package/src/components/common/expressions/__tests__/Clauses.spec.js +10 -9
- package/src/components/common/expressions/__tests__/Condition.spec.js +6 -26
- package/src/components/common/expressions/__tests__/ConstantSelector.spec.js +14 -30
- package/src/components/common/expressions/__tests__/Expression.spec.js +36 -62
- package/src/components/common/expressions/__tests__/FieldSelector.spec.js +2 -7
- package/src/components/common/expressions/__tests__/FunctionArgs.spec.js +18 -44
- package/src/components/common/expressions/__tests__/FunctionSelector.spec.js +19 -27
- package/src/components/common/expressions/__tests__/ParamSelector.spec.js +28 -58
- package/src/components/common/expressions/__tests__/ShapeSelector.spec.js +34 -47
- package/src/components/common/expressions/__tests__/__snapshots__/Condition.spec.js.snap +6 -6
- package/src/components/common/expressions/__tests__/__snapshots__/ConstantSelector.spec.js.snap +6 -7
- package/src/components/common/expressions/__tests__/__snapshots__/Expression.spec.js.snap +20 -20
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionArgs.spec.js.snap +8 -9
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionSelector.spec.js.snap +670 -8
- package/src/components/common/expressions/__tests__/__snapshots__/ParamSelector.spec.js.snap +5 -5
- package/src/components/common/expressions/__tests__/__snapshots__/ShapeSelector.spec.js.snap +9 -9
- package/src/components/common/expressions/__tests__/useWatchParams.spec.js +1 -4
- package/src/components/common/expressions/constantInputs/AnySelector.js +5 -6
- package/src/components/common/expressions/constantInputs/BooleanSelector.js +2 -2
- package/src/components/common/expressions/constantInputs/DefaultSelector.js +2 -2
- package/src/components/common/expressions/constantInputs/__tests__/AnySelector.spec.js +16 -37
- package/src/components/common/expressions/constantInputs/__tests__/BooleanSelector.spec.js +14 -17
- package/src/components/common/expressions/constantInputs/__tests__/DefaultSelector.spec.js +12 -27
- package/src/components/common/expressions/constantInputs/__tests__/__snapshots__/AnySelector.spec.js.snap +11 -11
- package/src/components/common/expressions/constantInputs/__tests__/__snapshots__/DefaultSelector.spec.js.snap +0 -1
- package/src/components/common/resourceSelectors/DataStructureSelector.js +2 -2
- package/src/components/common/resourceSelectors/DataViewSelector.js +2 -2
- package/src/components/common/resourceSelectors/ReferenceDatasetSelector.js +2 -2
- package/src/components/common/resourceSelectors/__tests__/DataStructureSelector.spec.js +5 -29
- package/src/components/common/resourceSelectors/__tests__/DataViewSelector.spec.js +23 -25
- package/src/components/common/resourceSelectors/__tests__/ReferenceDatasetSelector.spec.js +21 -32
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataStructureSelector.spec.js.snap +3 -4
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataViewSelector.spec.js.snap +1 -1
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/ReferenceDatasetSelector.spec.js.snap +1 -1
- package/src/components/dataViews/DataViewEditor.js +5 -6
- package/src/components/dataViews/DataViewSelect.js +4 -5
- package/src/components/dataViews/DataViews.js +1 -2
- package/src/components/dataViews/Queryable.js +4 -4
- package/src/components/dataViews/Queryables.js +0 -1
- package/src/components/dataViews/__tests__/DataViewEditor.spec.js +36 -111
- package/src/components/dataViews/__tests__/DataViewSelect.spec.js +0 -1
- package/src/components/dataViews/__tests__/DataViews.spec.js +15 -16
- package/src/components/dataViews/__tests__/Queryable.spec.js +0 -1
- package/src/components/dataViews/__tests__/Queryables.spec.js +35 -74
- package/src/components/dataViews/__tests__/__snapshots__/DataViewEditor.spec.js.snap +61 -55
- package/src/components/dataViews/__tests__/__snapshots__/DataViews.spec.js.snap +5 -5
- package/src/components/dataViews/__tests__/__snapshots__/Queryables.spec.js.snap +59 -59
- package/src/components/dataViews/queryableProperties/From.js +4 -4
- package/src/components/dataViews/queryableProperties/GroupBy.js +6 -6
- package/src/components/dataViews/queryableProperties/Join.js +6 -6
- package/src/components/dataViews/queryableProperties/JoinTypeIcon.js +8 -9
- package/src/components/dataViews/queryableProperties/Select.js +4 -5
- package/src/components/dataViews/queryableProperties/SelectField.js +4 -4
- package/src/components/dataViews/queryableProperties/Where.js +4 -4
- package/src/components/dataViews/queryableProperties/__tests__/From.spec.js +0 -1
- package/src/components/dataViews/queryableProperties/__tests__/GroupBy.spec.js +16 -42
- package/src/components/dataViews/queryableProperties/__tests__/Join.spec.js +6 -29
- package/src/components/dataViews/queryableProperties/__tests__/JoinTypeIcon.spec.js +0 -1
- package/src/components/dataViews/queryableProperties/__tests__/Select.spec.js +26 -50
- package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +19 -44
- package/src/components/dataViews/queryableProperties/__tests__/Where.spec.js +6 -17
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/GroupBy.spec.js.snap +309 -9
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Join.spec.js.snap +12 -12
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Select.spec.js.snap +192 -18
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/SelectField.spec.js.snap +6 -8
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Where.spec.js.snap +2 -2
- package/src/components/functions/FunctionEditor.js +3 -5
- package/src/components/functions/FunctionParams.js +2 -3
- package/src/components/functions/Functions.js +3 -4
- package/src/components/functions/__tests__/FunctionEditor.spec.js +61 -57
- package/src/components/functions/__tests__/FunctionParams.spec.js +50 -47
- package/src/components/functions/__tests__/Functions.spec.js +5 -12
- package/src/components/functions/__tests__/__snapshots__/FunctionParams.spec.js.snap +11 -11
- package/src/components/functions/__tests__/__snapshots__/Functions.spec.js.snap +4 -5
- package/src/components/qualityControls/ControlProperties.js +8 -7
- package/src/components/qualityControls/ControlPropertiesView.js +5 -5
- package/src/components/qualityControls/EditQualityControl.js +5 -5
- package/src/components/qualityControls/IconPopup.js +0 -1
- package/src/components/qualityControls/NewDraftQualityControl.js +8 -6
- package/src/components/qualityControls/NewQualityControl.js +5 -6
- package/src/components/qualityControls/QualityBadge.js +29 -21
- package/src/components/qualityControls/QualityControl.js +4 -7
- package/src/components/qualityControls/QualityControlActions.js +7 -7
- package/src/components/qualityControls/QualityControlCrumbs.js +1 -3
- package/src/components/qualityControls/QualityControlEditor.js +6 -12
- package/src/components/qualityControls/QualityControlHeader.js +4 -6
- package/src/components/qualityControls/QualityControlHistory.js +3 -3
- package/src/components/qualityControls/QualityControlManageDomain.js +2 -2
- package/src/components/qualityControls/QualityControlQueryModal.js +1 -1
- package/src/components/qualityControls/QualityControlRoutes.js +27 -54
- package/src/components/qualityControls/QualityControlRow.js +0 -2
- package/src/components/qualityControls/QualityControlScores.js +7 -5
- package/src/components/qualityControls/QualityControlTabs.js +2 -2
- package/src/components/qualityControls/QualityControls.js +10 -8
- package/src/components/qualityControls/QualityControlsLabelResults.js +0 -2
- package/src/components/qualityControls/QualityControlsPagination.js +0 -1
- package/src/components/qualityControls/QualityControlsTable.js +1 -2
- package/src/components/qualityControls/ScoreCriteria.js +8 -4
- package/src/components/qualityControls/ScoreCriteriaView.js +34 -54
- package/src/components/qualityControls/__tests__/ControlProperties.spec.js +16 -21
- package/src/components/qualityControls/__tests__/ControlPropertiesView.spec.js +5 -6
- package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +28 -70
- package/src/components/qualityControls/__tests__/IconPopup.spec.js +10 -11
- package/src/components/qualityControls/__tests__/NewDraftQualityControl.spec.js +33 -70
- package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +88 -107
- package/src/components/qualityControls/__tests__/QualityBadge.spec.js +55 -63
- package/src/components/qualityControls/__tests__/QualityControl.spec.js +19 -31
- package/src/components/qualityControls/__tests__/QualityControlActions.spec.js +49 -46
- package/src/components/qualityControls/__tests__/QualityControlCrumbs.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +68 -107
- package/src/components/qualityControls/__tests__/QualityControlHeader.spec.js +22 -25
- package/src/components/qualityControls/__tests__/QualityControlHistory.spec.js +6 -6
- package/src/components/qualityControls/__tests__/QualityControlManageDomain.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlQueryModal.spec.js +13 -12
- package/src/components/qualityControls/__tests__/QualityControlRow.spec.js +4 -8
- package/src/components/qualityControls/__tests__/QualityControlScores.spec.js +23 -19
- package/src/components/qualityControls/__tests__/QualityControlTabs.spec.js +2 -3
- package/src/components/qualityControls/__tests__/QualityControls.spec.js +69 -53
- package/src/components/qualityControls/__tests__/QualityControlsLabelResults.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlsPagination.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlsTable.spec.js +2 -3
- package/src/components/qualityControls/__tests__/ScoreCriteria.spec.js +3 -4
- package/src/components/qualityControls/__tests__/ScoreCriteriaView.spec.js +18 -3
- package/src/components/qualityControls/__tests__/__fixtures__/qualityControlHelper.js +2 -2
- 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 +45 -34
- package/src/components/qualityControls/__tests__/__snapshots__/NewDraftQualityControl.spec.js.snap +44 -33
- package/src/components/qualityControls/__tests__/__snapshots__/NewQualityControl.spec.js.snap +30 -19
- package/src/components/qualityControls/__tests__/__snapshots__/QualityBadge.spec.js.snap +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControl.spec.js.snap +11 -19
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlActions.spec.js.snap +5 -4
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlCrumbs.spec.js.snap +1 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlEditor.spec.js.snap +28 -5
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHeader.spec.js.snap +16 -11
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHistory.spec.js.snap +2 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlRow.spec.js.snap +2 -1
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlScores.spec.js.snap +3 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlTabs.spec.js.snap +3 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControls.spec.js.snap +11 -21
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlsTable.spec.js.snap +2 -0
- 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} +7 -7
- package/src/components/qualityControls/controlProperties/Ratio.js +6 -8
- package/src/components/qualityControls/controlProperties/__tests__/{ErrorCount.spec.js → Count.spec.js} +9 -25
- package/src/components/qualityControls/controlProperties/__tests__/Ratio.spec.js +9 -27
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/{ErrorCount.spec.js.snap → Count.spec.js.snap} +5 -5
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/Ratio.spec.js.snap +10 -10
- package/src/components/qualityControls/qualityByControlMode.js +39 -16
- package/src/components/qualityControls/qualityControlScoresColumns.js +1 -2
- package/src/components/qualityControls/scoreCriterias/Count.js +88 -0
- package/src/components/qualityControls/scoreCriterias/Deviation.js +2 -2
- package/src/components/qualityControls/scoreCriterias/ErrorCount.js +4 -4
- package/src/components/qualityControls/scoreCriterias/Percentage.js +2 -2
- package/src/components/qualityControls/scoreCriterias/__tests__/Count.spec.js +62 -0
- package/src/components/qualityControls/scoreCriterias/__tests__/Deviation.spec.js +0 -1
- package/src/components/qualityControls/scoreCriterias/__tests__/ErrorCount.spec.js +39 -31
- package/src/components/qualityControls/scoreCriterias/__tests__/Percentage.spec.js +23 -19
- package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/Count.spec.js.snap +58 -0
- package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/ErrorCount.spec.js.snap +4 -7
- package/src/components/scores/MyScoreGroups.js +0 -1
- package/src/components/scores/QualityBar.js +24 -22
- package/src/components/scores/Score.js +4 -5
- package/src/components/scores/ScoreCrumbs.js +3 -5
- package/src/components/scores/ScoreDetails.js +2 -2
- package/src/components/scores/ScoreEvents.js +2 -2
- package/src/components/scores/ScoreGroup.js +5 -4
- package/src/components/scores/ScoreGroupBreadcrumbs.js +1 -2
- package/src/components/scores/ScoreGroupForm.js +2 -4
- package/src/components/scores/ScoreGroupLink.js +1 -2
- package/src/components/scores/ScoreGroupMessage.js +0 -1
- package/src/components/scores/ScoreGroupPopup.js +1 -1
- package/src/components/scores/ScoreGroupsRoutes.js +19 -0
- package/src/components/scores/ScoreGroupsTable.js +15 -48
- package/src/components/scores/ScoreRoutes.js +9 -24
- package/src/components/scores/ScoreStatusDecorator.js +1 -2
- package/src/components/scores/ScoreTabs.js +2 -2
- package/src/components/scores/__tests__/MyScoreGroups.spec.js +2 -3
- package/src/components/scores/__tests__/QualityBar.spec.js +19 -26
- package/src/components/scores/__tests__/Score.spec.js +2 -3
- package/src/components/scores/__tests__/ScoreCrumbs.spec.js +4 -5
- package/src/components/scores/__tests__/ScoreDetails.spec.js +4 -5
- package/src/components/scores/__tests__/ScoreEvents.spec.js +2 -3
- package/src/components/scores/__tests__/ScoreGroup.spec.js +15 -14
- package/src/components/scores/__tests__/ScoreGroupBreadcrumbs.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupForm.spec.js +18 -34
- package/src/components/scores/__tests__/ScoreGroupLink.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupMessage.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupPopup.spec.js +0 -2
- package/src/components/scores/__tests__/ScoreGroupsRoutes.spec.js +32 -0
- package/src/components/scores/__tests__/ScoreGroupsTable.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreStatusDecorator.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreTabs.spec.js +3 -4
- package/src/components/scores/__tests__/__snapshots__/MyScoreGroups.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/Score.spec.js.snap +4 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreCrumbs.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreDetails.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroup.spec.js.snap +39 -10
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupBreadcrumbs.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupForm.spec.js.snap +10 -10
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupLink.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupsRoutes.spec.js.snap +19 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupsTable.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreStatusDecorator.spec.js.snap +5 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreTabs.spec.js.snap +4 -0
- package/src/hooks/__tests__/useDataViews.spec.js +1 -1
- package/src/hooks/__tests__/useFunctions.spec.js +5 -5
- package/src/hooks/useDataViews.js +2 -2
- package/src/hooks/useExecutionGroups.js +1 -1
- package/src/hooks/useFunctions.js +4 -4
- package/src/hooks/useQualityControls.js +13 -7
- package/src/hooks/useScoreGroups.js +1 -1
- package/src/hooks/useScores.js +2 -2
- package/src/styles/scores.less +21 -21
- package/src/types.js +1 -4
|
@@ -9,19 +9,19 @@ export default function qualityByControlMode(score) {
|
|
|
9
9
|
if (!scoreContent) return { isEmpty: true };
|
|
10
10
|
|
|
11
11
|
switch (controlMode) {
|
|
12
|
-
case "
|
|
12
|
+
case "count":
|
|
13
13
|
return {
|
|
14
14
|
color:
|
|
15
|
-
scoreContent.
|
|
15
|
+
scoreContent.count < scoreCriteria.goal
|
|
16
16
|
? "green"
|
|
17
|
-
: scoreContent.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
label1: "quality_control.score_criteria.
|
|
17
|
+
: scoreContent.count < scoreCriteria.maximum
|
|
18
|
+
? "yellow"
|
|
19
|
+
: "red",
|
|
20
|
+
label1: "quality_control.score_criteria.count.goal",
|
|
21
21
|
value1: scoreCriteria.goal,
|
|
22
|
-
label2: "quality_control.score_criteria.
|
|
22
|
+
label2: "quality_control.score_criteria.count.maximum",
|
|
23
23
|
value2: scoreCriteria.maximum,
|
|
24
|
-
text: scoreContent.
|
|
24
|
+
text: scoreContent.count,
|
|
25
25
|
};
|
|
26
26
|
case "deviation":
|
|
27
27
|
const deviationRatio =
|
|
@@ -36,10 +36,10 @@ export default function qualityByControlMode(score) {
|
|
|
36
36
|
scoreContent.total_count == 0
|
|
37
37
|
? "grey"
|
|
38
38
|
: deviationRatio < scoreCriteria.goal
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
? "green"
|
|
40
|
+
: deviationRatio < scoreCriteria.maximum
|
|
41
|
+
? "yellow"
|
|
42
|
+
: "red",
|
|
43
43
|
label1: "quality_control.score_criteria.deviation.goal",
|
|
44
44
|
value1: scoreCriteria.goal,
|
|
45
45
|
label2: "quality_control.score_criteria.deviation.maximum",
|
|
@@ -62,17 +62,40 @@ export default function qualityByControlMode(score) {
|
|
|
62
62
|
scoreContent.total_count == 0
|
|
63
63
|
? "grey"
|
|
64
64
|
: percentageRatio > scoreCriteria.goal
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
? "green"
|
|
66
|
+
: percentageRatio > scoreCriteria.minimum
|
|
67
|
+
? "yellow"
|
|
68
|
+
: "red",
|
|
69
69
|
label1: "quality_control.score_criteria.percentage.minimum",
|
|
70
70
|
value1: scoreCriteria.minimum,
|
|
71
71
|
label2: "quality_control.score_criteria.percentage.goal",
|
|
72
72
|
value2: scoreCriteria.goal,
|
|
73
73
|
text: percentageResult,
|
|
74
74
|
};
|
|
75
|
+
case "error_count":
|
|
76
|
+
const errorCount =
|
|
77
|
+
scoreContent.total_count == 0 ? null : scoreContent.validation_count;
|
|
78
|
+
|
|
79
|
+
const errorCountResult =
|
|
80
|
+
scoreContent.total_count == 0
|
|
81
|
+
? noResultsMessage
|
|
82
|
+
: scoreContent.validation_count;
|
|
75
83
|
|
|
84
|
+
return {
|
|
85
|
+
color:
|
|
86
|
+
scoreContent.total_count == 0
|
|
87
|
+
? "grey"
|
|
88
|
+
: errorCount > scoreCriteria.goal
|
|
89
|
+
? "green"
|
|
90
|
+
: errorCount > scoreCriteria.maximum
|
|
91
|
+
? "yellow"
|
|
92
|
+
: "red",
|
|
93
|
+
label1: "quality_control.score_criteria.error_count.goal",
|
|
94
|
+
value1: scoreCriteria.goal,
|
|
95
|
+
label2: "quality_control.score_criteria.error_count.maximum",
|
|
96
|
+
value2: scoreCriteria.maximum,
|
|
97
|
+
text: errorCountResult,
|
|
98
|
+
};
|
|
76
99
|
default:
|
|
77
100
|
return {};
|
|
78
101
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { Link } from "react-router";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { Link } from "react-router-dom";
|
|
5
4
|
import { FormattedMessage } from "react-intl";
|
|
6
5
|
import { DateDecorator } from "@truedat/core/services/columnDecorators";
|
|
7
6
|
import { linkTo } from "@truedat/core/routes";
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { useIntl } from "react-intl";
|
|
3
|
+
import { Controller, useFormContext } from "react-hook-form";
|
|
4
|
+
import { Form } from "semantic-ui-react";
|
|
5
|
+
import QxContext from "@truedat/qx/components/QxContext";
|
|
6
|
+
import { FieldLabel } from "@truedat/core/components";
|
|
7
|
+
import { numberRules } from "@truedat/core/services/formRules";
|
|
8
|
+
|
|
9
|
+
export default function Count() {
|
|
10
|
+
const { formatMessage } = useIntl();
|
|
11
|
+
const { field } = useContext(QxContext);
|
|
12
|
+
const { control, watch } = useFormContext();
|
|
13
|
+
|
|
14
|
+
const maximumField = `${field}.maximum`;
|
|
15
|
+
const goalField = `${field}.goal`;
|
|
16
|
+
const maximum = watch(maximumField);
|
|
17
|
+
const goal = watch(goalField);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<Controller
|
|
22
|
+
name={goalField}
|
|
23
|
+
control={control}
|
|
24
|
+
rules={numberRules({
|
|
25
|
+
formatMessage,
|
|
26
|
+
minValue: 0,
|
|
27
|
+
maxValue: maximum,
|
|
28
|
+
required: true,
|
|
29
|
+
})}
|
|
30
|
+
render={({
|
|
31
|
+
field: { onBlur, onChange, value },
|
|
32
|
+
fieldState: { error },
|
|
33
|
+
}) => (
|
|
34
|
+
<FieldLabel
|
|
35
|
+
label={formatMessage({
|
|
36
|
+
id: "quality_control.score_criteria.count.goal",
|
|
37
|
+
})}
|
|
38
|
+
required
|
|
39
|
+
error={error?.message}
|
|
40
|
+
>
|
|
41
|
+
<Form.Input
|
|
42
|
+
autoComplete="off"
|
|
43
|
+
placeholder={formatMessage({
|
|
44
|
+
id: "quality_control.score_criteria.count.goal",
|
|
45
|
+
})}
|
|
46
|
+
error={!!error}
|
|
47
|
+
onBlur={onBlur}
|
|
48
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
49
|
+
value={value || ""}
|
|
50
|
+
/>
|
|
51
|
+
</FieldLabel>
|
|
52
|
+
)}
|
|
53
|
+
/>
|
|
54
|
+
<Controller
|
|
55
|
+
name={maximumField}
|
|
56
|
+
control={control}
|
|
57
|
+
rules={numberRules({
|
|
58
|
+
formatMessage,
|
|
59
|
+
minValue: goal,
|
|
60
|
+
required: true,
|
|
61
|
+
})}
|
|
62
|
+
render={({
|
|
63
|
+
field: { onBlur, onChange, value },
|
|
64
|
+
fieldState: { error },
|
|
65
|
+
}) => (
|
|
66
|
+
<FieldLabel
|
|
67
|
+
label={formatMessage({
|
|
68
|
+
id: "quality_control.score_criteria.count.maximum",
|
|
69
|
+
})}
|
|
70
|
+
required
|
|
71
|
+
error={error?.message}
|
|
72
|
+
>
|
|
73
|
+
<Form.Input
|
|
74
|
+
autoComplete="off"
|
|
75
|
+
placeholder={formatMessage({
|
|
76
|
+
id: "quality_control.score_criteria.count.maximum",
|
|
77
|
+
})}
|
|
78
|
+
error={!!error}
|
|
79
|
+
onBlur={onBlur}
|
|
80
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
81
|
+
value={value || ""}
|
|
82
|
+
/>
|
|
83
|
+
</FieldLabel>
|
|
84
|
+
)}
|
|
85
|
+
/>
|
|
86
|
+
</>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { use } from "react";
|
|
2
2
|
import { useIntl } from "react-intl";
|
|
3
3
|
import { Controller, useFormContext } from "react-hook-form";
|
|
4
4
|
import { Form } from "semantic-ui-react";
|
|
@@ -8,7 +8,7 @@ import { numberRules } from "@truedat/core/services/formRules";
|
|
|
8
8
|
|
|
9
9
|
export default function Deviation() {
|
|
10
10
|
const { formatMessage } = useIntl();
|
|
11
|
-
const { field } =
|
|
11
|
+
const { field } = use(QxContext);
|
|
12
12
|
const { control, watch } = useFormContext();
|
|
13
13
|
|
|
14
14
|
const maximumField = `${field}.maximum`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { use } from "react";
|
|
2
2
|
import { useIntl } from "react-intl";
|
|
3
3
|
import { Controller, useFormContext } from "react-hook-form";
|
|
4
4
|
import { Form } from "semantic-ui-react";
|
|
@@ -8,7 +8,7 @@ import { numberRules } from "@truedat/core/services/formRules";
|
|
|
8
8
|
|
|
9
9
|
export default function ErrorCount() {
|
|
10
10
|
const { formatMessage } = useIntl();
|
|
11
|
-
const { field } =
|
|
11
|
+
const { field } = use(QxContext);
|
|
12
12
|
const { control, watch } = useFormContext();
|
|
13
13
|
|
|
14
14
|
const maximumField = `${field}.maximum`;
|
|
@@ -57,6 +57,7 @@ export default function ErrorCount() {
|
|
|
57
57
|
rules={numberRules({
|
|
58
58
|
formatMessage,
|
|
59
59
|
minValue: goal,
|
|
60
|
+
maxValue: 100,
|
|
60
61
|
required: true,
|
|
61
62
|
})}
|
|
62
63
|
render={({
|
|
@@ -67,8 +68,7 @@ export default function ErrorCount() {
|
|
|
67
68
|
label={formatMessage({
|
|
68
69
|
id: "quality_control.score_criteria.error_count.maximum",
|
|
69
70
|
})}
|
|
70
|
-
|
|
71
|
-
error={error?.message}
|
|
71
|
+
error={!!error}
|
|
72
72
|
>
|
|
73
73
|
<Form.Input
|
|
74
74
|
autoComplete="off"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { use } from "react";
|
|
2
2
|
import { useIntl } from "react-intl";
|
|
3
3
|
import { Controller, useFormContext } from "react-hook-form";
|
|
4
4
|
import { Form } from "semantic-ui-react";
|
|
@@ -8,7 +8,7 @@ import { numberRules } from "@truedat/core/services/formRules";
|
|
|
8
8
|
|
|
9
9
|
export default function Percentage() {
|
|
10
10
|
const { formatMessage } = useIntl();
|
|
11
|
-
const { field } =
|
|
11
|
+
const { field } = use(QxContext);
|
|
12
12
|
const { control, watch } = useFormContext();
|
|
13
13
|
|
|
14
14
|
const minimumField = `${field}.minimum`;
|
|
@@ -0,0 +1,62 @@
|
|
|
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 Count from "../Count";
|
|
8
|
+
|
|
9
|
+
const renderOpts = { messages };
|
|
10
|
+
|
|
11
|
+
describe("<Count />", () => {
|
|
12
|
+
it("matches the latest snapshot", async () => {
|
|
13
|
+
const { container } = render(
|
|
14
|
+
<TestFormWrapper>
|
|
15
|
+
<Count />
|
|
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
|
+
<Count />
|
|
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
|
+
<Count />
|
|
48
|
+
</TestFormWrapper>,
|
|
49
|
+
renderOpts
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const goalInput = getByPlaceholderText("Goal");
|
|
53
|
+
const thresholdInput = getByPlaceholderText("Threshold");
|
|
54
|
+
|
|
55
|
+
fireEvent.change(goalInput, { target: { value: "10" } });
|
|
56
|
+
fireEvent.change(thresholdInput, { target: { value: "1" } });
|
|
57
|
+
|
|
58
|
+
await waitFor(() =>
|
|
59
|
+
expect(queryByText(/Must be greater than 10/i)).toBeInTheDocument()
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -1,63 +1,71 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
1
|
+
import userEvent from "@testing-library/user-event";
|
|
3
2
|
import { waitFor } from "@testing-library/react";
|
|
4
|
-
import {
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
5
4
|
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
6
|
-
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
7
5
|
import ErrorCount from "../ErrorCount";
|
|
8
6
|
|
|
9
|
-
const renderOpts = { messages };
|
|
10
|
-
|
|
11
7
|
describe("<ErrorCount />", () => {
|
|
12
8
|
it("matches the latest snapshot", async () => {
|
|
13
|
-
const
|
|
9
|
+
const rendered = render(
|
|
14
10
|
<TestFormWrapper>
|
|
15
11
|
<ErrorCount />
|
|
16
|
-
</TestFormWrapper
|
|
17
|
-
renderOpts
|
|
12
|
+
</TestFormWrapper>
|
|
18
13
|
);
|
|
19
|
-
|
|
14
|
+
await waitForLoad(rendered);
|
|
15
|
+
expect(rendered.container).toMatchSnapshot();
|
|
20
16
|
});
|
|
21
17
|
|
|
22
18
|
it("should update the goal and maximum fields correctly", async () => {
|
|
23
19
|
const defaultValues = { "testField.goal": "", "testField.maximum": "" };
|
|
24
|
-
|
|
25
|
-
const { getByPlaceholderText, queryByText } = render(
|
|
20
|
+
const rendered = render(
|
|
26
21
|
<TestFormWrapper defaultValues={defaultValues}>
|
|
27
22
|
<ErrorCount />
|
|
28
|
-
</TestFormWrapper
|
|
29
|
-
renderOpts
|
|
23
|
+
</TestFormWrapper>
|
|
30
24
|
);
|
|
25
|
+
await waitForLoad(rendered);
|
|
31
26
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
const user = userEvent.setup({ delay: null });
|
|
28
|
+
const goalInput = rendered.getByPlaceholderText(
|
|
29
|
+
"quality_control.score_criteria.error_count.goal"
|
|
30
|
+
);
|
|
31
|
+
const thresholdInput = rendered.getByPlaceholderText(
|
|
32
|
+
"quality_control.score_criteria.error_count.maximum"
|
|
33
|
+
);
|
|
38
34
|
|
|
35
|
+
await user.type(goalInput, "10");
|
|
36
|
+
await user.type(thresholdInput, "20");
|
|
37
|
+
rendered.debug();
|
|
39
38
|
await waitFor(() =>
|
|
40
|
-
expect(
|
|
39
|
+
expect(
|
|
40
|
+
rendered.queryByText(/must be greater than y/i)
|
|
41
|
+
).not.toBeInTheDocument()
|
|
41
42
|
);
|
|
42
43
|
});
|
|
43
44
|
|
|
44
|
-
it("Show alert if thresholdInput is less than goal", async () => {
|
|
45
|
-
const
|
|
45
|
+
it.skip("Show alert if thresholdInput is less than goal", async () => {
|
|
46
|
+
const rendered = render(
|
|
46
47
|
<TestFormWrapper>
|
|
47
48
|
<ErrorCount />
|
|
48
|
-
</TestFormWrapper
|
|
49
|
-
renderOpts
|
|
49
|
+
</TestFormWrapper>
|
|
50
50
|
);
|
|
51
|
+
await waitForLoad(rendered);
|
|
51
52
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const user = userEvent.setup({ delay: null });
|
|
54
|
+
const goalInput = rendered.getByPlaceholderText(
|
|
55
|
+
"quality_control.score_criteria.error_count.goal"
|
|
56
|
+
);
|
|
57
|
+
const thresholdInput = rendered.getByPlaceholderText(
|
|
58
|
+
"quality_control.score_criteria.error_count.maximum"
|
|
59
|
+
);
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
await user.type(goalInput, "10");
|
|
62
|
+
await user.type(thresholdInput, "1");
|
|
63
|
+
await waitForLoad(rendered);
|
|
58
64
|
|
|
59
65
|
await waitFor(() =>
|
|
60
|
-
expect(
|
|
66
|
+
expect(
|
|
67
|
+
rendered.queryByText(/must be greater than 10/i)
|
|
68
|
+
).toBeInTheDocument()
|
|
61
69
|
);
|
|
62
70
|
});
|
|
63
71
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
1
|
+
import userEvent from "@testing-library/user-event";
|
|
3
2
|
import { waitFor } from "@testing-library/react";
|
|
4
|
-
import {
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
5
4
|
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
6
5
|
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
7
6
|
import Percentage from "../Percentage";
|
|
@@ -10,52 +9,57 @@ const renderOpts = { messages };
|
|
|
10
9
|
|
|
11
10
|
describe("<Percentage />", () => {
|
|
12
11
|
it("matches the latest snapshot", async () => {
|
|
13
|
-
const
|
|
12
|
+
const rendered = render(
|
|
14
13
|
<TestFormWrapper>
|
|
15
14
|
<Percentage />
|
|
16
15
|
</TestFormWrapper>,
|
|
17
16
|
renderOpts
|
|
18
17
|
);
|
|
19
|
-
|
|
20
|
-
expect(container).toMatchSnapshot();
|
|
18
|
+
await waitForLoad(rendered);
|
|
19
|
+
expect(rendered.container).toMatchSnapshot();
|
|
21
20
|
});
|
|
22
21
|
|
|
23
22
|
it("should update the goal and maximum fields correctly", async () => {
|
|
24
|
-
const {
|
|
23
|
+
const user = userEvent.setup({ delay: null });
|
|
24
|
+
const rendered = render(
|
|
25
25
|
<TestFormWrapper>
|
|
26
26
|
<Percentage />
|
|
27
27
|
</TestFormWrapper>,
|
|
28
28
|
renderOpts
|
|
29
29
|
);
|
|
30
|
+
await waitForLoad(rendered);
|
|
30
31
|
|
|
31
|
-
const goalInput = getByPlaceholderText(
|
|
32
|
+
const goalInput = rendered.getByPlaceholderText(/goal/i);
|
|
33
|
+
const thresholdInput = rendered.getByPlaceholderText(/threshold/i);
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
await user.type(goalInput, "20");
|
|
36
|
+
await user.type(thresholdInput, "10");
|
|
34
37
|
|
|
35
|
-
fireEvent.change(goalInput, { target: { value: "20" } });
|
|
36
|
-
fireEvent.change(thresholdInput, { target: { value: "10" } });
|
|
37
38
|
await waitFor(() =>
|
|
38
|
-
expect(
|
|
39
|
+
expect(
|
|
40
|
+
rendered.queryByText(/must be less than 10/i)
|
|
41
|
+
).not.toBeInTheDocument()
|
|
39
42
|
);
|
|
40
43
|
});
|
|
41
44
|
|
|
42
45
|
it("Show alert if thresholdInput is more than goal", async () => {
|
|
43
|
-
const {
|
|
46
|
+
const user = userEvent.setup({ delay: null });
|
|
47
|
+
const rendered = render(
|
|
44
48
|
<TestFormWrapper>
|
|
45
49
|
<Percentage />
|
|
46
50
|
</TestFormWrapper>,
|
|
47
51
|
renderOpts
|
|
48
52
|
);
|
|
53
|
+
await waitForLoad(rendered);
|
|
49
54
|
|
|
50
|
-
const goalInput = getByPlaceholderText(
|
|
51
|
-
|
|
52
|
-
const thresholdInput = getByPlaceholderText("Threshold");
|
|
55
|
+
const goalInput = rendered.getByPlaceholderText(/goal/i);
|
|
56
|
+
const thresholdInput = rendered.getByPlaceholderText(/threshold/i);
|
|
53
57
|
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
await user.type(goalInput, "10");
|
|
59
|
+
await user.type(thresholdInput, "20");
|
|
56
60
|
|
|
57
61
|
await waitFor(() =>
|
|
58
|
-
expect(queryByText(/
|
|
62
|
+
expect(rendered.queryByText(/must be less than 10/i)).toBeInTheDocument()
|
|
59
63
|
);
|
|
60
64
|
});
|
|
61
65
|
});
|
package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/Count.spec.js.snap
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<Count /> 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
|
+
`;
|
|
@@ -8,7 +8,7 @@ exports[`<ErrorCount /> matches the latest snapshot 1`] = `
|
|
|
8
8
|
<label
|
|
9
9
|
class="field-label"
|
|
10
10
|
>
|
|
11
|
-
|
|
11
|
+
quality_control.score_criteria.error_count.goal
|
|
12
12
|
<span>
|
|
13
13
|
*
|
|
14
14
|
</span>
|
|
@@ -21,7 +21,7 @@ exports[`<ErrorCount /> matches the latest snapshot 1`] = `
|
|
|
21
21
|
>
|
|
22
22
|
<input
|
|
23
23
|
autocomplete="off"
|
|
24
|
-
placeholder="
|
|
24
|
+
placeholder="quality_control.score_criteria.error_count.goal"
|
|
25
25
|
type="text"
|
|
26
26
|
value=""
|
|
27
27
|
/>
|
|
@@ -34,10 +34,7 @@ exports[`<ErrorCount /> matches the latest snapshot 1`] = `
|
|
|
34
34
|
<label
|
|
35
35
|
class="field-label"
|
|
36
36
|
>
|
|
37
|
-
|
|
38
|
-
<span>
|
|
39
|
-
*
|
|
40
|
-
</span>
|
|
37
|
+
quality_control.score_criteria.error_count.maximum
|
|
41
38
|
</label>
|
|
42
39
|
<div
|
|
43
40
|
class="field"
|
|
@@ -47,7 +44,7 @@ exports[`<ErrorCount /> matches the latest snapshot 1`] = `
|
|
|
47
44
|
>
|
|
48
45
|
<input
|
|
49
46
|
autocomplete="off"
|
|
50
|
-
placeholder="
|
|
47
|
+
placeholder="quality_control.score_criteria.error_count.maximum"
|
|
51
48
|
type="text"
|
|
52
49
|
value=""
|
|
53
50
|
/>
|