@finos/legend-application-studio 27.1.0 → 27.1.2

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 (156) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +1 -0
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +1 -0
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +1 -1
  6. package/lib/components/editor/editor-group/FunctionEditor.js +28 -24
  7. package/lib/components/editor/editor-group/FunctionEditor.js.map +1 -1
  8. package/lib/components/editor/editor-group/connection-editor/{DatabaseBuilder.d.ts → DatabaseBuilderWizard.d.ts} +4 -11
  9. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.d.ts.map +1 -0
  10. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js +48 -0
  11. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js.map +1 -0
  12. package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.d.ts +32 -0
  13. package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.d.ts.map +1 -0
  14. package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.js +99 -0
  15. package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.js.map +1 -0
  16. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +1 -1
  17. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
  18. package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.d.ts.map +1 -1
  19. package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.js +5 -4
  20. package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.js.map +1 -1
  21. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.d.ts.map +1 -1
  22. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js +62 -12
  23. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js.map +1 -1
  24. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts +1 -1
  25. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts.map +1 -1
  26. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js +101 -137
  27. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js.map +1 -1
  28. package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts +11 -0
  29. package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts.map +1 -1
  30. package/lib/components/editor/editor-group/testable/TestableSharedComponents.js +27 -2
  31. package/lib/components/editor/editor-group/testable/TestableSharedComponents.js.map +1 -1
  32. package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts +0 -7
  33. package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
  34. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +20 -77
  35. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
  36. package/lib/components/editor/side-bar/Explorer.js +3 -3
  37. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  38. package/lib/components/editor/side-bar/WorkflowManager.d.ts.map +1 -1
  39. package/lib/components/editor/side-bar/WorkflowManager.js +6 -1
  40. package/lib/components/editor/side-bar/WorkflowManager.js.map +1 -1
  41. package/lib/index.css +2 -2
  42. package/lib/index.css.map +1 -1
  43. package/lib/package.json +3 -3
  44. package/lib/stores/editor/ExplorerTreeState.d.ts +4 -4
  45. package/lib/stores/editor/ExplorerTreeState.d.ts.map +1 -1
  46. package/lib/stores/editor/ExplorerTreeState.js +4 -4
  47. package/lib/stores/editor/ExplorerTreeState.js.map +1 -1
  48. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  49. package/lib/stores/editor/NewElementState.js.map +1 -1
  50. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +12 -12
  51. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
  52. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +45 -46
  53. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
  54. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +20 -29
  55. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts.map +1 -1
  56. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js +60 -141
  57. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js.map +1 -1
  58. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.d.ts +33 -0
  59. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.d.ts.map +1 -0
  60. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js +71 -0
  61. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js.map +1 -0
  62. package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.d.ts +2 -2
  63. package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.d.ts.map +1 -1
  64. package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.js +2 -2
  65. package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.js.map +1 -1
  66. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.d.ts +14 -19
  67. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.d.ts.map +1 -1
  68. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.js +30 -65
  69. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.js.map +1 -1
  70. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts +56 -78
  71. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts.map +1 -1
  72. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js +285 -384
  73. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js.map +1 -1
  74. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts +23 -0
  75. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts.map +1 -0
  76. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js +129 -0
  77. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js.map +1 -0
  78. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
  79. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js +2 -2
  80. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
  81. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts +1 -0
  82. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
  83. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +12 -2
  84. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  85. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.d.ts.map +1 -1
  86. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.js +15 -8
  87. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.js.map +1 -1
  88. package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.d.ts +7 -4
  89. package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.d.ts.map +1 -1
  90. package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.js +53 -10
  91. package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.js.map +1 -1
  92. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts +2 -1
  93. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts.map +1 -1
  94. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js +20 -16
  95. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js.map +1 -1
  96. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts +3 -48
  97. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts.map +1 -1
  98. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js +12 -350
  99. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js.map +1 -1
  100. package/lib/stores/editor/sidebar-state/WorkflowManagerState.d.ts +5 -0
  101. package/lib/stores/editor/sidebar-state/WorkflowManagerState.d.ts.map +1 -1
  102. package/lib/stores/editor/sidebar-state/WorkflowManagerState.js +26 -0
  103. package/lib/stores/editor/sidebar-state/WorkflowManagerState.js.map +1 -1
  104. package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.d.ts +1 -1
  105. package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.d.ts.map +1 -1
  106. package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js +3 -0
  107. package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js.map +1 -1
  108. package/lib/stores/editor/utils/MockDataUtils.d.ts.map +1 -1
  109. package/lib/stores/editor/utils/MockDataUtils.js +3 -0
  110. package/lib/stores/editor/utils/MockDataUtils.js.map +1 -1
  111. package/lib/stores/editor/utils/TestableUtils.d.ts +11 -1
  112. package/lib/stores/editor/utils/TestableUtils.d.ts.map +1 -1
  113. package/lib/stores/editor/utils/TestableUtils.js +50 -1
  114. package/lib/stores/editor/utils/TestableUtils.js.map +1 -1
  115. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts +5 -4
  116. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts.map +1 -1
  117. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js +4 -1
  118. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js.map +1 -1
  119. package/package.json +9 -9
  120. package/src/__lib__/LegendStudioEvent.ts +1 -1
  121. package/src/components/editor/editor-group/FunctionEditor.tsx +133 -118
  122. package/src/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.tsx +191 -0
  123. package/src/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.tsx +227 -0
  124. package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +1 -1
  125. package/src/components/editor/editor-group/data-editor/EmbeddedDataEditor.tsx +34 -37
  126. package/src/components/editor/editor-group/data-editor/RelationalCSVDataEditor.tsx +134 -31
  127. package/src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx +296 -414
  128. package/src/components/editor/editor-group/testable/TestableSharedComponents.tsx +88 -3
  129. package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +47 -211
  130. package/src/components/editor/side-bar/Explorer.tsx +3 -3
  131. package/src/components/editor/side-bar/WorkflowManager.tsx +10 -0
  132. package/src/stores/editor/ExplorerTreeState.ts +6 -9
  133. package/src/stores/editor/NewElementState.ts +0 -1
  134. package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +44 -50
  135. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +88 -212
  136. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.ts +102 -0
  137. package/src/stores/editor/editor-state/element-editor-state/data/DataEditorState.ts +7 -1
  138. package/src/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.ts +48 -77
  139. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts +407 -617
  140. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.ts +243 -0
  141. package/src/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.ts +6 -2
  142. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +18 -1
  143. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.ts +20 -12
  144. package/src/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.ts +76 -18
  145. package/src/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.ts +29 -24
  146. package/src/stores/editor/panel-group/SQLPlaygroundPanelState.ts +13 -533
  147. package/src/stores/editor/sidebar-state/WorkflowManagerState.ts +47 -0
  148. package/src/stores/editor/sidebar-state/testable/GlobalTestRunnerState.ts +4 -1
  149. package/src/stores/editor/utils/MockDataUtils.ts +2 -0
  150. package/src/stores/editor/utils/TestableUtils.ts +73 -0
  151. package/src/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.ts +15 -12
  152. package/tsconfig.json +4 -1
  153. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.d.ts.map +0 -1
  154. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js +0 -133
  155. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js.map +0 -1
  156. package/src/components/editor/editor-group/connection-editor/DatabaseBuilder.tsx +0 -397
