@truedat/qx 8.5.1 → 8.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/components/common/expressions/Clauses.js +5 -9
- package/src/components/common/expressions/Condition.js +36 -37
- package/src/components/common/expressions/__tests__/Clauses.spec.js +87 -0
- package/src/components/common/expressions/__tests__/Condition.spec.js +220 -1
- package/src/components/common/expressions/__tests__/__snapshots__/Clauses.spec.js.snap +22 -21
- package/src/components/common/expressions/__tests__/__snapshots__/Condition.spec.js.snap +212 -214
- package/src/components/dataViews/queryableProperties/GroupBy.js +4 -2
- package/src/components/dataViews/queryableProperties/__tests__/GroupBy.spec.js +134 -28
- package/src/components/qualityControls/ControlProperties.js +32 -16
- package/src/components/qualityControls/ControlPropertiesForm.js +3 -3
- package/src/components/qualityControls/ControlPropertiesSummary.js +127 -104
- package/src/components/qualityControls/ControlPropertiesView.js +48 -74
- package/src/components/qualityControls/InformationForm.js +181 -180
- package/src/components/qualityControls/ScoreCriteria.js +0 -4
- package/src/components/qualityControls/ScoreCriteriaView.js +6 -9
- package/src/components/qualityControls/__tests__/ControlProperties.spec.js +47 -16
- package/src/components/qualityControls/__tests__/ControlPropertiesForm.spec.js +100 -0
- package/src/components/qualityControls/__tests__/ControlPropertiesSummary.spec.js +141 -0
- package/src/components/qualityControls/__tests__/ControlPropertiesView.spec.js +102 -11
- package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +27 -3
- package/src/components/qualityControls/__tests__/InformationForm.spec.js +342 -0
- package/src/components/qualityControls/__tests__/NewDraftQualityControl.spec.js +26 -6
- package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +66 -20
- package/src/components/qualityControls/__tests__/QualityBadge.spec.js +30 -3
- package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +282 -45
- package/src/components/qualityControls/__tests__/ScoreCriteria.spec.js +25 -3
- package/src/components/qualityControls/__tests__/ScoreCriteriaView.spec.js +19 -3
- package/src/components/qualityControls/__tests__/__fixtures__/qualityControlHelper.js +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/ControlProperties.spec.js.snap +13 -1
- package/src/components/qualityControls/__tests__/__snapshots__/ControlPropertiesView.spec.js.snap +70 -40
- package/src/components/qualityControls/__tests__/__snapshots__/EditQualityControl.spec.js.snap +118 -132
- package/src/components/qualityControls/__tests__/__snapshots__/NewDraftQualityControl.spec.js.snap +118 -132
- package/src/components/qualityControls/__tests__/__snapshots__/NewQualityControl.spec.js.snap +0 -13
- package/src/components/qualityControls/__tests__/__snapshots__/QualityBadge.spec.js.snap +15 -5
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlEditor.spec.js.snap +488 -125
- package/src/components/qualityControls/__tests__/__snapshots__/ScoreCriteria.spec.js.snap +13 -5
- package/src/components/qualityControls/__tests__/qualityByControlMode.spec.js +65 -14
- package/src/components/qualityControls/controlProperties/{Ratio.js → ResourceWithValidation.js} +19 -10
- package/src/components/qualityControls/controlProperties/__tests__/ResourceWithValidation.spec.js +192 -0
- package/src/components/qualityControls/qualityByControlMode.js +6 -30
- package/src/components/qualityControls/scoreCriterias/ErrorCount.js +0 -1
- package/src/components/qualityControls/scoreCriterias/__tests__/ErrorCount.spec.js +4 -4
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/GroupBy.spec.js.snap +0 -604
- package/src/components/qualityControls/controlProperties/Count.js +0 -56
- package/src/components/qualityControls/controlProperties/__tests__/Count.spec.js +0 -66
- package/src/components/qualityControls/controlProperties/__tests__/Ratio.spec.js +0 -95
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/Count.spec.js.snap +0 -67
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/Ratio.spec.js.snap +0 -161
- package/src/components/qualityControls/scoreCriterias/Count.js +0 -88
- package/src/components/qualityControls/scoreCriterias/__tests__/Count.spec.js +0 -62
- package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/Count.spec.js.snap +0 -58
|
@@ -8,20 +8,26 @@ import DataViewSummary from "../dataViews/DataViewSummary";
|
|
|
8
8
|
import { useDataViewFetch } from "@truedat/qx/hooks/useDataViews";
|
|
9
9
|
import { getColorById } from "../dataViews/queryableFunctions";
|
|
10
10
|
|
|
11
|
+
const ratioViewProps = {
|
|
12
|
+
resourceKey: "resource",
|
|
13
|
+
resourceLabelId: "quality_control.ratio.resource",
|
|
14
|
+
resourceEmptyLabelId: "quality_control.ratio.resource.empty",
|
|
15
|
+
validationLabelId: "quality_control.ratio.validation",
|
|
16
|
+
validationEmptyLabelId: "quality_control.ratio.validation.empty",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const countViewProps = {
|
|
20
|
+
resourceKey: "errors_resource",
|
|
21
|
+
resourceLabelId: "quality_control.count.errors_resource",
|
|
22
|
+
resourceEmptyLabelId: "quality_control.count.errors_resource.empty",
|
|
23
|
+
validationLabelId: "quality_control.count.validation",
|
|
24
|
+
validationEmptyLabelId: "quality_control.count.validation.empty",
|
|
25
|
+
};
|
|
26
|
+
|
|
11
27
|
export default function ControlPropertiesView({ qualityControl }) {
|
|
12
28
|
const { control_properties, control_mode } = qualityControl;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
<ControlPropertiesRatio controlProperties={control_properties} />
|
|
16
|
-
),
|
|
17
|
-
deviation: (
|
|
18
|
-
<ControlPropertiesRatio controlProperties={control_properties} />
|
|
19
|
-
),
|
|
20
|
-
count: <ControlPropertiesCount controlProperties={control_properties} />,
|
|
21
|
-
error_count: (
|
|
22
|
-
<ControlPropertiesRatio controlProperties={control_properties} />
|
|
23
|
-
),
|
|
24
|
-
};
|
|
29
|
+
const viewProps =
|
|
30
|
+
control_mode === "error_count" ? countViewProps : ratioViewProps;
|
|
25
31
|
|
|
26
32
|
return (
|
|
27
33
|
<>
|
|
@@ -33,7 +39,10 @@ export default function ControlPropertiesView({ qualityControl }) {
|
|
|
33
39
|
</Header>
|
|
34
40
|
<Segment>
|
|
35
41
|
{control_properties ? (
|
|
36
|
-
|
|
42
|
+
<ResourceWithValidationView
|
|
43
|
+
controlProperties={control_properties}
|
|
44
|
+
{...viewProps}
|
|
45
|
+
/>
|
|
37
46
|
) : (
|
|
38
47
|
<FormattedMessage id="quality_control.control_properties.empty" />
|
|
39
48
|
)}
|
|
@@ -42,32 +51,40 @@ export default function ControlPropertiesView({ qualityControl }) {
|
|
|
42
51
|
);
|
|
43
52
|
}
|
|
44
53
|
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
const ResourceWithValidationView = ({
|
|
55
|
+
controlProperties,
|
|
56
|
+
resourceKey,
|
|
57
|
+
resourceLabelId,
|
|
58
|
+
resourceEmptyLabelId,
|
|
59
|
+
validationLabelId,
|
|
60
|
+
validationEmptyLabelId,
|
|
61
|
+
}) => {
|
|
62
|
+
const resource = _.prop(resourceKey)(controlProperties);
|
|
63
|
+
const parentResource = { id: 0, embedded: resource?.embedded };
|
|
64
|
+
const isDataViewResource = resource?.type === "data_view";
|
|
65
|
+
const dataViewId = isDataViewResource ? resource?.id : null;
|
|
49
66
|
const { dataView, loading: dataViewLoading } = useDataViewFetch(dataViewId);
|
|
50
67
|
|
|
51
68
|
return (
|
|
52
69
|
<List>
|
|
53
70
|
<List.Item>
|
|
54
71
|
<List.Header>
|
|
55
|
-
<FormattedMessage id=
|
|
72
|
+
<FormattedMessage id={resourceLabelId} />
|
|
56
73
|
</List.Header>
|
|
57
74
|
<List.Content>
|
|
58
|
-
{
|
|
75
|
+
{resource ? (
|
|
59
76
|
<List.Description>
|
|
60
77
|
<Label horizontal>
|
|
61
78
|
<FormattedMessage
|
|
62
|
-
id={`queryables.resource.selector.${
|
|
79
|
+
id={`queryables.resource.selector.${resource?.type}`}
|
|
63
80
|
/>
|
|
64
81
|
</Label>
|
|
65
82
|
<Label color={getColorById(parentResource?.id)}>
|
|
66
|
-
{_.prop(
|
|
83
|
+
{_.prop(`${resourceKey}.embedded.name`)(controlProperties)}
|
|
67
84
|
</Label>
|
|
68
85
|
</List.Description>
|
|
69
86
|
) : (
|
|
70
|
-
<FormattedMessage id=
|
|
87
|
+
<FormattedMessage id={resourceEmptyLabelId} />
|
|
71
88
|
)}
|
|
72
89
|
</List.Content>
|
|
73
90
|
</List.Item>
|
|
@@ -87,7 +104,7 @@ const ControlPropertiesRatio = ({ controlProperties }) => {
|
|
|
87
104
|
)}
|
|
88
105
|
<List.Item>
|
|
89
106
|
<List.Header>
|
|
90
|
-
<FormattedMessage id=
|
|
107
|
+
<FormattedMessage id={validationLabelId} />
|
|
91
108
|
</List.Header>
|
|
92
109
|
<List.Content>
|
|
93
110
|
{controlProperties.validation ? (
|
|
@@ -98,7 +115,7 @@ const ControlPropertiesRatio = ({ controlProperties }) => {
|
|
|
98
115
|
/>
|
|
99
116
|
</List.Description>
|
|
100
117
|
) : (
|
|
101
|
-
<FormattedMessage id=
|
|
118
|
+
<FormattedMessage id={validationEmptyLabelId} />
|
|
102
119
|
)}
|
|
103
120
|
</List.Content>
|
|
104
121
|
</List.Item>
|
|
@@ -106,56 +123,13 @@ const ControlPropertiesRatio = ({ controlProperties }) => {
|
|
|
106
123
|
);
|
|
107
124
|
};
|
|
108
125
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const { dataView, loading: dataViewLoading } = useDataViewFetch(dataViewId);
|
|
117
|
-
|
|
118
|
-
return (
|
|
119
|
-
<List>
|
|
120
|
-
<List.Item>
|
|
121
|
-
<List.Header>
|
|
122
|
-
<FormattedMessage id="quality_control.count.errors_resource" />
|
|
123
|
-
</List.Header>
|
|
124
|
-
<List.Content>
|
|
125
|
-
{controlProperties.errors_resource ? (
|
|
126
|
-
<List.Description>
|
|
127
|
-
<Label horizontal>
|
|
128
|
-
<FormattedMessage
|
|
129
|
-
id={`queryables.resource.selector.${controlProperties.errors_resource?.type}`}
|
|
130
|
-
/>
|
|
131
|
-
</Label>
|
|
132
|
-
<Label
|
|
133
|
-
color={getColorById(parentResource?.id)}
|
|
134
|
-
>
|
|
135
|
-
{_.prop("errors_resource.embedded.name")(controlProperties)}
|
|
136
|
-
</Label>
|
|
137
|
-
</List.Description>
|
|
138
|
-
) : (
|
|
139
|
-
<FormattedMessage id="quality_control.count.errors_resource.empty" />
|
|
140
|
-
)}
|
|
141
|
-
</List.Content>
|
|
142
|
-
</List.Item>
|
|
143
|
-
{isDataViewResource && (
|
|
144
|
-
<List.Item>
|
|
145
|
-
<List.Header style={{ marginBottom: 8 }}>
|
|
146
|
-
<FormattedMessage id="quality_control.data_view_summary" />
|
|
147
|
-
</List.Header>
|
|
148
|
-
<List.Content>
|
|
149
|
-
{dataViewLoading ? (
|
|
150
|
-
<Loading />
|
|
151
|
-
) : dataView ? (
|
|
152
|
-
<DataViewSummary dataView={dataView} />
|
|
153
|
-
) : null}
|
|
154
|
-
</List.Content>
|
|
155
|
-
</List.Item>
|
|
156
|
-
)}
|
|
157
|
-
</List>
|
|
158
|
-
);
|
|
126
|
+
ResourceWithValidationView.propTypes = {
|
|
127
|
+
controlProperties: PropTypes.object,
|
|
128
|
+
resourceKey: PropTypes.oneOf(["resource", "errors_resource"]).isRequired,
|
|
129
|
+
resourceLabelId: PropTypes.string.isRequired,
|
|
130
|
+
resourceEmptyLabelId: PropTypes.string.isRequired,
|
|
131
|
+
validationLabelId: PropTypes.string.isRequired,
|
|
132
|
+
validationEmptyLabelId: PropTypes.string.isRequired,
|
|
159
133
|
};
|
|
160
134
|
|
|
161
135
|
ControlPropertiesView.propTypes = {
|
|
@@ -3,200 +3,201 @@ import { lazy, useEffect } from "react";
|
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { Divider, Form, Segment } from "semantic-ui-react";
|
|
5
5
|
import { useFormContext, Controller } from "react-hook-form";
|
|
6
|
-
import {
|
|
7
|
-
DomainSelector,
|
|
8
|
-
FieldLabel,
|
|
9
|
-
} from "@truedat/core/components";
|
|
6
|
+
import { DomainSelector, FieldLabel } from "@truedat/core/components";
|
|
10
7
|
import ScoreCriteria, {
|
|
11
|
-
|
|
8
|
+
defaultForMode as defaultScoreCriteriaForMode,
|
|
12
9
|
} from "./ScoreCriteria";
|
|
13
|
-
import {
|
|
14
|
-
defaultForMode as defaultControlPropertiesForMode,
|
|
15
|
-
} from "./ControlProperties";
|
|
10
|
+
import { defaultForMode as defaultControlPropertiesForMode } from "./ControlProperties";
|
|
16
11
|
|
|
17
12
|
const SelectableDynamicForm = lazy(
|
|
18
|
-
|
|
13
|
+
() => import("@truedat/df/components/SelectableDynamicForm"),
|
|
19
14
|
);
|
|
20
15
|
|
|
21
16
|
const InformationForm = ({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
isModification,
|
|
18
|
+
setStepInformation,
|
|
19
|
+
stepInformation,
|
|
20
|
+
setValidDfContent,
|
|
26
21
|
}) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
const { formatMessage } = useIntl();
|
|
23
|
+
const { control, watch, setValue } = useFormContext();
|
|
24
|
+
const fieldNames = [
|
|
25
|
+
"active",
|
|
26
|
+
"domain_ids",
|
|
27
|
+
"name",
|
|
28
|
+
"df_type",
|
|
29
|
+
"control_mode",
|
|
30
|
+
"score_criteria",
|
|
31
|
+
];
|
|
37
32
|
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
const formData = watch();
|
|
34
|
+
const { dynamic_content: dfContent, domain_ids: domainIds } = formData;
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
const setDfContent = ({ content, valid }) => {
|
|
37
|
+
setValue("dynamic_content", content, {
|
|
38
|
+
shouldValidate: true,
|
|
39
|
+
shouldDirty: true,
|
|
40
|
+
});
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
setValidDfContent(_.isEmpty(valid));
|
|
43
|
+
};
|
|
49
44
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
const controlModeOptions = _.map((v) => ({
|
|
46
|
+
key: v,
|
|
47
|
+
value: v,
|
|
48
|
+
text: formatMessage({ id: `quality_control.control_mode.${v}` }),
|
|
49
|
+
}))(["percentage", "deviation", "error_count"]);
|
|
55
50
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!_.isEqual(stepInformation?.fieldNames, fieldNames))
|
|
53
|
+
setStepInformation(0, { ...stepInformation, fieldNames });
|
|
54
|
+
}, [stepInformation, fieldNames]);
|
|
60
55
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
<Segment>
|
|
59
|
+
<Controller
|
|
60
|
+
control={control}
|
|
61
|
+
name="active"
|
|
62
|
+
render={({ field: { onChange, value } }) => (
|
|
63
|
+
<Form.Radio
|
|
64
|
+
checked={value}
|
|
65
|
+
disabled={isModification}
|
|
66
|
+
name="active"
|
|
67
|
+
label={formatMessage({
|
|
68
|
+
id: "quality_control.form.active",
|
|
69
|
+
})}
|
|
70
|
+
onChange={(_e, { checked }) => onChange(checked)}
|
|
71
|
+
toggle
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
74
|
+
/>
|
|
75
|
+
<Controller
|
|
76
|
+
control={control}
|
|
77
|
+
name="domain_ids"
|
|
78
|
+
rules={{
|
|
79
|
+
required: formatMessage({
|
|
80
|
+
id: "form.validation.empty_required",
|
|
81
|
+
}),
|
|
82
|
+
}}
|
|
83
|
+
render={({
|
|
84
|
+
field: { onBlur, onChange, value },
|
|
85
|
+
fieldState: { error },
|
|
86
|
+
}) => (
|
|
87
|
+
<FieldLabel
|
|
88
|
+
label={formatMessage({
|
|
89
|
+
id: "quality_control.form.domain_ids",
|
|
90
|
+
})}
|
|
91
|
+
required
|
|
92
|
+
error={error?.message}
|
|
93
|
+
>
|
|
94
|
+
<DomainSelector
|
|
95
|
+
action="createQualityControls"
|
|
96
|
+
value={value}
|
|
97
|
+
error={!!error}
|
|
98
|
+
multiple
|
|
99
|
+
onBlur={onBlur}
|
|
100
|
+
disabled={isModification}
|
|
101
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
102
|
+
labels
|
|
103
|
+
/>
|
|
104
|
+
</FieldLabel>
|
|
105
|
+
)}
|
|
106
|
+
/>
|
|
107
|
+
<Controller
|
|
108
|
+
control={control}
|
|
109
|
+
name="name"
|
|
110
|
+
rules={{
|
|
111
|
+
required: formatMessage({ id: "form.validation.empty_required" }),
|
|
112
|
+
}}
|
|
113
|
+
render={({
|
|
114
|
+
field: { onBlur, onChange, value },
|
|
115
|
+
fieldState: { error },
|
|
116
|
+
}) => (
|
|
117
|
+
<FieldLabel
|
|
118
|
+
label={formatMessage({ id: "quality_control.form.name" })}
|
|
119
|
+
required
|
|
120
|
+
error={error?.message}
|
|
121
|
+
>
|
|
122
|
+
<Form.Input
|
|
123
|
+
autoComplete="off"
|
|
124
|
+
placeholder={formatMessage({ id: "dataViews.form.name" })}
|
|
125
|
+
error={!!error}
|
|
126
|
+
onBlur={onBlur}
|
|
127
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
128
|
+
value={value}
|
|
129
|
+
/>
|
|
130
|
+
</FieldLabel>
|
|
131
|
+
)}
|
|
132
|
+
/>
|
|
133
|
+
<Controller
|
|
134
|
+
control={control}
|
|
135
|
+
name="df_type"
|
|
136
|
+
rules={{ required: true }}
|
|
137
|
+
render={({
|
|
138
|
+
field: { onBlur, onChange, value },
|
|
139
|
+
fieldState: { error },
|
|
140
|
+
}) => (
|
|
141
|
+
<SelectableDynamicForm
|
|
142
|
+
scope="quality_control"
|
|
143
|
+
content={dfContent}
|
|
144
|
+
domainIds={domainIds}
|
|
145
|
+
isModification={isModification}
|
|
146
|
+
name={value}
|
|
147
|
+
onChange={setDfContent}
|
|
148
|
+
onNameChange={onChange}
|
|
149
|
+
onBlur={onBlur}
|
|
150
|
+
requiredError={!!error}
|
|
151
|
+
required
|
|
152
|
+
/>
|
|
153
|
+
)}
|
|
154
|
+
/>
|
|
155
|
+
<Controller
|
|
156
|
+
name={"control_mode"}
|
|
157
|
+
control={control}
|
|
158
|
+
rules={{
|
|
159
|
+
required: {
|
|
160
|
+
value: true,
|
|
161
|
+
message: formatMessage({ id: "quality_control.form.required" }),
|
|
162
|
+
},
|
|
163
|
+
}}
|
|
164
|
+
render={({
|
|
165
|
+
field: { onBlur, onChange, value },
|
|
166
|
+
fieldState: { error },
|
|
167
|
+
}) => (
|
|
168
|
+
<Form.Field required>
|
|
169
|
+
<label>
|
|
170
|
+
{formatMessage({ id: "quality_control.control_mode" })}
|
|
171
|
+
</label>
|
|
172
|
+
<Form.Dropdown
|
|
173
|
+
selection
|
|
174
|
+
placeholder={formatMessage({
|
|
175
|
+
id: "quality_control.control_mode",
|
|
176
|
+
})}
|
|
177
|
+
onBlur={onBlur}
|
|
178
|
+
options={controlModeOptions}
|
|
179
|
+
onChange={(_e, { value }) => {
|
|
180
|
+
onChange(value);
|
|
181
|
+
setValue(
|
|
182
|
+
"control_properties",
|
|
183
|
+
defaultControlPropertiesForMode(value),
|
|
184
|
+
);
|
|
185
|
+
setValue(
|
|
186
|
+
"score_criteria",
|
|
187
|
+
defaultScoreCriteriaForMode(value),
|
|
188
|
+
);
|
|
189
|
+
}}
|
|
190
|
+
error={error?.message}
|
|
191
|
+
value={value}
|
|
192
|
+
/>
|
|
193
|
+
</Form.Field>
|
|
194
|
+
)}
|
|
195
|
+
/>
|
|
196
|
+
<ScoreCriteria />
|
|
197
|
+
</Segment>
|
|
198
|
+
<Divider hidden />
|
|
199
|
+
</>
|
|
200
|
+
);
|
|
200
201
|
};
|
|
201
202
|
|
|
202
203
|
export default InformationForm;
|
|
@@ -5,7 +5,6 @@ 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";
|
|
9
8
|
import Percentage from "./scoreCriterias/Percentage";
|
|
10
9
|
|
|
11
10
|
export default function ScoreCriteria() {
|
|
@@ -16,7 +15,6 @@ export default function ScoreCriteria() {
|
|
|
16
15
|
|
|
17
16
|
const scoreCriteriaForMode = {
|
|
18
17
|
deviation: <Deviation />,
|
|
19
|
-
count: <Count />,
|
|
20
18
|
error_count: <ErrorCount />,
|
|
21
19
|
percentage: <Percentage />,
|
|
22
20
|
};
|
|
@@ -34,8 +32,6 @@ export const defaultForMode = (controlMode) => {
|
|
|
34
32
|
switch (controlMode) {
|
|
35
33
|
case "deviation":
|
|
36
34
|
return { goal: null, maximum: null };
|
|
37
|
-
case "count":
|
|
38
|
-
return { goal: null, maximum: null };
|
|
39
35
|
case "error_count":
|
|
40
36
|
return { goal: null, maximum: null };
|
|
41
37
|
case "percentage":
|
|
@@ -11,11 +11,14 @@ export default function ScoreCriteriaView({ qualityControl }) {
|
|
|
11
11
|
|
|
12
12
|
switch (control_mode) {
|
|
13
13
|
case "percentage":
|
|
14
|
-
return
|
|
14
|
+
return (
|
|
15
|
+
!_.isNil(score_criteria.goal) && !_.isNil(score_criteria.minimum)
|
|
16
|
+
);
|
|
15
17
|
case "deviation":
|
|
16
18
|
case "error_count":
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
return (
|
|
20
|
+
!_.isNil(score_criteria.goal) && !_.isNil(score_criteria.maximum)
|
|
21
|
+
);
|
|
19
22
|
default:
|
|
20
23
|
return false;
|
|
21
24
|
}
|
|
@@ -35,12 +38,6 @@ export default function ScoreCriteriaView({ qualityControl }) {
|
|
|
35
38
|
/>
|
|
36
39
|
),
|
|
37
40
|
error_count: (
|
|
38
|
-
<ScoreCriteriaContent
|
|
39
|
-
goal={`${score_criteria?.goal}%`}
|
|
40
|
-
threshold={`${score_criteria?.maximum}%`}
|
|
41
|
-
/>
|
|
42
|
-
),
|
|
43
|
-
count: (
|
|
44
41
|
<ScoreCriteriaContent
|
|
45
42
|
goal={score_criteria?.goal}
|
|
46
43
|
threshold={score_criteria?.maximum}
|