@finos/legend-extension-dsl-data-quality 2.0.11 → 2.0.13
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/lib/__lib__/studio/DSL_DataQuality_LegendStudioApplicationNavigationContext.d.ts +21 -0
- package/lib/__lib__/studio/DSL_DataQuality_LegendStudioApplicationNavigationContext.d.ts.map +1 -0
- package/lib/__lib__/studio/DSL_DataQuality_LegendStudioApplicationNavigationContext.js +22 -0
- package/lib/__lib__/studio/DSL_DataQuality_LegendStudioApplicationNavigationContext.js.map +1 -0
- package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.d.ts +1 -0
- package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.js +8 -0
- package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.js.map +1 -1
- package/lib/components/DataQualityRelationGridResult.d.ts +33 -0
- package/lib/components/DataQualityRelationGridResult.d.ts.map +1 -0
- package/lib/components/DataQualityRelationGridResult.js +102 -0
- package/lib/components/DataQualityRelationGridResult.js.map +1 -0
- package/lib/components/DataQualityRelationTrialRuns.d.ts.map +1 -1
- package/lib/components/DataQualityRelationTrialRuns.js +20 -4
- package/lib/components/DataQualityRelationTrialRuns.js.map +1 -1
- package/lib/components/DataQualityRelationValidationConfigurationEditor.d.ts.map +1 -1
- package/lib/components/DataQualityRelationValidationConfigurationEditor.js +58 -30
- package/lib/components/DataQualityRelationValidationConfigurationEditor.js.map +1 -1
- package/lib/components/DataQualityRelationValidationEditor.d.ts.map +1 -1
- package/lib/components/DataQualityRelationValidationEditor.js +16 -9
- package/lib/components/DataQualityRelationValidationEditor.js.map +1 -1
- package/lib/components/DataQualityRelationValidationsEditor.d.ts +7 -0
- package/lib/components/DataQualityRelationValidationsEditor.d.ts.map +1 -0
- package/lib/components/DataQualityRelationValidationsEditor.js +38 -0
- package/lib/components/DataQualityRelationValidationsEditor.js.map +1 -0
- package/lib/components/DataQualityResultValues.d.ts +2 -0
- package/lib/components/DataQualityResultValues.d.ts.map +1 -1
- package/lib/components/DataQualityResultValues.js +8 -2
- package/lib/components/DataQualityResultValues.js.map +1 -1
- package/lib/components/DataQualityValidationDetailPanel.d.ts +1 -1
- package/lib/components/DataQualityValidationDetailPanel.d.ts.map +1 -1
- package/lib/components/DataQualityValidationDetailPanel.js +3 -3
- package/lib/components/DataQualityValidationDetailPanel.js.map +1 -1
- package/lib/components/states/DataQualityRelationResultState.d.ts +8 -0
- package/lib/components/states/DataQualityRelationResultState.d.ts.map +1 -1
- package/lib/components/states/DataQualityRelationResultState.js +3 -4
- package/lib/components/states/DataQualityRelationResultState.js.map +1 -1
- package/lib/components/states/DataQualityRelationValidationConfigurationState.d.ts +16 -6
- package/lib/components/states/DataQualityRelationValidationConfigurationState.d.ts.map +1 -1
- package/lib/components/states/DataQualityRelationValidationConfigurationState.js +126 -14
- package/lib/components/states/DataQualityRelationValidationConfigurationState.js.map +1 -1
- package/lib/components/states/DataQualityRelationValidationLambdaEditorState.js +1 -1
- package/lib/components/states/DataQualityRelationValidationLambdaEditorState.js.map +1 -1
- package/lib/components/states/DataQualityRelationValidationState.d.ts.map +1 -1
- package/lib/components/states/DataQualityRelationValidationState.js +6 -1
- package/lib/components/states/DataQualityRelationValidationState.js.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.d.ts +1 -0
- package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.d.ts.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.d.ts +1 -1
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.d.ts.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.js +3 -1
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.d.ts +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.js +3 -0
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.d.ts +2 -0
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.js +2 -0
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.js +7 -2
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +7 -7
- package/src/__lib__/studio/DSL_DataQuality_LegendStudioApplicationNavigationContext.ts +21 -0
- package/src/components/DSL_DataQuality_LegendStudioApplicationPlugin.tsx +9 -0
- package/src/components/DataQualityRelationGridResult.tsx +182 -0
- package/src/components/DataQualityRelationTrialRuns.tsx +48 -7
- package/src/components/DataQualityRelationValidationConfigurationEditor.tsx +207 -73
- package/src/components/DataQualityRelationValidationEditor.tsx +53 -27
- package/src/components/DataQualityRelationValidationsEditor.tsx +101 -0
- package/src/components/DataQualityResultValues.tsx +22 -2
- package/src/components/DataQualityValidationDetailPanel.tsx +34 -24
- package/src/components/states/DataQualityRelationResultState.ts +19 -3
- package/src/components/states/DataQualityRelationValidationConfigurationState.ts +171 -21
- package/src/components/states/DataQualityRelationValidationLambdaEditorState.ts +1 -1
- package/src/components/states/DataQualityRelationValidationState.ts +9 -0
- package/src/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.ts +1 -0
- package/src/graph-manager/DSL_DataQuality_GraphModifierHelper.ts +4 -2
- package/src/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.ts +3 -0
- package/src/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.ts +2 -0
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.ts +7 -2
- package/style/_data-quality-relation-validation-builder.scss +34 -9
- package/style/_data-quality-validation-builder.scss +34 -0
- package/tsconfig.json +3 -0
@@ -0,0 +1,101 @@
|
|
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
|
+
import { observer } from 'mobx-react-lite';
|
17
|
+
import type { DataQualityRelationValidationConfigurationState } from './states/DataQualityRelationValidationConfigurationState.js';
|
18
|
+
import React from 'react';
|
19
|
+
import { DragPreviewLayer, PlusIcon } from '@finos/legend-art';
|
20
|
+
import { stub_RawLambda } from '@finos/legend-graph';
|
21
|
+
import {
|
22
|
+
dataQualityRelationValidation_addValidation,
|
23
|
+
dataQualityRelationValidation_deleteValidation,
|
24
|
+
} from '../graph-manager/DSL_DataQuality_GraphModifierHelper.js';
|
25
|
+
import {
|
26
|
+
type RelationValidationDragSource,
|
27
|
+
DataQualityRelationValidationEditor,
|
28
|
+
RELATION_VALIDATION_DND_TYPE,
|
29
|
+
} from './DataQualityRelationValidationEditor.js';
|
30
|
+
import { DataQualityRelationValidation } from '../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
|
31
|
+
|
32
|
+
export const DataQualityRelationValidationsEditor = observer(
|
33
|
+
(props: {
|
34
|
+
dataQualityRelationValidationConfigurationState: DataQualityRelationValidationConfigurationState;
|
35
|
+
}) => {
|
36
|
+
const { dataQualityRelationValidationConfigurationState } = props;
|
37
|
+
const { validationElement, isReadOnly } =
|
38
|
+
dataQualityRelationValidationConfigurationState;
|
39
|
+
|
40
|
+
const addRelationValidation = (): void => {
|
41
|
+
const relationValidation = new DataQualityRelationValidation(
|
42
|
+
'',
|
43
|
+
stub_RawLambda(),
|
44
|
+
);
|
45
|
+
dataQualityRelationValidation_addValidation(
|
46
|
+
validationElement,
|
47
|
+
relationValidation,
|
48
|
+
);
|
49
|
+
dataQualityRelationValidationConfigurationState.addValidationState(
|
50
|
+
relationValidation,
|
51
|
+
);
|
52
|
+
};
|
53
|
+
|
54
|
+
const deleteRelationValidation =
|
55
|
+
(validation: DataQualityRelationValidation): (() => void) =>
|
56
|
+
(): void => {
|
57
|
+
dataQualityRelationValidation_deleteValidation(
|
58
|
+
validationElement,
|
59
|
+
validation,
|
60
|
+
);
|
61
|
+
dataQualityRelationValidationConfigurationState.deleteValidationState(
|
62
|
+
validation,
|
63
|
+
);
|
64
|
+
};
|
65
|
+
|
66
|
+
return (
|
67
|
+
<div className="relation-validation-config-editor__definition__item">
|
68
|
+
<div className="relation-validation-config-editor__definition__item__header-right">
|
69
|
+
<button
|
70
|
+
className="relation-validation-config-editor__definition__item__header__add-btn btn--dark"
|
71
|
+
disabled={isReadOnly}
|
72
|
+
onClick={addRelationValidation}
|
73
|
+
tabIndex={-1}
|
74
|
+
title="Add Relation Validation"
|
75
|
+
>
|
76
|
+
<PlusIcon />
|
77
|
+
</button>
|
78
|
+
</div>
|
79
|
+
<div className="relation-config-validations">
|
80
|
+
<DragPreviewLayer
|
81
|
+
labelGetter={(item: RelationValidationDragSource): string =>
|
82
|
+
item.validation.name === '' ? '(unknown)' : item.validation.name
|
83
|
+
}
|
84
|
+
types={[RELATION_VALIDATION_DND_TYPE]}
|
85
|
+
/>
|
86
|
+
{validationElement.validations.map((relationValidation) => (
|
87
|
+
<DataQualityRelationValidationEditor
|
88
|
+
key={relationValidation._UUID}
|
89
|
+
validation={relationValidation}
|
90
|
+
relationValidationConfigurationState={
|
91
|
+
dataQualityRelationValidationConfigurationState
|
92
|
+
}
|
93
|
+
deleteValidation={deleteRelationValidation(relationValidation)}
|
94
|
+
isReadOnly={isReadOnly}
|
95
|
+
/>
|
96
|
+
))}
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
);
|
100
|
+
},
|
101
|
+
);
|
@@ -19,14 +19,34 @@ import {
|
|
19
19
|
type ExecutionResult,
|
20
20
|
extractExecutionResultValues,
|
21
21
|
RawExecutionResult,
|
22
|
+
TDSExecutionResult,
|
22
23
|
} from '@finos/legend-graph';
|
23
24
|
import { CODE_EDITOR_LANGUAGE } from '@finos/legend-code-editor';
|
24
25
|
import { CodeEditor } from '@finos/legend-lego/code-editor';
|
25
26
|
import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
|
27
|
+
import { DataQualityRelationGridResult } from './DataQualityRelationGridResult.js';
|
28
|
+
import React from 'react';
|
29
|
+
import type { DataQualityRelationValidationConfigurationState } from './states/DataQualityRelationValidationConfigurationState.js';
|
26
30
|
|
27
31
|
export const DataQualityResultValues = observer(
|
28
|
-
(props: {
|
29
|
-
|
32
|
+
(props: {
|
33
|
+
executionResult: ExecutionResult;
|
34
|
+
relationValidationConfigurationState?: DataQualityRelationValidationConfigurationState;
|
35
|
+
}) => {
|
36
|
+
const { executionResult, relationValidationConfigurationState } = props;
|
37
|
+
if (
|
38
|
+
relationValidationConfigurationState &&
|
39
|
+
executionResult instanceof TDSExecutionResult
|
40
|
+
) {
|
41
|
+
return (
|
42
|
+
<DataQualityRelationGridResult
|
43
|
+
executionResult={executionResult}
|
44
|
+
relationValidationConfigurationState={
|
45
|
+
relationValidationConfigurationState
|
46
|
+
}
|
47
|
+
/>
|
48
|
+
);
|
49
|
+
}
|
30
50
|
if (executionResult instanceof RawExecutionResult) {
|
31
51
|
const inputValue =
|
32
52
|
executionResult.value === null
|
@@ -39,7 +39,7 @@ export const DataQualityValidationDetailPanel = observer(
|
|
39
39
|
relationValidationState: DataQualityRelationValidationState;
|
40
40
|
changeName: React.ChangeEventHandler<HTMLInputElement>;
|
41
41
|
changeDescription: React.ChangeEventHandler<HTMLInputElement>;
|
42
|
-
onLambdaEditorFocus: (
|
42
|
+
onLambdaEditorFocus: (isAssertion: boolean) => void;
|
43
43
|
onValidationTypeChange: (val: SelectOption) => void;
|
44
44
|
selectedValidationType: {
|
45
45
|
label: RelationValidationType;
|
@@ -123,35 +123,45 @@ export const DataQualityValidationDetailPanel = observer(
|
|
123
123
|
<div className="relation-validation-editor__label">
|
124
124
|
Row map function
|
125
125
|
</div>
|
126
|
-
<
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
126
|
+
<div className="data-quality-uml-element-editor__validation">
|
127
|
+
<div className="data-quality-uml-element-editor__lambda__value">
|
128
|
+
<InlineLambdaEditor
|
129
|
+
disabled={
|
130
|
+
dataQualityRelationValidationState.isConvertingValidationLambdaObjects ||
|
131
|
+
isReadOnly
|
132
|
+
}
|
133
|
+
lambdaEditorState={rowMapFunctionLambdaEditorState}
|
134
|
+
forceBackdrop={forceBackdrop}
|
135
|
+
expectedType={PrimitiveType.BOOLEAN}
|
136
|
+
onEditorFocus={() => onLambdaEditorFocus(false)}
|
137
|
+
disablePopUp={true}
|
138
|
+
className="relation-validation__lambda"
|
139
|
+
/>
|
140
|
+
</div>
|
141
|
+
</div>
|
137
142
|
</div>
|
138
143
|
)}
|
139
144
|
<div className="relation-validation-editor__content">
|
140
145
|
<div className="relation-validation-editor__label">
|
141
146
|
Validation Grammar
|
142
147
|
</div>
|
143
|
-
<
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
148
|
+
<div className="data-quality-uml-element-editor__validation">
|
149
|
+
<div className="data-quality-uml-element-editor__lambda__value">
|
150
|
+
<InlineLambdaEditor
|
151
|
+
disabled={
|
152
|
+
dataQualityRelationValidationState.isConvertingValidationLambdaObjects ||
|
153
|
+
isReadOnly
|
154
|
+
}
|
155
|
+
lambdaEditorState={relationValidationState}
|
156
|
+
forceBackdrop={forceBackdrop}
|
157
|
+
expectedType={PrimitiveType.BOOLEAN}
|
158
|
+
onEditorFocus={() => onLambdaEditorFocus(true)}
|
159
|
+
disablePopUp={true}
|
160
|
+
forceExpansion={true}
|
161
|
+
className="relation-validation__lambda"
|
162
|
+
/>
|
163
|
+
</div>
|
164
|
+
</div>
|
155
165
|
</div>
|
156
166
|
<div className="relation-validation-editor__content">
|
157
167
|
<div className="relation-validation-editor__label">
|
@@ -36,6 +36,22 @@ import { getDataQualityPureGraphManagerExtension } from '../../graph-manager/pro
|
|
36
36
|
import type { DataQualityRelationValidationConfigurationState } from './DataQualityRelationValidationConfigurationState.js';
|
37
37
|
import type { DataQualityRelationValidation } from '../../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
|
38
38
|
|
39
|
+
export type DataQualityRelationResultCellDataType =
|
40
|
+
| string
|
41
|
+
| number
|
42
|
+
| boolean
|
43
|
+
| null
|
44
|
+
| undefined;
|
45
|
+
|
46
|
+
export interface DataQualityRelationRowDataType {
|
47
|
+
[key: string]: DataQualityRelationResultCellDataType;
|
48
|
+
}
|
49
|
+
|
50
|
+
export interface DataQualityRelationResultCellCoordinate {
|
51
|
+
rowIndex: number;
|
52
|
+
colIndex: number;
|
53
|
+
}
|
54
|
+
|
39
55
|
export const DEFAULT_LIMIT = 1000;
|
40
56
|
export class DataQualityRelationResultState {
|
41
57
|
readonly dataQualityRelationValidationConfigurationState: DataQualityRelationValidationConfigurationState;
|
@@ -117,9 +133,6 @@ export class DataQualityRelationResultState {
|
|
117
133
|
}
|
118
134
|
|
119
135
|
handleRunValidation() {
|
120
|
-
if (this.isRunningValidation) {
|
121
|
-
return;
|
122
|
-
}
|
123
136
|
const queryLambda =
|
124
137
|
this.dataQualityRelationValidationConfigurationState
|
125
138
|
.bodyExpressionSequence;
|
@@ -127,6 +140,7 @@ export class DataQualityRelationResultState {
|
|
127
140
|
if (parameters.length) {
|
128
141
|
this.dataQualityRelationValidationConfigurationState.parametersState.openModal(
|
129
142
|
queryLambda,
|
143
|
+
true,
|
130
144
|
);
|
131
145
|
} else {
|
132
146
|
flowResult(this.runValidation()).catch(
|
@@ -225,6 +239,7 @@ export class DataQualityRelationResultState {
|
|
225
239
|
.graphManagerState.graphManager,
|
226
240
|
).debugExecutionPlanGeneration(model, packagePath, {
|
227
241
|
validationName: this.validationToRun?.name,
|
242
|
+
previewLimit: this.previewLimit,
|
228
243
|
})) as {
|
229
244
|
plan: RawExecutionPlan;
|
230
245
|
debug: string;
|
@@ -241,6 +256,7 @@ export class DataQualityRelationResultState {
|
|
241
256
|
.graphManagerState.graphManager,
|
242
257
|
).generatePlan(model, packagePath, {
|
243
258
|
validationName: this.validationToRun?.name,
|
259
|
+
previewLimit: this.previewLimit,
|
244
260
|
})) as RawExecutionPlan;
|
245
261
|
}
|
246
262
|
|
@@ -18,7 +18,6 @@ import {
|
|
18
18
|
type EditorStore,
|
19
19
|
ElementEditorState,
|
20
20
|
} from '@finos/legend-application-studio';
|
21
|
-
|
22
21
|
import {
|
23
22
|
type DataQualityRelationValidation,
|
24
23
|
DataQualityRelationValidationConfiguration,
|
@@ -36,7 +35,7 @@ import {
|
|
36
35
|
} from '@finos/legend-shared';
|
37
36
|
import {
|
38
37
|
type ExecutionResult,
|
39
|
-
type
|
38
|
+
type RawExecutionPlan,
|
40
39
|
buildSourceInformationSourceId,
|
41
40
|
GRAPH_MANAGER_EVENT,
|
42
41
|
isStubbed_PackageableElement,
|
@@ -56,6 +55,8 @@ import {
|
|
56
55
|
observable,
|
57
56
|
} from 'mobx';
|
58
57
|
import {
|
58
|
+
buildExecutionParameterValues,
|
59
|
+
ExecutionPlanState,
|
59
60
|
LambdaEditorState,
|
60
61
|
LambdaParametersState,
|
61
62
|
LambdaParameterState,
|
@@ -65,9 +66,11 @@ import { DataQualityRelationValidationState } from './DataQualityRelationValidat
|
|
65
66
|
import { DataQualityRelationResultState } from './DataQualityRelationResultState.js';
|
66
67
|
import { DATA_QUALITY_HASH_STRUCTURE } from '../../graph/metamodel/DSL_DataQuality_HashUtils.js';
|
67
68
|
import type { SelectOption } from '@finos/legend-art';
|
69
|
+
import { getDataQualityPureGraphManagerExtension } from '../../graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.js';
|
68
70
|
|
69
71
|
export enum DATA_QUALITY_RELATION_VALIDATION_EDITOR_TAB {
|
70
72
|
DEFINITION = 'Definition',
|
73
|
+
VALIDATIONS = 'Validations',
|
71
74
|
TRIAL_RUN = 'Trial Run',
|
72
75
|
}
|
73
76
|
|
@@ -203,21 +206,18 @@ export class RelationDefinitionParameterState extends LambdaParametersState {
|
|
203
206
|
relationValidationConfigurationState;
|
204
207
|
}
|
205
208
|
|
206
|
-
openModal(lambda: RawLambda): void {
|
209
|
+
openModal(lambda: RawLambda, runLambdaWithConstraints: boolean): void {
|
207
210
|
this.parameterStates = this.build(lambda);
|
208
211
|
this.parameterValuesEditorState.open(
|
209
212
|
(): Promise<void> =>
|
210
213
|
flowResult(
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
this.relationValidationConfigurationState.editorStore
|
219
|
-
.applicationStore.alertUnhandledError,
|
220
|
-
),
|
214
|
+
runLambdaWithConstraints
|
215
|
+
? this.relationValidationConfigurationState.resultState.runValidation()
|
216
|
+
: this.relationValidationConfigurationState.runValidation(),
|
217
|
+
).catch(
|
218
|
+
this.relationValidationConfigurationState.editorStore.applicationStore
|
219
|
+
.alertUnhandledError,
|
220
|
+
),
|
221
221
|
PARAMETER_SUBMIT_ACTION.RUN,
|
222
222
|
);
|
223
223
|
}
|
@@ -252,9 +252,11 @@ export class DataQualityRelationValidationConfigurationState extends ElementEdit
|
|
252
252
|
readonly relationFunctionDefinitionEditorState: RelationFunctionDefinitionEditorState;
|
253
253
|
selectedTab: DATA_QUALITY_RELATION_VALIDATION_EDITOR_TAB;
|
254
254
|
|
255
|
-
|
256
|
-
|
255
|
+
isRunningValidation = false;
|
256
|
+
isGeneratingPlan = false;
|
257
|
+
validationRunPromise: Promise<ExecutionResult> | undefined = undefined;
|
257
258
|
executionResult?: ExecutionResult | undefined; // NOTE: stored as lossless JSON string
|
259
|
+
executionPlanState: ExecutionPlanState;
|
258
260
|
validationStates: DataQualityRelationValidationState[] = [];
|
259
261
|
parametersState: RelationDefinitionParameterState;
|
260
262
|
isConvertingValidationLambdaObjects = false;
|
@@ -268,16 +270,22 @@ export class DataQualityRelationValidationConfigurationState extends ElementEdit
|
|
268
270
|
|
269
271
|
makeObservable(this, {
|
270
272
|
selectedTab: observable,
|
271
|
-
|
272
|
-
|
273
|
+
isRunningValidation: observable,
|
274
|
+
validationRunPromise: observable,
|
273
275
|
executionResult: observable,
|
276
|
+
resultState: observable,
|
274
277
|
setSelectedTab: action,
|
275
|
-
|
278
|
+
setValidationRunPromise: action,
|
276
279
|
setExecutionResult: action,
|
277
280
|
addValidationState: action,
|
281
|
+
resetResultState: action,
|
278
282
|
validationElement: computed,
|
279
283
|
relationValidationOptions: computed,
|
284
|
+
runValidation: flow,
|
285
|
+
handleRunValidation: flow,
|
280
286
|
convertValidationLambdaObjects: flow,
|
287
|
+
cancelValidationRun: flow,
|
288
|
+
generatePlan: flow,
|
281
289
|
});
|
282
290
|
assertType(
|
283
291
|
element,
|
@@ -292,6 +300,10 @@ export class DataQualityRelationValidationConfigurationState extends ElementEdit
|
|
292
300
|
new DataQualityRelationValidationState(validation, editorStore),
|
293
301
|
);
|
294
302
|
});
|
303
|
+
this.executionPlanState = new ExecutionPlanState(
|
304
|
+
this.editorStore.applicationStore,
|
305
|
+
this.editorStore.graphManagerState,
|
306
|
+
);
|
295
307
|
this.parametersState = new RelationDefinitionParameterState(this);
|
296
308
|
this.resultState = new DataQualityRelationResultState(this);
|
297
309
|
}
|
@@ -314,6 +326,15 @@ export class DataQualityRelationValidationConfigurationState extends ElementEdit
|
|
314
326
|
);
|
315
327
|
}
|
316
328
|
|
329
|
+
get validationOptions(): SelectOption[] {
|
330
|
+
return this.validationElement.validations.map((validation) => {
|
331
|
+
return {
|
332
|
+
label: validation.name,
|
333
|
+
value: validation,
|
334
|
+
};
|
335
|
+
});
|
336
|
+
}
|
337
|
+
|
317
338
|
getNullableValidationState = (
|
318
339
|
relationValidation: DataQualityRelationValidation,
|
319
340
|
): DataQualityRelationValidationState | undefined =>
|
@@ -336,6 +357,11 @@ export class DataQualityRelationValidationConfigurationState extends ElementEdit
|
|
336
357
|
value: type,
|
337
358
|
}));
|
338
359
|
}
|
360
|
+
|
361
|
+
resetResultState(): void {
|
362
|
+
this.resultState = new DataQualityRelationResultState(this);
|
363
|
+
}
|
364
|
+
|
339
365
|
addValidationState(validation: DataQualityRelationValidation): void {
|
340
366
|
if (
|
341
367
|
!this.validationStates.find(
|
@@ -357,10 +383,10 @@ export class DataQualityRelationValidationConfigurationState extends ElementEdit
|
|
357
383
|
}
|
358
384
|
}
|
359
385
|
|
360
|
-
|
361
|
-
promise: Promise<
|
386
|
+
setValidationRunPromise = (
|
387
|
+
promise: Promise<ExecutionResult> | undefined,
|
362
388
|
): void => {
|
363
|
-
this.
|
389
|
+
this.validationRunPromise = promise;
|
364
390
|
};
|
365
391
|
|
366
392
|
setSelectedTab(tab: DATA_QUALITY_RELATION_VALIDATION_EDITOR_TAB): void {
|
@@ -371,6 +397,21 @@ export class DataQualityRelationValidationConfigurationState extends ElementEdit
|
|
371
397
|
this.executionResult = executionResult;
|
372
398
|
};
|
373
399
|
|
400
|
+
*handleRunValidation(): GeneratorFn<void> {
|
401
|
+
if (this.isRunningValidation) {
|
402
|
+
return;
|
403
|
+
}
|
404
|
+
const queryLambda = this.bodyExpressionSequence;
|
405
|
+
const parameters = (queryLambda.parameters ?? []) as object[];
|
406
|
+
if (parameters.length) {
|
407
|
+
this.parametersState.openModal(queryLambda, false);
|
408
|
+
} else {
|
409
|
+
flowResult(this.runValidation()).catch(
|
410
|
+
this.editorStore.applicationStore.alertUnhandledError,
|
411
|
+
);
|
412
|
+
}
|
413
|
+
}
|
414
|
+
|
374
415
|
*convertValidationLambdaObjects(): GeneratorFn<void> {
|
375
416
|
const lambdas = new Map<string, RawLambda>();
|
376
417
|
const index = new Map<string, DataQualityRelationValidationState>();
|
@@ -419,6 +460,115 @@ export class DataQualityRelationValidationConfigurationState extends ElementEdit
|
|
419
460
|
);
|
420
461
|
}
|
421
462
|
|
463
|
+
setIsRunningValidation(val: boolean): void {
|
464
|
+
this.isRunningValidation = val;
|
465
|
+
}
|
466
|
+
|
467
|
+
*runValidation(): GeneratorFn<void> {
|
468
|
+
let promise;
|
469
|
+
try {
|
470
|
+
this.setIsRunningValidation(true);
|
471
|
+
const packagePath = this.validationElement.path;
|
472
|
+
const model = this.editorStore.graphManagerState.graph;
|
473
|
+
|
474
|
+
promise = getDataQualityPureGraphManagerExtension(
|
475
|
+
this.editorStore.graphManagerState.graphManager,
|
476
|
+
).execute(model, packagePath, {
|
477
|
+
runQuery: true,
|
478
|
+
lambdaParameterValues: buildExecutionParameterValues(
|
479
|
+
this.parametersState.parameterStates,
|
480
|
+
this.editorStore.graphManagerState,
|
481
|
+
),
|
482
|
+
});
|
483
|
+
|
484
|
+
this.setValidationRunPromise(promise);
|
485
|
+
const result = (yield promise) as ExecutionResult;
|
486
|
+
|
487
|
+
if (this.validationRunPromise === promise) {
|
488
|
+
this.setExecutionResult(result);
|
489
|
+
}
|
490
|
+
} catch (error) {
|
491
|
+
if (this.validationRunPromise === promise) {
|
492
|
+
assertErrorThrown(error);
|
493
|
+
this.setExecutionResult(undefined);
|
494
|
+
this.editorStore.applicationStore.logService.error(
|
495
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
|
496
|
+
error,
|
497
|
+
);
|
498
|
+
this.editorStore.applicationStore.notificationService.notifyError(
|
499
|
+
error,
|
500
|
+
);
|
501
|
+
}
|
502
|
+
} finally {
|
503
|
+
this.setIsRunningValidation(false);
|
504
|
+
}
|
505
|
+
}
|
506
|
+
|
507
|
+
*cancelValidationRun(): GeneratorFn<void> {
|
508
|
+
this.setIsRunningValidation(false);
|
509
|
+
this.setValidationRunPromise(undefined);
|
510
|
+
try {
|
511
|
+
yield this.editorStore.graphManagerState.graphManager.cancelUserExecutions(
|
512
|
+
true,
|
513
|
+
);
|
514
|
+
} catch (error) {
|
515
|
+
// Don't notify users about success or failure
|
516
|
+
this.editorStore.applicationStore.logService.error(
|
517
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
|
518
|
+
error,
|
519
|
+
);
|
520
|
+
}
|
521
|
+
}
|
522
|
+
|
523
|
+
*generatePlan(debug: boolean): GeneratorFn<void> {
|
524
|
+
const packagePath = this.validationElement.path;
|
525
|
+
const model = this.editorStore.graphManagerState.graph;
|
526
|
+
try {
|
527
|
+
this.isGeneratingPlan = true;
|
528
|
+
let rawPlan: RawExecutionPlan;
|
529
|
+
|
530
|
+
if (debug) {
|
531
|
+
const debugResult = (yield getDataQualityPureGraphManagerExtension(
|
532
|
+
this.editorStore.graphManagerState.graphManager,
|
533
|
+
).debugExecutionPlanGeneration(model, packagePath, {
|
534
|
+
runQuery: true,
|
535
|
+
})) as {
|
536
|
+
plan: RawExecutionPlan;
|
537
|
+
debug: string;
|
538
|
+
};
|
539
|
+
rawPlan = debugResult.plan;
|
540
|
+
this.executionPlanState.setDebugText(debugResult.debug);
|
541
|
+
} else {
|
542
|
+
rawPlan = (yield getDataQualityPureGraphManagerExtension(
|
543
|
+
this.editorStore.graphManagerState.graphManager,
|
544
|
+
).generatePlan(model, packagePath, {
|
545
|
+
runQuery: true,
|
546
|
+
})) as RawExecutionPlan;
|
547
|
+
}
|
548
|
+
|
549
|
+
try {
|
550
|
+
this.executionPlanState.setRawPlan(rawPlan);
|
551
|
+
const plan =
|
552
|
+
this.editorStore.graphManagerState.graphManager.buildExecutionPlan(
|
553
|
+
rawPlan,
|
554
|
+
this.editorStore.graphManagerState.graph,
|
555
|
+
);
|
556
|
+
this.executionPlanState.initialize(plan);
|
557
|
+
} catch {
|
558
|
+
//do nothing
|
559
|
+
}
|
560
|
+
} catch (error) {
|
561
|
+
assertErrorThrown(error);
|
562
|
+
this.editorStore.applicationStore.logService.error(
|
563
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
|
564
|
+
error,
|
565
|
+
);
|
566
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
567
|
+
} finally {
|
568
|
+
this.isGeneratingPlan = false;
|
569
|
+
}
|
570
|
+
}
|
571
|
+
|
422
572
|
get hashCode(): string {
|
423
573
|
return hashArray([
|
424
574
|
DATA_QUALITY_HASH_STRUCTURE.DATA_QUALITY_RELATION_VALIDATION,
|
@@ -42,7 +42,7 @@ export class DataQualityRelationValidationLambdaEditorState extends LambdaEditor
|
|
42
42
|
relationValidation: DataQualityRelationValidation,
|
43
43
|
editorStore: EditorStore,
|
44
44
|
) {
|
45
|
-
super('
|
45
|
+
super('', '|');
|
46
46
|
|
47
47
|
makeObservable(this, {
|
48
48
|
relationValidation: observable,
|
@@ -37,6 +37,7 @@ import { LambdaEditorState } from '@finos/legend-query-builder';
|
|
37
37
|
import { VALIDATION_SOURCE_ID_LABEL } from './ConstraintState.js';
|
38
38
|
import {
|
39
39
|
dataQualityRelationValidation_setAssertion,
|
40
|
+
dataQualityRelationValidation_setRowMapFunction,
|
40
41
|
dataQualityRelationValidation_setType,
|
41
42
|
} from '../../graph-manager/DSL_DataQuality_GraphModifierHelper.js';
|
42
43
|
import { DATA_QUALITY_HASH_STRUCTURE } from '../../graph/metamodel/DSL_DataQuality_HashUtils.js';
|
@@ -60,6 +61,7 @@ export class DataQualityRelationValidationState extends LambdaEditorState {
|
|
60
61
|
relationValidation: observable,
|
61
62
|
editorStore: observable,
|
62
63
|
isValidationDialogOpen: observable,
|
64
|
+
rowMapFunctionLambdaEditorState: observable,
|
63
65
|
setIsValidationDialogOpen: action,
|
64
66
|
onValidationTypeChange: action,
|
65
67
|
});
|
@@ -92,15 +94,22 @@ export class DataQualityRelationValidationState extends LambdaEditorState {
|
|
92
94
|
this.relationValidation,
|
93
95
|
val.value as RelationValidationType,
|
94
96
|
);
|
97
|
+
let defaultLambda;
|
95
98
|
if (val.value === RelationValidationType.AGGREGATE) {
|
96
99
|
this.rowMapFunctionLambdaEditorState =
|
97
100
|
new DataQualityRelationValidationLambdaEditorState(
|
98
101
|
this.relationValidation,
|
99
102
|
this.editorStore,
|
100
103
|
);
|
104
|
+
defaultLambda = stub_RawLambda();
|
101
105
|
} else {
|
102
106
|
this.rowMapFunctionLambdaEditorState = undefined;
|
107
|
+
defaultLambda = undefined;
|
103
108
|
}
|
109
|
+
dataQualityRelationValidation_setRowMapFunction(
|
110
|
+
this.relationValidation,
|
111
|
+
defaultLambda,
|
112
|
+
);
|
104
113
|
}
|
105
114
|
|
106
115
|
*convertLambdaGrammarStringToObject(): GeneratorFn<void> {
|
@@ -40,6 +40,7 @@ export interface DQExecuteInputOptions {
|
|
40
40
|
clientVersion?: string | undefined;
|
41
41
|
validationName?: string | undefined;
|
42
42
|
previewLimit?: number | undefined;
|
43
|
+
runQuery?: boolean | undefined;
|
43
44
|
}
|
44
45
|
|
45
46
|
export abstract class DataQualityExecutionContext implements Hashable {
|
@@ -149,9 +149,11 @@ export const dataQualityRelationValidation_setType = action(
|
|
149
149
|
export const dataQualityRelationValidation_setRowMapFunction = action(
|
150
150
|
(
|
151
151
|
_constraint: DataQualityRelationValidation,
|
152
|
-
rowMapFunction: RawLambda,
|
152
|
+
rowMapFunction: RawLambda | undefined,
|
153
153
|
): void => {
|
154
|
-
_constraint.rowMapFunction =
|
154
|
+
_constraint.rowMapFunction = rowMapFunction
|
155
|
+
? observe_RawLambda(rowMapFunction)
|
156
|
+
: rowMapFunction;
|
155
157
|
},
|
156
158
|
);
|
157
159
|
|
@@ -73,6 +73,7 @@ export class V1_DQExecuteInput {
|
|
73
73
|
packagePath!: string;
|
74
74
|
queryLimit: number | undefined;
|
75
75
|
validationName: string | undefined;
|
76
|
+
runQuery: boolean | undefined;
|
76
77
|
|
77
78
|
static readonly serialization = new SerializationFactory(
|
78
79
|
createModelSchema(V1_DQExecuteInput, {
|
@@ -82,6 +83,7 @@ export class V1_DQExecuteInput {
|
|
82
83
|
packagePath: primitive(),
|
83
84
|
queryLimit: optional(primitive()),
|
84
85
|
validationName: optional(primitive()),
|
86
|
+
runQuery: optional(primitive()),
|
85
87
|
}),
|
86
88
|
);
|
87
89
|
}
|
@@ -174,6 +176,7 @@ export class V1_DSL_Data_Quality_PureGraphManagerExtension extends DSL_DataQuali
|
|
174
176
|
dqExecuteInput.packagePath = packagePath;
|
175
177
|
dqExecuteInput.queryLimit = options.previewLimit;
|
176
178
|
dqExecuteInput.validationName = options.validationName;
|
179
|
+
dqExecuteInput.runQuery = options.runQuery;
|
177
180
|
return dqExecuteInput;
|
178
181
|
}
|
179
182
|
|
@@ -149,6 +149,8 @@ export class V1_DataQualityRelationValidationsConfiguration
|
|
149
149
|
{
|
150
150
|
query!: V1_DataQualityRelationQueryLambda;
|
151
151
|
validations: V1_DataQualityRelationValidation[] = [];
|
152
|
+
taggedValues: V1_TaggedValue[] = [];
|
153
|
+
stereotypes: V1_StereotypePtr[] = [];
|
152
154
|
|
153
155
|
override get hashCode(): string {
|
154
156
|
return hashArray([
|