@truedat/qx 7.0.7 → 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
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React, { Fragment } from "react";
|
|
2
|
+
import React, { useState, Fragment } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
|
-
import {
|
|
6
|
-
import { Button, Container, Divider, Form } from "semantic-ui-react";
|
|
5
|
+
import { Button, Container, Dropdown, Divider, Form } from "semantic-ui-react";
|
|
7
6
|
import { FormProvider, useForm, Controller } from "react-hook-form";
|
|
8
7
|
import {
|
|
9
8
|
ConfirmModal,
|
|
10
9
|
DomainSelector,
|
|
11
10
|
FieldLabel,
|
|
12
11
|
} from "@truedat/core/components";
|
|
13
|
-
import { lowerDeburrTrim } from "@truedat/core/services/sort";
|
|
14
12
|
import useActionDomains from "@truedat/core/hooks/useActionDomains";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import { fieldsFromResource } from "@truedat/qx/components/dataViews/queryableFunctions";
|
|
22
|
-
import ResultType from "./ResultType";
|
|
13
|
+
import ScoreCriteria, {
|
|
14
|
+
defaultForMode as defaultScoreCriteriaForMode,
|
|
15
|
+
} from "./ScoreCriteria";
|
|
16
|
+
import ControlProperties, {
|
|
17
|
+
defaultForMode as defaultControlPropertiesForMode,
|
|
18
|
+
} from "./ControlProperties";
|
|
23
19
|
|
|
24
20
|
const SelectableDynamicForm = React.lazy(() =>
|
|
25
21
|
import("@truedat/df/components/SelectableDynamicForm")
|
|
@@ -28,7 +24,7 @@ const SourceSelector = React.lazy(() =>
|
|
|
28
24
|
import("@truedat/cx/sources/components/SourceSelector")
|
|
29
25
|
);
|
|
30
26
|
|
|
31
|
-
export default function
|
|
27
|
+
export default function QualityControlEditor({
|
|
32
28
|
value,
|
|
33
29
|
onPublish,
|
|
34
30
|
onSave,
|
|
@@ -37,6 +33,7 @@ export default function QualityControlEditor({
|
|
|
37
33
|
isSubmitting,
|
|
38
34
|
}) {
|
|
39
35
|
const { formatMessage } = useIntl();
|
|
36
|
+
const [validDfContent, setValidDfContent] = useState(false);
|
|
40
37
|
const { data: publishDomainsData, loading: loadingDomains } =
|
|
41
38
|
useActionDomains({
|
|
42
39
|
action: "publishQualityControls",
|
|
@@ -46,80 +43,88 @@ export default function QualityControlEditor({
|
|
|
46
43
|
mode: "onTouched",
|
|
47
44
|
defaultValues: value,
|
|
48
45
|
});
|
|
49
|
-
const {
|
|
50
|
-
control,
|
|
51
|
-
handleSubmit,
|
|
52
|
-
formState,
|
|
53
|
-
watch,
|
|
54
|
-
setValue,
|
|
55
|
-
setError,
|
|
56
|
-
clearErrors,
|
|
57
|
-
} = form;
|
|
46
|
+
const { control, handleSubmit, formState, watch, setValue } = form;
|
|
58
47
|
const { isDirty, isValid } = formState;
|
|
59
48
|
|
|
60
|
-
const { data, loading: dataViewsLoading } = useDataViews();
|
|
61
|
-
const { data: functionsData, loading: functionsLoading } = useFunctions();
|
|
62
|
-
const { data: referenceDatasetsData, loading: referenceDatasetsLoading } =
|
|
63
|
-
useQuery(REFERENCE_DATASETS_HEADERS_QUERY);
|
|
64
|
-
|
|
65
|
-
const loading =
|
|
66
|
-
dataViewsLoading || functionsLoading || referenceDatasetsLoading;
|
|
67
|
-
|
|
68
49
|
const submitLoading = isSubmitting || loadingDomains;
|
|
69
50
|
|
|
70
|
-
const dataViews = _.orderBy(["id"], ["asc"])(data?.data);
|
|
71
|
-
const functions = functionsData?.data;
|
|
72
|
-
const referenceDatasets = _.flow(
|
|
73
|
-
_.getOr([], "referenceDatasets"),
|
|
74
|
-
_.sortBy([({ name }) => lowerDeburrTrim(name), "name"]),
|
|
75
|
-
_.map((row) => ({ ...row, id: Number(row?.id) }))
|
|
76
|
-
)(referenceDatasetsData);
|
|
77
|
-
|
|
78
|
-
const context = {
|
|
79
|
-
dataViews,
|
|
80
|
-
referenceDatasets,
|
|
81
|
-
functions,
|
|
82
|
-
};
|
|
83
|
-
|
|
84
51
|
if (!value) return null;
|
|
85
52
|
|
|
86
53
|
const formData = watch();
|
|
87
54
|
|
|
88
|
-
const {
|
|
89
|
-
resource,
|
|
90
|
-
name,
|
|
91
|
-
source_id: sourceId,
|
|
92
|
-
df_content: dfContent,
|
|
93
|
-
domain_ids: domainIds,
|
|
94
|
-
} = formData;
|
|
55
|
+
const { dynamic_content: dfContent, domain_ids: domainIds } = formData;
|
|
95
56
|
|
|
96
|
-
const allowedToPublish = _.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
domainIds
|
|
100
|
-
);
|
|
57
|
+
const allowedToPublish = _.every((domainId) =>
|
|
58
|
+
_.find({ id: `${domainId}` })(publishDomains)
|
|
59
|
+
)(domainIds);
|
|
101
60
|
|
|
102
61
|
const setDfContent = ({ content, valid }) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
setValue("df_content", content, {
|
|
109
|
-
shouldValidate: true,
|
|
110
|
-
shouldDirty: true,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
62
|
+
setValue("dynamic_content", content, {
|
|
63
|
+
shouldValidate: true,
|
|
64
|
+
shouldDirty: true,
|
|
65
|
+
});
|
|
66
|
+
setValidDfContent(_.isEmpty(valid));
|
|
113
67
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
68
|
+
|
|
69
|
+
const controlModeOptions = _.map((v) => ({
|
|
70
|
+
key: v,
|
|
71
|
+
value: v,
|
|
72
|
+
text: formatMessage({ id: `quality_control.control_mode.${v}` }),
|
|
73
|
+
}))(["percentage", "deviation", "error_count"]);
|
|
118
74
|
|
|
119
75
|
return (
|
|
120
76
|
<Fragment>
|
|
121
77
|
<FormProvider {...form}>
|
|
122
|
-
<Form
|
|
78
|
+
<Form>
|
|
79
|
+
<Controller
|
|
80
|
+
control={control}
|
|
81
|
+
name="active"
|
|
82
|
+
render={({ field: { onChange, value } }) => (
|
|
83
|
+
<Form.Radio
|
|
84
|
+
checked={value}
|
|
85
|
+
disabled={isModification}
|
|
86
|
+
name="active"
|
|
87
|
+
label={formatMessage({
|
|
88
|
+
id: "quality_control.form.active",
|
|
89
|
+
})}
|
|
90
|
+
onChange={(_e, { checked }) => onChange(checked)}
|
|
91
|
+
toggle
|
|
92
|
+
/>
|
|
93
|
+
)}
|
|
94
|
+
/>
|
|
95
|
+
<Controller
|
|
96
|
+
control={control}
|
|
97
|
+
name="domain_ids"
|
|
98
|
+
rules={{
|
|
99
|
+
required: formatMessage({
|
|
100
|
+
id: "form.validation.empty_required",
|
|
101
|
+
}),
|
|
102
|
+
}}
|
|
103
|
+
render={({
|
|
104
|
+
field: { onBlur, onChange, value },
|
|
105
|
+
fieldState: { error },
|
|
106
|
+
}) => (
|
|
107
|
+
<FieldLabel
|
|
108
|
+
label={formatMessage({
|
|
109
|
+
id: "quality_control.form.domain_ids",
|
|
110
|
+
})}
|
|
111
|
+
required
|
|
112
|
+
error={error?.message}
|
|
113
|
+
>
|
|
114
|
+
<DomainSelector
|
|
115
|
+
action="createQualityControls"
|
|
116
|
+
value={value}
|
|
117
|
+
error={!!error}
|
|
118
|
+
multiple
|
|
119
|
+
onBlur={onBlur}
|
|
120
|
+
disabled={isModification}
|
|
121
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
122
|
+
labels
|
|
123
|
+
/>
|
|
124
|
+
</FieldLabel>
|
|
125
|
+
)}
|
|
126
|
+
/>
|
|
127
|
+
|
|
123
128
|
<Controller
|
|
124
129
|
control={control}
|
|
125
130
|
name="name"
|
|
@@ -146,42 +151,6 @@ export default function QualityControlEditor({
|
|
|
146
151
|
</FieldLabel>
|
|
147
152
|
)}
|
|
148
153
|
/>
|
|
149
|
-
|
|
150
|
-
{isModification ? null : (
|
|
151
|
-
<Controller
|
|
152
|
-
control={control}
|
|
153
|
-
name="domain_ids"
|
|
154
|
-
rules={{
|
|
155
|
-
required: formatMessage({
|
|
156
|
-
id: "form.validation.empty_required",
|
|
157
|
-
}),
|
|
158
|
-
}}
|
|
159
|
-
render={({
|
|
160
|
-
field: { onBlur, onChange, value },
|
|
161
|
-
fieldState: { error },
|
|
162
|
-
}) => (
|
|
163
|
-
<FieldLabel
|
|
164
|
-
label={formatMessage({
|
|
165
|
-
id: "quality_control.form.domain_ids",
|
|
166
|
-
})}
|
|
167
|
-
required
|
|
168
|
-
error={error?.message}
|
|
169
|
-
>
|
|
170
|
-
<DomainSelector
|
|
171
|
-
action="createQualityControls"
|
|
172
|
-
value={value}
|
|
173
|
-
error={!!error}
|
|
174
|
-
multiple
|
|
175
|
-
onBlur={onBlur}
|
|
176
|
-
onChange={(_e, { value }) => onChange(value)}
|
|
177
|
-
labels
|
|
178
|
-
/>
|
|
179
|
-
</FieldLabel>
|
|
180
|
-
)}
|
|
181
|
-
/>
|
|
182
|
-
)}
|
|
183
|
-
<ResultType />
|
|
184
|
-
|
|
185
154
|
<Controller
|
|
186
155
|
control={control}
|
|
187
156
|
name="df_type"
|
|
@@ -216,32 +185,42 @@ export default function QualityControlEditor({
|
|
|
216
185
|
</Form.Field>
|
|
217
186
|
)}
|
|
218
187
|
/>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
188
|
+
|
|
189
|
+
<Controller
|
|
190
|
+
name={"control_mode"}
|
|
191
|
+
control={control}
|
|
192
|
+
rules={{ required: true }}
|
|
193
|
+
render={({ field: { onBlur, onChange, value } }) => (
|
|
194
|
+
<Form.Field required>
|
|
195
|
+
<label>
|
|
196
|
+
{formatMessage({ id: "quality_control.control_mode" })}
|
|
197
|
+
</label>
|
|
198
|
+
<Dropdown
|
|
199
|
+
selection
|
|
200
|
+
placeholder={formatMessage({
|
|
201
|
+
id: "quality_control.control_mode",
|
|
202
|
+
})}
|
|
203
|
+
onBlur={onBlur}
|
|
204
|
+
options={controlModeOptions}
|
|
205
|
+
onChange={(_e, { value }) => {
|
|
206
|
+
onChange(value);
|
|
207
|
+
setValue(
|
|
208
|
+
"control_properties",
|
|
209
|
+
defaultControlPropertiesForMode(value)
|
|
210
|
+
);
|
|
211
|
+
setValue(
|
|
212
|
+
"score_criteria",
|
|
213
|
+
defaultScoreCriteriaForMode(value)
|
|
214
|
+
);
|
|
215
|
+
}}
|
|
216
|
+
value={value}
|
|
227
217
|
/>
|
|
228
|
-
</
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
sourceId,
|
|
235
|
-
fields,
|
|
236
|
-
field: "validation",
|
|
237
|
-
}}
|
|
238
|
-
>
|
|
239
|
-
<Clauses labelId="quality_control.form.validation" />
|
|
240
|
-
</QxContext.Provider>
|
|
241
|
-
</div>
|
|
242
|
-
) : null}
|
|
243
|
-
</>
|
|
244
|
-
) : null}
|
|
218
|
+
</Form.Field>
|
|
219
|
+
)}
|
|
220
|
+
/>
|
|
221
|
+
|
|
222
|
+
<ScoreCriteria />
|
|
223
|
+
<ControlProperties />
|
|
245
224
|
|
|
246
225
|
<Divider hidden />
|
|
247
226
|
<Container textAlign="right">
|
|
@@ -250,7 +229,7 @@ export default function QualityControlEditor({
|
|
|
250
229
|
onClick={handleSubmit((data) => onPublish(data))}
|
|
251
230
|
primary
|
|
252
231
|
loading={submitLoading}
|
|
253
|
-
disabled={!isValid || !isDirty}
|
|
232
|
+
disabled={!isValid || !isDirty || !validDfContent}
|
|
254
233
|
content={formatMessage({ id: "actions.publish" })}
|
|
255
234
|
/>
|
|
256
235
|
) : null}
|
|
@@ -259,7 +238,7 @@ export default function QualityControlEditor({
|
|
|
259
238
|
onClick={() => onSave(formData)}
|
|
260
239
|
primary
|
|
261
240
|
loading={submitLoading}
|
|
262
|
-
disabled={!
|
|
241
|
+
disabled={!isValid || !isDirty}
|
|
263
242
|
content={formatMessage({ id: "actions.save" })}
|
|
264
243
|
/>
|
|
265
244
|
) : null}
|
|
@@ -277,7 +256,7 @@ export default function QualityControlEditor({
|
|
|
277
256
|
content={formatMessage({
|
|
278
257
|
id: "actions.discard.confirmation.content",
|
|
279
258
|
})}
|
|
280
|
-
onConfirm={onCancel}
|
|
259
|
+
onConfirm={() => onCancel()}
|
|
281
260
|
onOpen={(e) => e.stopPropagation()}
|
|
282
261
|
onClose={(e) => e.stopPropagation()}
|
|
283
262
|
/>
|
|
@@ -18,7 +18,11 @@ export default function QualityControlHeader({ children }) {
|
|
|
18
18
|
|
|
19
19
|
const qualityControl = _.propOr({}, "data")(data);
|
|
20
20
|
const actions = _.propOr([], "_actions")(data);
|
|
21
|
-
const context = { qualityControl, loading, id };
|
|
21
|
+
const context = { qualityControl, actions, mutate, loading, id };
|
|
22
|
+
|
|
23
|
+
const [subheaderIcon, subheaderColor] = qualityControl.active
|
|
24
|
+
? ["play", "green"]
|
|
25
|
+
: ["pause", "orange"];
|
|
22
26
|
|
|
23
27
|
return (
|
|
24
28
|
<QxContext.Provider value={context}>
|
|
@@ -30,15 +34,33 @@ export default function QualityControlHeader({ children }) {
|
|
|
30
34
|
<Grid.Column width={8}>
|
|
31
35
|
<Header as="h2">
|
|
32
36
|
<Icon circular name="archive" />
|
|
33
|
-
<Header.Content>
|
|
37
|
+
<Header.Content>
|
|
38
|
+
{qualityControl.name}
|
|
39
|
+
|
|
40
|
+
<Header.Subheader>
|
|
41
|
+
<div className="control-subheader">
|
|
42
|
+
<Label className="no-margin">
|
|
43
|
+
<FormattedMessage
|
|
44
|
+
id={`quality_control.control_mode.${qualityControl.control_mode}`}
|
|
45
|
+
/>
|
|
46
|
+
</Label>
|
|
47
|
+
<div className="flex-gapped">
|
|
48
|
+
<Icon
|
|
49
|
+
name={subheaderIcon}
|
|
50
|
+
color={subheaderColor}
|
|
51
|
+
fitted
|
|
52
|
+
/>
|
|
53
|
+
<FormattedMessage
|
|
54
|
+
id={`quality_control.props.active.${qualityControl.active}`}
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</Header.Subheader>
|
|
59
|
+
</Header.Content>
|
|
34
60
|
</Header>
|
|
35
61
|
</Grid.Column>
|
|
36
62
|
<Grid.Column width={8}>
|
|
37
|
-
<QualityControlActions
|
|
38
|
-
actions={actions}
|
|
39
|
-
qualityControl={qualityControl}
|
|
40
|
-
mutate={mutate}
|
|
41
|
-
/>
|
|
63
|
+
<QualityControlActions />
|
|
42
64
|
</Grid.Column>
|
|
43
65
|
</Grid>
|
|
44
66
|
<Label
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React, { useContext } from "react";
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
|
-
import { Table
|
|
4
|
+
import { Table } from "semantic-ui-react";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { columnDecorator } from "@truedat/core/services";
|
|
7
|
-
|
|
7
|
+
import { Loading } from "@truedat/core/components";
|
|
8
8
|
import QxContext from "../QxContext";
|
|
9
9
|
|
|
10
10
|
const translateDecorator = (id) =>
|
|
@@ -32,7 +32,9 @@ export default function QualityControlsHistory() {
|
|
|
32
32
|
const { formatMessage } = useIntl();
|
|
33
33
|
return (
|
|
34
34
|
<>
|
|
35
|
-
{
|
|
35
|
+
{loading ? (
|
|
36
|
+
<Loading />
|
|
37
|
+
) : !_.isEmpty(versions) ? (
|
|
36
38
|
<Table sortable>
|
|
37
39
|
<Table.Header>
|
|
38
40
|
<Table.Row>
|
|
@@ -67,15 +69,7 @@ export default function QualityControlsHistory() {
|
|
|
67
69
|
))}
|
|
68
70
|
</Table.Body>
|
|
69
71
|
</Table>
|
|
70
|
-
)}
|
|
71
|
-
{_.isEmpty(versions) && !loading && (
|
|
72
|
-
<Header as="h4">
|
|
73
|
-
<Icon name="search" />
|
|
74
|
-
<Header.Content>
|
|
75
|
-
{formatMessage({ id: "ruleImplementations.search.results.empty" })}
|
|
76
|
-
</Header.Content>
|
|
77
|
-
</Header>
|
|
78
|
-
)}
|
|
72
|
+
) : null}
|
|
79
73
|
</>
|
|
80
74
|
);
|
|
81
75
|
}
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
TextArea,
|
|
9
9
|
Button,
|
|
10
10
|
Modal,
|
|
11
|
-
Divider,
|
|
12
11
|
} from "semantic-ui-react";
|
|
13
12
|
import { FormattedMessage } from "react-intl";
|
|
14
13
|
import { useQualityControlQueries } from "../../hooks/useQualityControls";
|
|
@@ -27,7 +26,7 @@ const JsonBox = ({ title, content }) => {
|
|
|
27
26
|
</span>
|
|
28
27
|
<Button
|
|
29
28
|
icon={copied ? "check" : "copy"}
|
|
30
|
-
color={copied
|
|
29
|
+
color={copied ? "green" : undefined}
|
|
31
30
|
onClick={(e) => {
|
|
32
31
|
e.stopPropagation();
|
|
33
32
|
setCopied(true);
|
|
@@ -40,8 +39,8 @@ const JsonBox = ({ title, content }) => {
|
|
|
40
39
|
<AccordionContent active={expanded}>
|
|
41
40
|
<TextArea
|
|
42
41
|
className="json-box"
|
|
43
|
-
fluid
|
|
44
|
-
editable=
|
|
42
|
+
fluid="true"
|
|
43
|
+
editable="false"
|
|
45
44
|
rows={10}
|
|
46
45
|
size="small"
|
|
47
46
|
value={contentString}
|
|
@@ -67,7 +66,7 @@ const ModalContent = ({ id }) => {
|
|
|
67
66
|
);
|
|
68
67
|
};
|
|
69
68
|
export default function QualityControlQueryModal({ qualityControlId: id }) {
|
|
70
|
-
const [open, setOpen] = useState(
|
|
69
|
+
const [open, setOpen] = useState(false);
|
|
71
70
|
return (
|
|
72
71
|
<Modal
|
|
73
72
|
open={open}
|
|
@@ -81,3 +80,7 @@ export default function QualityControlQueryModal({ qualityControlId: id }) {
|
|
|
81
80
|
/>
|
|
82
81
|
);
|
|
83
82
|
}
|
|
83
|
+
|
|
84
|
+
QualityControlQueryModal.propTypes = {
|
|
85
|
+
qualityControlId: PropTypes.number,
|
|
86
|
+
};
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Route, Switch } from "react-router-dom";
|
|
3
|
-
import { Unauthorized } from "@truedat/core/components";
|
|
4
|
-
import { useAuthorized } from "@truedat/core/hooks";
|
|
5
3
|
import {
|
|
6
4
|
QUALITY_CONTROLS_DEPRECATED,
|
|
7
5
|
QUALITY_CONTROLS_DRAFTS,
|
|
8
6
|
QUALITY_CONTROLS_PUBLISHED,
|
|
9
|
-
QUALITY_CONTROLS_EXECUTION_GROUPS,
|
|
10
|
-
QUALITY_CONTROLS_EXECUTION_GROUP,
|
|
11
7
|
QUALITY_CONTROL_NEW,
|
|
12
8
|
QUALITY_CONTROL_EDIT,
|
|
13
9
|
QUALITY_CONTROL_NEW_DRAFT,
|
|
14
10
|
QUALITY_CONTROL,
|
|
15
11
|
QUALITY_CONTROL_HISTORY,
|
|
12
|
+
QUALITY_CONTROL_SCORES,
|
|
16
13
|
} from "@truedat/core/routes";
|
|
17
|
-
|
|
18
14
|
import { SearchContextProvider } from "@truedat/core/search/SearchContext";
|
|
19
|
-
import ExecutionGroupsTable from "../executions/ExecutionGroupsTable";
|
|
20
|
-
import ExecutionGroupsHeader from "../executions/ExecutionGroupsHeader";
|
|
21
|
-
import ExecutionGroupDetail from "../executions/executionGroupDetail";
|
|
22
|
-
|
|
23
15
|
import {
|
|
24
16
|
useQualityControlsSearch,
|
|
25
17
|
useQualityControlsFilters,
|
|
@@ -28,13 +20,12 @@ import QualityControls from "./QualityControls";
|
|
|
28
20
|
import QualityControl from "./QualityControl";
|
|
29
21
|
import QualityControlHeader from "./QualityControlHeader";
|
|
30
22
|
import QualityControlHistory from "./QualityControlHistory";
|
|
31
|
-
|
|
23
|
+
import QualityControlScores from "./QualityControlScores";
|
|
32
24
|
import NewQualityControl from "./NewQualityControl";
|
|
33
25
|
import EditQualityControl from "./EditQualityControl";
|
|
34
26
|
import NewDraftQualityControl from "./NewDraftQualityControl";
|
|
35
27
|
|
|
36
|
-
export default function
|
|
37
|
-
const authorized = useAuthorized("quality_control");
|
|
28
|
+
export default function QualityControlRoutes() {
|
|
38
29
|
const searchProps = {
|
|
39
30
|
initialSortColumn: "updated_at",
|
|
40
31
|
initialSortDirection: "descending",
|
|
@@ -44,116 +35,80 @@ export default function QxRoutes() {
|
|
|
44
35
|
|
|
45
36
|
return (
|
|
46
37
|
<Switch>
|
|
47
|
-
<Route
|
|
48
|
-
exact
|
|
49
|
-
path={QUALITY_CONTROLS_EXECUTION_GROUPS}
|
|
50
|
-
render={() =>
|
|
51
|
-
authorized ? (
|
|
52
|
-
<ExecutionGroupsHeader>
|
|
53
|
-
<ExecutionGroupsTable />
|
|
54
|
-
</ExecutionGroupsHeader>
|
|
55
|
-
) : (
|
|
56
|
-
<Unauthorized />
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
/>
|
|
60
|
-
<Route
|
|
61
|
-
exact
|
|
62
|
-
path={QUALITY_CONTROLS_EXECUTION_GROUP}
|
|
63
|
-
render={() =>
|
|
64
|
-
authorized ? <ExecutionGroupDetail /> : <Unauthorized />
|
|
65
|
-
}
|
|
66
|
-
/>
|
|
67
38
|
<Route
|
|
68
39
|
exact
|
|
69
40
|
path={QUALITY_CONTROLS_PUBLISHED}
|
|
70
|
-
render={() =>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
) : (
|
|
79
|
-
<Unauthorized />
|
|
80
|
-
)
|
|
81
|
-
}
|
|
41
|
+
render={() => (
|
|
42
|
+
<SearchContextProvider
|
|
43
|
+
{...searchProps}
|
|
44
|
+
defaultFilters={{ status: "published" }}
|
|
45
|
+
>
|
|
46
|
+
<QualityControls />
|
|
47
|
+
</SearchContextProvider>
|
|
48
|
+
)}
|
|
82
49
|
/>
|
|
83
50
|
<Route
|
|
84
51
|
exact
|
|
85
52
|
path={QUALITY_CONTROLS_DEPRECATED}
|
|
86
|
-
render={() =>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
) : (
|
|
95
|
-
<Unauthorized />
|
|
96
|
-
)
|
|
97
|
-
}
|
|
53
|
+
render={() => (
|
|
54
|
+
<SearchContextProvider
|
|
55
|
+
{...searchProps}
|
|
56
|
+
defaultFilters={{ status: "deprecated" }}
|
|
57
|
+
>
|
|
58
|
+
<QualityControls />
|
|
59
|
+
</SearchContextProvider>
|
|
60
|
+
)}
|
|
98
61
|
/>
|
|
99
62
|
<Route
|
|
100
63
|
exact
|
|
101
64
|
path={QUALITY_CONTROLS_DRAFTS}
|
|
102
|
-
render={() =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
) : (
|
|
111
|
-
<Unauthorized />
|
|
112
|
-
)
|
|
113
|
-
}
|
|
65
|
+
render={() => (
|
|
66
|
+
<SearchContextProvider
|
|
67
|
+
{...searchProps}
|
|
68
|
+
defaultFilters={{ status: "draft" }}
|
|
69
|
+
>
|
|
70
|
+
<QualityControls />
|
|
71
|
+
</SearchContextProvider>
|
|
72
|
+
)}
|
|
114
73
|
/>
|
|
115
74
|
<Route
|
|
116
75
|
exact
|
|
117
76
|
path={QUALITY_CONTROL_NEW}
|
|
118
|
-
render={() =>
|
|
77
|
+
render={() => <NewQualityControl />}
|
|
119
78
|
/>
|
|
120
79
|
<Route
|
|
121
80
|
exact
|
|
122
81
|
path={QUALITY_CONTROL_EDIT}
|
|
123
|
-
render={() =>
|
|
82
|
+
render={() => <EditQualityControl />}
|
|
124
83
|
/>
|
|
125
84
|
<Route
|
|
126
85
|
exact
|
|
127
86
|
path={QUALITY_CONTROL_NEW_DRAFT}
|
|
128
|
-
render={() =>
|
|
129
|
-
authorized ? <NewDraftQualityControl /> : <Unauthorized />
|
|
130
|
-
}
|
|
87
|
+
render={() => <NewDraftQualityControl />}
|
|
131
88
|
/>
|
|
132
89
|
<Route
|
|
133
|
-
exact
|
|
134
90
|
path={QUALITY_CONTROL}
|
|
135
|
-
render={() =>
|
|
136
|
-
|
|
137
|
-
<
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
91
|
+
render={() => (
|
|
92
|
+
<QualityControlHeader>
|
|
93
|
+
<Switch>
|
|
94
|
+
<Route
|
|
95
|
+
exact
|
|
96
|
+
path={QUALITY_CONTROL}
|
|
97
|
+
render={() => <QualityControl />}
|
|
98
|
+
/>
|
|
99
|
+
<Route
|
|
100
|
+
exact
|
|
101
|
+
path={QUALITY_CONTROL_HISTORY}
|
|
102
|
+
render={() => <QualityControlHistory />}
|
|
103
|
+
/>
|
|
104
|
+
<Route
|
|
105
|
+
exact
|
|
106
|
+
path={QUALITY_CONTROL_SCORES}
|
|
107
|
+
render={() => <QualityControlScores />}
|
|
108
|
+
/>
|
|
109
|
+
</Switch>
|
|
110
|
+
</QualityControlHeader>
|
|
111
|
+
)}
|
|
157
112
|
/>
|
|
158
113
|
</Switch>
|
|
159
114
|
);
|