@finos/legend-application-studio 28.13.12 → 28.13.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/components/editor/editor-group/mapping-editor/MappingEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingEditor.js +4 -3
- package/lib/components/editor/editor-group/mapping-editor/MappingEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.d.ts +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.js +6 -13
- package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/{DEPRECATED__MappingTestEditor.d.ts → legacy/DEPRECATED__MappingTestEditor.d.ts} +1 -1
- package/lib/components/editor/editor-group/mapping-editor/legacy/DEPRECATED__MappingTestEditor.d.ts.map +1 -0
- package/lib/components/editor/editor-group/mapping-editor/{DEPRECATED__MappingTestEditor.js → legacy/DEPRECATED__MappingTestEditor.js} +9 -9
- package/lib/components/editor/editor-group/mapping-editor/legacy/DEPRECATED__MappingTestEditor.js.map +1 -0
- package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.d.ts +24 -0
- package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.d.ts.map +1 -0
- package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.js +42 -0
- package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts +6 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js +24 -5
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts +9 -9
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js +4 -4
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/{DEPRECATED__MappingTestState.d.ts → legacy/DEPRECATED__MappingTestState.d.ts} +12 -12
- package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/{DEPRECATED__MappingTestState.js → legacy/DEPRECATED__MappingTestState.js} +9 -9
- package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.d.ts +72 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.js +281 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.js.map +1 -0
- package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts +5 -5
- package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js.map +1 -1
- package/package.json +11 -11
- package/src/components/editor/editor-group/mapping-editor/MappingEditor.tsx +9 -2
- package/src/components/editor/editor-group/mapping-editor/MappingTestsExplorer.tsx +16 -26
- package/src/components/editor/editor-group/mapping-editor/{DEPRECATED__MappingTestEditor.tsx → legacy/DEPRECATED__MappingTestEditor.tsx} +9 -9
- package/src/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.tsx +156 -0
- package/src/index.ts +1 -1
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.ts +37 -10
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts +14 -14
- package/src/stores/editor/editor-state/element-editor-state/mapping/{DEPRECATED__MappingTestState.ts → legacy/DEPRECATED__MappingTestState.ts} +23 -22
- package/src/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.ts +383 -0
- package/src/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.ts +8 -8
- package/tsconfig.json +4 -2
- package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.d.ts.map +0 -1
- package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.js.map +0 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts.map +0 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js.map +0 -1
@@ -21,7 +21,7 @@ import {
|
|
21
21
|
type DEPRECATED__MappingTestState,
|
22
22
|
MAPPING_TEST_EDITOR_TAB_TYPE,
|
23
23
|
TEST_RESULT,
|
24
|
-
} from '../../../../stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js';
|
24
|
+
} from '../../../../stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.js';
|
25
25
|
import {
|
26
26
|
clsx,
|
27
27
|
ContextMenu,
|
@@ -36,10 +36,10 @@ import {
|
|
36
36
|
ExclamationCircleIcon,
|
37
37
|
PauseCircleIcon,
|
38
38
|
PanelDropZone,
|
39
|
-
BlankPanelPlaceholder,
|
40
39
|
MenuContent,
|
41
40
|
MenuContentItem,
|
42
41
|
Panel,
|
42
|
+
WarningIcon,
|
43
43
|
} from '@finos/legend-art';
|
44
44
|
import {
|
45
45
|
type MappingElementDragSource,
|
@@ -47,17 +47,11 @@ import {
|
|
47
47
|
} from '../../../../stores/editor/utils/DnDUtils.js';
|
48
48
|
import { ClassMappingSelectorModal } from './MappingExecutionBuilder.js';
|
49
49
|
import { flowResult } from 'mobx';
|
50
|
-
import { Randomizer } from '@finos/legend-shared';
|
51
50
|
import { useEditorStore } from '../../EditorStoreProvider.js';
|
52
51
|
import { useApplicationStore } from '@finos/legend-application';
|
53
52
|
import { SetImplementation } from '@finos/legend-graph';
|
54
53
|
import { MappingEditorState } from '../../../../stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js';
|
55
54
|
|
56
|
-
const addTestPromps = [
|
57
|
-
`Let's add some tests!`,
|
58
|
-
`"A test a day keeps the QA away"`,
|
59
|
-
];
|
60
|
-
|
61
55
|
export const MappingTestExplorerContextMenu = observer(
|
62
56
|
forwardRef<
|
63
57
|
HTMLDivElement,
|
@@ -370,6 +364,9 @@ export const MappingTestsExplorer = observer(
|
|
370
364
|
// Class mapping selector
|
371
365
|
const [openClassMappingSelectorModal, setOpenClassMappingSelectorModal] =
|
372
366
|
useState(false);
|
367
|
+
|
368
|
+
const openMigrationtool = (): void =>
|
369
|
+
mappingEditorState.openMigrationTool();
|
373
370
|
const showClassMappingSelectorModal = (): void =>
|
374
371
|
setOpenClassMappingSelectorModal(true);
|
375
372
|
const hideClassMappingSelectorModal = (): void =>
|
@@ -416,6 +413,17 @@ export const MappingTestsExplorer = observer(
|
|
416
413
|
</div>
|
417
414
|
</div>
|
418
415
|
<div className="panel__header__actions">
|
416
|
+
{Boolean(mappingEditorState.mapping.test.length) && (
|
417
|
+
<button
|
418
|
+
className="panel__header__action"
|
419
|
+
onClick={openMigrationtool}
|
420
|
+
disabled={isReadOnly}
|
421
|
+
tabIndex={-1}
|
422
|
+
title="Please migrate to new mapping test framework"
|
423
|
+
>
|
424
|
+
<WarningIcon />
|
425
|
+
</button>
|
426
|
+
)}
|
419
427
|
<button
|
420
428
|
className="panel__header__action"
|
421
429
|
onClick={showClassMappingSelectorModal}
|
@@ -478,24 +486,6 @@ export const MappingTestsExplorer = observer(
|
|
478
486
|
/>
|
479
487
|
),
|
480
488
|
)}
|
481
|
-
{!isReadOnly &&
|
482
|
-
!mappingEditorState.DEPRECATED_mappingTestStates.length && (
|
483
|
-
<BlankPanelPlaceholder
|
484
|
-
text={
|
485
|
-
new Randomizer().getRandomItemInCollection(
|
486
|
-
addTestPromps,
|
487
|
-
) ??
|
488
|
-
addTestPromps[0] ??
|
489
|
-
'Add a mapping test'
|
490
|
-
}
|
491
|
-
onClick={showClassMappingSelectorModal}
|
492
|
-
clickActionType="add"
|
493
|
-
tooltipText="Drop a mapping element to start testing"
|
494
|
-
isDropZoneActive={isDragOver && !isReadOnly}
|
495
|
-
disabled={isReadOnly}
|
496
|
-
previewText="No test"
|
497
|
-
/>
|
498
|
-
)}
|
499
489
|
</div>
|
500
490
|
</PanelDropZone>
|
501
491
|
</ContextMenu>
|
@@ -24,7 +24,7 @@ import {
|
|
24
24
|
MappingTestFlatDataInputDataState,
|
25
25
|
MappingTestExpectedOutputAssertionState,
|
26
26
|
MappingTestRelationalInputDataState,
|
27
|
-
} from '
|
27
|
+
} from '../../../../../stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.js';
|
28
28
|
import {
|
29
29
|
clsx,
|
30
30
|
PanelLoadingIndicator,
|
@@ -50,7 +50,7 @@ import { useDrop } from 'react-dnd';
|
|
50
50
|
import {
|
51
51
|
type MappingElementDragSource,
|
52
52
|
CORE_DND_TYPE,
|
53
|
-
} from '
|
53
|
+
} from '../../../../../stores/editor/utils/DnDUtils.js';
|
54
54
|
import {
|
55
55
|
IllegalStateError,
|
56
56
|
guaranteeType,
|
@@ -65,14 +65,14 @@ import {
|
|
65
65
|
import {
|
66
66
|
ClassMappingSelectorModal,
|
67
67
|
getRelationalInputTestDataEditorLanguage,
|
68
|
-
} from '
|
68
|
+
} from '../MappingExecutionBuilder.js';
|
69
69
|
import { flowResult } from 'mobx';
|
70
|
-
import { MappingTestStatusIndicator } from '
|
70
|
+
import { MappingTestStatusIndicator } from '../MappingTestsExplorer.js';
|
71
71
|
import {
|
72
72
|
getMappingElementSource,
|
73
73
|
getMappingElementTarget,
|
74
|
-
} from '
|
75
|
-
import { useEditorStore } from '
|
74
|
+
} from '../../../../../stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js';
|
75
|
+
import { useEditorStore } from '../../../EditorStoreProvider.js';
|
76
76
|
import {
|
77
77
|
Class,
|
78
78
|
SetImplementation,
|
@@ -82,17 +82,17 @@ import {
|
|
82
82
|
isStubbed_RawLambda,
|
83
83
|
DEPRECATED__validate_MappingTestAssert,
|
84
84
|
} from '@finos/legend-graph';
|
85
|
-
import { flatData_setData } from '
|
85
|
+
import { flatData_setData } from '../../../../../stores/graph-modifier/STO_FlatData_GraphModifierHelper.js';
|
86
86
|
import {
|
87
87
|
relationalInputData_setData,
|
88
88
|
relationalInputData_setInputType,
|
89
|
-
} from '
|
89
|
+
} from '../../../../../stores/graph-modifier/STO_Relational_GraphModifierHelper.js';
|
90
90
|
import {
|
91
91
|
type QueryBuilderState,
|
92
92
|
QueryBuilderTextEditorMode,
|
93
93
|
ExecutionPlanViewer,
|
94
94
|
} from '@finos/legend-query-builder';
|
95
|
-
import { MappingExecutionQueryBuilderState } from '
|
95
|
+
import { MappingExecutionQueryBuilderState } from '../../../../../stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.js';
|
96
96
|
import {
|
97
97
|
CODE_EDITOR_LANGUAGE,
|
98
98
|
CodeEditor,
|
@@ -0,0 +1,156 @@
|
|
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
|
+
BaseStepper,
|
19
|
+
BlankPanelContent,
|
20
|
+
Dialog,
|
21
|
+
Modal,
|
22
|
+
ModalBody,
|
23
|
+
ModalFooter,
|
24
|
+
ModalFooterButton,
|
25
|
+
ModalHeader,
|
26
|
+
PanelFormListItems,
|
27
|
+
PanelLoadingIndicator,
|
28
|
+
clsx,
|
29
|
+
} from '@finos/legend-art';
|
30
|
+
import { observer } from 'mobx-react-lite';
|
31
|
+
import type { MappingEditorState } from '../../../../../stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js';
|
32
|
+
import {
|
33
|
+
MIGRATE_PHASE,
|
34
|
+
type MappingTestMigrationState,
|
35
|
+
} from '../../../../../stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.js';
|
36
|
+
import {
|
37
|
+
CODE_EDITOR_LANGUAGE,
|
38
|
+
CodeDiffView,
|
39
|
+
} from '@finos/legend-lego/code-editor';
|
40
|
+
|
41
|
+
export const MappingTestMigrationTool = observer(
|
42
|
+
(props: {
|
43
|
+
mappingEditorState: MappingEditorState;
|
44
|
+
migrationState: MappingTestMigrationState;
|
45
|
+
}) => {
|
46
|
+
const { mappingEditorState, migrationState } = props;
|
47
|
+
const isLoading =
|
48
|
+
migrationState.confirmationState?.calculatingDiffs.isInProgress;
|
49
|
+
const close = (): void => {
|
50
|
+
mappingEditorState.closeMigrationTool();
|
51
|
+
};
|
52
|
+
const handleBack = (): void => {
|
53
|
+
migrationState.handleBack();
|
54
|
+
};
|
55
|
+
const handleNext = (): void => {
|
56
|
+
migrationState.handleNext();
|
57
|
+
};
|
58
|
+
const disabled =
|
59
|
+
!migrationState.migrateableTests.length &&
|
60
|
+
!migrationState.unSupportedTestsToMigrate.length;
|
61
|
+
return (
|
62
|
+
<Dialog
|
63
|
+
open={true}
|
64
|
+
onClose={close}
|
65
|
+
classes={{
|
66
|
+
root: 'editor-modal__root-container',
|
67
|
+
container: 'editor-modal__container',
|
68
|
+
paper: 'editor-modal__content',
|
69
|
+
}}
|
70
|
+
>
|
71
|
+
<Modal
|
72
|
+
darkMode={true}
|
73
|
+
className={clsx('editor-modal query-builder-text-mode__modal')}
|
74
|
+
>
|
75
|
+
<ModalHeader title="Migrate Legacy Tests"></ModalHeader>
|
76
|
+
<ModalBody>
|
77
|
+
<PanelLoadingIndicator isLoading={Boolean(isLoading)} />
|
78
|
+
<BaseStepper
|
79
|
+
steps={migrationState.steps}
|
80
|
+
activeStep={migrationState.activeStep}
|
81
|
+
/>
|
82
|
+
{!disabled ? (
|
83
|
+
<div className="mapping-migration-tool">
|
84
|
+
{migrationState.currentStep === MIGRATE_PHASE.OVERVIEW && (
|
85
|
+
<>
|
86
|
+
<PanelFormListItems
|
87
|
+
title="Migrable Tests"
|
88
|
+
prompt="tests that can be migrated via migration tool"
|
89
|
+
>
|
90
|
+
{migrationState.migrateableTests.map((test) => (
|
91
|
+
<div
|
92
|
+
className="panel__content__form__section__list__item"
|
93
|
+
key={test.name}
|
94
|
+
>
|
95
|
+
<div className="panel__content__form__section__list__item__value">
|
96
|
+
{test.name}
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
))}
|
100
|
+
</PanelFormListItems>
|
101
|
+
<PanelFormListItems
|
102
|
+
title="Unsupported Tests"
|
103
|
+
prompt="tests unable to be migrated"
|
104
|
+
>
|
105
|
+
{migrationState.unSupportedTestsToMigrate.map((test) => (
|
106
|
+
<div
|
107
|
+
className="panel__content__form__section__list__item"
|
108
|
+
key={test.name}
|
109
|
+
>
|
110
|
+
<div className="panel__content__form__section__list__item__value">
|
111
|
+
{test.name}
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
))}
|
115
|
+
</PanelFormListItems>
|
116
|
+
</>
|
117
|
+
)}
|
118
|
+
{migrationState.currentStep === MIGRATE_PHASE.CONFIRM &&
|
119
|
+
migrationState.confirmationState && (
|
120
|
+
<div className="query-builder__diff-panel__content">
|
121
|
+
<CodeDiffView
|
122
|
+
language={CODE_EDITOR_LANGUAGE.PURE}
|
123
|
+
from={migrationState.confirmationState.before ?? ''}
|
124
|
+
to={migrationState.confirmationState.after ?? ''}
|
125
|
+
/>
|
126
|
+
</div>
|
127
|
+
)}
|
128
|
+
</div>
|
129
|
+
) : (
|
130
|
+
<div className="mapping-migration-tool">
|
131
|
+
<BlankPanelContent>No Migrateable Tests</BlankPanelContent>
|
132
|
+
</div>
|
133
|
+
)}
|
134
|
+
</ModalBody>
|
135
|
+
<ModalFooter>
|
136
|
+
<ModalFooterButton
|
137
|
+
className="query-connection-workflow__actions__action-btn"
|
138
|
+
disabled={migrationState.disableBack || disabled}
|
139
|
+
onClick={handleBack}
|
140
|
+
title="Go to previous step..."
|
141
|
+
>
|
142
|
+
Back
|
143
|
+
</ModalFooterButton>
|
144
|
+
<ModalFooterButton
|
145
|
+
className="query-connection-workflow__actions__action-btn query-connection-workflow__actions__action-btn--primary"
|
146
|
+
disabled={migrationState.disableNext || disabled}
|
147
|
+
onClick={handleNext}
|
148
|
+
>
|
149
|
+
{migrationState.nextText}
|
150
|
+
</ModalFooterButton>
|
151
|
+
</ModalFooter>
|
152
|
+
</Modal>
|
153
|
+
</Dialog>
|
154
|
+
);
|
155
|
+
},
|
156
|
+
);
|
package/src/index.ts
CHANGED
@@ -74,7 +74,7 @@ export * from './stores/editor/sidebar-state/testable/GlobalTestRunnerState.js';
|
|
74
74
|
|
75
75
|
export { PostProcessorEditorState } from './stores/editor/editor-state/element-editor-state/connection/PostProcessorEditorState.js';
|
76
76
|
export { MappingExecutionState } from './stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js';
|
77
|
-
export { DEPRECATED__MappingTestState } from './stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js';
|
77
|
+
export { DEPRECATED__MappingTestState } from './stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.js';
|
78
78
|
export {
|
79
79
|
ConnectionValueState,
|
80
80
|
RelationalDatabaseConnectionValueState,
|
@@ -33,7 +33,7 @@ import {
|
|
33
33
|
MAPPING_TEST_EDITOR_TAB_TYPE,
|
34
34
|
DEPRECATED__MappingTestState,
|
35
35
|
TEST_RESULT,
|
36
|
-
} from './DEPRECATED__MappingTestState.js';
|
36
|
+
} from './legacy/DEPRECATED__MappingTestState.js';
|
37
37
|
import { createMockDataForMappingElementSource } from '../../../utils/MockDataUtils.js';
|
38
38
|
import {
|
39
39
|
type GeneratorFn,
|
@@ -59,7 +59,7 @@ import { RootRelationalInstanceSetImplementationState } from './relational/Relat
|
|
59
59
|
import {
|
60
60
|
type CompilationError,
|
61
61
|
type PackageableElement,
|
62
|
-
type
|
62
|
+
type DEPRECATED__InputData,
|
63
63
|
Type,
|
64
64
|
type EmbeddedSetImplementation,
|
65
65
|
type ExecutionResult,
|
@@ -74,8 +74,8 @@ import {
|
|
74
74
|
EnumerationMapping,
|
75
75
|
SetImplementation,
|
76
76
|
PureInstanceSetImplementation,
|
77
|
-
|
78
|
-
|
77
|
+
DEPRECATED__ExpectedOutputMappingTestAssert,
|
78
|
+
DEPRECATED__ObjectInputData,
|
79
79
|
ObjectInputType,
|
80
80
|
FlatDataInstanceSetImplementation,
|
81
81
|
InstanceSetImplementation,
|
@@ -125,6 +125,7 @@ import { rootRelationalSetImp_setMainTableAlias } from '../../../../graph-modifi
|
|
125
125
|
import { LambdaEditorState } from '@finos/legend-query-builder';
|
126
126
|
import type { MappingEditorTabState } from './MappingTabManagerState.js';
|
127
127
|
import { MappingTestableState } from './testable/MappingTestableState.js';
|
128
|
+
import { MappingTestMigrationState } from './legacy/MappingTestMigrationState.js';
|
128
129
|
|
129
130
|
export interface MappingExplorerTreeNodeData extends TreeNodeData {
|
130
131
|
mappingElement: MappingElement;
|
@@ -626,6 +627,7 @@ export class MappingEditorState extends ElementEditorState {
|
|
626
627
|
|
627
628
|
// DEPREACTED legacy tests: TO REMOVE once mapping testable dev work is complete
|
628
629
|
DEPRECATED_mappingTestStates: DEPRECATED__MappingTestState[] = [];
|
630
|
+
migrationState: MappingTestMigrationState | undefined;
|
629
631
|
isRunningAllTests = false;
|
630
632
|
allTestRunTime = 0;
|
631
633
|
|
@@ -640,11 +642,15 @@ export class MappingEditorState extends ElementEditorState {
|
|
640
642
|
isRunningAllTests: observable,
|
641
643
|
allTestRunTime: observable,
|
642
644
|
selectedTab: observable,
|
645
|
+
migrationState: observable,
|
643
646
|
mappingExplorerTreeData: observable.ref,
|
644
647
|
mapping: computed,
|
645
648
|
testSuiteResult: computed,
|
646
649
|
setNewMappingElementSpec: action,
|
650
|
+
openMigrationTool: action,
|
651
|
+
closeMigrationTool: action,
|
647
652
|
setMappingExplorerTreeNodeData: action,
|
653
|
+
buildLegacyTestsStates: action,
|
648
654
|
openMappingElement: action,
|
649
655
|
closeAllTabs: action,
|
650
656
|
createMappingElement: action,
|
@@ -666,9 +672,7 @@ export class MappingEditorState extends ElementEditorState {
|
|
666
672
|
deleteMappingElement: flow,
|
667
673
|
});
|
668
674
|
|
669
|
-
this.DEPRECATED_mappingTestStates = this.
|
670
|
-
(t) => new DEPRECATED__MappingTestState(editorStore, t, this),
|
671
|
-
);
|
675
|
+
this.DEPRECATED_mappingTestStates = this.buildLegacyTestsStates();
|
672
676
|
this.mappingExplorerTreeData = getMappingElementTreeData(
|
673
677
|
this.mapping,
|
674
678
|
editorStore,
|
@@ -684,6 +688,12 @@ export class MappingEditorState extends ElementEditorState {
|
|
684
688
|
);
|
685
689
|
}
|
686
690
|
|
691
|
+
buildLegacyTestsStates(): DEPRECATED__MappingTestState[] {
|
692
|
+
return this.mapping.test.map(
|
693
|
+
(t) => new DEPRECATED__MappingTestState(this.editorStore, t, this),
|
694
|
+
);
|
695
|
+
}
|
696
|
+
|
687
697
|
/**
|
688
698
|
* This method is used to check if a target is being mapped multiple times, so we can make
|
689
699
|
* decision on things like whether we enforce the user to provide an ID for those mapping elements.
|
@@ -1393,6 +1403,23 @@ export class MappingEditorState extends ElementEditorState {
|
|
1393
1403
|
|
1394
1404
|
// -------------------------------------- Test ---------------------------------------
|
1395
1405
|
|
1406
|
+
openMigrationTool(): void {
|
1407
|
+
if (!this.mapping.test.length) {
|
1408
|
+
this.editorStore.applicationStore.notificationService.notifyError(
|
1409
|
+
'No legacy tests to migrate',
|
1410
|
+
);
|
1411
|
+
return;
|
1412
|
+
}
|
1413
|
+
this.migrationState = MappingTestMigrationState.build(
|
1414
|
+
this.editorStore,
|
1415
|
+
this,
|
1416
|
+
);
|
1417
|
+
}
|
1418
|
+
|
1419
|
+
closeMigrationTool(): void {
|
1420
|
+
this.migrationState = undefined;
|
1421
|
+
}
|
1422
|
+
|
1396
1423
|
*openTest(
|
1397
1424
|
test: DEPRECATED__MappingTest,
|
1398
1425
|
openTab?: MAPPING_TEST_EDITOR_TAB_TYPE,
|
@@ -1546,9 +1573,9 @@ export class MappingEditorState extends ElementEditorState {
|
|
1546
1573
|
`Can't auto-generate input data for operation class mapping. Please pick a concrete class mapping instead`,
|
1547
1574
|
);
|
1548
1575
|
}
|
1549
|
-
let inputData:
|
1576
|
+
let inputData: DEPRECATED__InputData;
|
1550
1577
|
if (source === undefined || source instanceof Class) {
|
1551
|
-
inputData = new
|
1578
|
+
inputData = new DEPRECATED__ObjectInputData(
|
1552
1579
|
PackageableElementExplicitReference.create(source ?? stub_Class()),
|
1553
1580
|
ObjectInputType.JSON,
|
1554
1581
|
source
|
@@ -1578,7 +1605,7 @@ export class MappingEditorState extends ElementEditorState {
|
|
1578
1605
|
generateMappingTestName(this.mapping),
|
1579
1606
|
query,
|
1580
1607
|
[inputData],
|
1581
|
-
new
|
1608
|
+
new DEPRECATED__ExpectedOutputMappingTestAssert('{}'),
|
1582
1609
|
);
|
1583
1610
|
mapping_addDEPRECATEDTest(
|
1584
1611
|
this.mapping,
|
package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts
CHANGED
@@ -51,7 +51,7 @@ import {
|
|
51
51
|
} from '@finos/legend-shared';
|
52
52
|
import { createMockDataForMappingElementSource } from '../../../utils/MockDataUtils.js';
|
53
53
|
import {
|
54
|
-
type
|
54
|
+
type DEPRECATED__InputData,
|
55
55
|
type Mapping,
|
56
56
|
type Connection,
|
57
57
|
type ExecutionResult,
|
@@ -69,9 +69,9 @@ import {
|
|
69
69
|
LAMBDA_PIPE,
|
70
70
|
GRAPH_MANAGER_EVENT,
|
71
71
|
Class,
|
72
|
-
|
72
|
+
DEPRECATED__ObjectInputData,
|
73
73
|
ObjectInputType,
|
74
|
-
|
74
|
+
DEPRECATED__ExpectedOutputMappingTestAssert,
|
75
75
|
IdentifiedConnection,
|
76
76
|
EngineRuntime,
|
77
77
|
JsonModelConnection,
|
@@ -209,12 +209,12 @@ abstract class MappingExecutionInputDataState {
|
|
209
209
|
readonly uuid = uuid();
|
210
210
|
editorStore: EditorStore;
|
211
211
|
mapping: Mapping;
|
212
|
-
inputData?:
|
212
|
+
inputData?: DEPRECATED__InputData | undefined;
|
213
213
|
|
214
214
|
constructor(
|
215
215
|
editorStore: EditorStore,
|
216
216
|
mapping: Mapping,
|
217
|
-
inputData:
|
217
|
+
inputData: DEPRECATED__InputData | undefined,
|
218
218
|
) {
|
219
219
|
this.editorStore = editorStore;
|
220
220
|
this.mapping = mapping;
|
@@ -232,7 +232,7 @@ abstract class MappingExecutionInputDataState {
|
|
232
232
|
return undefined;
|
233
233
|
}
|
234
234
|
|
235
|
-
abstract buildInputDataForTest():
|
235
|
+
abstract buildInputDataForTest(): DEPRECATED__InputData;
|
236
236
|
}
|
237
237
|
|
238
238
|
export const createRuntimeForExecution = (
|
@@ -267,7 +267,7 @@ export class MappingExecutionEmptyInputDataState extends MappingExecutionInputDa
|
|
267
267
|
);
|
268
268
|
}
|
269
269
|
|
270
|
-
buildInputDataForTest():
|
270
|
+
buildInputDataForTest(): DEPRECATED__InputData {
|
271
271
|
throw new IllegalStateError(
|
272
272
|
'Mapping execution runtime information is not specified',
|
273
273
|
);
|
@@ -276,13 +276,13 @@ export class MappingExecutionEmptyInputDataState extends MappingExecutionInputDa
|
|
276
276
|
|
277
277
|
// TODO?: handle XML
|
278
278
|
export class MappingExecutionObjectInputDataState extends MappingExecutionInputDataState {
|
279
|
-
declare inputData:
|
279
|
+
declare inputData: DEPRECATED__ObjectInputData;
|
280
280
|
|
281
281
|
constructor(editorStore: EditorStore, mapping: Mapping, _class: Class) {
|
282
282
|
super(
|
283
283
|
editorStore,
|
284
284
|
mapping,
|
285
|
-
new
|
285
|
+
new DEPRECATED__ObjectInputData(
|
286
286
|
PackageableElementExplicitReference.create(
|
287
287
|
guaranteeNonNullable(_class),
|
288
288
|
),
|
@@ -344,8 +344,8 @@ export class MappingExecutionObjectInputDataState extends MappingExecutionInputD
|
|
344
344
|
return jsonAssertion;
|
345
345
|
}
|
346
346
|
|
347
|
-
buildInputDataForTest():
|
348
|
-
return new
|
347
|
+
buildInputDataForTest(): DEPRECATED__InputData {
|
348
|
+
return new DEPRECATED__ObjectInputData(
|
349
349
|
PackageableElementExplicitReference.create(
|
350
350
|
guaranteeNonNullable(this.inputData.sourceClass.value),
|
351
351
|
),
|
@@ -402,7 +402,7 @@ export class MappingExecutionFlatDataInputDataState extends MappingExecutionInpu
|
|
402
402
|
);
|
403
403
|
}
|
404
404
|
|
405
|
-
buildInputDataForTest():
|
405
|
+
buildInputDataForTest(): DEPRECATED__InputData {
|
406
406
|
return new FlatDataInputData(
|
407
407
|
PackageableElementExplicitReference.create(
|
408
408
|
guaranteeNonNullable(this.inputData.sourceFlatData.value),
|
@@ -474,7 +474,7 @@ export class MappingExecutionRelationalInputDataState extends MappingExecutionIn
|
|
474
474
|
);
|
475
475
|
}
|
476
476
|
|
477
|
-
buildInputDataForTest():
|
477
|
+
buildInputDataForTest(): DEPRECATED__InputData {
|
478
478
|
return new RelationalInputData(
|
479
479
|
PackageableElementExplicitReference.create(
|
480
480
|
guaranteeNonNullable(this.inputData.database.value),
|
@@ -664,7 +664,7 @@ export class MappingExecutionState extends MappingEditorTabState {
|
|
664
664
|
this.executionResultText
|
665
665
|
) {
|
666
666
|
const inputData = this.inputDataState.buildInputDataForTest();
|
667
|
-
const assert = new
|
667
|
+
const assert = new DEPRECATED__ExpectedOutputMappingTestAssert(
|
668
668
|
toGrammarString(this.executionResultText),
|
669
669
|
);
|
670
670
|
const mappingTest = new DEPRECATED__MappingTest(
|