@truedat/qx 8.6.7 → 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.
Files changed (160) hide show
  1. package/package.json +3 -3
  2. package/src/components/__tests__/QxRoutes.spec.js +1 -1
  3. package/src/components/common/ClauseViewer.js +1 -1
  4. package/src/components/common/ResourceSelector.js +1 -1
  5. package/src/components/common/TypeSelector.js +7 -3
  6. package/src/components/common/__tests__/ResourceSelector.spec.js +6 -6
  7. package/src/components/common/expressions/FieldSelector.js +2 -2
  8. package/src/components/common/expressions/FunctionSelector.js +3 -3
  9. package/src/components/common/expressions/ParamSelector.js +1 -1
  10. package/src/components/common/expressions/ShapeSelector.js +4 -5
  11. package/src/components/common/expressions/__tests__/Clauses.spec.js +11 -11
  12. package/src/components/common/expressions/__tests__/Condition.spec.js +15 -13
  13. package/src/components/common/expressions/__tests__/ConstantSelector.spec.js +2 -2
  14. package/src/components/common/expressions/__tests__/Expression.spec.js +5 -5
  15. package/src/components/common/expressions/__tests__/FieldSelector.spec.js +6 -2
  16. package/src/components/common/expressions/__tests__/FunctionArgs.spec.js +3 -3
  17. package/src/components/common/expressions/__tests__/FunctionSelector.spec.js +3 -3
  18. package/src/components/common/expressions/__tests__/ParamSelector.spec.js +3 -3
  19. package/src/components/common/expressions/__tests__/ShapeSelector.spec.js +7 -7
  20. package/src/components/common/expressions/__tests__/useWatchParams.spec.js +3 -1
  21. package/src/components/common/expressions/constantInputs/AnySelector.js +0 -1
  22. package/src/components/common/expressions/constantInputs/BooleanSelector.js +5 -1
  23. package/src/components/common/expressions/constantInputs/__tests__/AnySelector.spec.js +6 -2
  24. package/src/components/common/expressions/constantInputs/__tests__/BooleanSelector.spec.js +8 -4
  25. package/src/components/common/expressions/constantInputs/__tests__/DefaultSelector.spec.js +6 -3
  26. package/src/components/common/resourceSelectors/DataStructureSelector.js +5 -1
  27. package/src/components/common/resourceSelectors/DataViewSelector.js +3 -3
  28. package/src/components/common/resourceSelectors/ReferenceDatasetSelector.js +7 -2
  29. package/src/components/common/resourceSelectors/__tests__/DataStructureSelector.spec.js +1 -1
  30. package/src/components/common/resourceSelectors/__tests__/DataViewSelector.spec.js +7 -7
  31. package/src/components/common/resourceSelectors/__tests__/ReferenceDatasetSelector.spec.js +6 -6
  32. package/src/components/dataViews/DataViewEditor.js +3 -2
  33. package/src/components/dataViews/DataViewSummary.js +1 -1
  34. package/src/components/dataViews/DataViews.js +2 -2
  35. package/src/components/dataViews/__tests__/AdvancedDataViewEditor.spec.js +3 -3
  36. package/src/components/dataViews/__tests__/DataViewEditor.spec.js +7 -7
  37. package/src/components/dataViews/__tests__/DataViewSelect.spec.js +1 -1
  38. package/src/components/dataViews/__tests__/DataViewSummary.spec.js +15 -15
  39. package/src/components/dataViews/__tests__/DataViews.spec.js +6 -6
  40. package/src/components/dataViews/__tests__/Queryable.spec.js +6 -6
  41. package/src/components/dataViews/__tests__/Queryables.spec.js +6 -6
  42. package/src/components/dataViews/__tests__/SimpleDataViewEditor.spec.js +17 -17
  43. package/src/components/dataViews/__tests__/queryableFunctions.spec.js +4 -4
  44. package/src/components/dataViews/advancedForm/AdvancedDataViewEditor.js +3 -3
  45. package/src/components/dataViews/advancedForm/DataViewSelect.js +1 -1
  46. package/src/components/dataViews/advancedForm/Queryable.js +3 -3
  47. package/src/components/dataViews/queryableFunctions.js +35 -35
  48. package/src/components/dataViews/queryableProperties/Select.js +1 -1
  49. package/src/components/dataViews/queryableProperties/SelectField.js +5 -5
  50. package/src/components/dataViews/queryableProperties/__tests__/From.spec.js +1 -1
  51. package/src/components/dataViews/queryableProperties/__tests__/GroupBy.spec.js +19 -19
  52. package/src/components/dataViews/queryableProperties/__tests__/Join.spec.js +1 -1
  53. package/src/components/dataViews/queryableProperties/__tests__/JoinTypeIcon.spec.js +1 -1
  54. package/src/components/dataViews/queryableProperties/__tests__/Select.spec.js +5 -5
  55. package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +3 -3
  56. package/src/components/dataViews/queryableProperties/__tests__/Where.spec.js +1 -1
  57. package/src/components/dataViews/queryableSummaryHelpers.js +1 -1
  58. package/src/components/dataViews/simpleForm/AggregationForm.js +2 -2
  59. package/src/components/dataViews/simpleForm/DatasetForm.js +1 -1
  60. package/src/components/dataViews/simpleForm/FormQueryable.js +3 -3
  61. package/src/components/dataViews/simpleForm/InformationForm.js +2 -2
  62. package/src/components/dataViews/simpleForm/SelectionForm.js +1 -1
  63. package/src/components/dataViews/simpleForm/SimpleDataViewEditor.js +3 -3
  64. package/src/components/dataViews/summary/GroupBy.js +1 -1
  65. package/src/components/dataViews/summary/Join.js +50 -48
  66. package/src/components/dataViews/summary/Select.js +1 -1
  67. package/src/components/dataViews/summary/Where.js +6 -1
  68. package/src/components/functions/FunctionEditor.js +1 -1
  69. package/src/components/functions/Functions.js +1 -1
  70. package/src/components/functions/__tests__/FunctionEditor.spec.js +7 -7
  71. package/src/components/functions/__tests__/FunctionParams.spec.js +4 -4
  72. package/src/components/qualityControls/ConceptLinkNew.js +2 -2
  73. package/src/components/qualityControls/ConceptLinks.js +1 -1
  74. package/src/components/qualityControls/ContentSummary.js +23 -21
  75. package/src/components/qualityControls/ControlProperties.js +1 -1
  76. package/src/components/qualityControls/ControlPropertiesView.js +1 -1
  77. package/src/components/qualityControls/EditQualityControl.js +1 -1
  78. package/src/components/qualityControls/NewDraftQualityControl.js +1 -1
  79. package/src/components/qualityControls/QualityControlActions.js +4 -4
  80. package/src/components/qualityControls/QualityControlEditor.js +11 -20
  81. package/src/components/qualityControls/QualityControlEvents.js +2 -2
  82. package/src/components/qualityControls/QualityControlHeader.js +2 -2
  83. package/src/components/qualityControls/QualityControlRoutes.js +1 -1
  84. package/src/components/qualityControls/QualityControlScores.js +3 -3
  85. package/src/components/qualityControls/QualityControlSelector.js +1 -1
  86. package/src/components/qualityControls/QualityControlSummary.js +17 -15
  87. package/src/components/qualityControls/QualityControls.js +9 -11
  88. package/src/components/qualityControls/QualityControlsTable.js +1 -1
  89. package/src/components/qualityControls/SegmentationForm.js +99 -100
  90. package/src/components/qualityControls/SegmentationSummary.js +113 -104
  91. package/src/components/qualityControls/StructureLinkNew.js +2 -2
  92. package/src/components/qualityControls/StructureLinks.js +1 -1
  93. package/src/components/qualityControls/__tests__/ConceptLinkNew.spec.js +5 -5
  94. package/src/components/qualityControls/__tests__/ConceptLinks.spec.js +3 -3
  95. package/src/components/qualityControls/__tests__/ControlProperties.spec.js +6 -2
  96. package/src/components/qualityControls/__tests__/ControlPropertiesForm.spec.js +6 -6
  97. package/src/components/qualityControls/__tests__/ControlPropertiesSummary.spec.js +7 -7
  98. package/src/components/qualityControls/__tests__/ControlPropertiesView.spec.js +7 -2
  99. package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +12 -12
  100. package/src/components/qualityControls/__tests__/InformationForm.spec.js +29 -11
  101. package/src/components/qualityControls/__tests__/NewDraftQualityControl.spec.js +23 -21
  102. package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +38 -38
  103. package/src/components/qualityControls/__tests__/QualityBadge.spec.js +7 -7
  104. package/src/components/qualityControls/__tests__/QualityControl.spec.js +7 -7
  105. package/src/components/qualityControls/__tests__/QualityControlActions.spec.js +16 -16
  106. package/src/components/qualityControls/__tests__/QualityControlCrumbs.spec.js +1 -1
  107. package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +6 -2
  108. package/src/components/qualityControls/__tests__/QualityControlEvents.spec.js +3 -3
  109. package/src/components/qualityControls/__tests__/QualityControlHeader.spec.js +3 -3
  110. package/src/components/qualityControls/__tests__/QualityControlHistory.spec.js +2 -2
  111. package/src/components/qualityControls/__tests__/QualityControlManageDomain.spec.js +4 -4
  112. package/src/components/qualityControls/__tests__/QualityControlQueryModal.spec.js +2 -2
  113. package/src/components/qualityControls/__tests__/QualityControlRoutes.spec.js +2 -2
  114. package/src/components/qualityControls/__tests__/QualityControlRow.spec.js +4 -4
  115. package/src/components/qualityControls/__tests__/QualityControlScores.spec.js +9 -9
  116. package/src/components/qualityControls/__tests__/QualityControlSelector.spec.js +21 -17
  117. package/src/components/qualityControls/__tests__/QualityControls.spec.js +21 -21
  118. package/src/components/qualityControls/__tests__/QualityControlsLabelResults.spec.js +5 -5
  119. package/src/components/qualityControls/__tests__/QualityControlsPagination.spec.js +1 -1
  120. package/src/components/qualityControls/__tests__/QualityControlsTable.spec.js +1 -1
  121. package/src/components/qualityControls/__tests__/ScoreCriteria.spec.js +6 -6
  122. package/src/components/qualityControls/__tests__/ScoreCriteriaView.spec.js +6 -6
  123. package/src/components/qualityControls/__tests__/StructureLinkNew.spec.js +9 -9
  124. package/src/components/qualityControls/__tests__/StructureLinks.spec.js +6 -6
  125. package/src/components/qualityControls/controlProperties/__tests__/ResourceWithValidation.spec.js +9 -9
  126. package/src/components/qualityControls/scoreCriterias/__tests__/Deviation.spec.js +5 -5
  127. package/src/components/qualityControls/scoreCriterias/__tests__/ErrorCount.spec.js +10 -10
  128. package/src/components/qualityControls/scoreCriterias/__tests__/Percentage.spec.js +6 -6
  129. package/src/components/scores/QualityBar.js +1 -1
  130. package/src/components/scores/ScoreDetails.js +1 -1
  131. package/src/components/scores/ScoreGroup.js +2 -2
  132. package/src/components/scores/ScoreGroupForm.js +1 -1
  133. package/src/components/scores/__tests__/MyScoreGroups.spec.js +1 -1
  134. package/src/components/scores/__tests__/QualityBar.spec.js +3 -3
  135. package/src/components/scores/__tests__/Score.spec.js +1 -1
  136. package/src/components/scores/__tests__/ScoreContext.spec.js +2 -2
  137. package/src/components/scores/__tests__/ScoreCrumbs.spec.js +2 -2
  138. package/src/components/scores/__tests__/ScoreDetails.spec.js +2 -2
  139. package/src/components/scores/__tests__/ScoreEvents.spec.js +1 -1
  140. package/src/components/scores/__tests__/ScoreGroup.spec.js +1 -1
  141. package/src/components/scores/__tests__/ScoreGroupBreadcrumbs.spec.js +1 -1
  142. package/src/components/scores/__tests__/ScoreGroupForm.spec.js +3 -3
  143. package/src/components/scores/__tests__/ScoreGroupLink.spec.js +1 -1
  144. package/src/components/scores/__tests__/ScoreGroupMessage.spec.js +1 -1
  145. package/src/components/scores/__tests__/ScoreGroupPopup.spec.js +2 -2
  146. package/src/components/scores/__tests__/ScoreGroupsRoutes.spec.js +1 -1
  147. package/src/components/scores/__tests__/ScoreGroupsTable.spec.js +2 -2
  148. package/src/components/scores/__tests__/ScorePagination.spec.js +1 -1
  149. package/src/components/scores/__tests__/ScoreStatusDecorator.spec.js +2 -2
  150. package/src/components/selectors/__tests__/getMyScoreGroupsColumns.spec.js +5 -5
  151. package/src/components/selectors/__tests__/getQualityControlScoresColumns.spec.js +3 -3
  152. package/src/components/selectors/getMyScoreGroupsColumns.js +1 -1
  153. package/src/components/selectors/getQualityControlScoresColumns.js +1 -1
  154. package/src/hooks/useDataViews.js +1 -1
  155. package/src/hooks/useExecutionGroups.js +2 -2
  156. package/src/hooks/useFunctions.js +1 -1
  157. package/src/hooks/useQualityControls.js +3 -3
  158. package/src/hooks/useScoreGroups.js +3 -3
  159. package/src/hooks/useScores.js +1 -1
  160. 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
