@finos/legend-extension-dsl-data-quality 1.0.60 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. package/lib/components/{DSL_DataQuality_ClassElementDriver.d.ts → DSL_DataQuality_ElementDriver.d.ts} +17 -7
  2. package/lib/components/DSL_DataQuality_ElementDriver.d.ts.map +1 -0
  3. package/lib/components/{DSL_DataQuality_ClassElementDriver.js → DSL_DataQuality_ElementDriver.js} +70 -23
  4. package/lib/components/DSL_DataQuality_ElementDriver.js.map +1 -0
  5. package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.d.ts.map +1 -1
  6. package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.js +20 -39
  7. package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.js.map +1 -1
  8. package/lib/components/{DSL_NewDataQualityClassValidationElement.d.ts → DSL_NewDataQualityValidationElement.d.ts} +2 -2
  9. package/lib/components/DSL_NewDataQualityValidationElement.d.ts.map +1 -0
  10. package/lib/components/DSL_NewDataQualityValidationElement.js +80 -0
  11. package/lib/components/DSL_NewDataQualityValidationElement.js.map +1 -0
  12. package/lib/components/DataQualityRelationTrialRuns.d.ts +22 -0
  13. package/lib/components/DataQualityRelationTrialRuns.d.ts.map +1 -0
  14. package/lib/components/DataQualityRelationTrialRuns.js +87 -0
  15. package/lib/components/DataQualityRelationTrialRuns.js.map +1 -0
  16. package/lib/components/{DSL_NewDataQualityServiceValidationElement.d.ts → DataQualityRelationValidationConfigurationEditor.d.ts} +2 -2
  17. package/lib/components/DataQualityRelationValidationConfigurationEditor.d.ts.map +1 -0
  18. package/lib/components/DataQualityRelationValidationConfigurationEditor.js +99 -0
  19. package/lib/components/DataQualityRelationValidationConfigurationEditor.js.map +1 -0
  20. package/lib/components/DataQualityRelationValidationEditor.d.ts +30 -0
  21. package/lib/components/DataQualityRelationValidationEditor.d.ts.map +1 -0
  22. package/lib/components/DataQualityRelationValidationEditor.js +89 -0
  23. package/lib/components/DataQualityRelationValidationEditor.js.map +1 -0
  24. package/lib/components/DataQualityResultPanel.d.ts.map +1 -1
  25. package/lib/components/DataQualityResultPanel.js +1 -1
  26. package/lib/components/DataQualityResultPanel.js.map +1 -1
  27. package/lib/components/DataQualityResultValues.d.ts +0 -2
  28. package/lib/components/DataQualityResultValues.d.ts.map +1 -1
  29. package/lib/components/DataQualityResultValues.js.map +1 -1
  30. package/lib/components/DataQualitySideBar.js +2 -2
  31. package/lib/components/DataQualitySideBar.js.map +1 -1
  32. package/lib/components/DataQualityValidationDetailPanel.d.ts +36 -0
  33. package/lib/components/DataQualityValidationDetailPanel.d.ts.map +1 -0
  34. package/lib/components/DataQualityValidationDetailPanel.js +39 -0
  35. package/lib/components/DataQualityValidationDetailPanel.js.map +1 -0
  36. package/lib/components/DataQualityValidationParametersEditor.d.ts +15 -0
  37. package/lib/components/DataQualityValidationParametersEditor.d.ts.map +1 -0
  38. package/lib/components/DataQualityValidationParametersEditor.js +129 -0
  39. package/lib/components/DataQualityValidationParametersEditor.js.map +1 -0
  40. package/lib/components/states/ConstraintState.d.ts +2 -0
  41. package/lib/components/states/ConstraintState.d.ts.map +1 -1
  42. package/lib/components/states/ConstraintState.js +2 -0
  43. package/lib/components/states/ConstraintState.js.map +1 -1
  44. package/lib/components/states/DataQualityClassValidationState.d.ts +2 -2
  45. package/lib/components/states/DataQualityClassValidationState.d.ts.map +1 -1
  46. package/lib/components/states/DataQualityClassValidationState.js +4 -4
  47. package/lib/components/states/DataQualityClassValidationState.js.map +1 -1
  48. package/lib/components/states/DataQualityRelationResultState.d.ts +46 -0
  49. package/lib/components/states/DataQualityRelationResultState.d.ts.map +1 -0
  50. package/lib/components/states/DataQualityRelationResultState.js +194 -0
  51. package/lib/components/states/DataQualityRelationResultState.js.map +1 -0
  52. package/lib/components/states/DataQualityRelationValidationConfigurationState.d.ts +73 -0
  53. package/lib/components/states/DataQualityRelationValidationConfigurationState.d.ts.map +1 -0
  54. package/lib/components/states/DataQualityRelationValidationConfigurationState.js +255 -0
  55. package/lib/components/states/DataQualityRelationValidationConfigurationState.js.map +1 -0
  56. package/lib/components/states/DataQualityRelationValidationLambdaEditorState.d.ts +32 -0
  57. package/lib/components/states/DataQualityRelationValidationLambdaEditorState.d.ts.map +1 -0
  58. package/lib/components/states/DataQualityRelationValidationLambdaEditorState.js +79 -0
  59. package/lib/components/states/DataQualityRelationValidationLambdaEditorState.js.map +1 -0
  60. package/lib/components/states/DataQualityRelationValidationState.d.ts +38 -0
  61. package/lib/components/states/DataQualityRelationValidationState.d.ts.map +1 -0
  62. package/lib/components/states/DataQualityRelationValidationState.js +119 -0
  63. package/lib/components/states/DataQualityRelationValidationState.js.map +1 -0
  64. package/lib/components/states/DataQualityResultState.d.ts.map +1 -1
  65. package/lib/components/states/DataQualityResultState.js +6 -3
  66. package/lib/components/states/DataQualityResultState.js.map +1 -1
  67. package/lib/components/states/DataQualityState.js +1 -1
  68. package/lib/components/states/DataQualityState.js.map +1 -1
  69. package/lib/graph/metamodel/DSL_DataQuality_HashUtils.d.ts +5 -1
  70. package/lib/graph/metamodel/DSL_DataQuality_HashUtils.d.ts.map +1 -1
  71. package/lib/graph/metamodel/DSL_DataQuality_HashUtils.js +4 -0
  72. package/lib/graph/metamodel/DSL_DataQuality_HashUtils.js.map +1 -1
  73. package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.d.ts.map +1 -1
  74. package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.js +2 -1
  75. package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.js.map +1 -1
  76. package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.d.ts +36 -3
  77. package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.d.ts.map +1 -1
  78. package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js +58 -4
  79. package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js.map +1 -1
  80. package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.d.ts +2 -1
  81. package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.d.ts.map +1 -1
  82. package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.js +2 -1
  83. package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.js.map +1 -1
  84. package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.d.ts +13 -2
  85. package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.d.ts.map +1 -1
  86. package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.js +36 -2
  87. package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.js.map +1 -1
  88. package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.d.ts.map +1 -1
  89. package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.js +5 -2
  90. package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.js.map +1 -1
  91. package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.d.ts +5 -1
  92. package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.d.ts.map +1 -1
  93. package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.js +29 -2
  94. package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.js.map +1 -1
  95. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.d.ts +6 -5
  96. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.d.ts.map +1 -1
  97. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.js.map +1 -1
  98. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.d.ts +1 -1
  99. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.d.ts.map +1 -1
  100. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.js +34 -40
  101. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.js.map +1 -1
  102. package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.d.ts +8 -6
  103. package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.d.ts.map +1 -1
  104. package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.js +19 -12
  105. package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.js.map +1 -1
  106. package/lib/graph-manager/protocol/pure/v1/{V1_DataQualityConstraintsConfiguration.d.ts → V1_DataQualityValidationConfiguration.d.ts} +26 -4
  107. package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.d.ts.map +1 -0
  108. package/lib/graph-manager/protocol/pure/v1/{V1_DataQualityConstraintsConfiguration.js → V1_DataQualityValidationConfiguration.js} +49 -4
  109. package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.js.map +1 -0
  110. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.d.ts +7 -3
  111. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.d.ts.map +1 -1
  112. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.js +43 -3
  113. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.js.map +1 -1
  114. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.d.ts +6 -3
  115. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.d.ts.map +1 -1
  116. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.js +39 -2
  117. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.js.map +1 -1
  118. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.d.ts +5 -2
  119. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.d.ts.map +1 -1
  120. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.js +27 -9
  121. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.js.map +1 -1
  122. package/lib/index.css +2 -2
  123. package/lib/index.css.map +1 -1
  124. package/lib/package.json +1 -1
  125. package/package.json +7 -7
  126. package/src/components/{DSL_DataQuality_ClassElementDriver.tsx → DSL_DataQuality_ElementDriver.tsx} +87 -18
  127. package/src/components/DSL_DataQuality_LegendStudioApplicationPlugin.tsx +33 -48
  128. package/src/components/DSL_NewDataQualityValidationElement.tsx +208 -0
  129. package/src/components/DataQualityRelationTrialRuns.tsx +288 -0
  130. package/src/components/DataQualityRelationValidationConfigurationEditor.tsx +364 -0
  131. package/src/components/DataQualityRelationValidationEditor.tsx +290 -0
  132. package/src/components/DataQualityResultPanel.tsx +1 -4
  133. package/src/components/DataQualityResultValues.tsx +1 -5
  134. package/src/components/DataQualitySideBar.tsx +2 -2
  135. package/src/components/DataQualityValidationDetailPanel.tsx +182 -0
  136. package/src/components/DataQualityValidationParametersEditor.tsx +355 -0
  137. package/src/components/states/ConstraintState.ts +2 -0
  138. package/src/components/states/DataQualityClassValidationState.ts +5 -5
  139. package/src/components/states/DataQualityRelationResultState.ts +274 -0
  140. package/src/components/states/DataQualityRelationValidationConfigurationState.ts +429 -0
  141. package/src/components/states/DataQualityRelationValidationLambdaEditorState.ts +138 -0
  142. package/src/components/states/DataQualityRelationValidationState.ts +180 -0
  143. package/src/components/states/DataQualityResultState.ts +6 -8
  144. package/src/components/states/DataQualityState.ts +1 -1
  145. package/src/graph/metamodel/DSL_DataQuality_HashUtils.ts +4 -0
  146. package/src/graph/metamodel/DSL_DataQuality_PureGraphPlugin.ts +2 -0
  147. package/src/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.ts +79 -3
  148. package/src/graph-manager/DSL_DataQuality_GraphManagerHelper.ts +13 -0
  149. package/src/graph-manager/DSL_DataQuality_GraphModifierHelper.ts +107 -0
  150. package/src/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.ts +8 -0
  151. package/src/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.ts +54 -1
  152. package/src/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.ts +5 -3
  153. package/src/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.ts +72 -81
  154. package/src/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.ts +20 -23
  155. package/src/graph-manager/protocol/pure/v1/{V1_DataQualityConstraintsConfiguration.ts → V1_DataQualityValidationConfiguration.ts} +63 -4
  156. package/src/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.ts +116 -2
  157. package/src/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.ts +78 -1
  158. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.ts +55 -8
  159. package/style/_data-quality-relation-validation-builder.scss +454 -0
  160. package/style/index.scss +6 -0
  161. package/tsconfig.json +13 -6
  162. package/lib/components/DSL_DataQuality_ClassElementDriver.d.ts.map +0 -1
  163. package/lib/components/DSL_DataQuality_ClassElementDriver.js.map +0 -1
  164. package/lib/components/DSL_DataQuality_ServiceElementDriver.d.ts +0 -27
  165. package/lib/components/DSL_DataQuality_ServiceElementDriver.d.ts.map +0 -1
  166. package/lib/components/DSL_DataQuality_ServiceElementDriver.js +0 -41
  167. package/lib/components/DSL_DataQuality_ServiceElementDriver.js.map +0 -1
  168. package/lib/components/DSL_NewDataQualityClassValidationElement.d.ts.map +0 -1
  169. package/lib/components/DSL_NewDataQualityClassValidationElement.js +0 -64
  170. package/lib/components/DSL_NewDataQualityClassValidationElement.js.map +0 -1
  171. package/lib/components/DSL_NewDataQualityServiceValidationElement.d.ts.map +0 -1
  172. package/lib/components/DSL_NewDataQualityServiceValidationElement.js +0 -41
  173. package/lib/components/DSL_NewDataQualityServiceValidationElement.js.map +0 -1
  174. package/lib/graph-manager/protocol/pure/v1/V1_DataQualityConstraintsConfiguration.d.ts.map +0 -1
  175. package/lib/graph-manager/protocol/pure/v1/V1_DataQualityConstraintsConfiguration.js.map +0 -1
  176. package/src/components/DSL_DataQuality_ServiceElementDriver.tsx +0 -57
  177. package/src/components/DSL_NewDataQualityClassValidationElement.tsx +0 -156
  178. package/src/components/DSL_NewDataQualityServiceValidationElement.tsx +0 -74
