@finos/legend-application-studio 28.13.12 → 28.13.14
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__/LegendStudioEvent.d.ts +3 -0
- package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioEvent.js +4 -2
- package/lib/__lib__/LegendStudioEvent.js.map +1 -1
- package/lib/__lib__/LegendStudioNavigation.d.ts +7 -0
- package/lib/__lib__/LegendStudioNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioNavigation.js +2 -0
- package/lib/__lib__/LegendStudioNavigation.js.map +1 -1
- package/lib/__lib__/LegendStudioTelemetryHelper.d.ts +10 -0
- package/lib/__lib__/LegendStudioTelemetryHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioTelemetryHelper.js +10 -0
- package/lib/__lib__/LegendStudioTelemetryHelper.js.map +1 -1
- package/lib/components/LegendStudioWebApplication.d.ts.map +1 -1
- package/lib/components/LegendStudioWebApplication.js +7 -1
- package/lib/components/LegendStudioWebApplication.js.map +1 -1
- package/lib/components/editor/ActivityBar.d.ts.map +1 -1
- package/lib/components/editor/ActivityBar.js +23 -14
- package/lib/components/editor/ActivityBar.js.map +1 -1
- package/lib/components/editor/editor-group/GrammarTextEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/GrammarTextEditor.js +3 -2
- package/lib/components/editor/editor-group/GrammarTextEditor.js.map +1 -1
- 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/components/lazy-text-editor/LazyTextEditor.d.ts +18 -0
- package/lib/components/lazy-text-editor/LazyTextEditor.d.ts.map +1 -0
- package/lib/components/lazy-text-editor/LazyTextEditor.js +170 -0
- package/lib/components/lazy-text-editor/LazyTextEditor.js.map +1 -0
- package/lib/components/workspace-setup/WorkspaceSetup.js +6 -6
- package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
- 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/ShowcaseManagerState.d.ts +3 -1
- package/lib/stores/ShowcaseManagerState.d.ts.map +1 -1
- package/lib/stores/ShowcaseManagerState.js +29 -8
- package/lib/stores/ShowcaseManagerState.js.map +1 -1
- package/lib/stores/editor/EditorConfig.d.ts +2 -1
- package/lib/stores/editor/EditorConfig.d.ts.map +1 -1
- package/lib/stores/editor/EditorConfig.js +1 -0
- package/lib/stores/editor/EditorConfig.js.map +1 -1
- package/lib/stores/editor/EditorGraphState.d.ts +1 -0
- package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
- package/lib/stores/editor/EditorGraphState.js +17 -0
- package/lib/stores/editor/EditorGraphState.js.map +1 -1
- package/lib/stores/editor/EditorStore.d.ts +4 -0
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +62 -5
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/lib/stores/editor/GraphEditGrammarModeState.d.ts +6 -1
- package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
- package/lib/stores/editor/GraphEditGrammarModeState.js +6 -1
- package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
- package/lib/stores/editor/GraphEditorMode.d.ts +6 -1
- package/lib/stores/editor/GraphEditorMode.d.ts.map +1 -1
- package/lib/stores/editor/GraphEditorMode.js +3 -0
- package/lib/stores/editor/GraphEditorMode.js.map +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/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts +30 -0
- package/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts.map +1 -0
- package/lib/stores/lazy-text-editor/LazyTextEditorStore.js +66 -0
- package/lib/stores/lazy-text-editor/LazyTextEditorStore.js.map +1 -0
- package/lib/stores/showcase/ShowcaseViewerStore.d.ts.map +1 -1
- package/lib/stores/showcase/ShowcaseViewerStore.js +3 -0
- package/lib/stores/showcase/ShowcaseViewerStore.js.map +1 -1
- package/package.json +11 -11
- package/src/__lib__/LegendStudioEvent.ts +4 -2
- package/src/__lib__/LegendStudioNavigation.ts +8 -0
- package/src/__lib__/LegendStudioTelemetryHelper.ts +32 -0
- package/src/components/LegendStudioWebApplication.tsx +13 -1
- package/src/components/editor/ActivityBar.tsx +118 -111
- package/src/components/editor/editor-group/GrammarTextEditor.tsx +6 -3
- 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/components/lazy-text-editor/LazyTextEditor.tsx +458 -0
- package/src/components/workspace-setup/WorkspaceSetup.tsx +6 -6
- package/src/index.ts +1 -1
- package/src/stores/ShowcaseManagerState.ts +41 -11
- package/src/stores/editor/EditorConfig.ts +1 -0
- package/src/stores/editor/EditorGraphState.ts +25 -0
- package/src/stores/editor/EditorStore.ts +108 -7
- package/src/stores/editor/GraphEditGrammarModeState.ts +14 -2
- package/src/stores/editor/GraphEditorMode.ts +9 -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/src/stores/lazy-text-editor/LazyTextEditorStore.ts +99 -0
- package/src/stores/showcase/ShowcaseViewerStore.ts +6 -0
- package/tsconfig.json +6 -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
@@ -684,9 +684,10 @@ export const GrammarTextEditor = observer(() => {
|
|
684
684
|
>();
|
685
685
|
const editorStore = useEditorStore();
|
686
686
|
const applicationStore = useApplicationStore();
|
687
|
-
const
|
687
|
+
const grammarModeState = editorStore.getGraphEditorMode(
|
688
688
|
GraphEditGrammarModeState,
|
689
|
-
)
|
689
|
+
);
|
690
|
+
const grammarTextEditorState = grammarModeState.grammarTextEditorState;
|
690
691
|
const error = editorStore.graphState.error;
|
691
692
|
const [elementsFolded, setFoldingElements] = useState(false);
|
692
693
|
|
@@ -1185,7 +1186,9 @@ export const GrammarTextEditor = observer(() => {
|
|
1185
1186
|
className="editor-group__text-mode__tab editor-group__text-mode__tab--active"
|
1186
1187
|
content={<GrammarTextEditorHeaderTabContextMenu />}
|
1187
1188
|
>
|
1188
|
-
<div className="editor-group__text-mode__tab__label">
|
1189
|
+
<div className="editor-group__text-mode__tab__label">
|
1190
|
+
{grammarModeState.headerLabel}
|
1191
|
+
</div>
|
1189
1192
|
</ContextMenu>
|
1190
1193
|
</div>
|
1191
1194
|
<div className="editor-group__header__actions">
|
@@ -51,8 +51,8 @@ import {
|
|
51
51
|
} from '../../../../stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js';
|
52
52
|
import { MappingElementState } from '../../../../stores/editor/editor-state/element-editor-state/mapping/MappingElementState.js';
|
53
53
|
import { MappingExplorer } from './MappingExplorer.js';
|
54
|
-
import { DEPRECATED__MappingTestEditor } from './DEPRECATED__MappingTestEditor.js';
|
55
|
-
import { DEPRECATED__MappingTestState } from '../../../../stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js';
|
54
|
+
import { DEPRECATED__MappingTestEditor } from './legacy/DEPRECATED__MappingTestEditor.js';
|
55
|
+
import { DEPRECATED__MappingTestState } from '../../../../stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.js';
|
56
56
|
import { MappingTestsExplorer } from './MappingTestsExplorer.js';
|
57
57
|
import { LEGEND_STUDIO_TEST_ID } from '../../../../__lib__/LegendStudioTesting.js';
|
58
58
|
import { MappingExecutionState } from '../../../../stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js';
|
@@ -75,6 +75,7 @@ import type { MappingEditorTabState } from '../../../../stores/editor/editor-sta
|
|
75
75
|
import { MappingTestableEditor } from './MappingTestableEditor.js';
|
76
76
|
import { DocumentationLink } from '@finos/legend-lego/application';
|
77
77
|
import { LEGEND_STUDIO_DOCUMENTATION_KEY } from '../../../../__lib__/LegendStudioDocumentation.js';
|
78
|
+
import { MappingTestMigrationTool } from './legacy/MappingTestMigrationTool.js';
|
78
79
|
|
79
80
|
export const MappingEditorSplashScreen: React.FC = () => {
|
80
81
|
const logoWidth = 280;
|
@@ -400,6 +401,12 @@ export const MappingEditor = observer(() => {
|
|
400
401
|
mappingTestableState={mappingEditorState.mappingTestableState}
|
401
402
|
/>
|
402
403
|
)}
|
404
|
+
{mappingEditorState.migrationState && (
|
405
|
+
<MappingTestMigrationTool
|
406
|
+
mappingEditorState={mappingEditorState}
|
407
|
+
migrationState={mappingEditorState.migrationState}
|
408
|
+
/>
|
409
|
+
)}
|
403
410
|
</div>
|
404
411
|
</div>
|
405
412
|
</div>
|
@@ -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
|
+
);
|