- if (!qualityControl) return null;
9
+ if (!qualityControl) return null;
10
10
 
11
- return (
12
- <Container>
13
- <ContentSummary qualityControl={qualityControl} />
14
- {qualityControl.control_mode && <ScoreCriteriaView qualityControl={qualityControl} />}
15
- <ControlPropertiesSummary qualityControl={qualityControl} />
16
- {qualityControl.control_properties?.segmentation && (
17
- <SegmentationSummary
18
- segmentation={qualityControl.control_properties.segmentation}
19
- controlProperties={qualityControl.control_properties}
20
- />
21
- )}
22
- </Container>
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
- qualityControl: PropTypes.object,
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
- const { formatMessage } = useIntl();
11
- const { control, watch, setValue } = useFormContext();
12
- const context = use(QxContext);
13
- const fieldNames = ["control_properties.segmentation"];
10
+ const { formatMessage } = useIntl();
11
+ const { control, watch, setValue } = useFormContext();
12
+ const context = use(QxContext);
13
+ const fieldNames = ["control_properties.segmentation"];
14
14
 
15
- const controlProperties = watch("control_properties");
16
- const segmentation = _.prop("segmentation")(controlProperties);
15
+ const controlProperties = watch("control_properties");
16
+ const segmentation = _.prop("segmentation")(controlProperties);
17
17
 
18
- useEffect(() => {
19
- if (!_.isEqual(stepInformation?.fieldNames, fieldNames))
20
- setStepInformation(2, { ...stepInformation, fieldNames });
21
- }, [stepInformation, fieldNames]);
18
+ useEffect(() => {
19
+ if (!_.isEqual(stepInformation?.fieldNames, fieldNames))
20
+ setStepInformation(2, { ...stepInformation, fieldNames });
21
+ }, [stepInformation, fieldNames]);
22
22
 
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
- };
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
- const handleDeleteSegmentation = () => {
41
- setValue(
42
- "control_properties.segmentation",
43
- null,
44
- { shouldValidate: false, shouldDirty: true }
45
- );
46
- };
40
+ const handleDeleteSegmentation = () => {
41
+ setValue("control_properties.segmentation", null, {
42
+ shouldValidate: false,
43
+ shouldDirty: true,
44
+ });
45
+ };
47
46
 