@@ -0,0 +1,290 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { useCallback, useRef } from 'react';
18
+ import { observer } from 'mobx-react-lite';
19
+ import {
20
+ type SelectOption,
21
+ clsx,
22
+ CustomSelectorInput,
23
+ FilledWindowMaximizeIcon,
24
+ PanelDnDEntry,
25
+ PanelEntryDragHandle,
26
+ RocketIcon,
27
+ TimesIcon,
28
+ useDragPreviewLayer,
29
+ } from '@finos/legend-art';
30
+ import { flowResult } from 'mobx';
31
+ import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '@finos/legend-application-studio';
32
+ import { PrimitiveType } from '@finos/legend-graph';
33
+ import {
34
+ ApplicationNavigationContextData,
35
+ useApplicationStore,
36
+ } from '@finos/legend-application';
37
+ import { InlineLambdaEditor } from '@finos/legend-query-builder';
38
+ import {
39
+ type DataQualityRelationValidationConfigurationState,
40
+ DATA_QUALITY_RELATION_VALIDATION_EDITOR_TAB,
41
+ } from './states/DataQualityRelationValidationConfigurationState.js';
42
+ import type { DataQualityRelationValidation } from '../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
43
+ import {
44
+ dataQualityRelationValidation_setDescription,
45
+ dataQualityRelationValidation_setName,
46
+ dataQualityRelationValidation_swapValidations,
47
+ } from '../graph-manager/DSL_DataQuality_GraphModifierHelper.js';
48
+ import { DataQualityValidationDetailPanel } from './DataQualityValidationDetailPanel.js';
49
+ import { useDrag, useDrop } from 'react-dnd';
50
+
51
+ export type RelationValidationDragSource = {
52
+ validation: DataQualityRelationValidation;
53
+ };
54
+ export const RELATION_VALIDATION_DND_TYPE = 'RELATION_VALIDATION';
55
+
56
+ export const DataQualityRelationValidationEditor = observer(
57
+ (props: {
58
+ relationValidationConfigurationState: DataQualityRelationValidationConfigurationState;
59
+ validation: DataQualityRelationValidation;
60
+ deleteValidation: () => void;
61
+ isReadOnly: boolean;
62
+ }) => {
63
+ const ref = useRef<HTMLDivElement>(null);
64
+ const handleRef = useRef<HTMLDivElement>(null);
65
+
66
+ const {
67
+ validation,
68
+ deleteValidation,
69
+ relationValidationConfigurationState,
70
+ isReadOnly,
71
+ } = props;
72
+ const applicationStore = useApplicationStore();
73
+ const hasParserError =
74
+ relationValidationConfigurationState.validationStates.some(
75
+ (state) => state.parserError,
76
+ );
77
+ const validationState =
78
+ relationValidationConfigurationState.getValidationState(validation);
79
+
80
+ const changeName: React.ChangeEventHandler<HTMLInputElement> = (event) =>
81
+ dataQualityRelationValidation_setName(validation, event.target.value);
82
+
83
+ const changeDescription: React.ChangeEventHandler<HTMLInputElement> = (
84
+ event,
85
+ ) =>
86
+ dataQualityRelationValidation_setDescription(
87
+ validation,
88
+ event.target.value,
89
+ );
90
+
91
+ const handleHover = useCallback(
92
+ (item: RelationValidationDragSource): void => {
93
+ const draggingProperty = item.validation;
94
+ const hoveredProperty = validation;
95
+ dataQualityRelationValidation_swapValidations(
96
+ relationValidationConfigurationState.validationElement,
97
+ draggingProperty,
98
+ hoveredProperty,
99
+ );
100
+ },
101
+ [relationValidationConfigurationState.validationElement, validation],
102
+ );
103
+
104
+ const [{ isBeingDraggedValidation }, dropConnector] = useDrop<
105
+ RelationValidationDragSource,
106
+ void,
107
+ { isBeingDraggedValidation: DataQualityRelationValidation | undefined }
108
+ >(
109
+ () => ({
110
+ accept: [RELATION_VALIDATION_DND_TYPE],
111
+ hover: (item) => handleHover(item),
112
+ collect: (
113
+ monitor,
114
+ ): {
115
+ isBeingDraggedValidation: DataQualityRelationValidation | undefined;
116
+ } => ({
117
+ isBeingDraggedValidation:
118
+ monitor.getItem<RelationValidationDragSource | null>()?.validation,
119
+ }),
120
+ }),
121
+ [handleHover],
122
+ );
123
+ const isBeingDragged = validation === isBeingDraggedValidation;
124
+
125
+ const [, dragConnector, dragPreviewConnector] =
126
+ useDrag<RelationValidationDragSource>(
127
+ () => ({
128
+ type: RELATION_VALIDATION_DND_TYPE,
129
+ item: () => ({
130
+ validation: validation,
131
+ }),
132
+ }),
133
+ [validation],
134
+ );
135
+ dragConnector(handleRef);
136
+ dropConnector(ref);
137
+ useDragPreviewLayer(dragPreviewConnector);
138
+
139
+ // Actions
140
+ const onLambdaEditorFocus = (): void =>
141
+ applicationStore.navigationContextService.push(
142
+ ApplicationNavigationContextData.createTransient(
143
+ LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.CLASS_CONTRAINT_LAMBDA_EDITOR,
144
+ ),
145
+ );
146
+ const remove = applicationStore.guardUnhandledError(async () => {
147
+ await flowResult(
148
+ validationState.convertLambdaObjectToGrammarString({ pretty: false }),
149
+ );
150
+ deleteValidation();
151
+ });
152
+
153
+ const runQuery = (): void => {
154
+ relationValidationConfigurationState.setSelectedTab(
155
+ DATA_QUALITY_RELATION_VALIDATION_EDITOR_TAB.TRIAL_RUN,
156
+ );
157
+ relationValidationConfigurationState.resultState.setValidationToRun(
158
+ validation,
159
+ );
160
+ relationValidationConfigurationState.resultState.handleRunValidation();
161
+ };
162
+
163
+ const onValidationTypeChange = (val: SelectOption): void => {
164
+ validationState.onValidationTypeChange(val);
165
+ };
166
+
167
+ const selectedValidationType = {
168
+ label: validation.type,
169
+ value: validation.type,
170
+ };
171
+
172
+ const openValidationDialog = () => {
173
+ validationState.setIsValidationDialogOpen(true);
174
+ };
175
+
176
+ return (
177
+ <PanelDnDEntry
178
+ ref={ref}
179
+ placeholder={<div className="uml-element-editor__dnd__placeholder" />}
180
+ className="relation-validation__container"
181
+ showPlaceholder={isBeingDragged}
182
+ >
183
+ <div
184
+ className={clsx('relation-validation', {
185
+ backdrop__element: validationState.parserError,
186
+ })}
187
+ >
188
+ <div className="relation-validation__content">
189
+ <PanelEntryDragHandle
190
+ dragSourceConnector={handleRef}
191
+ isDragging={isBeingDragged}
192
+ />
193
+ <input
194
+ className="relation-validation__content__name"
195
+ spellCheck={false}
196
+ disabled={isReadOnly}
197
+ value={validation.name}
198
+ onChange={changeName}
199
+ placeholder="Validation name"
200
+ />
201
+ <CustomSelectorInput
202
+ options={
203
+ relationValidationConfigurationState.relationValidationOptions
204
+ }
205
+ onChange={onValidationTypeChange}
206
+ value={selectedValidationType}
207
+ darkMode={
208
+ !applicationStore.layoutService
209
+ .TEMPORARY__isLightColorThemeEnabled
210
+ }
211
+ placeholder={'Type of validation to be added'}
212
+ />
213
+ {!isReadOnly && (
214
+ <button
215
+ className="uml-element-editor__remove-btn"
216
+ onClick={remove}
217
+ tabIndex={-1}
218
+ title="Remove"
219
+ >
220
+ <TimesIcon />
221
+ </button>
222
+ )}
223
+ <button
224
+ className="uml-element-editor__remove-btn"
225
+ onClick={runQuery}
226
+ tabIndex={-1}
227
+ title="Run Validation"
228
+ >
229
+ <RocketIcon />
230
+ </button>
231
+ <button
232
+ className="uml-element-editor__remove-btn"
233
+ onClick={openValidationDialog}
234
+ tabIndex={-1}
235
+ title="Open Validation Details dialog"
236
+ >
237
+ <FilledWindowMaximizeIcon />
238
+ </button>
239
+ </div>
240
+ {validationState.rowMapFunctionLambdaEditorState && (
241
+ <div className="uml-element-editor__row-map">
242
+ <div className="uml-element-editor__row-map__label">
243
+ Row Map Function
244
+ </div>
245
+ <InlineLambdaEditor
246
+ disabled={
247
+ relationValidationConfigurationState.isConvertingValidationLambdaObjects ||
248
+ isReadOnly
249
+ }
250
+ lambdaEditorState={
251
+ validationState.rowMapFunctionLambdaEditorState
252
+ }
253
+ forceBackdrop={hasParserError}
254
+ expectedType={PrimitiveType.BOOLEAN}
255
+ onEditorFocus={onLambdaEditorFocus}
256
+ disablePopUp={true}
257
+ />
258
+ </div>
259
+ )}
260
+ <InlineLambdaEditor
261
+ disabled={
262
+ relationValidationConfigurationState.isConvertingValidationLambdaObjects ||
263
+ isReadOnly
264
+ }
265
+ lambdaEditorState={validationState}
266
+ forceBackdrop={hasParserError}
267
+ expectedType={PrimitiveType.BOOLEAN}
268
+ onEditorFocus={onLambdaEditorFocus}
269
+ disablePopUp={true}
270
+ />
271
+ </div>
272
+ {validationState.isValidationDialogOpen && (
273
+ <DataQualityValidationDetailPanel
274
+ dataQualityRelationValidationState={
275
+ relationValidationConfigurationState
276
+ }
277
+ isReadOnly={isReadOnly}
278
+ relationValidationState={validationState}
279
+ changeName={changeName}
280
+ changeDescription={changeDescription}
281
+ onLambdaEditorFocus={onLambdaEditorFocus}
282
+ forceBackdrop={hasParserError}
283
+ onValidationTypeChange={onValidationTypeChange}
284
+ selectedValidationType={selectedValidationType}
285
+ />
286
+ )}
287
+ </PanelDnDEntry>
288
+ );
289
+ },
290
+ );
@@ -362,10 +362,7 @@ export const DataQualityResultPanel = observer(
362
362
  )}
