@finos/legend-application-studio 26.1.9 → 26.1.11

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 (153) hide show
  1. package/lib/application/LegendStudioApplicationConfig.d.ts +4 -0
  2. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  3. package/lib/application/LegendStudioApplicationConfig.js +4 -0
  4. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  5. package/lib/components/editor/QuickInput.d.ts.map +1 -1
  6. package/lib/components/editor/QuickInput.js +4 -2
  7. package/lib/components/editor/QuickInput.js.map +1 -1
  8. package/lib/components/editor/StatusBar.d.ts.map +1 -1
  9. package/lib/components/editor/StatusBar.js +1 -4
  10. package/lib/components/editor/StatusBar.js.map +1 -1
  11. package/lib/components/editor/editor-group/{FileGenerationViewer.d.ts → ArtifactGenerationViewer.d.ts} +2 -2
  12. package/lib/components/editor/editor-group/ArtifactGenerationViewer.d.ts.map +1 -0
  13. package/lib/components/editor/editor-group/ArtifactGenerationViewer.js +32 -0
  14. package/lib/components/editor/editor-group/ArtifactGenerationViewer.js.map +1 -0
  15. package/lib/components/editor/editor-group/EditorGroup.js +6 -6
  16. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  17. package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +1 -1
  18. package/lib/components/editor/editor-group/FunctionEditor.js +13 -6
  19. package/lib/components/editor/editor-group/FunctionEditor.js.map +1 -1
  20. package/lib/components/editor/editor-group/data-editor/DataElementEditor.d.ts.map +1 -1
  21. package/lib/components/editor/editor-group/data-editor/DataElementEditor.js +1 -1
  22. package/lib/components/editor/editor-group/data-editor/DataElementEditor.js.map +1 -1
  23. package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.d.ts.map +1 -1
  24. package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.js +1 -1
  25. package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.js.map +1 -1
  26. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.d.ts.map +1 -1
  27. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js +1 -1
  28. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js.map +1 -1
  29. package/lib/components/editor/editor-group/element-generation-editor/FileGenerationEditor.js +1 -1
  30. package/lib/components/editor/editor-group/element-generation-editor/FileGenerationEditor.js.map +1 -1
  31. package/lib/components/editor/editor-group/element-generation-editor/FileSystemViewer.d.ts.map +1 -1
  32. package/lib/components/editor/editor-group/element-generation-editor/FileSystemViewer.js +1 -1
  33. package/lib/components/editor/editor-group/element-generation-editor/FileSystemViewer.js.map +1 -1
  34. package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.js +1 -1
  35. package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.js.map +1 -1
  36. package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.d.ts.map +1 -1
  37. package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.js +6 -10
  38. package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.js.map +1 -1
  39. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js +1 -1
  40. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
  41. package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.d.ts.map +1 -1
  42. package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.js +13 -12
  43. package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.js.map +1 -1
  44. package/lib/components/editor/editor-group/mapping-editor/MappingExplorer.js +2 -2
  45. package/lib/components/editor/editor-group/mapping-editor/MappingExplorer.js.map +1 -1
  46. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts.map +1 -1
  47. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js +3 -7
  48. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js.map +1 -1
  49. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
  50. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js +10 -14
  51. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
  52. package/lib/components/editor/panel-group/DevToolPanel.d.ts.map +1 -1
  53. package/lib/components/editor/panel-group/DevToolPanel.js +4 -1
  54. package/lib/components/editor/panel-group/DevToolPanel.js.map +1 -1
  55. package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
  56. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +1 -1
  57. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
  58. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  59. package/lib/components/editor/side-bar/CreateNewElementModal.js +1 -1
  60. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  61. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  62. package/lib/components/editor/side-bar/Explorer.js +37 -5
  63. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  64. package/lib/index.css +2 -2
  65. package/lib/index.css.map +1 -1
  66. package/lib/package.json +4 -4
  67. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  68. package/lib/stores/editor/EditorGraphState.js +7 -6
  69. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  70. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  71. package/lib/stores/editor/EditorStore.js +4 -2
  72. package/lib/stores/editor/EditorStore.js.map +1 -1
  73. package/lib/stores/editor/ExplorerTreeState.d.ts +3 -3
  74. package/lib/stores/editor/ExplorerTreeState.d.ts.map +1 -1
  75. package/lib/stores/editor/ExplorerTreeState.js +10 -10
  76. package/lib/stores/editor/ExplorerTreeState.js.map +1 -1
  77. package/lib/stores/editor/NewElementState.d.ts +3 -3
  78. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  79. package/lib/stores/editor/NewElementState.js +2 -2
  80. package/lib/stores/editor/NewElementState.js.map +1 -1
  81. package/lib/stores/editor/QuickInputState.d.ts +3 -0
  82. package/lib/stores/editor/QuickInputState.d.ts.map +1 -1
  83. package/lib/stores/editor/editor-state/{FileGenerationViewerState.d.ts → ArtifactGenerationViewerState.d.ts} +4 -4
  84. package/lib/stores/editor/editor-state/ArtifactGenerationViewerState.d.ts.map +1 -0
  85. package/lib/stores/editor/editor-state/{FileGenerationViewerState.js → ArtifactGenerationViewerState.js} +10 -9
  86. package/lib/stores/editor/editor-state/ArtifactGenerationViewerState.js.map +1 -0
  87. package/lib/stores/editor/editor-state/FileGenerationState.js +1 -1
  88. package/lib/stores/editor/editor-state/FileGenerationState.js.map +1 -1
  89. package/lib/stores/editor/editor-state/GraphGenerationState.d.ts +32 -19
  90. package/lib/stores/editor/editor-state/GraphGenerationState.d.ts.map +1 -1
  91. package/lib/stores/editor/editor-state/GraphGenerationState.js +173 -113
  92. package/lib/stores/editor/editor-state/GraphGenerationState.js.map +1 -1
  93. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js +1 -1
  94. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
  95. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +1 -0
  96. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
  97. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +14 -7
  98. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
  99. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts +2 -2
  100. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts.map +1 -1
  101. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js +48 -48
  102. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js.map +1 -1
  103. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts +4 -1
  104. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts.map +1 -1
  105. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js +37 -12
  106. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  107. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js +2 -2
  108. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  109. package/lib/stores/project-view/ProjectViewerStore.js +1 -1
  110. package/lib/stores/project-view/ProjectViewerStore.js.map +1 -1
  111. package/package.json +14 -14
  112. package/src/application/LegendStudioApplicationConfig.ts +5 -0
  113. package/src/components/editor/QuickInput.tsx +5 -1
  114. package/src/components/editor/StatusBar.tsx +1 -4
  115. package/src/components/editor/editor-group/{FileGenerationViewer.tsx → ArtifactGenerationViewer.tsx} +28 -25
  116. package/src/components/editor/editor-group/EditorGroup.tsx +6 -6
  117. package/src/components/editor/editor-group/FunctionEditor.tsx +67 -55
  118. package/src/components/editor/editor-group/data-editor/DataElementEditor.tsx +1 -1
  119. package/src/components/editor/editor-group/data-editor/EmbeddedDataEditor.tsx +1 -1
  120. package/src/components/editor/editor-group/data-editor/RelationalCSVDataEditor.tsx +1 -0
  121. package/src/components/editor/editor-group/element-generation-editor/FileGenerationEditor.tsx +1 -1
  122. package/src/components/editor/editor-group/element-generation-editor/FileSystemViewer.tsx +4 -4
  123. package/src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.tsx +1 -1
  124. package/src/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.tsx +63 -69
  125. package/src/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.tsx +1 -1
  126. package/src/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.tsx +69 -48
  127. package/src/components/editor/editor-group/mapping-editor/MappingExplorer.tsx +2 -2
  128. package/src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx +8 -12
  129. package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +91 -99
  130. package/src/components/editor/panel-group/DevToolPanel.tsx +14 -0
  131. package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +3 -0
  132. package/src/components/editor/side-bar/CreateNewElementModal.tsx +3 -5
  133. package/src/components/editor/side-bar/Explorer.tsx +84 -2
  134. package/src/stores/editor/EditorGraphState.ts +7 -6
  135. package/src/stores/editor/EditorStore.ts +5 -2
  136. package/src/stores/editor/ExplorerTreeState.ts +10 -10
  137. package/src/stores/editor/NewElementState.ts +5 -5
  138. package/src/stores/editor/QuickInputState.ts +3 -0
  139. package/src/stores/editor/editor-state/{FileGenerationViewerState.ts → ArtifactGenerationViewerState.ts} +12 -9
  140. package/src/stores/editor/editor-state/FileGenerationState.ts +1 -1
  141. package/src/stores/editor/editor-state/GraphGenerationState.ts +258 -170
  142. package/src/stores/editor/editor-state/element-editor-state/ElementEditorState.ts +1 -1
  143. package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +18 -8
  144. package/src/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.ts +70 -69
  145. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts +62 -36
  146. package/src/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.ts +5 -5
  147. package/src/stores/project-view/ProjectViewerStore.ts +1 -1
  148. package/tsconfig.json +2 -2
  149. package/lib/components/editor/editor-group/FileGenerationViewer.d.ts.map +0 -1
  150. package/lib/components/editor/editor-group/FileGenerationViewer.js +0 -32
  151. package/lib/components/editor/editor-group/FileGenerationViewer.js.map +0 -1
  152. package/lib/stores/editor/editor-state/FileGenerationViewerState.d.ts.map +0 -1
  153. package/lib/stores/editor/editor-state/FileGenerationViewerState.js.map +0 -1
