@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.
Files changed (131) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +3 -0
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +4 -2
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/__lib__/LegendStudioNavigation.d.ts +7 -0
  6. package/lib/__lib__/LegendStudioNavigation.d.ts.map +1 -1
  7. package/lib/__lib__/LegendStudioNavigation.js +2 -0
  8. package/lib/__lib__/LegendStudioNavigation.js.map +1 -1
  9. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts +10 -0
  10. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts.map +1 -1
  11. package/lib/__lib__/LegendStudioTelemetryHelper.js +10 -0
  12. package/lib/__lib__/LegendStudioTelemetryHelper.js.map +1 -1
  13. package/lib/components/LegendStudioWebApplication.d.ts.map +1 -1
  14. package/lib/components/LegendStudioWebApplication.js +7 -1
  15. package/lib/components/LegendStudioWebApplication.js.map +1 -1
  16. package/lib/components/editor/ActivityBar.d.ts.map +1 -1
  17. package/lib/components/editor/ActivityBar.js +23 -14
  18. package/lib/components/editor/ActivityBar.js.map +1 -1
  19. package/lib/components/editor/editor-group/GrammarTextEditor.d.ts.map +1 -1
  20. package/lib/components/editor/editor-group/GrammarTextEditor.js +3 -2
  21. package/lib/components/editor/editor-group/GrammarTextEditor.js.map +1 -1
  22. package/lib/components/editor/editor-group/mapping-editor/MappingEditor.d.ts.map +1 -1
  23. package/lib/components/editor/editor-group/mapping-editor/MappingEditor.js +4 -3
  24. package/lib/components/editor/editor-group/mapping-editor/MappingEditor.js.map +1 -1
  25. package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.d.ts +1 -1
  26. package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.d.ts.map +1 -1
  27. package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.js +6 -13
  28. package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.js.map +1 -1
  29. package/lib/components/editor/editor-group/mapping-editor/{DEPRECATED__MappingTestEditor.d.ts → legacy/DEPRECATED__MappingTestEditor.d.ts} +1 -1
  30. package/lib/components/editor/editor-group/mapping-editor/legacy/DEPRECATED__MappingTestEditor.d.ts.map +1 -0
  31. package/lib/components/editor/editor-group/mapping-editor/{DEPRECATED__MappingTestEditor.js → legacy/DEPRECATED__MappingTestEditor.js} +9 -9
  32. package/lib/components/editor/editor-group/mapping-editor/legacy/DEPRECATED__MappingTestEditor.js.map +1 -0
  33. package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.d.ts +24 -0
  34. package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.d.ts.map +1 -0
  35. package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.js +42 -0
  36. package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.js.map +1 -0
  37. package/lib/components/lazy-text-editor/LazyTextEditor.d.ts +18 -0
  38. package/lib/components/lazy-text-editor/LazyTextEditor.d.ts.map +1 -0
  39. package/lib/components/lazy-text-editor/LazyTextEditor.js +170 -0
  40. package/lib/components/lazy-text-editor/LazyTextEditor.js.map +1 -0
  41. package/lib/components/workspace-setup/WorkspaceSetup.js +6 -6
  42. package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
  43. package/lib/index.css +2 -2
  44. package/lib/index.css.map +1 -1
  45. package/lib/index.d.ts +1 -1
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/index.js +1 -1
  48. package/lib/index.js.map +1 -1
  49. package/lib/package.json +1 -1
  50. package/lib/stores/ShowcaseManagerState.d.ts +3 -1
  51. package/lib/stores/ShowcaseManagerState.d.ts.map +1 -1
  52. package/lib/stores/ShowcaseManagerState.js +29 -8
  53. package/lib/stores/ShowcaseManagerState.js.map +1 -1
  54. package/lib/stores/editor/EditorConfig.d.ts +2 -1
  55. package/lib/stores/editor/EditorConfig.d.ts.map +1 -1
  56. package/lib/stores/editor/EditorConfig.js +1 -0
  57. package/lib/stores/editor/EditorConfig.js.map +1 -1
  58. package/lib/stores/editor/EditorGraphState.d.ts +1 -0
  59. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  60. package/lib/stores/editor/EditorGraphState.js +17 -0
  61. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  62. package/lib/stores/editor/EditorStore.d.ts +4 -0
  63. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  64. package/lib/stores/editor/EditorStore.js +62 -5
  65. package/lib/stores/editor/EditorStore.js.map +1 -1
  66. package/lib/stores/editor/GraphEditGrammarModeState.d.ts +6 -1
  67. package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
  68. package/lib/stores/editor/GraphEditGrammarModeState.js +6 -1
  69. package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
  70. package/lib/stores/editor/GraphEditorMode.d.ts +6 -1
  71. package/lib/stores/editor/GraphEditorMode.d.ts.map +1 -1
  72. package/lib/stores/editor/GraphEditorMode.js +3 -0
  73. package/lib/stores/editor/GraphEditorMode.js.map +1 -1
  74. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts +6 -1
  75. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts.map +1 -1
  76. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js +24 -5
  77. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
  78. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts +9 -9
  79. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts.map +1 -1
  80. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js +4 -4
  81. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  82. package/lib/stores/editor/editor-state/element-editor-state/mapping/{DEPRECATED__MappingTestState.d.ts → legacy/DEPRECATED__MappingTestState.d.ts} +12 -12
  83. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.d.ts.map +1 -0
  84. package/lib/stores/editor/editor-state/element-editor-state/mapping/{DEPRECATED__MappingTestState.js → legacy/DEPRECATED__MappingTestState.js} +9 -9
  85. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.js.map +1 -0
  86. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.d.ts +72 -0
  87. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.d.ts.map +1 -0
  88. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.js +281 -0
  89. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.js.map +1 -0
  90. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts +5 -5
  91. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts.map +1 -1
  92. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js.map +1 -1
  93. package/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts +30 -0
  94. package/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts.map +1 -0
  95. package/lib/stores/lazy-text-editor/LazyTextEditorStore.js +66 -0
  96. package/lib/stores/lazy-text-editor/LazyTextEditorStore.js.map +1 -0
  97. package/lib/stores/showcase/ShowcaseViewerStore.d.ts.map +1 -1
  98. package/lib/stores/showcase/ShowcaseViewerStore.js +3 -0
  99. package/lib/stores/showcase/ShowcaseViewerStore.js.map +1 -1
  100. package/package.json +11 -11
  101. package/src/__lib__/LegendStudioEvent.ts +4 -2
  102. package/src/__lib__/LegendStudioNavigation.ts +8 -0
  103. package/src/__lib__/LegendStudioTelemetryHelper.ts +32 -0
  104. package/src/components/LegendStudioWebApplication.tsx +13 -1
  105. package/src/components/editor/ActivityBar.tsx +118 -111
  106. package/src/components/editor/editor-group/GrammarTextEditor.tsx +6 -3
  107. package/src/components/editor/editor-group/mapping-editor/MappingEditor.tsx +9 -2
  108. package/src/components/editor/editor-group/mapping-editor/MappingTestsExplorer.tsx +16 -26
  109. package/src/components/editor/editor-group/mapping-editor/{DEPRECATED__MappingTestEditor.tsx → legacy/DEPRECATED__MappingTestEditor.tsx} +9 -9
  110. package/src/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.tsx +156 -0
  111. package/src/components/lazy-text-editor/LazyTextEditor.tsx +458 -0
  112. package/src/components/workspace-setup/WorkspaceSetup.tsx +6 -6
  113. package/src/index.ts +1 -1
  114. package/src/stores/ShowcaseManagerState.ts +41 -11
  115. package/src/stores/editor/EditorConfig.ts +1 -0
  116. package/src/stores/editor/EditorGraphState.ts +25 -0
  117. package/src/stores/editor/EditorStore.ts +108 -7
  118. package/src/stores/editor/GraphEditGrammarModeState.ts +14 -2
  119. package/src/stores/editor/GraphEditorMode.ts +9 -1
  120. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.ts +37 -10
  121. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts +14 -14
  122. package/src/stores/editor/editor-state/element-editor-state/mapping/{DEPRECATED__MappingTestState.ts → legacy/DEPRECATED__MappingTestState.ts} +23 -22
  123. package/src/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.ts +383 -0
  124. package/src/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.ts +8 -8
  125. package/src/stores/lazy-text-editor/LazyTextEditorStore.ts +99 -0
  126. package/src/stores/showcase/ShowcaseViewerStore.ts +6 -0
  127. package/tsconfig.json +6 -2
  128. package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.d.ts.map +0 -1
  129. package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.js.map +0 -1
  130. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts.map +0 -1
  131. 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 grammarTextEditorState = editorStore.getGraphEditorMode(
687
+ const grammarModeState = editorStore.getGraphEditorMode(
688
688
  GraphEditGrammarModeState,
689
- ).grammarTextEditorState;
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">Text Mode</div>
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 '../../../../stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js';
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 '../../../../stores/editor/utils/DnDUtils.js';
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 './MappingExecutionBuilder.js';
68
+ } from '../MappingExecutionBuilder.js';
69
69
  import { flowResult } from 'mobx';
70
- import { MappingTestStatusIndicator } from './MappingTestsExplorer.js';
70
+ import { MappingTestStatusIndicator } from '../MappingTestsExplorer.js';
71
71
  import {
72
72
  getMappingElementSource,
73
73
  getMappingElementTarget,
74
- } from '../../../../stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js';
75
- import { useEditorStore } from '../../EditorStoreProvider.js';
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 '../../../../stores/graph-modifier/STO_FlatData_GraphModifierHelper.js';
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 '../../../../stores/graph-modifier/STO_Relational_GraphModifierHelper.js';
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 '../../../../stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.js';
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
+ );