363
363
  {executionResult && !isLoading && (
364
364
  <div className="data-quality-validation__result__values">
365
- <DataQualityResultValues
366
- executionResult={executionResult}
367
- dataQualityState={dataQualityState}
368
- />
365
+ <DataQualityResultValues executionResult={executionResult} />
369
366
  </div>
370
367
  )}
371
368
  </PanelContent>
@@ -15,7 +15,6 @@
15
15
  */
16
16
 
17
17
  import { observer } from 'mobx-react-lite';
18
- import type { DataQualityState } from './states/DataQualityState.js';
19
18
  import {
20
19
  type ExecutionResult,
21
20
  extractExecutionResultValues,
@@ -26,10 +25,7 @@ import { CodeEditor } from '@finos/legend-lego/code-editor';
26
25
  import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
27
26
 
28
27
  export const DataQualityResultValues = observer(
29
- (props: {
30
- executionResult: ExecutionResult;
31
- dataQualityState: DataQualityState;
32
- }) => {
28
+ (props: { executionResult: ExecutionResult }) => {
33
29
  const { executionResult } = props;
34
30
  if (executionResult instanceof RawExecutionResult) {
35
31
  const inputValue =
@@ -25,7 +25,7 @@ import { useApplicationStore } from '@finos/legend-application';
25
25
  import type { DataQualityState } from './states/DataQualityState.js';
26
26
  import { DataQualityDataSpaceBuilderSetupPanelContent } from './DataQualityDataSpaceBuilder.js';
27
27
  import { DataQualityMappingAndRuntimeBuilder } from './DataQualityMappingAndRuntimeBuilder.js';
28
- import { ELEMENT_CREATION_BASIS } from './DSL_DataQuality_ClassElementDriver.js';
28
+ import { CLASS_ELEMENT_CREATION_BASIS } from './DSL_DataQuality_ElementDriver.js';
29
29
  import { type Class, isElementDeprecated } from '@finos/legend-graph';
30
30
  import type { DataQualityClassValidationState } from './states/DataQualityClassValidationState.js';
31
31
  import type { DataQualityServiceValidationState } from './states/DataQualityServiceValidationState.js';
@@ -191,7 +191,7 @@ export const DataQualityClassValidationSideBar = observer(
191
191
  >
192
192
  <div className="panel__content data-quality-validation__setup__content">
193
193
  {validationElementCreationBasis ===
194
- ELEMENT_CREATION_BASIS.DATASPACE_BASED ? (
194
+ CLASS_ELEMENT_CREATION_BASIS.DATASPACE_BASED ? (
195
195
  <DataQualityDataSpaceBuilderSetupPanelContent
196
196
  dataQualityState={dataQualityClassValidationState}
197
197
  />
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import {
18
+ type SelectOption,
19
+ clsx,
20
+ CustomSelectorInput,
21
+ Dialog,
22
+ Modal,
23
+ ModalBody,
24
+ ModalFooter,
25
+ ModalFooterButton,
26
+ ModalHeader,
27
+ } from '@finos/legend-art';
28
+ import { observer } from 'mobx-react-lite';
29
+ import { PrimitiveType } from '@finos/legend-graph';
30
+ import type { DataQualityRelationValidationConfigurationState } from './states/DataQualityRelationValidationConfigurationState.js';
31
+ import type { DataQualityRelationValidationState } from './states/DataQualityRelationValidationState.js';
32
+ import { InlineLambdaEditor } from '@finos/legend-query-builder';
33
+ import type { RelationValidationType } from '../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
34
+
35
+ export const DataQualityValidationDetailPanel = observer(
36
+ (props: {
37
+ dataQualityRelationValidationState: DataQualityRelationValidationConfigurationState;
38
+ isReadOnly: boolean;
39
+ relationValidationState: DataQualityRelationValidationState;
40
+ changeName: React.ChangeEventHandler<HTMLInputElement>;
41
+ changeDescription: React.ChangeEventHandler<HTMLInputElement>;
42
+ onLambdaEditorFocus: (() => void) | undefined;
43
+ onValidationTypeChange: (val: SelectOption) => void;
44
+ selectedValidationType: {
45
+ label: RelationValidationType;
46
+ value: RelationValidationType;
47
+ };
48
+ forceBackdrop: boolean;
49
+ }) => {
50
+ const {
51
+ dataQualityRelationValidationState,
52
+ isReadOnly,
53
+ relationValidationState,
54
+ changeName,
55
+ onLambdaEditorFocus,
56
+ forceBackdrop,
57
+ onValidationTypeChange,
58
+ selectedValidationType,
59
+ changeDescription,
60
+ } = props;
61
+ const {
62
+ editorStore: { applicationStore },
63
+ } = dataQualityRelationValidationState;
64
+ const { relationValidation, rowMapFunctionLambdaEditorState } =
65
+ relationValidationState;
66
+ const closePlanViewer = () => {
67
+ relationValidationState.setIsValidationDialogOpen(false);
68
+ };
69
+
70
+ return (
71
+ <Dialog
72
+ open={true}
73
+ classes={{
74
+ root: 'relation-validation-dialog-modal__root-container',
75
+ container: 'relation-validation-dialog-modal__container',
76
+ paper: 'relation-validation-dialog-modal__content',
77
+ }}
78
+ >
79
+ <Modal
80
+ className="relation-validation-dialog-modal"
81
+ darkMode={
82
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
83
+ }
84
+ >
85
+ <ModalHeader title="Validation Details" />
86
+ <ModalBody className="relation-validation-dialog-modal__body">
87
+ <div
88
+ className={clsx('relation-validation-editor', {
89
+ backdrop__element: relationValidationState.parserError,
90
+ })}
91
+ >
92
+ <div className="relation-validation-editor__content">
93
+ <div className="relation-validation-editor__label">Name</div>
94
+ <input
95
+ className="relation-validation-editor__content__name"
96
+ spellCheck={false}
97
+ disabled={isReadOnly}
98
+ value={relationValidation.name}
99
+ onChange={changeName}
100
+ placeholder="Validation name"
101
+ />
102
+ </div>
103
+ <div className="relation-validation-editor__content">
104
+ <div className="relation-validation-editor__label">Type</div>
105
+ <div className="relation-validation-editor__content__select">
106
+ <CustomSelectorInput
107
+ className="relation-validation-editor__select"
108
+ options={
109
+ dataQualityRelationValidationState.relationValidationOptions
110
+ }
111
+ onChange={onValidationTypeChange}
112
+ value={selectedValidationType}
113
+ darkMode={
114
+ !applicationStore.layoutService
115
+ .TEMPORARY__isLightColorThemeEnabled
116
+ }
117
+ placeholder={'Type of validation to be added'}
118
+ />
119
+ </div>
120
+ </div>
121
+ {rowMapFunctionLambdaEditorState && (
122
+ <div className="relation-validation-editor__content">
123
+ <div className="relation-validation-editor__label">
124
+ Row map function
125
+ </div>
126
+ <InlineLambdaEditor
127
+ disabled={
128
+ dataQualityRelationValidationState.isConvertingValidationLambdaObjects ||
129
+ isReadOnly
130
+ }
131
+ lambdaEditorState={rowMapFunctionLambdaEditorState}
132
+ forceBackdrop={forceBackdrop}
133
+ expectedType={PrimitiveType.BOOLEAN}
134
+ onEditorFocus={onLambdaEditorFocus}
135
+ disablePopUp={true}
136
+ />
137
+ </div>
138
+ )}
139
+ <div className="relation-validation-editor__content">
140
+ <div className="relation-validation-editor__label">
141
+ Validation Grammar
142
+ </div>
143
+ <InlineLambdaEditor
144
+ disabled={
145
+ dataQualityRelationValidationState.isConvertingValidationLambdaObjects ||
146
+ isReadOnly
147
+ }
148
+ lambdaEditorState={relationValidationState}
149
+ forceBackdrop={forceBackdrop}
150
+ expectedType={PrimitiveType.BOOLEAN}
151
+ onEditorFocus={onLambdaEditorFocus}
152
+ disablePopUp={true}
153
+ forceExpansion={true}
154
+ />
155
+ </div>
156
+ <div className="relation-validation-editor__content">
157
+ <div className="relation-validation-editor__label">
158
+ Description
159
+ </div>
160
+ <input
161
+ className="relation-validation-editor__content__name"
162
+ spellCheck={false}
163
+ disabled={isReadOnly}
164
+ value={relationValidation.description}
165
+ onChange={changeDescription}
166
+ placeholder="Enter the description"
167
+ />
168
+ </div>
169
+ </div>
170
+ </ModalBody>
171
+ <ModalFooter>
172
+ <ModalFooterButton
173
+ onClick={closePlanViewer}
174
+ text="Close"
175
+ type="secondary"
176
+ />
177
+ </ModalFooter>
178
+ </Modal>
179
+ </Dialog>
180
+ );
181
+ },
182
+ );