@@ -21,6 +21,7 @@ import {
21
21
  makeObservable,
22
22
  flow,
23
23
  flowResult,
24
+ override,
24
25
  } from 'mobx';
25
26
  import type { EditorStore } from '../../EditorStore.js';
26
27
  import {
@@ -50,6 +51,7 @@ import {
50
51
  buildLambdaVariableExpressions,
51
52
  VariableExpression,
52
53
  observe_ValueSpecification,
54
+ generateFunctionPrettyName,
53
55
  } from '@finos/legend-graph';
54
56
  import {
55
57
  ExecutionPlanState,
@@ -254,13 +256,14 @@ export class FunctionEditorState extends ElementEditorState {
254
256
 
255
257
  makeObservable(this, {
256
258
  selectedTab: observable,
257
- functionElement: computed,
258
- setSelectedTab: action,
259
- reprocess: action,
260
259
  isRunningQuery: observable,
261
260
  isGeneratingPlan: observable,
262
261
  executionResultText: observable,
263
262
  executionPlanState: observable,
263
+ label: override,
264
+ functionElement: computed,
265
+ setSelectedTab: action,
266
+ reprocess: action,
264
267
  setExecutionResultText: action,
265
268
  setIsRunningQuery: action,
266
269
  runQuery: flow,
@@ -287,6 +290,13 @@ export class FunctionEditorState extends ElementEditorState {
287
290
  this.parametersState = new FunctionParametersState(this);
288
291
  }
289
292
 
293
+ override get label(): string {
294
+ return generateFunctionPrettyName(this.functionElement, {
295
+ fullPath: true,
296
+ spacing: false,
297
+ });
298
+ }
299
+
290
300
  get functionElement(): ConcreteFunctionDefinition {
291
301
  return guaranteeType(
292
302
  this.element,
@@ -512,15 +522,15 @@ export class FunctionEditorState extends ElementEditorState {
512
522
  );
513
523
  }
514
524
  } catch (error) {
515
- // When user cancels the query by calling the cancelQuery api, it will throw an exeuction failure error.
525
+ // When user cancels the query by calling the cancelQuery api, it will throw an execution failure error.
516
526
  // For now, we don't want to notify users about this failure. Therefore we check to ensure the promise is still the same one.
517
527
  // When cancelled the query, we set the queryRunPromise as undefined.
518
- this.editorStore.applicationStore.logService.error(
519
- LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
520
- error,
521
- );
522
528
  if (this.queryRunPromise === promise) {
523
529
  assertErrorThrown(error);
530
+ this.editorStore.applicationStore.logService.error(
531
+ LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
532
+ error,
533
+ );
524
534
  this.editorStore.applicationStore.notificationService.notifyError(
525
535
  error,
526
536
  );
@@ -476,6 +476,7 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
476
476
  get label(): string {
477
477
  return this.test.name;
478
478
  }
479
+
479
480
  setIsRunningTest(val: boolean): void {
480
481
  this.isRunningTest = val;
481
482
  }
@@ -703,75 +704,6 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
703
704
  }
704
705
  }
705
706
 
706
- *runTest(): GeneratorFn<void> {
707
- if (DEPRECATED__validate_MappingTest(this.test)) {
708
- this.editorStore.applicationStore.notificationService.notifyError(
709
- `Can't run test '${this.test.name}'. Please make sure that the test is valid`,
710
- );
711
- return;
712
- } else if (this.isExecutingTest) {
713
- this.editorStore.applicationStore.notificationService.notifyWarning(
714
- `Test '${this.test.name}' is already running`,
715
- );
716
- return;
717
- }
718
- const startTime = Date.now();
719
- let promise;
720
- try {
721
- const runtime = this.inputDataState.runtime;
722
- this.isRunningTest = true;
723
- promise = this.editorStore.graphManagerState.graphManager.runQuery(
724
- this.test.query,
725
- this.mappingEditorState.mapping,
726
- runtime,
727
- this.editorStore.graphManagerState.graph,
728
- {
729
- useLosslessParse: true,
730
- },
731
- );
732
- this.setTestRunPromise(promise);
733
- const result = (yield promise) as ExecutionResult;
734
- if (this.testRunPromise === promise) {
735
- this.handleResult(result);
736
- }
737
- } catch (error) {
738
- // When user cancels the query by calling the cancelQuery api, it will throw an exeuction failure error.
739
- // For now, we don't want to notify users about this failure. Therefore we check to ensure the promise is still the same one.
740
- // When cancelled the query, we set the queryRunPromise as undefined.
741
- if (this.testRunPromise === promise) {
742
- assertErrorThrown(error);
743
- this.handleError(error, promise);
744
- }
745
- } finally {
746
- this.isRunningTest = false;
747
- this.runTime = Date.now() - startTime;
748
- // if the test is currently opened and ran but did not pass, switch to the result tab
749
- if (
750
- [TEST_RESULT.FAILED, TEST_RESULT.ERROR].includes(this.result) &&
751
- this.testRunPromise === promise &&
752
- this.mappingEditorState.currentTabState === this
753
- ) {
754
- this.setSelectedTab(MAPPING_TEST_EDITOR_TAB_TYPE.RESULT);
755
- }
756
- }
757
- }
758
-
759
- *cancelTest(): GeneratorFn<void> {
760
- this.setIsRunningTest(false);
761
- this.setTestRunPromise(undefined);
762
- try {
763
- yield this.editorStore.graphManagerState.graphManager.cancelUserExecutions(
764
- true,
765
- );
766
- } catch (error) {
767
- // don't notify users about success or failure
768
- this.editorStore.applicationStore.logService.error(
769
- LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
770
- error,
771
- );
772
- }
773
- }
774
-
775
707
  handleResult(result: ExecutionResult): void {
776
708
  this.testExecutionResultText = stringifyLosslessJSON(
777
709
  extractExecutionResultValues(result),
@@ -843,6 +775,75 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
843
775
  );
844
776
  }
845
777
 
778
+ *runTest(): GeneratorFn<void> {
779
+ if (DEPRECATED__validate_MappingTest(this.test)) {
780
+ this.editorStore.applicationStore.notificationService.notifyError(
781
+ `Can't run test '${this.test.name}'. Please make sure that the test is valid`,
782
+ );
783
+ return;
784
+ } else if (this.isExecutingTest) {
785
+ this.editorStore.applicationStore.notificationService.notifyWarning(
786
+ `Test '${this.test.name}' is already running`,
787
+ );
788
+ return;
789
+ }
790
+ const startTime = Date.now();
791
+ let promise;
792
+ try {
793
+ const runtime = this.inputDataState.runtime;
794
+ this.isRunningTest = true;
795
+ promise = this.editorStore.graphManagerState.graphManager.runQuery(
796
+ this.test.query,
797
+ this.mappingEditorState.mapping,
798
+ runtime,
799
+ this.editorStore.graphManagerState.graph,
800
+ {
801
+ useLosslessParse: true,
802
+ },
803
+ );
804
+ this.setTestRunPromise(promise);
805
+ const result = (yield promise) as ExecutionResult;
806
+ if (this.testRunPromise === promise) {
807
+ this.handleResult(result);
808
+ }
809
+ } catch (error) {
810
+ // When user cancels the query by calling the cancelQuery api, it will throw an execution failure error.
811
+ // For now, we don't want to notify users about this failure. Therefore we check to ensure the promise is still the same one.
812
+ // When cancelled the query, we set the queryRunPromise as undefined.
813
+ if (this.testRunPromise === promise) {
814
+ assertErrorThrown(error);
815
+ this.handleError(error, promise);
816
+ }
817
+ } finally {
818
+ this.isRunningTest = false;
819
+ this.runTime = Date.now() - startTime;
820
+ // if the test is currently opened and ran but did not pass, switch to the result tab
821
+ if (
822
+ [TEST_RESULT.FAILED, TEST_RESULT.ERROR].includes(this.result) &&
823
+ this.testRunPromise === promise &&
824
+ this.mappingEditorState.currentTabState === this
825
+ ) {
826
+ this.setSelectedTab(MAPPING_TEST_EDITOR_TAB_TYPE.RESULT);
827
+ }
828
+ }
829
+ }
830
+
831
+ *cancelTest(): GeneratorFn<void> {
832
+ this.setIsRunningTest(false);
833
+ this.setTestRunPromise(undefined);
834
+ try {
835
+ yield this.editorStore.graphManagerState.graphManager.cancelUserExecutions(
836
+ true,
837
+ );
838
+ } catch (error) {
839
+ // don't notify users about success or failure
840
+ this.editorStore.applicationStore.logService.error(
841
+ LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
842
+ error,
843
+ );
844
+ }
845
+ }
846
+
846
847
  *generatePlan(debug: boolean): GeneratorFn<void> {
847
848
  try {
848
849
  this.isGeneratingPlan = true;
@@ -66,7 +66,6 @@ import {
66
66
  DEFAULT_TEST_PREFIX,
67
67
  EqualToJson,
68
68
  ServiceTest,
69
- extractExecutionResultValues,
70
69
  LAMBDA_PIPE,
71
70
  GRAPH_MANAGER_EVENT,
72
71
  Class,
@@ -498,6 +497,7 @@ export class MappingExecutionState extends MappingEditorTabState {
498
497
  isGeneratingPlan = false;
499
498
  executionPlanState: ExecutionPlanState;
500
499
  planGenerationDebugText?: string | undefined;
500
+ executionRunPromise: Promise<ExecutionResult> | undefined = undefined;
501
501
 
502
502
  constructor(
503
503
  editorStore: EditorStore,
@@ -515,6 +515,8 @@ export class MappingExecutionState extends MappingEditorTabState {
515
515
  isExecuting: observable,
516
516
  isGeneratingPlan: observable,
517
517
  planGenerationDebugText: observable,
518
+ executionRunPromise: observable,
519
+ setExecutionRunPromise: action,
518
520
  setQueryState: action,
519
521
  setInputDataState: action,
520
522
  setExecutionResultText: action,
@@ -524,6 +526,7 @@ export class MappingExecutionState extends MappingEditorTabState {
524
526
  reset: action,
525
527
  promoteToTest: flow,
526
528
  promoteToService: flow,
529
+ cancelExecution: flow,
527
530
  executeMapping: flow,
528
531
  generatePlan: flow,
529
532
  buildQueryWithClassMapping: flow,
@@ -550,6 +553,11 @@ export class MappingExecutionState extends MappingEditorTabState {
550
553
  get label(): string {
551
554
  return this.name;
552
555
  }
556
+
557
+ setExecutionRunPromise(promise: Promise<ExecutionResult> | undefined): void {
558
+ this.executionRunPromise = promise;
559
+ }
560
+
553
561
  setQueryState(val: MappingExecutionQueryState): void {
554
562
  this.queryState = val;
555
563
  }
@@ -759,7 +767,24 @@ export class MappingExecutionState extends MappingEditorTabState {
759
767
  }
760
768
  }
761
769
 
770
+ *cancelExecution(): GeneratorFn<void> {
771
+ this.isExecuting = false;
772
+ this.setExecutionRunPromise(undefined);
773
+ try {
774
+ yield this.editorStore.graphManagerState.graphManager.cancelUserExecutions(
775
+ true,
776
+ );
777
+ } catch (error) {
778
+ // don't notify users about success or failure
779
+ this.editorStore.applicationStore.logService.error(
780
+ LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
781
+ error,
782
+ );
783
+ }
784
+ }
785
+
762
786
  *executeMapping(): GeneratorFn<void> {
787
+ let promise;
763
788
  try {
764
789
  const query = this.queryState.query;
765
790
  const runtime = this.inputDataState.runtime;
@@ -779,45 +804,46 @@ export class MappingExecutionState extends MappingEditorTabState {
779
804
  this.editorStore.graphManagerState.graph,
780
805
  );
781
806
 
782
- const result =
783
- (yield this.editorStore.graphManagerState.graphManager.runQuery(
784
- query,
785
- this.mappingEditorState.mapping,
786
- runtime,
787
- this.editorStore.graphManagerState.graph,
788
- {
789
- useLosslessParse: true,
790
- },
791
- report,
792
- )) as ExecutionResult;
793
-
794
- this.setExecutionResultText(
795
- stringifyLosslessJSON(
796
- extractExecutionResultValues(result),
797
- undefined,
798
- DEFAULT_TAB_SIZE,
799
- ),
800
- );
801
-
802
- // report
803
- report.timings =
804
- this.editorStore.applicationStore.timeService.finalizeTimingsRecord(
805
- stopWatch,
806
- report.timings,
807
- );
808
- QueryBuilderTelemetryHelper.logEvent_QueryRunSucceeded(
809
- this.editorStore.applicationStore.telemetryService,
807
+ promise = this.editorStore.graphManagerState.graphManager.runQuery(
808
+ query,
809
+ this.mappingEditorState.mapping,
810
+ runtime,
811
+ this.editorStore.graphManagerState.graph,
812
+ {
813
+ useLosslessParse: true,
814
+ },
810
815
  report,
811
816
  );
817
+ this.setExecutionRunPromise(promise);
818
+ const result = (yield promise) as ExecutionResult;
819
+ if (this.executionRunPromise === promise) {
820
+ this.setExecutionResultText(
821
+ stringifyLosslessJSON(result, undefined, DEFAULT_TAB_SIZE),
822
+ );
823
+ // report
824
+ report.timings =
825
+ this.editorStore.applicationStore.timeService.finalizeTimingsRecord(
826
+ stopWatch,
827
+ report.timings,
828
+ );
829
+ QueryBuilderTelemetryHelper.logEvent_QueryRunSucceeded(
830
+ this.editorStore.applicationStore.telemetryService,
831
+ report,
832
+ );
833
+ }
812
834
  }
813
835
  } catch (error) {
814
- assertErrorThrown(error);
815
- this.editorStore.applicationStore.logService.error(
816
- LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
817
- error,
818
- );
819
- this.editorStore.applicationStore.notificationService.notifyError(error);
820
- this.setExecutionResultText('');
836
+ if (this.executionRunPromise === promise) {
837
+ assertErrorThrown(error);
838
+ this.editorStore.applicationStore.logService.error(
839
+ LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
840
+ error,
841
+ );
842
+ this.editorStore.applicationStore.notificationService.notifyError(
843
+ error,
844
+ );
845
+ this.setExecutionResultText('');
846
+ }
821
847
  } finally {
822
848
  this.isExecuting = false;
823
849
  }
@@ -644,15 +644,15 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
644
644
  );
645
645
  }
646
646
  } catch (error) {
647
- // When user cancels the query by calling the cancelQuery api, it will throw an exeuction failure error.
647
+ // When user cancels the query by calling the cancelQuery api, it will throw an execution failure error.
648
648
  // For now, we don't want to notify users about this failure. Therefore we check to ensure the promise is still the same one.
649
649
  // When cancelled the query, we set the queryRunPromise as undefined.
650
- this.editorStore.applicationStore.logService.error(
651
- LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
652
- error,
653
- );
654
650
  if (this.queryRunPromise === promise) {
655
651
  assertErrorThrown(error);
652
+ this.editorStore.applicationStore.logService.error(
653
+ LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
654
+ error,
655
+ );
656
656
  this.editorStore.applicationStore.notificationService.notifyError(
657
657
  error,
658
658
  );
@@ -439,7 +439,7 @@ export class ProjectViewerStore {
439
439
 
440
440
  // fetch available editor configurations
441
441
  yield Promise.all([
442
- this.editorStore.graphState.graphGenerationState.fetchAvailableFileGenerationDescriptions(),
442
+ this.editorStore.graphState.graphGenerationState.globalFileGenerationState.fetchAvailableFileGenerationDescriptions(),
443
443
  this.editorStore.graphState.graphGenerationState.externalFormatState.fetchExternalFormatDescriptions(),
444
444
  this.editorStore.graphState.graphGenerationState.externalFormatState.fetchExternalFormatDescriptions(),
445
445
  this.editorStore.graphState.fetchAvailableFunctionActivatorConfigurations(),
package/tsconfig.json CHANGED
@@ -71,10 +71,10 @@
71
71
  "./src/stores/editor/QuickInputState.ts",
72
72
  "./src/stores/editor/StandardEditorMode.ts",
73
73
  "./src/stores/editor/__test-utils__/EditorStoreTestUtils.ts",
74
+ "./src/stores/editor/editor-state/ArtifactGenerationViewerState.ts",
74
75
  "./src/stores/editor/editor-state/EditorState.ts",
75
76
  "./src/stores/editor/editor-state/ExternalFormatState.ts",
76
77
  "./src/stores/editor/editor-state/FileGenerationState.ts",
77
- "./src/stores/editor/editor-state/FileGenerationViewerState.ts",
78
78
  "./src/stores/editor/editor-state/FileSystemState.ts",
79
79
  "./src/stores/editor/editor-state/GenerationSpecificationEditorState.ts",
80
80
  "./src/stores/editor/editor-state/GrammarTextEditorState.ts",
@@ -180,8 +180,8 @@
180
180
  "./src/components/editor/StatusBar.tsx",
181
181
  "./src/components/editor/__test-utils__/EditorComponentTestUtils.tsx",
182
182
  "./src/components/editor/command-center/ProjectSearchCommand.tsx",
183
+ "./src/components/editor/editor-group/ArtifactGenerationViewer.tsx",
183
184
  "./src/components/editor/editor-group/EditorGroup.tsx",
184
- "./src/components/editor/editor-group/FileGenerationViewer.tsx",
185
185
  "./src/components/editor/editor-group/FunctionEditor.tsx",
186
186
  "./src/components/editor/editor-group/GenerationSpecificationEditor.tsx",
187
187
  "./src/components/editor/editor-group/GrammarTextEditor.tsx",
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileGenerationViewer.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/editor-group/FileGenerationViewer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAmBH,eAAO,MAAM,oBAAoB;;CAwE/B,CAAC"}
@@ -1,32 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- * Copyright (c) 2020-present, Goldman Sachs
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import { observer } from 'mobx-react-lite';
18
- import { FileGenerationViewerState, getTextContent, getEditorLanguageForFormat, } from '../../../stores/editor/editor-state/FileGenerationViewerState.js';
19
- import { LockIcon, FireIcon, StickArrowCircleRightIcon, Panel, PanelContent, } from '@finos/legend-art';
20
- import { useEditorStore } from '../EditorStoreProvider.js';
21
- import { CodeEditor } from '@finos/legend-lego/code-editor';
22
- export const FileGenerationViewer = observer(() => {
23
- const editorStore = useEditorStore();
24
- const generatedFileState = editorStore.tabManagerState.getCurrentEditorState(FileGenerationViewerState);
25
- const generatedFile = generatedFileState.file;
26
- const fileGeneration = generatedFile.parentId
27
- ? editorStore.graphManagerState.graph.getNullableFileGeneration(generatedFile.parentId)
28
- : undefined;
29
- const visitFileGeneration = (fg) => editorStore.graphEditorMode.openElement(fg);
30
- return (_jsx("div", { className: "file-generation-viewer", children: _jsxs(Panel, { children: [_jsx("div", { className: "panel__header", children: _jsxs("div", { className: "panel__header__title", children: [_jsx("div", { className: "uml-element-editor__header__lock", children: _jsx(LockIcon, {}) }), _jsx("div", { className: "panel__header__title__label", children: "generated-file" }), _jsx("div", { className: "panel__header__title__content", children: generatedFile.name })] }) }), _jsxs("div", { className: "panel file-generation-viewer__content", children: [_jsxs("div", { className: "panel__header", children: [_jsx("div", { className: "panel__header__title", children: _jsx("div", { className: "panel__header__title__label", children: fileGeneration?.type }) }), _jsx("div", { className: "panel__header__actions", children: fileGeneration && (_jsxs("button", { className: "uml-element-editor__header__generation-origin", onClick: () => visitFileGeneration(fileGeneration), tabIndex: -1, title: `Visit generation parent '${fileGeneration.path}'`, children: [_jsx("div", { className: "uml-element-editor__header__generation-origin__label", children: _jsx(FireIcon, {}) }), _jsx("div", { className: "uml-element-editor__header__generation-origin__parent-name", children: fileGeneration.name }), _jsx("div", { className: "uml-element-editor__header__generation-origin__visit-btn", children: _jsx(StickArrowCircleRightIcon, {}) })] })) })] }), _jsx(PanelContent, { children: _jsx(CodeEditor, { inputValue: getTextContent(generatedFile.content, generatedFile.format), isReadOnly: true, language: getEditorLanguageForFormat(generatedFile.format) }) })] })] }) }));
31
- });
32
- //# sourceMappingURL=FileGenerationViewer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileGenerationViewer.js","sourceRoot":"","sources":["../../../../src/components/editor/editor-group/FileGenerationViewer.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,yBAAyB,EACzB,cAAc,EACd,0BAA0B,GAC3B,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,yBAAyB,EACzB,KAAK,EACL,YAAY,GACb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,GAAG,EAAE;IAChD,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,kBAAkB,GAAG,WAAW,CAAC,eAAe,CAAC,qBAAqB,CAC1E,yBAAyB,CAC1B,CAAC;IACF,MAAM,aAAa,GAAG,kBAAkB,CAAC,IAAI,CAAC;IAC9C,MAAM,cAAc,GAAG,aAAa,CAAC,QAAQ;QAC3C,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,yBAAyB,CAC3D,aAAa,CAAC,QAAQ,CACvB;QACH,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,mBAAmB,GAAG,CAAC,EAA+B,EAAQ,EAAE,CACpE,WAAW,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAE9C,OAAO,CACL,cAAK,SAAS,EAAC,wBAAwB,YACrC,MAAC,KAAK,eACJ,cAAK,SAAS,EAAC,eAAe,YAC5B,eAAK,SAAS,EAAC,sBAAsB,aAEjC,cAAK,SAAS,EAAC,kCAAkC,YAC/C,KAAC,QAAQ,KAAG,GACR,EAER,cAAK,SAAS,EAAC,6BAA6B,+BAAqB,EACjE,cAAK,SAAS,EAAC,+BAA+B,YAC3C,aAAa,CAAC,IAAI,GACf,IACF,GACF,EACN,eAAK,SAAS,EAAC,uCAAuC,aACpD,eAAK,SAAS,EAAC,eAAe,aAC5B,cAAK,SAAS,EAAC,sBAAsB,YACnC,cAAK,SAAS,EAAC,6BAA6B,YACzC,cAAc,EAAE,IAAI,GACjB,GACF,EACN,cAAK,SAAS,EAAC,wBAAwB,YACpC,cAAc,IAAI,CACjB,kBACE,SAAS,EAAC,+CAA+C,EACzD,OAAO,EAAE,GAAS,EAAE,CAAC,mBAAmB,CAAC,cAAc,CAAC,EACxD,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAE,4BAA4B,cAAc,CAAC,IAAI,GAAG,aAEzD,cAAK,SAAS,EAAC,sDAAsD,YACnE,KAAC,QAAQ,KAAG,GACR,EACN,cAAK,SAAS,EAAC,4DAA4D,YACxE,cAAc,CAAC,IAAI,GAChB,EACN,cAAK,SAAS,EAAC,0DAA0D,YACvE,KAAC,yBAAyB,KAAG,GACzB,IACC,CACV,GACG,IACF,EACN,KAAC,YAAY,cACX,KAAC,UAAU,IACT,UAAU,EAAE,cAAc,CACxB,aAAa,CAAC,OAAO,EACrB,aAAa,CAAC,MAAM,CACrB,EACD,UAAU,EAAE,IAAI,EAChB,QAAQ,EAAE,0BAA0B,CAAC,aAAa,CAAC,MAAM,CAAC,GAC1D,GACW,IACX,IACA,GACJ,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileGenerationViewerState.d.ts","sourceRoot":"","sources":["../../../../src/stores/editor/editor-state/FileGenerationViewerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,eAAO,MAAM,cAAc,YAChB,MAAM,UACP,MAAM,GAAG,SAAS,KACzB,MAWF,CAAC;AAEF,eAAO,MAAM,0BAA0B,YAC5B,MAAM,KACd,oBASF,CAAC;AAEF,qBAAa,yBAA0B,SAAQ,WAAW;IACxD,IAAI,EAAE,eAAe,CAAC;gBAEV,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe;IAY3D,IAAI,KAAK,IAAI,MAAM,CAElB;IAEQ,KAAK,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO;IAIzC,IAAI,iBAAiB,IAAI,MAAM,CAE9B;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileGenerationViewerState.js","sourceRoot":"","sources":["../../../../src/stores/editor/editor-state/FileGenerationViewerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,OAAe,EACf,MAA0B,EAClB,EAAE;IACV,QAAQ,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,KAAK,oBAAoB,CAAC,IAAI;YAC5B,OAAO,CACL,kBAAkB,CAAC,GAAG,EAAE,CACtB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,gBAAgB,CAAC,CACjE,IAAI,OAAO,CACb,CAAC;QACJ;YACE,OAAO,OAAO,CAAC;KAClB;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,MAAe,EACO,EAAE;IACxB,QAAQ,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,KAAK,oBAAoB,CAAC,IAAI;YAC5B,OAAO,oBAAoB,CAAC,IAAI,CAAC;QACnC,KAAK,oBAAoB,CAAC,IAAI;YAC5B,OAAO,oBAAoB,CAAC,IAAI,CAAC;QACnC;YACE,OAAO,oBAAoB,CAAC,IAAI,CAAC;KACpC;AACH,CAAC,CAAC;AAEF,MAAM,OAAO,yBAA0B,SAAQ,WAAW;IACxD,IAAI,CAAkB;IAEtB,YAAY,WAAwB,EAAE,IAAqB;QACzD,KAAK,CAAC,WAAW,CAAC,CAAC;QAEnB,cAAc,CAAC,IAAI,EAAE;YACnB,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,QAAQ;YACf,iBAAiB,EAAE,QAAQ;SAC5B,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC;IAEQ,KAAK,CAAC,GAAgB;QAC7B,OAAO,GAAG,YAAY,yBAAyB,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC;IAC5E,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC;CACF"}