@truedat/qx 8.7.0 → 8.7.1
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/__tests__/QxRoutes.spec.js +1 -1
- package/src/components/common/ClauseViewer.js +1 -1
- package/src/components/common/ResourceSelector.js +1 -1
- package/src/components/common/TypeSelector.js +7 -3
- package/src/components/common/__tests__/ResourceSelector.spec.js +6 -6
- package/src/components/common/expressions/FieldSelector.js +2 -2
- package/src/components/common/expressions/FunctionSelector.js +3 -3
- package/src/components/common/expressions/ParamSelector.js +1 -1
- package/src/components/common/expressions/ShapeSelector.js +4 -5
- package/src/components/common/expressions/__tests__/Clauses.spec.js +11 -11
- package/src/components/common/expressions/__tests__/Condition.spec.js +15 -13
- package/src/components/common/expressions/__tests__/ConstantSelector.spec.js +2 -2
- package/src/components/common/expressions/__tests__/Expression.spec.js +5 -5
- package/src/components/common/expressions/__tests__/FieldSelector.spec.js +6 -2
- package/src/components/common/expressions/__tests__/FunctionArgs.spec.js +3 -3
- package/src/components/common/expressions/__tests__/FunctionSelector.spec.js +3 -3
- package/src/components/common/expressions/__tests__/ParamSelector.spec.js +3 -3
- package/src/components/common/expressions/__tests__/ShapeSelector.spec.js +7 -7
- package/src/components/common/expressions/__tests__/useWatchParams.spec.js +3 -1
- package/src/components/common/expressions/constantInputs/AnySelector.js +0 -1
- package/src/components/common/expressions/constantInputs/BooleanSelector.js +5 -1
- package/src/components/common/expressions/constantInputs/__tests__/AnySelector.spec.js +6 -2
- package/src/components/common/expressions/constantInputs/__tests__/BooleanSelector.spec.js +8 -4
- package/src/components/common/expressions/constantInputs/__tests__/DefaultSelector.spec.js +6 -3
- package/src/components/common/resourceSelectors/DataStructureSelector.js +5 -1
- package/src/components/common/resourceSelectors/DataViewSelector.js +3 -3
- package/src/components/common/resourceSelectors/ReferenceDatasetSelector.js +7 -2
- package/src/components/common/resourceSelectors/__tests__/DataStructureSelector.spec.js +1 -1
- package/src/components/common/resourceSelectors/__tests__/DataViewSelector.spec.js +7 -7
- package/src/components/common/resourceSelectors/__tests__/ReferenceDatasetSelector.spec.js +6 -6
- package/src/components/dataViews/DataViewEditor.js +3 -2
- package/src/components/dataViews/DataViewSummary.js +1 -1
- package/src/components/dataViews/DataViews.js +2 -2
- package/src/components/dataViews/__tests__/AdvancedDataViewEditor.spec.js +3 -3
- package/src/components/dataViews/__tests__/DataViewEditor.spec.js +7 -7
- package/src/components/dataViews/__tests__/DataViewSelect.spec.js +1 -1
- package/src/components/dataViews/__tests__/DataViewSummary.spec.js +15 -15
- package/src/components/dataViews/__tests__/DataViews.spec.js +6 -6
- package/src/components/dataViews/__tests__/Queryable.spec.js +6 -6
- package/src/components/dataViews/__tests__/Queryables.spec.js +6 -6
- package/src/components/dataViews/__tests__/SimpleDataViewEditor.spec.js +17 -17
- package/src/components/dataViews/__tests__/queryableFunctions.spec.js +4 -4
- package/src/components/dataViews/advancedForm/AdvancedDataViewEditor.js +3 -3
- package/src/components/dataViews/advancedForm/DataViewSelect.js +1 -1
- package/src/components/dataViews/advancedForm/Queryable.js +3 -3
- package/src/components/dataViews/queryableFunctions.js +35 -35
- package/src/components/dataViews/queryableProperties/Select.js +1 -1
- package/src/components/dataViews/queryableProperties/SelectField.js +5 -5
- package/src/components/dataViews/queryableProperties/__tests__/From.spec.js +1 -1
- package/src/components/dataViews/queryableProperties/__tests__/GroupBy.spec.js +19 -19
- package/src/components/dataViews/queryableProperties/__tests__/Join.spec.js +1 -1
- package/src/components/dataViews/queryableProperties/__tests__/JoinTypeIcon.spec.js +1 -1
- package/src/components/dataViews/queryableProperties/__tests__/Select.spec.js +5 -5
- package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +3 -3
- package/src/components/dataViews/queryableProperties/__tests__/Where.spec.js +1 -1
- package/src/components/dataViews/queryableSummaryHelpers.js +1 -1
- package/src/components/dataViews/simpleForm/AggregationForm.js +2 -2
- package/src/components/dataViews/simpleForm/DatasetForm.js +1 -1
- package/src/components/dataViews/simpleForm/FormQueryable.js +3 -3
- package/src/components/dataViews/simpleForm/InformationForm.js +2 -2
- package/src/components/dataViews/simpleForm/SelectionForm.js +1 -1
- package/src/components/dataViews/simpleForm/SimpleDataViewEditor.js +3 -3
- package/src/components/dataViews/summary/GroupBy.js +1 -1
- package/src/components/dataViews/summary/Join.js +50 -48
- package/src/components/dataViews/summary/Select.js +1 -1
- package/src/components/dataViews/summary/Where.js +6 -1
- package/src/components/functions/FunctionEditor.js +1 -1
- package/src/components/functions/Functions.js +1 -1
- package/src/components/functions/__tests__/FunctionEditor.spec.js +7 -7
- package/src/components/functions/__tests__/FunctionParams.spec.js +4 -4
- package/src/components/qualityControls/ConceptLinkNew.js +2 -2
- package/src/components/qualityControls/ConceptLinks.js +1 -1
- package/src/components/qualityControls/ContentSummary.js +23 -21
- package/src/components/qualityControls/ControlProperties.js +1 -1
- package/src/components/qualityControls/ControlPropertiesView.js +1 -1
- package/src/components/qualityControls/EditQualityControl.js +1 -1
- package/src/components/qualityControls/NewDraftQualityControl.js +1 -1
- package/src/components/qualityControls/QualityControlActions.js +4 -4
- package/src/components/qualityControls/QualityControlEditor.js +11 -20
- package/src/components/qualityControls/QualityControlEvents.js +2 -2
- package/src/components/qualityControls/QualityControlHeader.js +2 -2
- package/src/components/qualityControls/QualityControlRoutes.js +1 -1
- package/src/components/qualityControls/QualityControlScores.js +3 -3
- package/src/components/qualityControls/QualityControlSelector.js +1 -1
- package/src/components/qualityControls/QualityControlSummary.js +17 -15
- package/src/components/qualityControls/QualityControls.js +9 -11
- package/src/components/qualityControls/QualityControlsTable.js +1 -1
- package/src/components/qualityControls/SegmentationForm.js +99 -100
- package/src/components/qualityControls/SegmentationSummary.js +113 -104
- package/src/components/qualityControls/StructureLinkNew.js +2 -2
- package/src/components/qualityControls/StructureLinks.js +1 -1
- package/src/components/qualityControls/__tests__/ConceptLinkNew.spec.js +5 -5
- package/src/components/qualityControls/__tests__/ConceptLinks.spec.js +3 -3
- package/src/components/qualityControls/__tests__/ControlProperties.spec.js +6 -2
- package/src/components/qualityControls/__tests__/ControlPropertiesForm.spec.js +6 -6
- package/src/components/qualityControls/__tests__/ControlPropertiesSummary.spec.js +7 -7
- package/src/components/qualityControls/__tests__/ControlPropertiesView.spec.js +7 -2
- package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +12 -12
- package/src/components/qualityControls/__tests__/InformationForm.spec.js +29 -11
- package/src/components/qualityControls/__tests__/NewDraftQualityControl.spec.js +23 -21
- package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +38 -38
- package/src/components/qualityControls/__tests__/QualityBadge.spec.js +7 -7
- package/src/components/qualityControls/__tests__/QualityControl.spec.js +7 -7
- package/src/components/qualityControls/__tests__/QualityControlActions.spec.js +16 -16
- package/src/components/qualityControls/__tests__/QualityControlCrumbs.spec.js +1 -1
- package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +6 -2
- package/src/components/qualityControls/__tests__/QualityControlEvents.spec.js +3 -3
- package/src/components/qualityControls/__tests__/QualityControlHeader.spec.js +3 -3
- package/src/components/qualityControls/__tests__/QualityControlHistory.spec.js +2 -2
- package/src/components/qualityControls/__tests__/QualityControlManageDomain.spec.js +4 -4
- package/src/components/qualityControls/__tests__/QualityControlQueryModal.spec.js +2 -2
- package/src/components/qualityControls/__tests__/QualityControlRoutes.spec.js +2 -2
- package/src/components/qualityControls/__tests__/QualityControlRow.spec.js +4 -4
- package/src/components/qualityControls/__tests__/QualityControlScores.spec.js +9 -9
- package/src/components/qualityControls/__tests__/QualityControlSelector.spec.js +21 -17
- package/src/components/qualityControls/__tests__/QualityControls.spec.js +21 -21
- package/src/components/qualityControls/__tests__/QualityControlsLabelResults.spec.js +5 -5
- package/src/components/qualityControls/__tests__/QualityControlsPagination.spec.js +1 -1
- package/src/components/qualityControls/__tests__/QualityControlsTable.spec.js +1 -1
- package/src/components/qualityControls/__tests__/ScoreCriteria.spec.js +6 -6
- package/src/components/qualityControls/__tests__/ScoreCriteriaView.spec.js +6 -6
- package/src/components/qualityControls/__tests__/StructureLinkNew.spec.js +9 -9
- package/src/components/qualityControls/__tests__/StructureLinks.spec.js +6 -6
- package/src/components/qualityControls/controlProperties/__tests__/ResourceWithValidation.spec.js +9 -9
- package/src/components/qualityControls/scoreCriterias/__tests__/Deviation.spec.js +5 -5
- package/src/components/qualityControls/scoreCriterias/__tests__/ErrorCount.spec.js +10 -10
- package/src/components/qualityControls/scoreCriterias/__tests__/Percentage.spec.js +6 -6
- package/src/components/scores/QualityBar.js +1 -1
- package/src/components/scores/ScoreDetails.js +1 -1
- package/src/components/scores/ScoreGroup.js +2 -2
- package/src/components/scores/ScoreGroupForm.js +1 -1
- package/src/components/scores/__tests__/MyScoreGroups.spec.js +1 -1
- package/src/components/scores/__tests__/QualityBar.spec.js +3 -3
- package/src/components/scores/__tests__/Score.spec.js +1 -1
- package/src/components/scores/__tests__/ScoreContext.spec.js +2 -2
- package/src/components/scores/__tests__/ScoreCrumbs.spec.js +2 -2
- package/src/components/scores/__tests__/ScoreDetails.spec.js +2 -2
- package/src/components/scores/__tests__/ScoreEvents.spec.js +1 -1
- package/src/components/scores/__tests__/ScoreGroup.spec.js +1 -1
- package/src/components/scores/__tests__/ScoreGroupBreadcrumbs.spec.js +1 -1
- package/src/components/scores/__tests__/ScoreGroupForm.spec.js +3 -3
- package/src/components/scores/__tests__/ScoreGroupLink.spec.js +1 -1
- package/src/components/scores/__tests__/ScoreGroupMessage.spec.js +1 -1
- package/src/components/scores/__tests__/ScoreGroupPopup.spec.js +2 -2
- package/src/components/scores/__tests__/ScoreGroupsRoutes.spec.js +1 -1
- package/src/components/scores/__tests__/ScoreGroupsTable.spec.js +2 -2
- package/src/components/scores/__tests__/ScorePagination.spec.js +1 -1
- package/src/components/scores/__tests__/ScoreStatusDecorator.spec.js +2 -2
- package/src/components/selectors/__tests__/getMyScoreGroupsColumns.spec.js +5 -5
- package/src/components/selectors/__tests__/getQualityControlScoresColumns.spec.js +3 -3
- package/src/components/selectors/getMyScoreGroupsColumns.js +1 -1
- package/src/components/selectors/getQualityControlScoresColumns.js +1 -1
- package/src/hooks/useDataViews.js +1 -1
- package/src/hooks/useExecutionGroups.js +2 -2
- package/src/hooks/useFunctions.js +1 -1
- package/src/hooks/useQualityControls.js +3 -3
- package/src/hooks/useScoreGroups.js +3 -3
- package/src/hooks/useScores.js +1 -1
- package/src/types.js +5 -3
|
@@ -6,23 +6,25 @@ import SegmentationSummary from "./SegmentationSummary";
|
|
|
6
6
|
import ContentSummary from "./ContentSummary";
|
|
7
7
|
|
|
8
8
|
export default function QualityControlSummary({ qualityControl }) {
|
|
9
|
-
|
|
9
|
+
if (!qualityControl) return null;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
return (
|
|
12
|
+
<Container>
|
|
13
|
+
<ContentSummary qualityControl={qualityControl} />
|
|
14
|
+
{qualityControl.control_mode && (
|
|
15
|
+
<ScoreCriteriaView qualityControl={qualityControl} />
|
|
16
|
+
)}
|
|
17
|
+
<ControlPropertiesSummary qualityControl={qualityControl} />
|
|
18
|
+
{qualityControl.control_properties?.segmentation && (
|
|
19
|
+
<SegmentationSummary
|
|
20
|
+
segmentation={qualityControl.control_properties.segmentation}
|
|
21
|
+
controlProperties={qualityControl.control_properties}
|
|
22
|
+
/>
|
|
23
|
+
)}
|
|
24
|
+
</Container>
|
|
25
|
+
);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
QualityControlSummary.propTypes = {
|
|
27
|
-
|
|
29
|
+
qualityControl: PropTypes.object,
|
|
28
30
|
};
|
|
@@ -44,7 +44,7 @@ export const QualityControls = () => {
|
|
|
44
44
|
|
|
45
45
|
const [selectedQualityControls, setSelectedQualityControls] = useState([]);
|
|
46
46
|
const [executeQualityControlOn, setExecuteMode] = useState(
|
|
47
|
-
_.matches({ active: [true] })(hiddenFilters)
|
|
47
|
+
_.matches({ active: [true] })(hiddenFilters),
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
const qualityControls = searchData?.data;
|
|
@@ -64,33 +64,33 @@ export const QualityControls = () => {
|
|
|
64
64
|
const ids = _.map(_.prop("id"))(qualityControls);
|
|
65
65
|
checkedAll
|
|
66
66
|
? setSelectedQualityControls(
|
|
67
|
-
_.flow(_.concat(ids), _.uniq)(selectedQualityControls)
|
|
67
|
+
_.flow(_.concat(ids), _.uniq)(selectedQualityControls),
|
|
68
68
|
)
|
|
69
69
|
: setSelectedQualityControls(
|
|
70
|
-
_.flow(_.difference(selectedQualityControls), _.uniq)(ids)
|
|
70
|
+
_.flow(_.difference(selectedQualityControls), _.uniq)(ids),
|
|
71
71
|
);
|
|
72
72
|
};
|
|
73
73
|
const isRowChecked = (qualityControl) => {
|
|
74
74
|
const id = _.prop("id")(qualityControl);
|
|
75
75
|
return _.some((selectedId) => _.eq(id, selectedId))(
|
|
76
|
-
selectedQualityControls
|
|
76
|
+
selectedQualityControls,
|
|
77
77
|
);
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
const checkRow = (qualityControl) => {
|
|
81
81
|
const id = _.prop("id")(qualityControl);
|
|
82
82
|
const exists = _.some((selectedId) => _.eq(id, selectedId))(
|
|
83
|
-
selectedQualityControls
|
|
83
|
+
selectedQualityControls,
|
|
84
84
|
);
|
|
85
85
|
exists
|
|
86
86
|
? setSelectedQualityControls(
|
|
87
87
|
_.flow(
|
|
88
88
|
_.remove((selectedId) => _.eq(id, selectedId)),
|
|
89
|
-
_.uniq
|
|
90
|
-
)(selectedQualityControls)
|
|
89
|
+
_.uniq,
|
|
90
|
+
)(selectedQualityControls),
|
|
91
91
|
)
|
|
92
92
|
: setSelectedQualityControls(
|
|
93
|
-
_.flow(_.concat(id), _.uniq)(selectedQualityControls)
|
|
93
|
+
_.flow(_.concat(id), _.uniq)(selectedQualityControls),
|
|
94
94
|
);
|
|
95
95
|
};
|
|
96
96
|
|
|
@@ -159,9 +159,7 @@ export const QualityControls = () => {
|
|
|
159
159
|
id="execute_checkbox"
|
|
160
160
|
className="bgOrange"
|
|
161
161
|
toggle
|
|
162
|
-
onChange={() =>
|
|
163
|
-
handleExecuteChange(!executeQualityControlOn)
|
|
164
|
-
}
|
|
162
|
+
onChange={() => handleExecuteChange(!executeQualityControlOn)}
|
|
165
163
|
checked={executeQualityControlOn}
|
|
166
164
|
style={{ top: "6px", marginRight: "7.5px" }}
|
|
167
165
|
/>
|
|
@@ -105,7 +105,7 @@ export default function QualityControlsTable({
|
|
|
105
105
|
_.has("quality_control_id")(selectedQualityControl) && placeToTop
|
|
106
106
|
? _.any(
|
|
107
107
|
(qc) =>
|
|
108
|
-
qc.quality_control_id === selectedQualityControl.quality_control_id
|
|
108
|
+
qc.quality_control_id === selectedQualityControl.quality_control_id,
|
|
109
109
|
)(qualityControls)
|
|
110
110
|
? qualityControls
|
|
111
111
|
: [selectedQualityControl, ...qualityControls]
|
|
@@ -7,113 +7,112 @@ import QxContext from "@truedat/qx/components/QxContext";
|
|
|
7
7
|
import GroupBy from "../dataViews/queryableProperties/GroupBy";
|
|
8
8
|
|
|
9
9
|
const SegmentationForm = ({ setStepInformation, stepInformation }) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const { formatMessage } = useIntl();
|
|
11
|
+
const { control, watch, setValue } = useFormContext();
|
|
12
|
+
const context = use(QxContext);
|
|
13
|
+
const fieldNames = ["control_properties.segmentation"];
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const controlProperties = watch("control_properties");
|
|
16
|
+
const segmentation = _.prop("segmentation")(controlProperties);
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!_.isEqual(stepInformation?.fieldNames, fieldNames))
|
|
20
|
+
setStepInformation(2, { ...stepInformation, fieldNames });
|
|
21
|
+
}, [stepInformation, fieldNames]);
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
const handleAddSegmentation = () => {
|
|
24
|
+
const nextId = 1;
|
|
25
|
+
setValue(
|
|
26
|
+
"control_properties.segmentation",
|
|
27
|
+
{
|
|
28
|
+
id: nextId,
|
|
29
|
+
type: "group_by",
|
|
30
|
+
alias: "",
|
|
31
|
+
properties: {
|
|
32
|
+
group_fields: [],
|
|
33
|
+
aggregate_fields: [],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{ shouldValidate: false, shouldDirty: true },
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
40
|
+
const handleDeleteSegmentation = () => {
|
|
41
|
+
setValue("control_properties.segmentation", null, {
|
|
42
|
+
shouldValidate: false,
|
|
43
|
+
shouldDirty: true,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
const { source_id: sourceId } = watch();
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
if (!sourceId) return null;
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<Segment>
|
|
54
|
+
{!segmentation ? (
|
|
55
|
+
<Button
|
|
56
|
+
onClick={handleAddSegmentation}
|
|
57
|
+
basic
|
|
58
|
+
className="td-icon-text-control"
|
|
59
|
+
icon="plus"
|
|
60
|
+
content={formatMessage({
|
|
61
|
+
id: "quality_control.form.segmentation.add",
|
|
62
|
+
defaultMessage: "Add segmentation",
|
|
63
|
+
})}
|
|
64
|
+
/>
|
|
65
|
+
) : (
|
|
66
|
+
<>
|
|
67
|
+
<Button
|
|
68
|
+
onClick={handleDeleteSegmentation}
|
|
69
|
+
icon="trash alternate outline"
|
|
70
|
+
basic
|
|
71
|
+
color="red"
|
|
72
|
+
aria-label="delete"
|
|
73
|
+
floated="right"
|
|
74
|
+
/>
|
|
75
|
+
<Controller
|
|
76
|
+
control={control}
|
|
77
|
+
name="control_properties.segmentation.alias"
|
|
78
|
+
render={({
|
|
79
|
+
field: { onBlur, onChange, value },
|
|
80
|
+
fieldState: { error },
|
|
81
|
+
}) => (
|
|
82
|
+
<Form.Field>
|
|
83
|
+
<label>
|
|
84
|
+
{formatMessage({
|
|
85
|
+
id: "dataViews.form.queryable.alias",
|
|
86
|
+
})}
|
|
87
|
+
</label>
|
|
88
|
+
<Form.Input
|
|
89
|
+
autoComplete="off"
|
|
90
|
+
placeholder={formatMessage({
|
|
91
|
+
id: "dataViews.form.queryable.alias",
|
|
92
|
+
})}
|
|
93
|
+
error={!!error}
|
|
94
|
+
onBlur={onBlur}
|
|
95
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
96
|
+
value={value || ""}
|
|
97
|
+
/>
|
|
98
|
+
</Form.Field>
|
|
99
|
+
)}
|
|
100
|
+
/>
|
|
101
|
+
<QxContext
|
|
102
|
+
value={{
|
|
103
|
+
...context,
|
|
104
|
+
sourceId,
|
|
105
|
+
field: "control_properties.segmentation.properties",
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
<GroupBy />
|
|
109
|
+
</QxContext>
|
|
110
|
+
</>
|
|
111
|
+
)}
|
|
112
|
+
</Segment>
|
|
113
|
+
<Divider hidden />
|
|
114
|
+
</>
|
|
115
|
+
);
|
|
117
116
|
};
|
|
118
117
|
|
|
119
118
|
export default SegmentationForm;
|
|
@@ -2,121 +2,130 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import { useIntl } from "react-intl";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { Header, Icon, Segment, List, Label } from "semantic-ui-react";
|
|
5
|
+
import { ExpressionViewer } from "@truedat/qx/components/common/ClauseViewer";
|
|
6
|
+
import QxContext from "@truedat/qx/components/QxContext";
|
|
5
7
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
getAggregateFields,
|
|
9
|
+
getGroupByFields,
|
|
10
|
+
buildParentResourceMap,
|
|
9
11
|
} from "../dataViews/queryableSummaryHelpers";
|
|
10
12
|
import { getColorById } from "../dataViews/queryableFunctions";
|
|
11
|
-
import { ExpressionViewer } from "@truedat/qx/components/common/ClauseViewer";
|
|
12
|
-
import QxContext from "@truedat/qx/components/QxContext";
|
|
13
13
|
|
|
14
|
-
export default function SegmentationSummary({
|
|
15
|
-
|
|
14
|
+
export default function SegmentationSummary({
|
|
15
|
+
segmentation,
|
|
16
|
+
controlProperties,
|
|
17
|
+
}) {
|
|
18
|
+
const { formatMessage } = useIntl();
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
if (!segmentation || segmentation.type !== "group_by") return null;
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
const resource =
|
|
23
|
+
controlProperties?.resource || controlProperties?.errors_resource;
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
const fromQueryable = resource
|
|
26
|
+
? {
|
|
27
|
+
id: 0,
|
|
28
|
+
type: "from",
|
|
29
|
+
alias: null,
|
|
30
|
+
properties: {
|
|
31
|
+
resource: resource,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
: null;
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const queryables = fromQueryable
|
|
37
|
+
? [fromQueryable, segmentation]
|
|
38
|
+
: [segmentation];
|
|
39
|
+
const parentResourceMap = buildParentResourceMap(queryables);
|
|
40
|
+
const groupByFields = getGroupByFields(segmentation);
|
|
41
|
+
const aggregateFields = getAggregateFields(segmentation);
|
|
42
|
+
const color = getColorById(segmentation.id);
|
|
43
|
+
const hasGroupByFields = _.size(groupByFields) > 0;
|
|
44
|
+
const hasAggregateFields = _.size(aggregateFields) > 0;
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<Header as="h5">
|
|
49
|
+
<Icon name="chart bar" size="small" />
|
|
50
|
+
<Header.Content>
|
|
51
|
+
{formatMessage({
|
|
52
|
+
id: "quality_control.form.segmentation.title",
|
|
53
|
+
defaultMessage: "Segmentation",
|
|
54
|
+
})}
|
|
55
|
+
</Header.Content>
|
|
56
|
+
</Header>
|
|
57
|
+
<QxContext value={{ parentResourceMap }}>
|
|
58
|
+
<Segment>
|
|
59
|
+
<List>
|
|
60
|
+
<List.Item>
|
|
61
|
+
<List.Header style={{ marginBottom: 4 }}>
|
|
62
|
+
<Icon name="calculator" />
|
|
63
|
+
{formatMessage({ id: "dataViews.form.queryable.group_by" })}
|
|
64
|
+
</List.Header>
|
|
65
|
+
<List.Content>
|
|
66
|
+
{segmentation.alias && (
|
|
67
|
+
<div style={{ marginBottom: 4 }}>
|
|
68
|
+
<b style={{ marginRight: 4 }}>as</b>
|
|
69
|
+
<Label color={color}>{segmentation.alias}</Label>
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
72
|
+
{hasGroupByFields && (
|
|
73
|
+
<Segment>
|
|
74
|
+
<List.Description>
|
|
75
|
+
<div style={{ marginBottom: 8 }}>
|
|
76
|
+
<Header as="h5">
|
|
77
|
+
<Icon name="group" size="small" />
|
|
78
|
+
{formatMessage({
|
|
79
|
+
id: "queryables.group_by.form.group_fields",
|
|
80
|
+
})}
|
|
81
|
+
</Header>
|
|
82
|
+
</div>
|
|
83
|
+
<div>
|
|
84
|
+
{groupByFields.map((field, idx) => (
|
|
85
|
+
<ExpressionViewer
|
|
86
|
+
key={idx}
|
|
87
|
+
expression={field.expression}
|
|
88
|
+
alias={field.alias}
|
|
89
|
+
/>
|
|
90
|
+
))}
|
|
91
|
+
</div>
|
|
92
|
+
</List.Description>
|
|
93
|
+
</Segment>
|
|
94
|
+
)}
|
|
86
95
|
|
|
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
|
-
|
|
96
|
+
{hasAggregateFields && (
|
|
97
|
+
<Segment>
|
|
98
|
+
<List.Description>
|
|
99
|
+
<div style={{ marginBottom: 8 }}>
|
|
100
|
+
<Header as="h5">
|
|
101
|
+
<Icon name="chart bar" size="small" />
|
|
102
|
+
{formatMessage({
|
|
103
|
+
id: "queryables.group_by.form.aggregate_fields",
|
|
104
|
+
})}
|
|
105
|
+
</Header>
|
|
106
|
+
</div>
|
|
107
|
+
<div>
|
|
108
|
+
{aggregateFields.map((field, idx) => (
|
|
109
|
+
<ExpressionViewer
|
|
110
|
+
key={idx}
|
|
111
|
+
expression={field.expression}
|
|
112
|
+
alias={field.alias}
|
|
113
|
+
/>
|
|
114
|
+
))}
|
|
115
|
+
</div>
|
|
116
|
+
</List.Description>
|
|
117
|
+
</Segment>
|
|
118
|
+
)}
|
|
119
|
+
</List.Content>
|
|
120
|
+
</List.Item>
|
|
121
|
+
</List>
|
|
122
|
+
</Segment>
|
|
123
|
+
</QxContext>
|
|
124
|
+
</>
|
|
125
|
+
);
|
|
117
126
|
}
|
|
118
127
|
|
|
119
128
|
SegmentationSummary.propTypes = {
|
|
120
|
-
|
|
121
|
-
|
|
129
|
+
segmentation: PropTypes.object,
|
|
130
|
+
controlProperties: PropTypes.object,
|
|
122
131
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { lazy, use } from "react";
|
|
2
2
|
import { Header } from "semantic-ui-react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
|
-
import QxContext from "../QxContext";
|
|
5
4
|
import { makeTagOptionsSelector } from "@truedat/core/selectors";
|
|
6
5
|
import { linkTo } from "@truedat/core/routes";
|
|
6
|
+
import QxContext from "../QxContext";
|
|
7
7
|
|
|
8
8
|
const StructureLinkForm = lazy(
|
|
9
|
-
() => import("@truedat/lm/components/StructureLinkForm")
|
|
9
|
+
() => import("@truedat/lm/components/StructureLinkForm"),
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
const selectTagOptions = makeTagOptionsSelector("quality_control");
|
|
@@ -2,7 +2,7 @@ import { lazy, use } from "react";
|
|
|
2
2
|
import QxContext from "../QxContext";
|
|
3
3
|
|
|
4
4
|
const QualityControlStructures = lazy(
|
|
5
|
-
() => import("@truedat/lm/components/QualityControlStructures")
|
|
5
|
+
() => import("@truedat/lm/components/QualityControlStructures"),
|
|
6
6
|
);
|
|
7
7
|
|
|
8
8
|
const StructureLinks = () => {
|
|
@@ -17,13 +17,13 @@ jest.mock("@truedat/core/routes", () => ({
|
|
|
17
17
|
linkTo: {
|
|
18
18
|
QUALITY_CONTROL_CONCEPTS: jest.fn(
|
|
19
19
|
({ id, version }) =>
|
|
20
|
-
`/qualityControls/${id}/version/${version}/links/concepts
|
|
20
|
+
`/qualityControls/${id}/version/${version}/links/concepts`,
|
|
21
21
|
),
|
|
22
22
|
},
|
|
23
23
|
}));
|
|
24
24
|
|
|
25
25
|
jest.mock("@truedat/lm/components/ConceptLinkForm", () =>
|
|
26
|
-
jest.fn(() => <div>ConceptLinkForm</div>)
|
|
26
|
+
jest.fn(() => <div>ConceptLinkForm</div>),
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
const qualityControl = {
|
|
@@ -41,7 +41,7 @@ describe("<ConceptLinkNew />", () => {
|
|
|
41
41
|
const rendered = render(
|
|
42
42
|
<QxContext value={context}>
|
|
43
43
|
<ConceptLinkNew />
|
|
44
|
-
</QxContext
|
|
44
|
+
</QxContext>,
|
|
45
45
|
);
|
|
46
46
|
await waitForLoad(rendered);
|
|
47
47
|
expect(rendered.container).toMatchSnapshot();
|
|
@@ -51,12 +51,12 @@ describe("<ConceptLinkNew />", () => {
|
|
|
51
51
|
const rendered = render(
|
|
52
52
|
<QxContext value={context}>
|
|
53
53
|
<ConceptLinkNew />
|
|
54
|
-
</QxContext
|
|
54
|
+
</QxContext>,
|
|
55
55
|
);
|
|
56
56
|
await waitForLoad(rendered);
|
|
57
57
|
|
|
58
58
|
expect(
|
|
59
|
-
rendered.getByText("quality_controls.relation.new.concept.header")
|
|
59
|
+
rendered.getByText("quality_controls.relation.new.concept.header"),
|
|
60
60
|
).toBeInTheDocument();
|
|
61
61
|
expect(rendered.getByText("ConceptLinkForm")).toBeInTheDocument();
|
|
62
62
|
});
|