@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.
- package/lib/components/{DSL_DataQuality_ClassElementDriver.d.ts → DSL_DataQuality_ElementDriver.d.ts} +17 -7
- package/lib/components/DSL_DataQuality_ElementDriver.d.ts.map +1 -0
- package/lib/components/{DSL_DataQuality_ClassElementDriver.js → DSL_DataQuality_ElementDriver.js} +70 -23
- package/lib/components/DSL_DataQuality_ElementDriver.js.map +1 -0
- package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.js +20 -39
- package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.js.map +1 -1
- package/lib/components/{DSL_NewDataQualityClassValidationElement.d.ts → DSL_NewDataQualityValidationElement.d.ts} +2 -2
- package/lib/components/DSL_NewDataQualityValidationElement.d.ts.map +1 -0
- package/lib/components/DSL_NewDataQualityValidationElement.js +80 -0
- package/lib/components/DSL_NewDataQualityValidationElement.js.map +1 -0
- package/lib/components/DataQualityRelationTrialRuns.d.ts +22 -0
- package/lib/components/DataQualityRelationTrialRuns.d.ts.map +1 -0
- package/lib/components/DataQualityRelationTrialRuns.js +87 -0
- package/lib/components/DataQualityRelationTrialRuns.js.map +1 -0
- package/lib/components/{DSL_NewDataQualityServiceValidationElement.d.ts → DataQualityRelationValidationConfigurationEditor.d.ts} +2 -2
- package/lib/components/DataQualityRelationValidationConfigurationEditor.d.ts.map +1 -0
- package/lib/components/DataQualityRelationValidationConfigurationEditor.js +99 -0
- package/lib/components/DataQualityRelationValidationConfigurationEditor.js.map +1 -0
- package/lib/components/DataQualityRelationValidationEditor.d.ts +30 -0
- package/lib/components/DataQualityRelationValidationEditor.d.ts.map +1 -0
- package/lib/components/DataQualityRelationValidationEditor.js +89 -0
- package/lib/components/DataQualityRelationValidationEditor.js.map +1 -0
- package/lib/components/DataQualityResultPanel.d.ts.map +1 -1
- package/lib/components/DataQualityResultPanel.js +1 -1
- package/lib/components/DataQualityResultPanel.js.map +1 -1
- package/lib/components/DataQualityResultValues.d.ts +0 -2
- package/lib/components/DataQualityResultValues.d.ts.map +1 -1
- package/lib/components/DataQualityResultValues.js.map +1 -1
- package/lib/components/DataQualitySideBar.js +2 -2
- package/lib/components/DataQualitySideBar.js.map +1 -1
- package/lib/components/DataQualityValidationDetailPanel.d.ts +36 -0
- package/lib/components/DataQualityValidationDetailPanel.d.ts.map +1 -0
- package/lib/components/DataQualityValidationDetailPanel.js +39 -0
- package/lib/components/DataQualityValidationDetailPanel.js.map +1 -0
- package/lib/components/DataQualityValidationParametersEditor.d.ts +15 -0
- package/lib/components/DataQualityValidationParametersEditor.d.ts.map +1 -0
- package/lib/components/DataQualityValidationParametersEditor.js +129 -0
- package/lib/components/DataQualityValidationParametersEditor.js.map +1 -0
- package/lib/components/states/ConstraintState.d.ts +2 -0
- package/lib/components/states/ConstraintState.d.ts.map +1 -1
- package/lib/components/states/ConstraintState.js +2 -0
- package/lib/components/states/ConstraintState.js.map +1 -1
- package/lib/components/states/DataQualityClassValidationState.d.ts +2 -2
- package/lib/components/states/DataQualityClassValidationState.d.ts.map +1 -1
- package/lib/components/states/DataQualityClassValidationState.js +4 -4
- package/lib/components/states/DataQualityClassValidationState.js.map +1 -1
- package/lib/components/states/DataQualityRelationResultState.d.ts +46 -0
- package/lib/components/states/DataQualityRelationResultState.d.ts.map +1 -0
- package/lib/components/states/DataQualityRelationResultState.js +194 -0
- package/lib/components/states/DataQualityRelationResultState.js.map +1 -0
- package/lib/components/states/DataQualityRelationValidationConfigurationState.d.ts +73 -0
- package/lib/components/states/DataQualityRelationValidationConfigurationState.d.ts.map +1 -0
- package/lib/components/states/DataQualityRelationValidationConfigurationState.js +255 -0
- package/lib/components/states/DataQualityRelationValidationConfigurationState.js.map +1 -0
- package/lib/components/states/DataQualityRelationValidationLambdaEditorState.d.ts +32 -0
- package/lib/components/states/DataQualityRelationValidationLambdaEditorState.d.ts.map +1 -0
- package/lib/components/states/DataQualityRelationValidationLambdaEditorState.js +79 -0
- package/lib/components/states/DataQualityRelationValidationLambdaEditorState.js.map +1 -0
- package/lib/components/states/DataQualityRelationValidationState.d.ts +38 -0
- package/lib/components/states/DataQualityRelationValidationState.d.ts.map +1 -0
- package/lib/components/states/DataQualityRelationValidationState.js +119 -0
- package/lib/components/states/DataQualityRelationValidationState.js.map +1 -0
- package/lib/components/states/DataQualityResultState.d.ts.map +1 -1
- package/lib/components/states/DataQualityResultState.js +6 -3
- package/lib/components/states/DataQualityResultState.js.map +1 -1
- package/lib/components/states/DataQualityState.js +1 -1
- package/lib/components/states/DataQualityState.js.map +1 -1
- package/lib/graph/metamodel/DSL_DataQuality_HashUtils.d.ts +5 -1
- package/lib/graph/metamodel/DSL_DataQuality_HashUtils.d.ts.map +1 -1
- package/lib/graph/metamodel/DSL_DataQuality_HashUtils.js +4 -0
- package/lib/graph/metamodel/DSL_DataQuality_HashUtils.js.map +1 -1
- package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.d.ts.map +1 -1
- package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.js +2 -1
- package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.js.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.d.ts +36 -3
- package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.d.ts.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js +58 -4
- package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.d.ts +2 -1
- package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.d.ts.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.js +2 -1
- package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.js.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.d.ts +13 -2
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.d.ts.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.js +36 -2
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.js.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.d.ts.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.js +5 -2
- package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.js.map +1 -1
- package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.d.ts +5 -1
- package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.d.ts.map +1 -1
- package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.js +29 -2
- package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.d.ts +6 -5
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.js.map +1 -1
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.d.ts +1 -1
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.js +34 -40
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.d.ts +8 -6
- 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 +19 -12
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/{V1_DataQualityConstraintsConfiguration.d.ts → V1_DataQualityValidationConfiguration.d.ts} +26 -4
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/{V1_DataQualityConstraintsConfiguration.js → V1_DataQualityValidationConfiguration.js} +49 -4
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.d.ts +7 -3
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.js +43 -3
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.d.ts +6 -3
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.js +39 -2
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.d.ts +5 -2
- 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 +27 -9
- 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/components/{DSL_DataQuality_ClassElementDriver.tsx → DSL_DataQuality_ElementDriver.tsx} +87 -18
- package/src/components/DSL_DataQuality_LegendStudioApplicationPlugin.tsx +33 -48
- package/src/components/DSL_NewDataQualityValidationElement.tsx +208 -0
- package/src/components/DataQualityRelationTrialRuns.tsx +288 -0
- package/src/components/DataQualityRelationValidationConfigurationEditor.tsx +364 -0
- package/src/components/DataQualityRelationValidationEditor.tsx +290 -0
- package/src/components/DataQualityResultPanel.tsx +1 -4
- package/src/components/DataQualityResultValues.tsx +1 -5
- package/src/components/DataQualitySideBar.tsx +2 -2
- package/src/components/DataQualityValidationDetailPanel.tsx +182 -0
- package/src/components/DataQualityValidationParametersEditor.tsx +355 -0
- package/src/components/states/ConstraintState.ts +2 -0
- package/src/components/states/DataQualityClassValidationState.ts +5 -5
- package/src/components/states/DataQualityRelationResultState.ts +274 -0
- package/src/components/states/DataQualityRelationValidationConfigurationState.ts +429 -0
- package/src/components/states/DataQualityRelationValidationLambdaEditorState.ts +138 -0
- package/src/components/states/DataQualityRelationValidationState.ts +180 -0
- package/src/components/states/DataQualityResultState.ts +6 -8
- package/src/components/states/DataQualityState.ts +1 -1
- package/src/graph/metamodel/DSL_DataQuality_HashUtils.ts +4 -0
- package/src/graph/metamodel/DSL_DataQuality_PureGraphPlugin.ts +2 -0
- package/src/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.ts +79 -3
- package/src/graph-manager/DSL_DataQuality_GraphManagerHelper.ts +13 -0
- package/src/graph-manager/DSL_DataQuality_GraphModifierHelper.ts +107 -0
- package/src/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.ts +8 -0
- package/src/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.ts +54 -1
- package/src/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.ts +5 -3
- package/src/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.ts +72 -81
- package/src/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.ts +20 -23
- package/src/graph-manager/protocol/pure/v1/{V1_DataQualityConstraintsConfiguration.ts → V1_DataQualityValidationConfiguration.ts} +63 -4
- package/src/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.ts +116 -2
- package/src/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.ts +78 -1
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.ts +55 -8
- package/style/_data-quality-relation-validation-builder.scss +454 -0
- package/style/index.scss +6 -0
- package/tsconfig.json +13 -6
- package/lib/components/DSL_DataQuality_ClassElementDriver.d.ts.map +0 -1
- package/lib/components/DSL_DataQuality_ClassElementDriver.js.map +0 -1
- package/lib/components/DSL_DataQuality_ServiceElementDriver.d.ts +0 -27
- package/lib/components/DSL_DataQuality_ServiceElementDriver.d.ts.map +0 -1
- package/lib/components/DSL_DataQuality_ServiceElementDriver.js +0 -41
- package/lib/components/DSL_DataQuality_ServiceElementDriver.js.map +0 -1
- package/lib/components/DSL_NewDataQualityClassValidationElement.d.ts.map +0 -1
- package/lib/components/DSL_NewDataQualityClassValidationElement.js +0 -64
- package/lib/components/DSL_NewDataQualityClassValidationElement.js.map +0 -1
- package/lib/components/DSL_NewDataQualityServiceValidationElement.d.ts.map +0 -1
- package/lib/components/DSL_NewDataQualityServiceValidationElement.js +0 -41
- package/lib/components/DSL_NewDataQualityServiceValidationElement.js.map +0 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityConstraintsConfiguration.d.ts.map +0 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityConstraintsConfiguration.js.map +0 -1
- package/src/components/DSL_DataQuality_ServiceElementDriver.tsx +0 -57
- package/src/components/DSL_NewDataQualityClassValidationElement.tsx +0 -156
- package/src/components/DSL_NewDataQualityServiceValidationElement.tsx +0 -74
@@ -0,0 +1,288 @@
|
|
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 { observer } from 'mobx-react-lite';
|
18
|
+
import { useApplicationStore } from '@finos/legend-application';
|
19
|
+
import { flowResult } from 'mobx';
|
20
|
+
import {
|
21
|
+
ExecutionPlanViewer,
|
22
|
+
LambdaParameterValuesEditor,
|
23
|
+
} from '@finos/legend-query-builder';
|
24
|
+
import { type ExecutionResult } from '@finos/legend-graph';
|
25
|
+
import { prettyDuration } from '@finos/legend-shared';
|
26
|
+
import React, { useRef, useState } from 'react';
|
27
|
+
import { DATA_QUALITY_VALIDATION_TEST_ID } from './constants/DataQualityConstants.js';
|
28
|
+
import {
|
29
|
+
BlankPanelContent,
|
30
|
+
CaretDownIcon,
|
31
|
+
ControlledDropdownMenu,
|
32
|
+
CubesLoadingIndicator,
|
33
|
+
CubesLoadingIndicatorIcon,
|
34
|
+
DebugIcon,
|
35
|
+
ExclamationTriangleIcon,
|
36
|
+
MenuContent,
|
37
|
+
MenuContentItem,
|
38
|
+
MenuContentItemIcon,
|
39
|
+
MenuContentItemLabel,
|
40
|
+
PanelContent,
|
41
|
+
PauseCircleIcon,
|
42
|
+
PlayIcon,
|
43
|
+
ReportIcon,
|
44
|
+
} from '@finos/legend-art';
|
45
|
+
import { DataQualityResultValues } from './DataQualityResultValues.js';
|
46
|
+
import type { DataQualityRelationValidationConfigurationState } from './states/DataQualityRelationValidationConfigurationState.js';
|
47
|
+
|
48
|
+
export const DataQualityRelationTrialRuns = observer(
|
49
|
+
(props: {
|
50
|
+
dataQualityRelationValidationConfigurationState: DataQualityRelationValidationConfigurationState;
|
51
|
+
}) => {
|
52
|
+
const { dataQualityRelationValidationConfigurationState } = props;
|
53
|
+
const applicationStore = useApplicationStore();
|
54
|
+
const resultState =
|
55
|
+
dataQualityRelationValidationConfigurationState.resultState;
|
56
|
+
const executionResult = resultState.executionResult;
|
57
|
+
|
58
|
+
const runQuery = (): void => {
|
59
|
+
resultState.handleRunValidation();
|
60
|
+
};
|
61
|
+
|
62
|
+
const cancelQuery = applicationStore.guardUnhandledError(() =>
|
63
|
+
flowResult(resultState.cancelValidation()),
|
64
|
+
);
|
65
|
+
|
66
|
+
const generatePlan = applicationStore.guardUnhandledError(() => {
|
67
|
+
return flowResult(resultState.generatePlan(false));
|
68
|
+
});
|
69
|
+
const debugPlanGeneration = applicationStore.guardUnhandledError(() =>
|
70
|
+
flowResult(resultState.generatePlan(true)),
|
71
|
+
);
|
72
|
+
|
73
|
+
const isRunQueryDisabled =
|
74
|
+
resultState.isGeneratingPlan || resultState.isRunningValidation;
|
75
|
+
|
76
|
+
const getResultSetDescription = (
|
77
|
+
_executionResult: ExecutionResult,
|
78
|
+
): string | undefined => {
|
79
|
+
const queryDuration = resultState.executionDuration
|
80
|
+
? prettyDuration(resultState.executionDuration, {
|
81
|
+
ms: true,
|
82
|
+
})
|
83
|
+
: undefined;
|
84
|
+
if (!queryDuration) {
|
85
|
+
return undefined;
|
86
|
+
}
|
87
|
+
return `validation ran in ${queryDuration}`;
|
88
|
+
};
|
89
|
+
const resultDescription =
|
90
|
+
!resultState.isRunningValidation && executionResult
|
91
|
+
? getResultSetDescription(executionResult)
|
92
|
+
: undefined;
|
93
|
+
|
94
|
+
const [previewLimitValue, setPreviewLimitValue] = useState(
|
95
|
+
resultState.previewLimit,
|
96
|
+
);
|
97
|
+
|
98
|
+
const changePreviewLimit: React.ChangeEventHandler<HTMLInputElement> = (
|
99
|
+
event,
|
100
|
+
) => {
|
101
|
+
setPreviewLimitValue(parseInt(event.target.value, 10));
|
102
|
+
};
|
103
|
+
|
104
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
105
|
+
|
106
|
+
const getPreviewLimit = (): void => {
|
107
|
+
if (isNaN(previewLimitValue) || previewLimitValue === 0) {
|
108
|
+
setPreviewLimitValue(1);
|
109
|
+
dataQualityRelationValidationConfigurationState.resultState.setPreviewLimit(
|
110
|
+
1,
|
111
|
+
);
|
112
|
+
} else {
|
113
|
+
dataQualityRelationValidationConfigurationState.resultState.setPreviewLimit(
|
114
|
+
previewLimitValue,
|
115
|
+
);
|
116
|
+
}
|
117
|
+
};
|
118
|
+
|
119
|
+
const onKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {
|
120
|
+
if (event.code === 'Enter') {
|
121
|
+
getPreviewLimit();
|
122
|
+
inputRef.current?.focus();
|
123
|
+
} else if (event.code === 'Escape') {
|
124
|
+
inputRef.current?.select();
|
125
|
+
}
|
126
|
+
};
|
127
|
+
|
128
|
+
const isLoading =
|
129
|
+
resultState.isRunningValidation || resultState.isGeneratingPlan;
|
130
|
+
|
131
|
+
return (
|
132
|
+
<div
|
133
|
+
data-testid={
|
134
|
+
DATA_QUALITY_VALIDATION_TEST_ID.DATA_QUALITY_VALIDATION_RESULT_PANEL
|
135
|
+
}
|
136
|
+
className="panel data-quality-validation__result"
|
137
|
+
>
|
138
|
+
<div className="panel__header">
|
139
|
+
<div className="panel__header__title">
|
140
|
+
<div className="panel__header__title__label">results</div>
|
141
|
+
{resultState.validationToRun && (
|
142
|
+
<div className="panel__header__title__label">
|
143
|
+
{resultState.validationToRun.name}
|
144
|
+
</div>
|
145
|
+
)}
|
146
|
+
{resultState.isRunningValidation && (
|
147
|
+
<div className="panel__header__title__label__status">
|
148
|
+
Running Validation...
|
149
|
+
</div>
|
150
|
+
)}
|
151
|
+
<div
|
152
|
+
data-testid={
|
153
|
+
DATA_QUALITY_VALIDATION_TEST_ID.DATA_QUALITY_VALIDATION_RESULT_ANALYTICS
|
154
|
+
}
|
155
|
+
className="data-quality-validation__result__analytics"
|
156
|
+
>
|
157
|
+
{resultDescription ?? ''}
|
158
|
+
</div>
|
159
|
+
{executionResult && resultState.checkForStaleResults && (
|
160
|
+
<div className="data-quality-validation__result__stale-status">
|
161
|
+
<div className="data-quality-validation__result__stale-status__icon">
|
162
|
+
<ExclamationTriangleIcon />
|
163
|
+
</div>
|
164
|
+
<div className="data-quality-validation__result__stale-status__label">
|
165
|
+
Preview data might be stale
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
)}
|
169
|
+
</div>
|
170
|
+
<div className="panel__header__actions data-quality-validation__result__header__actions">
|
171
|
+
<div className="data-quality-validation__result__limit">
|
172
|
+
<div className="data-quality-validation__result__limit__label">
|
173
|
+
preview row limit
|
174
|
+
</div>
|
175
|
+
<input
|
176
|
+
ref={inputRef}
|
177
|
+
className="input--dark data-quality-validation__result__limit__input"
|
178
|
+
spellCheck={false}
|
179
|
+
type="number"
|
180
|
+
value={previewLimitValue}
|
181
|
+
onChange={changePreviewLimit}
|
182
|
+
onBlur={getPreviewLimit}
|
183
|
+
onKeyDown={onKeyDown}
|
184
|
+
/>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div className="data-quality-validation__result__execute-btn btn__dropdown-combo btn__dropdown-combo--primary">
|
188
|
+
{resultState.isRunningValidation ? (
|
189
|
+
<button
|
190
|
+
className="btn__dropdown-combo__canceler data-quality-validation__result__execute-btn__btn"
|
191
|
+
onClick={cancelQuery}
|
192
|
+
tabIndex={-1}
|
193
|
+
>
|
194
|
+
<div className="btn--dark btn--caution btn__dropdown-combo__canceler__label data-quality-validation__result__execute-btn__btn">
|
195
|
+
<PauseCircleIcon />
|
196
|
+
Stop
|
197
|
+
</div>
|
198
|
+
</button>
|
199
|
+
) : (
|
200
|
+
<>
|
201
|
+
<button
|
202
|
+
className="btn__dropdown-combo__label data-quality-validation__result__execute-btn__validation data-quality-validation__result__execute-btn__btn data-quality-validation__result__execute-btn__btn--green"
|
203
|
+
onClick={runQuery}
|
204
|
+
tabIndex={-1}
|
205
|
+
disabled={isRunQueryDisabled}
|
206
|
+
>
|
207
|
+
<PlayIcon />
|
208
|
+
Run Validation
|
209
|
+
</button>
|
210
|
+
<ControlledDropdownMenu
|
211
|
+
className="btn__dropdown-combo__dropdown-btn data-quality-validation__result__execute-btn__btn data-quality-validation__result__execute-btn__btn--green"
|
212
|
+
disabled={isRunQueryDisabled}
|
213
|
+
content={
|
214
|
+
<MenuContent>
|
215
|
+
<MenuContentItem
|
216
|
+
className="btn__dropdown-combo__option"
|
217
|
+
onClick={generatePlan}
|
218
|
+
disabled={isRunQueryDisabled}
|
219
|
+
>
|
220
|
+
<MenuContentItemIcon>
|
221
|
+
<ReportIcon />
|
222
|
+
</MenuContentItemIcon>
|
223
|
+
<MenuContentItemLabel>
|
224
|
+
Generate Plan
|
225
|
+
</MenuContentItemLabel>
|
226
|
+
</MenuContentItem>
|
227
|
+
<MenuContentItem
|
228
|
+
className="btn__dropdown-combo__option"
|
229
|
+
onClick={debugPlanGeneration}
|
230
|
+
disabled={isRunQueryDisabled}
|
231
|
+
>
|
232
|
+
<MenuContentItemIcon>
|
233
|
+
<DebugIcon />
|
234
|
+
</MenuContentItemIcon>
|
235
|
+
<MenuContentItemLabel>Debug</MenuContentItemLabel>
|
236
|
+
</MenuContentItem>
|
237
|
+
</MenuContent>
|
238
|
+
}
|
239
|
+
menuProps={{
|
240
|
+
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
241
|
+
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
242
|
+
}}
|
243
|
+
>
|
244
|
+
<CaretDownIcon />
|
245
|
+
</ControlledDropdownMenu>
|
246
|
+
</>
|
247
|
+
)}
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
</div>
|
251
|
+
<PanelContent className="data-quality-validation__result__content">
|
252
|
+
<CubesLoadingIndicator isLoading={isLoading}>
|
253
|
+
<CubesLoadingIndicatorIcon />
|
254
|
+
</CubesLoadingIndicator>
|
255
|
+
{!executionResult && !isLoading && (
|
256
|
+
<BlankPanelContent>
|
257
|
+
Click on run validation to see the validation results
|
258
|
+
</BlankPanelContent>
|
259
|
+
)}
|
260
|
+
{executionResult && !isLoading && (
|
261
|
+
<div className="data-quality-validation__result__values">
|
262
|
+
<DataQualityResultValues executionResult={executionResult} />
|
263
|
+
</div>
|
264
|
+
)}
|
265
|
+
</PanelContent>
|
266
|
+
<ExecutionPlanViewer
|
267
|
+
executionPlanState={resultState.executionPlanState}
|
268
|
+
/>
|
269
|
+
{dataQualityRelationValidationConfigurationState.parametersState
|
270
|
+
.parameterValuesEditorState.showModal && (
|
271
|
+
<LambdaParameterValuesEditor
|
272
|
+
graph={
|
273
|
+
dataQualityRelationValidationConfigurationState.editorStore
|
274
|
+
.graphManagerState.graph
|
275
|
+
}
|
276
|
+
observerContext={
|
277
|
+
dataQualityRelationValidationConfigurationState.editorStore
|
278
|
+
.changeDetectionState.observerContext
|
279
|
+
}
|
280
|
+
lambdaParametersState={
|
281
|
+
dataQualityRelationValidationConfigurationState.parametersState
|
282
|
+
}
|
283
|
+
/>
|
284
|
+
)}
|
285
|
+
</div>
|
286
|
+
);
|
287
|
+
},
|
288
|
+
);
|
@@ -0,0 +1,364 @@
|
|
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 { observer } from 'mobx-react-lite';
|
18
|
+
import {
|
19
|
+
type UMLEditorElementDropTarget,
|
20
|
+
type ElementDragSource,
|
21
|
+
CORE_DND_TYPE,
|
22
|
+
useEditorStore,
|
23
|
+
} from '@finos/legend-application-studio';
|
24
|
+
import {
|
25
|
+
DATA_QUALITY_RELATION_VALIDATION_EDITOR_TAB,
|
26
|
+
DataQualityRelationValidationConfigurationState,
|
27
|
+
} from './states/DataQualityRelationValidationConfigurationState.js';
|
28
|
+
import React, { useCallback, useEffect } from 'react';
|
29
|
+
import {
|
30
|
+
clsx,
|
31
|
+
DragPreviewLayer,
|
32
|
+
Panel,
|
33
|
+
PanelContent,
|
34
|
+
PanelLoadingIndicator,
|
35
|
+
PlusIcon,
|
36
|
+
} from '@finos/legend-art';
|
37
|
+
import { prettyCONSTName } from '@finos/legend-shared';
|
38
|
+
import { LambdaEditor } from '@finos/legend-query-builder';
|
39
|
+
import {
|
40
|
+
type RawVariableExpression,
|
41
|
+
PrimitiveType,
|
42
|
+
stub_RawLambda,
|
43
|
+
stub_RawVariableExpression,
|
44
|
+
Type,
|
45
|
+
} from '@finos/legend-graph';
|
46
|
+
import {
|
47
|
+
useApplicationNavigationContext,
|
48
|
+
useApplicationStore,
|
49
|
+
} from '@finos/legend-application';
|
50
|
+
import {
|
51
|
+
dataQualityRelationValidation_addParameter,
|
52
|
+
dataQualityRelationValidation_addValidation,
|
53
|
+
dataQualityRelationValidation_deleteParameter,
|
54
|
+
dataQualityRelationValidation_deleteValidation,
|
55
|
+
} from '../graph-manager/DSL_DataQuality_GraphModifierHelper.js';
|
56
|
+
import { flowResult } from 'mobx';
|
57
|
+
import {
|
58
|
+
type RelationValidationDragSource,
|
59
|
+
DataQualityRelationValidationEditor,
|
60
|
+
RELATION_VALIDATION_DND_TYPE,
|
61
|
+
} from './DataQualityRelationValidationEditor.js';
|
62
|
+
import { DataQualityRelationValidation } from '../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
|
63
|
+
import { DataQualityRelationTrialRuns } from './DataQualityRelationTrialRuns.js';
|
64
|
+
import {
|
65
|
+
type FunctionParameterDragSource,
|
66
|
+
DataQualityValidationParametersEditor,
|
67
|
+
FUNCTION_PARAMETER_DND_TYPE,
|
68
|
+
} from './DataQualityValidationParametersEditor.js';
|
69
|
+
import { useDrop } from 'react-dnd';
|
70
|
+
|
71
|
+
const RelationDefinitionEditor = observer(
|
72
|
+
(props: {
|
73
|
+
dataQualityRelationValidationState: DataQualityRelationValidationConfigurationState;
|
74
|
+
}) => {
|
75
|
+
const { dataQualityRelationValidationState } = props;
|
76
|
+
const { relationFunctionDefinitionEditorState, resultState } =
|
77
|
+
dataQualityRelationValidationState;
|
78
|
+
const validationElement =
|
79
|
+
dataQualityRelationValidationState.validationElement;
|
80
|
+
|
81
|
+
const isReadOnly = dataQualityRelationValidationState.isReadOnly;
|
82
|
+
|
83
|
+
const addRelationValidation = (): void => {
|
84
|
+
const relationValidation = new DataQualityRelationValidation(
|
85
|
+
'',
|
86
|
+
stub_RawLambda(),
|
87
|
+
);
|
88
|
+
dataQualityRelationValidation_addValidation(
|
89
|
+
validationElement,
|
90
|
+
relationValidation,
|
91
|
+
);
|
92
|
+
dataQualityRelationValidationState.addValidationState(relationValidation);
|
93
|
+
};
|
94
|
+
|
95
|
+
const deleteRelationValidation =
|
96
|
+
(validation: DataQualityRelationValidation): (() => void) =>
|
97
|
+
(): void => {
|
98
|
+
dataQualityRelationValidation_deleteValidation(
|
99
|
+
validationElement,
|
100
|
+
validation,
|
101
|
+
);
|
102
|
+
dataQualityRelationValidationState.deleteValidationState(validation);
|
103
|
+
};
|
104
|
+
|
105
|
+
const addParameter = (): void => {
|
106
|
+
dataQualityRelationValidation_addParameter(
|
107
|
+
validationElement.query.parameters,
|
108
|
+
stub_RawVariableExpression(PrimitiveType.STRING),
|
109
|
+
);
|
110
|
+
};
|
111
|
+
|
112
|
+
const deleteParameter =
|
113
|
+
(val: RawVariableExpression): (() => void) =>
|
114
|
+
(): void => {
|
115
|
+
dataQualityRelationValidation_deleteParameter(
|
116
|
+
validationElement.query.parameters,
|
117
|
+
val,
|
118
|
+
);
|
119
|
+
};
|
120
|
+
|
121
|
+
const handleDropParameter = useCallback(
|
122
|
+
(item: UMLEditorElementDropTarget): void => {
|
123
|
+
if (!isReadOnly && item.data.packageableElement instanceof Type) {
|
124
|
+
dataQualityRelationValidation_addParameter(
|
125
|
+
validationElement.query.parameters,
|
126
|
+
stub_RawVariableExpression(item.data.packageableElement),
|
127
|
+
);
|
128
|
+
}
|
129
|
+
},
|
130
|
+
[validationElement, isReadOnly],
|
131
|
+
);
|
132
|
+
const [{ isParameterDragOver }, dropParameterRef] = useDrop<
|
133
|
+
ElementDragSource,
|
134
|
+
void,
|
135
|
+
{ isParameterDragOver: boolean }
|
136
|
+
>(
|
137
|
+
() => ({
|
138
|
+
accept: [
|
139
|
+
CORE_DND_TYPE.PROJECT_EXPLORER_CLASS,
|
140
|
+
CORE_DND_TYPE.PROJECT_EXPLORER_ENUMERATION,
|
141
|
+
],
|
142
|
+
drop: (item) => handleDropParameter(item),
|
143
|
+
collect: (monitor) => ({
|
144
|
+
isParameterDragOver: monitor.isOver({ shallow: true }),
|
145
|
+
}),
|
146
|
+
}),
|
147
|
+
[handleDropParameter],
|
148
|
+
);
|
149
|
+
|
150
|
+
return (
|
151
|
+
<>
|
152
|
+
<PanelLoadingIndicator
|
153
|
+
isLoading={
|
154
|
+
resultState.isGeneratingPlan ||
|
155
|
+
dataQualityRelationValidationState.isRunningFunc
|
156
|
+
}
|
157
|
+
/>
|
158
|
+
<div className="relation-validation-config-editor__definition">
|
159
|
+
<div className="relation-validation-config-editor__definition__item">
|
160
|
+
<div className="relation-validation-config-editor__definition__item__header">
|
161
|
+
<div className="relation-validation-config-editor__definition__item__header__title">
|
162
|
+
PARAMETERS
|
163
|
+
</div>
|
164
|
+
<button
|
165
|
+
className="relation-validation-config-editor__definition__item__header__add-btn btn--dark"
|
166
|
+
disabled={isReadOnly}
|
167
|
+
onClick={addParameter}
|
168
|
+
tabIndex={-1}
|
169
|
+
title="Add Parameter"
|
170
|
+
>
|
171
|
+
<PlusIcon />
|
172
|
+
</button>
|
173
|
+
</div>
|
174
|
+
<DragPreviewLayer
|
175
|
+
labelGetter={(item: FunctionParameterDragSource): string =>
|
176
|
+
item.parameter.name === '' ? '(unknown)' : item.parameter.name
|
177
|
+
}
|
178
|
+
types={[FUNCTION_PARAMETER_DND_TYPE]}
|
179
|
+
/>
|
180
|
+
<div
|
181
|
+
ref={dropParameterRef}
|
182
|
+
className={clsx(
|
183
|
+
'relation-validation-config-editor__definition__item__content',
|
184
|
+
{
|
185
|
+
'panel__content__lists--dnd-over':
|
186
|
+
isParameterDragOver && !isReadOnly,
|
187
|
+
},
|
188
|
+
)}
|
189
|
+
>
|
190
|
+
{validationElement.query.parameters.map((param) => (
|
191
|
+
<DataQualityValidationParametersEditor
|
192
|
+
key={param._UUID}
|
193
|
+
parameter={param}
|
194
|
+
_validationConfig={validationElement}
|
195
|
+
deleteParameter={deleteParameter(param)}
|
196
|
+
isReadOnly={isReadOnly}
|
197
|
+
/>
|
198
|
+
))}
|
199
|
+
{validationElement.query.parameters.length === 0 && (
|
200
|
+
<div className="relation-validation-config-editor__definition__item__content--empty">
|
201
|
+
No parameters
|
202
|
+
</div>
|
203
|
+
)}
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
<div className="relation-validation-config-editor__definition__item">
|
207
|
+
<div className="relation-validation-config-editor__definition__item__header">
|
208
|
+
<div className="relation-validation-config-editor__definition__item__header__title">
|
209
|
+
LAMBDA
|
210
|
+
</div>
|
211
|
+
</div>
|
212
|
+
<div
|
213
|
+
className={clsx(
|
214
|
+
'relation-validation-config-editor__definition__item__content',
|
215
|
+
{
|
216
|
+
backdrop__element: Boolean(
|
217
|
+
relationFunctionDefinitionEditorState.parserError,
|
218
|
+
),
|
219
|
+
},
|
220
|
+
)}
|
221
|
+
>
|
222
|
+
<LambdaEditor
|
223
|
+
className="relation-validation-config-editor__definition__lambda-editor lambda-editor--dark"
|
224
|
+
disabled={
|
225
|
+
relationFunctionDefinitionEditorState.isConvertingFunctionBodyToString ||
|
226
|
+
false
|
227
|
+
}
|
228
|
+
lambdaEditorState={relationFunctionDefinitionEditorState}
|
229
|
+
forceBackdrop={false}
|
230
|
+
autoFocus={true}
|
231
|
+
/>
|
232
|
+
</div>
|
233
|
+
</div>
|
234
|
+
<div className="relation-validation-config-editor__definition__item">
|
235
|
+
<div className="relation-validation-config-editor__definition__item__header">
|
236
|
+
<div className="relation-validation-config-editor__definition__item__header__title">
|
237
|
+
VALIDATIONS
|
238
|
+
</div>
|
239
|
+
<button
|
240
|
+
className="relation-validation-config-editor__definition__item__header__add-btn btn--dark"
|
241
|
+
disabled={isReadOnly}
|
242
|
+
onClick={addRelationValidation}
|
243
|
+
tabIndex={-1}
|
244
|
+
title="Add Relation Validation"
|
245
|
+
>
|
246
|
+
<PlusIcon />
|
247
|
+
</button>
|
248
|
+
</div>
|
249
|
+
<div className="relation-config-validations">
|
250
|
+
<DragPreviewLayer
|
251
|
+
labelGetter={(item: RelationValidationDragSource): string =>
|
252
|
+
item.validation.name === ''
|
253
|
+
? '(unknown)'
|
254
|
+
: item.validation.name
|
255
|
+
}
|
256
|
+
types={[RELATION_VALIDATION_DND_TYPE]}
|
257
|
+
/>
|
258
|
+
{validationElement.validations.map((relationValidation) => (
|
259
|
+
<DataQualityRelationValidationEditor
|
260
|
+
key={relationValidation._UUID}
|
261
|
+
validation={relationValidation}
|
262
|
+
relationValidationConfigurationState={
|
263
|
+
dataQualityRelationValidationState
|
264
|
+
}
|
265
|
+
deleteValidation={deleteRelationValidation(
|
266
|
+
relationValidation,
|
267
|
+
)}
|
268
|
+
isReadOnly={isReadOnly}
|
269
|
+
/>
|
270
|
+
))}
|
271
|
+
</div>
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
</>
|
275
|
+
);
|
276
|
+
},
|
277
|
+
);
|
278
|
+
|
279
|
+
export const DataQualityRelationValidationConfigurationEditor = observer(() => {
|
280
|
+
const editorStore = useEditorStore();
|
281
|
+
const applicationStore = useApplicationStore();
|
282
|
+
const dataQualityRelationValidationConfigurationState =
|
283
|
+
editorStore.tabManagerState.getCurrentEditorState(
|
284
|
+
DataQualityRelationValidationConfigurationState,
|
285
|
+
);
|
286
|
+
const dataQualityRelationValidationElement =
|
287
|
+
dataQualityRelationValidationConfigurationState.validationElement;
|
288
|
+
const selectedTab =
|
289
|
+
dataQualityRelationValidationConfigurationState.selectedTab;
|
290
|
+
|
291
|
+
const changeTab =
|
292
|
+
(tab: DATA_QUALITY_RELATION_VALIDATION_EDITOR_TAB): (() => void) =>
|
293
|
+
(): void =>
|
294
|
+
dataQualityRelationValidationConfigurationState.setSelectedTab(tab);
|
295
|
+
|
296
|
+
useEffect(() => {
|
297
|
+
flowResult(
|
298
|
+
dataQualityRelationValidationConfigurationState.relationFunctionDefinitionEditorState.convertLambdaObjectToGrammarString(
|
299
|
+
{
|
300
|
+
pretty: true,
|
301
|
+
firstLoad: true,
|
302
|
+
},
|
303
|
+
),
|
304
|
+
).catch(applicationStore.alertUnhandledError);
|
305
|
+
flowResult(
|
306
|
+
dataQualityRelationValidationConfigurationState.convertValidationLambdaObjects(),
|
307
|
+
).catch(applicationStore.alertUnhandledError);
|
308
|
+
}, [applicationStore, dataQualityRelationValidationConfigurationState]);
|
309
|
+
|
310
|
+
useApplicationNavigationContext('studio.editor.dq-relation-editor');
|
311
|
+
|
312
|
+
return (
|
313
|
+
<div className="relation-validation-config-editor uml-editor uml-editor--dark">
|
314
|
+
<Panel>
|
315
|
+
<div className="panel__header">
|
316
|
+
<div className="panel__header__title">
|
317
|
+
<div className="panel__header__title__label">
|
318
|
+
dataQualityRelationValidation
|
319
|
+
</div>
|
320
|
+
<div className="panel__header__title__content">
|
321
|
+
{dataQualityRelationValidationElement.name}
|
322
|
+
</div>
|
323
|
+
</div>
|
324
|
+
</div>
|
325
|
+
<div className="panel__header relation-validation-config-editor__tabs__header">
|
326
|
+
<div className="relation-validation-config-editor__tabs">
|
327
|
+
{Object.values(DATA_QUALITY_RELATION_VALIDATION_EDITOR_TAB).map(
|
328
|
+
(tab) => (
|
329
|
+
<div
|
330
|
+
key={tab}
|
331
|
+
onClick={changeTab(tab)}
|
332
|
+
className={clsx('relation-validation-config-editor__tab', {
|
333
|
+
'relation-validation-config-editor__tab--active':
|
334
|
+
tab === selectedTab,
|
335
|
+
})}
|
336
|
+
>
|
337
|
+
{prettyCONSTName(tab)}
|
338
|
+
</div>
|
339
|
+
),
|
340
|
+
)}
|
341
|
+
</div>
|
342
|
+
</div>
|
343
|
+
<PanelContent>
|
344
|
+
{selectedTab ===
|
345
|
+
DATA_QUALITY_RELATION_VALIDATION_EDITOR_TAB.DEFINITION && (
|
346
|
+
<RelationDefinitionEditor
|
347
|
+
dataQualityRelationValidationState={
|
348
|
+
dataQualityRelationValidationConfigurationState
|
349
|
+
}
|
350
|
+
/>
|
351
|
+
)}
|
352
|
+
{selectedTab ===
|
353
|
+
DATA_QUALITY_RELATION_VALIDATION_EDITOR_TAB.TRIAL_RUN && (
|
354
|
+
<DataQualityRelationTrialRuns
|
355
|
+
dataQualityRelationValidationConfigurationState={
|
356
|
+
dataQualityRelationValidationConfigurationState
|
357
|
+
}
|
358
|
+
/>
|
359
|
+
)}
|
360
|
+
</PanelContent>
|
361
|
+
</Panel>
|
362
|
+
</div>
|
363
|
+
);
|
364
|
+
});
|