48
- const { source_id: sourceId } = watch();
47
+ const { source_id: sourceId } = watch();
49
48
 
50
- if (!sourceId) return null;
49
+ if (!sourceId) return null;
51
50
 
52
- return (
53
- <>
54
- <Segment>
55
- {!segmentation ? (
56
- <Button
57
- onClick={handleAddSegmentation}
58
- basic
59
- className="td-icon-text-control"
60
- icon="plus"
61
- content={formatMessage({
62
- id: "quality_control.form.segmentation.add",
63
- defaultMessage: "Add segmentation",
64
- })}
65
- />
66
- ) : (
67
- <>
68
- <Button
69
- onClick={handleDeleteSegmentation}
70
- icon="trash alternate outline"
71
- basic
72
- color="red"
73
- aria-label="delete"
74
- floated="right"
75
- />
76
- <Controller
77
- control={control}
78
- name="control_properties.segmentation.alias"
79
- render={({
80
- field: { onBlur, onChange, value },
81
- fieldState: { error },
82
- }) => (
83
- <Form.Field>
84
- <label>
85
- {formatMessage({
86
- id: "dataViews.form.queryable.alias",
87
- })}
88
- </label>
89
- <Form.Input
90
- autoComplete="off"
91
- placeholder={formatMessage({
92
- id: "dataViews.form.queryable.alias",
93
- })}
94
- error={!!error}
95
- onBlur={onBlur}
96
- onChange={(_e, { value }) => onChange(value)}
97
- value={value || ""}
98
- />
99
- </Form.Field>
100
- )}
101
- />
102
- <QxContext
103
- value={{
104
- ...context,
105
- sourceId,
106
- field: "control_properties.segmentation.properties",
107
- }}
108
- >
109
- <GroupBy />
110
- </QxContext>
111
- </>
112
- )}
113
- </Segment>
114
- <Divider hidden />
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
- getAggregateFields,
7
- getGroupByFields,
8
- buildParentResourceMap,
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({ segmentation, controlProperties }) {
15
- const { formatMessage } = useIntl();
14
+ export default function SegmentationSummary({
15
+ segmentation,
16
+ controlProperties,
17
+ }) {
18
+ const { formatMessage } = useIntl();
16
19
 
17
- if (!segmentation || segmentation.type !== "group_by") return null;
20
+ if (!segmentation || segmentation.type !== "group_by") return null;
18
21
 
19
- const resource = controlProperties?.resource || controlProperties?.errors_resource;
22
+ const resource =
23
+ controlProperties?.resource || controlProperties?.errors_resource;
20
24
 
21
- const fromQueryable = resource
22
- ? {
23
- id: 0,
24
- type: "from",
25
- alias: null,
26
- properties: {
27
- resource: resource,
28
- },
29
- }
30
- : null;
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
- const queryables = fromQueryable ? [fromQueryable, segmentation] : [segmentation];
33
- const parentResourceMap = buildParentResourceMap(queryables);
34
- const groupByFields = getGroupByFields(segmentation);
35
- const aggregateFields = getAggregateFields(segmentation);
36
- const color = getColorById(segmentation.id);
37
- const hasGroupByFields = _.size(groupByFields) > 0;
38
- const hasAggregateFields = _.size(aggregateFields) > 0;
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
- return (
41
- <>
42
- <Header as="h5">
43
- <Icon name="chart bar" size="small" />
44
- <Header.Content>
45
- {formatMessage({ id: "quality_control.form.segmentation.title", defaultMessage: "Segmentation" })}
46
- </Header.Content>
47
- </Header>
48
- <QxContext value={{ parentResourceMap }}>
49
- <Segment>
50
- <List>
51
- <List.Item>
52
- <List.Header style={{ marginBottom: 4 }}>
53
- <Icon name="calculator" />
54
- {formatMessage({ id: "dataViews.form.queryable.group_by" })}
55
- </List.Header>
56
- <List.Content>
57
- {segmentation.alias && (
58
- <div style={{ marginBottom: 4 }}>
59
- <b style={{ marginRight: 4 }}>as</b>
60
- <Label color={color}>{segmentation.alias}</Label>
61
- </div>
62
- )}
63
- {hasGroupByFields && (
64
- <Segment>
65
- <List.Description>
66
- <div style={{ marginBottom: 8 }}>
67
- <Header as="h5">
68
- <Icon name="group" size="small" />
69
- {formatMessage({
70
- id: "queryables.group_by.form.group_fields",
71
- })}
72
- </Header>
73
- </div>
74
- <div>
75
- {groupByFields.map((field, idx) => (
76
- <ExpressionViewer
77
- key={idx}
78
- expression={field.expression}
79
- alias={field.alias}
80
- />
81
- ))}
82
- </div>
83
- </List.Description>
84
- </Segment>
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
- {hasAggregateFields && (
88
- <Segment>
89
- <List.Description>
90
- <div style={{ marginBottom: 8 }}>
91
- <Header as="h5">
92
- <Icon name="chart bar" size="small" />
93
- {formatMessage({
94
- id: "queryables.group_by.form.aggregate_fields",
95
- })}
96
- </Header>
97
- </div>
98
- <div>
99
- {aggregateFields.map((field, idx) => (
100
- <ExpressionViewer
101
- key={idx}
102
- expression={field.expression}
103
- alias={field.alias}
104
- />
105
- ))}
106
- </div>
107
- </List.Description>
108
- </Segment>
109
- )}
110
- </List.Content>
111
- </List.Item>
112
- </List>
113
- </Segment>
114
- </QxContext>
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
- segmentation: PropTypes.object,
121
- controlProperties: PropTypes.object,
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
  });