@@ -35,7 +35,7 @@ export enum LEGEND_STUDIO_APP_EVENT {
35
35
  SERVICE_TEST_SETUP_FAILURE = 'editor.service-editor.test-setup.failure',
36
36
  GENERATION_FAILURE = 'editor.generation.failure',
37
37
  EXTERNAL_FORMAT_FAILURE = 'editor.external-format.failure',
38
-
38
+ MAPPING_TEST_FAILURE = 'editor.mapping-editor.test-runner.failure',
39
39
  // SDLC
40
40
  // TODO: consider to split this generic errors into more specific events
41
41
  SDLC_MANAGER_FAILURE = 'sdlc.manager.failure',
@@ -60,6 +60,7 @@ import {
60
60
  Modal,
61
61
  PauseCircleIcon,
62
62
  PlayIcon,
63
+ PanelLoadingIndicator,
63
64
  } from '@finos/legend-art';
64
65
  import { LEGEND_STUDIO_TEST_ID } from '../../../__lib__/LegendStudioTesting.js';
65
66
  import {
@@ -95,6 +96,8 @@ import {
95
96
  generateFunctionPrettyName,
96
97
  extractAnnotatedElementDocumentation,
97
98
  getClassProperty,
99
+ RawExecutionResult,
100
+ extractExecutionResultValues,
98
101
  } from '@finos/legend-graph';
99
102
  import {
100
103
  type ApplicationStore,
@@ -103,6 +106,7 @@ import {
103
106
  type LegendApplicationPluginManager,
104
107
  useApplicationNavigationContext,
105
108
  useApplicationStore,
109
+ DEFAULT_TAB_SIZE,
106
110
  } from '@finos/legend-application';
107
111
  import {
108
112
  type PackageableElementOption,
@@ -139,6 +143,7 @@ import {
139
143
  CODE_EDITOR_LANGUAGE,
140
144
  CodeEditor,
141
145
  } from '@finos/legend-lego/code-editor';
146
+ import { PanelGroupItemExperimentalBadge } from '../panel-group/PanelGroup.js';
142
147
 
143
148
  enum FUNCTION_PARAMETER_TYPE {
144
149
  CLASS = 'CLASS',
@@ -661,6 +666,7 @@ const FunctionDefinitionEditor = observer(
661
666
  const applicationStore = useApplicationStore();
662
667
  const lambdaEditorState = functionEditorState.functionDefinitionEditorState;
663
668
  const functionElement = functionEditorState.functionElement;
669
+ const execResult = functionEditorState.executionResult;
664
670
 
665
671
  // Parameters
666
672
  const addParameter = (): void => {
@@ -706,83 +712,136 @@ const FunctionDefinitionEditor = observer(
706
712
  [handleDropParameter],
707
713
  );
708
714
 
715
+ const renderFuncResult = (): React.ReactNode => {
716
+ if (execResult instanceof RawExecutionResult) {
717
+ const val =
718
+ execResult.value === null ? 'null' : execResult.value.toString();
719
+ return (
720
+ <CodeEditor
721
+ language={CODE_EDITOR_LANGUAGE.TEXT}
722
+ inputValue={val}
723
+ isReadOnly={true}
724
+ />
725
+ );
726
+ } else if (execResult !== undefined) {
727
+ const json =
728
+ returnUndefOnError(() =>
729
+ JSON.stringify(
730
+ extractExecutionResultValues(execResult),
731
+ null,
732
+ DEFAULT_TAB_SIZE,
733
+ ),
734
+ ) ?? JSON.stringify(execResult);
735
+ return (
736
+ <CodeEditor
737
+ language={CODE_EDITOR_LANGUAGE.JSON}
738
+ inputValue={json}
739
+ isReadOnly={true}
740
+ />
741
+ );
742
+ }
743
+ return <BlankPanelContent>Function Did Not Run</BlankPanelContent>;
744
+ };
745
+
709
746
  return (
710
- <div className="function-editor__definition">
711
- <div className="function-editor__definition__item">
712
- <div className="function-editor__definition__item__header">
713
- <div className="function-editor__definition__item__header__title">
714
- PARAMETERS
747
+ <>
748
+ <PanelLoadingIndicator
749
+ isLoading={
750
+ functionEditorState.isGeneratingPlan ||
751
+ functionEditorState.isRunningFunc
752
+ }
753
+ />
754
+ <div className="function-editor__definition">
755
+ <div className="function-editor__definition__item">
756
+ <div className="function-editor__definition__item__header">
757
+ <div className="function-editor__definition__item__header__title">
758
+ PARAMETERS
759
+ </div>
760
+ <button
761
+ className="function-editor__definition__item__header__add-btn btn--dark"
762
+ disabled={isReadOnly}
763
+ onClick={addParameter}
764
+ tabIndex={-1}
765
+ title="Add Parameter"
766
+ >
767
+ <PlusIcon />
768
+ </button>
715
769
  </div>
716
- <button
717
- className="function-editor__definition__item__header__add-btn btn--dark"
718
- disabled={isReadOnly}
719
- onClick={addParameter}
720
- tabIndex={-1}
721
- title="Add Parameter"
770
+ <DragPreviewLayer
771
+ labelGetter={(item: FunctionParameterDragSource): string =>
772
+ item.parameter.name === '' ? '(unknown)' : item.parameter.name
773
+ }
774
+ types={[FUNCTION_PARAMETER_DND_TYPE]}
775
+ />
776
+ <div
777
+ ref={dropParameterRef}
778
+ className={clsx('function-editor__definition__item__content', {
779
+ 'panel__content__lists--dnd-over':
780
+ isParameterDragOver && !isReadOnly,
781
+ })}
722
782
  >
723
- <PlusIcon />
724
- </button>
783
+ {functionElement.parameters.map((param) => (
784
+ <ParameterBasicEditor
785
+ key={param._UUID}
786
+ parameter={param}
787
+ _func={functionElement}
788
+ deleteParameter={deleteParameter(param)}
789
+ isReadOnly={isReadOnly}
790
+ />
791
+ ))}
792
+ {functionElement.parameters.length === 0 && (
793
+ <div className="function-editor__definition__item__content--empty">
794
+ No parameters
795
+ </div>
796
+ )}
797
+ </div>
725
798
  </div>
726
- <DragPreviewLayer
727
- labelGetter={(item: FunctionParameterDragSource): string =>
728
- item.parameter.name === '' ? '(unknown)' : item.parameter.name
729
- }
730
- types={[FUNCTION_PARAMETER_DND_TYPE]}
731
- />
732
- <div
733
- ref={dropParameterRef}
734
- className={clsx('function-editor__definition__item__content', {
735
- 'panel__content__lists--dnd-over':
736
- isParameterDragOver && !isReadOnly,
737
- })}
738
- >
739
- {functionElement.parameters.map((param) => (
740
- <ParameterBasicEditor
741
- key={param._UUID}
742
- parameter={param}
743
- _func={functionElement}
744
- deleteParameter={deleteParameter(param)}
745
- isReadOnly={isReadOnly}
746
- />
747
- ))}
748
- {functionElement.parameters.length === 0 && (
749
- <div className="function-editor__definition__item__content--empty">
750
- No parameters
799
+ <div className="function-editor__definition__item">
800
+ <div className="function-editor__definition__item__header">
801
+ <div className="function-editor__definition__item__header__title">
802
+ LAMBDA
803
+ </div>
804
+ <div className="">
805
+ <ReturnTypeEditor
806
+ functionElement={functionElement}
807
+ isReadOnly={isReadOnly}
808
+ />
751
809
  </div>
752
- )}
753
- </div>
754
- </div>
755
- <div className="function-editor__definition__item">
756
- <div className="function-editor__definition__item__header">
757
- <div className="function-editor__definition__item__header__title">
758
- LAMBDA
759
810
  </div>
760
- <div className="">
761
- <ReturnTypeEditor
762
- functionElement={functionElement}
763
- isReadOnly={isReadOnly}
811
+ <div
812
+ className={clsx('function-editor__definition__item__content', {
813
+ backdrop__element: Boolean(
814
+ functionEditorState.functionDefinitionEditorState.parserError,
815
+ ),
816
+ })}
817
+ >
818
+ <LambdaEditor
819
+ className="function-editor__definition__lambda-editor lambda-editor--dark"
820
+ disabled={
821
+ lambdaEditorState.isConvertingFunctionBodyToString ||
822
+ isReadOnly
823
+ }
824
+ lambdaEditorState={lambdaEditorState}
825
+ forceBackdrop={false}
826
+ autoFocus={true}
764
827
  />
765
828
  </div>
766
829
  </div>
767
- <div
768
- className={clsx('function-editor__definition__item__content', {
769
- backdrop__element: Boolean(
770
- functionEditorState.functionDefinitionEditorState.parserError,
771
- ),
772
- })}
773
- >
774
- <LambdaEditor
775
- className="function-editor__definition__lambda-editor lambda-editor--dark"
776
- disabled={
777
- lambdaEditorState.isConvertingFunctionBodyToString || isReadOnly
778
- }
779
- lambdaEditorState={lambdaEditorState}
780
- forceBackdrop={false}
781
- autoFocus={true}
782
- />
830
+ <div className="function-editor__definition__item">
831
+ <div className="function-editor__definition__item__header">
832
+ <div className="function-editor__definition__item__header__title">
833
+ RESULT
834
+ <PanelGroupItemExperimentalBadge />
835
+ </div>
836
+ </div>
837
+ <div className="function-editor__definition__item__content">
838
+ <div className="function-editor__definition__result-viewer">
839
+ {renderFuncResult()}
840
+ </div>
841
+ </div>
783
842
  </div>
784
843
  </div>
785
- </div>
844
+ </>
786
845
  );
787
846
  },
788
847
  );
@@ -872,47 +931,6 @@ const FunctionActivatorContentBuilder = observer(
872
931
  },
873
932
  );
874
933
 
875
- const ExecutionResultViewer = observer(
876
- (props: { functionEditorState: FunctionEditorState }) => {
877
- const { functionEditorState } = props;
878
- // execution
879
- const executionResultText = functionEditorState.executionResultText;
880
- const closeExecutionResultViewer = (): void =>
881
- functionEditorState.setExecutionResultText(undefined);
882
-
883
- return (
884
- <Dialog
885
- open={Boolean(executionResultText)}
886
- onClose={closeExecutionResultViewer}
887
- classes={{
888
- root: 'editor-modal__root-container',
889
- container: 'editor-modal__container',
890
- paper: 'editor-modal__content',
891
- }}
892
- >
893
- <Modal darkMode={true} className="editor-modal">
894
- <ModalHeader title="Execution Result" />
895
- <ModalBody>
896
- <CodeEditor
897
- inputValue={executionResultText ?? ''}
898
- isReadOnly={true}
899
- language={CODE_EDITOR_LANGUAGE.JSON}
900
- />
901
- </ModalBody>
902
- <ModalFooter>
903
- <button
904
- className="btn modal__footer__close-btn btn--dark"
905
- onClick={closeExecutionResultViewer}
906
- >
907
- Close
908
- </button>
909
- </ModalFooter>
910
- </Modal>
911
- </Dialog>
912
- );
913
- },
914
- );
915
-
916
934
  export const FunctionEditor = observer(() => {
917
935
  const editorStore = useEditorStore();
918
936
  const applicationStore = useApplicationStore();
@@ -1019,15 +1037,15 @@ export const FunctionEditor = observer(() => {
1019
1037
  );
1020
1038
  };
1021
1039
 
1022
- const runQuery = applicationStore.guardUnhandledError(() =>
1023
- flowResult(functionEditorState.handleRunQuery()),
1040
+ const runFunc = applicationStore.guardUnhandledError(() =>
1041
+ flowResult(functionEditorState.handleRunFunc()),
1024
1042
  );
1025
1043
 
1026
1044
  const executionIsRunning =
1027
- functionEditorState.isRunningQuery || functionEditorState.isGeneratingPlan;
1045
+ functionEditorState.isRunningFunc || functionEditorState.isGeneratingPlan;
1028
1046
 
1029
1047
  const cancelQuery = applicationStore.guardUnhandledError(() =>
1030
- flowResult(functionEditorState.cancelQuery()),
1048
+ flowResult(functionEditorState.cancelFuncRun()),
1031
1049
  );
1032
1050
 
1033
1051
  const generatePlan = applicationStore.guardUnhandledError(() =>
@@ -1083,7 +1101,7 @@ export const FunctionEditor = observer(() => {
1083
1101
  </div>
1084
1102
  <div className="panel__header__actions">
1085
1103
  <div className="btn__dropdown-combo btn__dropdown-combo--primary">
1086
- {functionEditorState.isRunningQuery ? (
1104
+ {functionEditorState.isRunningFunc ? (
1087
1105
  <button
1088
1106
  className="btn__dropdown-combo__canceler"
1089
1107
  onClick={cancelQuery}
@@ -1100,15 +1118,13 @@ export const FunctionEditor = observer(() => {
1100
1118
  <>
1101
1119
  <button
1102
1120
  className="btn__dropdown-combo__label"
1103
- onClick={runQuery}
1104
- title="Run Query"
1121
+ onClick={runFunc}
1122
+ title="Run Function"
1105
1123
  disabled={executionIsRunning}
1106
1124
  tabIndex={-1}
1107
1125
  >
1108
1126
  <PlayIcon className="btn__dropdown-combo__label__icon" />
1109
- <div className="btn__dropdown-combo__label__title">
1110
- Run Query
1111
- </div>
1127
+ <div className="btn__dropdown-combo__label__title">Run</div>
1112
1128
  </button>
1113
1129
  <DropdownMenu
1114
1130
  className="btn__dropdown-combo__dropdown-btn"
@@ -1343,7 +1359,6 @@ export const FunctionEditor = observer(() => {
1343
1359
  <ExecutionPlanViewer
1344
1360
  executionPlanState={functionEditorState.executionPlanState}
1345
1361
  />
1346
- <ExecutionResultViewer functionEditorState={functionEditorState} />
1347
1362
  {functionEditorState.parametersState.parameterValuesEditorState
1348
1363
  .showModal && (
1349
1364
  <LambdaParameterValuesEditor
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { observer } from 'mobx-react-lite';
18
+ import {
19
+ Dialog,
20
+ ResizablePanelGroup,
21
+ ResizablePanel,
22
+ ResizablePanelSplitter,
23
+ PanelLoadingIndicator,
24
+ PanelContent,
25
+ Modal,
26
+ ModalHeader,
27
+ ModalBody,
28
+ ModalFooter,
29
+ ModalTitle,
30
+ ModalHeaderActions,
31
+ TimesIcon,
32
+ ModalFooterButton,
33
+ BlankPanelContent,
34
+ PanelHeader,
35
+ Panel,
36
+ } from '@finos/legend-art';
37
+ import { useEffect } from 'react';
38
+ import { noop } from '@finos/legend-shared';
39
+ import {
40
+ useApplicationStore,
41
+ useConditionedApplicationNavigationContext,
42
+ } from '@finos/legend-application';
43
+ import { flowResult } from 'mobx';
44
+ import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../../__lib__/LegendStudioApplicationNavigationContext.js';
45
+ import {
46
+ CODE_EDITOR_LANGUAGE,
47
+ CodeEditor,
48
+ } from '@finos/legend-lego/code-editor';
49
+ import type { DatabaseBuilderWizardState } from '../../../../stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js';
50
+ import { DatabaseSchemaExplorer } from './DatabaseSchemaExplorer.js';
51
+
52
+ export const DatabaseBuilderWizard = observer(
53
+ (props: {
54
+ databaseBuilderState: DatabaseBuilderWizardState;
55
+ isReadOnly: boolean;
56
+ }) => {
57
+ const { databaseBuilderState, isReadOnly } = props;
58
+ const schemaExplorerState = databaseBuilderState.schemaExplorerState;
59
+ const applicationStore = useApplicationStore();
60
+ const preview = applicationStore.guardUnhandledError(() =>
61
+ flowResult(databaseBuilderState.previewDatabaseModel()),
62
+ );
63
+ const updateDatabase = applicationStore.guardUnhandledError(() =>
64
+ flowResult(databaseBuilderState.updateDatabase()),
65
+ );
66
+ const closeModal = (): void => {
67
+ databaseBuilderState.setShowModal(false);
68
+ databaseBuilderState.editorStore.explorerTreeState.setDatabaseBuilderState(
69
+ undefined,
70
+ );
71
+ };
72
+ const isExecutingAction =
73
+ schemaExplorerState.isGeneratingDatabase ||
74
+ schemaExplorerState.isUpdatingDatabase;
75
+
76
+ useEffect(() => {
77
+ flowResult(schemaExplorerState.fetchDatabaseMetadata()).catch(
78
+ applicationStore.alertUnhandledError,
79
+ );
80
+ }, [applicationStore, schemaExplorerState]);
81
+
82
+ useConditionedApplicationNavigationContext(
83
+ LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.DATABASE_BUILDER,
84
+ databaseBuilderState.showModal,
85
+ );
86
+
87
+ return (
88
+ <Dialog
89
+ open={databaseBuilderState.showModal}
90
+ onClose={noop} // disallow closing dialog by using Esc key or clicking on the backdrop
91
+ classes={{ container: 'search-modal__container' }}
92
+ PaperProps={{
93
+ classes: {
94
+ root: 'search-modal__inner-container database-builder__container',
95
+ },
96
+ }}
97
+ >
98
+ <Modal darkMode={true} className="database-builder">
99
+ <ModalHeader>
100
+ <ModalTitle title="Database Builder" />
101
+ <ModalHeaderActions>
102
+ <button
103
+ className="modal__header__action"
104
+ tabIndex={-1}
105
+ onClick={closeModal}
106
+ >
107
+ <TimesIcon />
108
+ </button>
109
+ </ModalHeaderActions>
110
+ </ModalHeader>
111
+ <ModalBody className="database-builder__content">
112
+ <PanelLoadingIndicator isLoading={isExecutingAction} />
113
+ <ResizablePanelGroup orientation="vertical">
114
+ <ResizablePanel size={450}>
115
+ <div className="database-builder__config">
116
+ <PanelHeader title="schema explorer" />
117
+ <PanelContent className="database-builder__config__content">
118
+ {schemaExplorerState.treeData && (
119
+ <DatabaseSchemaExplorer
120
+ treeData={schemaExplorerState.treeData}
121
+ isReadOnly={false}
122
+ schemaExplorerState={
123
+ databaseBuilderState.schemaExplorerState
124
+ }
125
+ />
126
+ )}
127
+ </PanelContent>
128
+ </div>
129
+ </ResizablePanel>
130
+ <ResizablePanelSplitter />
131
+ <ResizablePanel>
132
+ <Panel className="database-builder__model">
133
+ <PanelHeader title="database model" />
134
+
135
+ <PanelContent>
136
+ <div className="database-builder__modeller">
137
+ <div className="panel__content__form__section database-builder__modeller__path">
138
+ <div className="panel__content__form__section__header__label">
139
+ Target Database Path
140
+ </div>
141
+ <input
142
+ className="panel__content__form__section__input"
143
+ spellCheck={false}
144
+ disabled={true}
145
+ value={schemaExplorerState.database.path}
146
+ />
147
+ </div>
148
+ <div className="database-builder__modeller__preview">
149
+ {databaseBuilderState.databaseGrammarCode && (
150
+ <CodeEditor
151
+ language={CODE_EDITOR_LANGUAGE.PURE}
152
+ inputValue={
153
+ databaseBuilderState.databaseGrammarCode
154
+ }
155
+ isReadOnly={true}
156
+ />
157
+ )}
158
+ {!databaseBuilderState.databaseGrammarCode && (
159
+ <BlankPanelContent>
160
+ No database preview
161
+ </BlankPanelContent>
162
+ )}
163
+ </div>
164
+ </div>
165
+ </PanelContent>
166
+ </Panel>
167
+ </ResizablePanel>
168
+ </ResizablePanelGroup>
169
+ </ModalBody>
170
+ <ModalFooter>
171
+ <ModalFooterButton
172
+ className="database-builder__action--btn"
173
+ disabled={isReadOnly || isExecutingAction}
174
+ onClick={preview}
175
+ title="Preview database model..."
176
+ >
177
+ Preview
178
+ </ModalFooterButton>
179
+ <ModalFooterButton
180
+ className="database-builder__action--btn"
181
+ disabled={isReadOnly || isExecutingAction}
182
+ onClick={updateDatabase}
183
+ >
184
+ Update Database
185
+ </ModalFooterButton>
186
+ </ModalFooter>
187
+ </Modal>
188
+ </Dialog>
189
+ );
190
+ },
191
+ );