@finos/legend-application-studio 26.1.10 → 27.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/application/LegendStudioApplicationConfig.d.ts +4 -0
- package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.js +4 -0
- package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
- package/lib/components/editor/QuickInput.d.ts.map +1 -1
- package/lib/components/editor/QuickInput.js +4 -2
- package/lib/components/editor/QuickInput.js.map +1 -1
- package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/FunctionEditor.js +13 -6
- package/lib/components/editor/editor-group/FunctionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js +1 -1
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.js +6 -10
- package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js +1 -1
- package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.js +13 -12
- package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingExplorer.js +2 -2
- package/lib/components/editor/editor-group/mapping-editor/MappingExplorer.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js +3 -7
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js.map +1 -1
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js +6 -6
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js +10 -14
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js +9 -3
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +36 -4
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/components/editor/side-bar/testable/GlobalTestRunner.d.ts.map +1 -1
- package/lib/components/editor/side-bar/testable/GlobalTestRunner.js +15 -14
- package/lib/components/editor/side-bar/testable/GlobalTestRunner.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +5 -5
- package/lib/stores/LegendStudioApplicationPlugin.d.ts +7 -7
- package/lib/stores/LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendStudioApplicationPlugin.js.map +1 -1
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +2 -0
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/lib/stores/editor/GraphEditFormModeState.d.ts.map +1 -1
- package/lib/stores/editor/GraphEditFormModeState.js +0 -1
- package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +5 -3
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/lib/stores/editor/QuickInputState.d.ts +3 -0
- package/lib/stores/editor/QuickInputState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +14 -7
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js +48 -48
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts +4 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js +37 -12
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServicePostValidationState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServicePostValidationState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +3 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.d.ts +1 -1
- package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.js +2 -2
- package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.js.map +1 -1
- package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js +1 -1
- package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js.map +1 -1
- package/lib/stores/editor/utils/MockDataUtils.d.ts +1 -1
- package/lib/stores/editor/utils/MockDataUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/MockDataUtils.js.map +1 -1
- package/lib/stores/editor/utils/PackageTreeUtils.js +3 -3
- package/lib/stores/editor/utils/PackageTreeUtils.js.map +1 -1
- package/package.json +15 -15
- package/src/application/LegendStudioApplicationConfig.ts +5 -0
- package/src/components/editor/QuickInput.tsx +5 -1
- package/src/components/editor/editor-group/FunctionEditor.tsx +67 -55
- package/src/components/editor/editor-group/data-editor/RelationalCSVDataEditor.tsx +1 -0
- package/src/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.tsx +63 -69
- package/src/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.tsx +1 -1
- package/src/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.tsx +69 -48
- package/src/components/editor/editor-group/mapping-editor/MappingExplorer.tsx +2 -2
- package/src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx +8 -12
- package/src/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.tsx +6 -10
- package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +91 -99
- package/src/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.tsx +13 -5
- package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +3 -0
- package/src/components/editor/side-bar/Explorer.tsx +83 -1
- package/src/components/editor/side-bar/testable/GlobalTestRunner.tsx +21 -23
- package/src/stores/LegendStudioApplicationPlugin.ts +7 -11
- package/src/stores/editor/EditorStore.ts +3 -0
- package/src/stores/editor/GraphEditFormModeState.ts +0 -1
- package/src/stores/editor/NewElementState.ts +6 -3
- package/src/stores/editor/QuickInputState.ts +3 -0
- package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +18 -8
- package/src/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.ts +70 -69
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts +62 -36
- package/src/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.ts +5 -5
- package/src/stores/editor/editor-state/element-editor-state/service/ServicePostValidationState.ts +1 -1
- package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +12 -2
- package/src/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.ts +2 -2
- package/src/stores/editor/sidebar-state/BulkServiceRegistrationState.ts +1 -1
- package/src/stores/editor/utils/MockDataUtils.ts +1 -1
- package/src/stores/editor/utils/PackageTreeUtils.ts +3 -3
@@ -14,7 +14,13 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import
|
17
|
+
import React, {
|
18
|
+
Fragment,
|
19
|
+
useRef,
|
20
|
+
useEffect,
|
21
|
+
useState,
|
22
|
+
forwardRef,
|
23
|
+
} from 'react';
|
18
24
|
import { observer } from 'mobx-react-lite';
|
19
25
|
import {
|
20
26
|
type TreeNodeContainerProps,
|
@@ -61,6 +67,7 @@ import { LEGEND_STUDIO_TEST_ID } from '../../../__lib__/LegendStudioTesting.js';
|
|
61
67
|
import {
|
62
68
|
ACTIVITY_MODE,
|
63
69
|
GRAPH_EDITOR_MODE,
|
70
|
+
PANEL_MODE,
|
64
71
|
} from '../../../stores/editor/EditorConfig.js';
|
65
72
|
import { getTreeChildNodes } from '../../../stores/editor/utils/PackageTreeUtils.js';
|
66
73
|
import type { PackageTreeNodeData } from '../../../stores/editor/utils/TreeUtils.js';
|
@@ -76,6 +83,7 @@ import {
|
|
76
83
|
import {
|
77
84
|
guaranteeNonEmptyString,
|
78
85
|
guaranteeNonNullable,
|
86
|
+
guaranteeType,
|
79
87
|
isNonNullable,
|
80
88
|
toTitleCase,
|
81
89
|
} from '@finos/legend-shared';
|
@@ -102,6 +110,7 @@ import {
|
|
102
110
|
RelationalDatabaseConnection,
|
103
111
|
guaranteeRelationalDatabaseConnection,
|
104
112
|
extractDependencyGACoordinateFromRootPackageName,
|
113
|
+
type FunctionActivatorConfiguration,
|
105
114
|
} from '@finos/legend-graph';
|
106
115
|
import { useApplicationStore } from '@finos/legend-application';
|
107
116
|
import {
|
@@ -125,6 +134,7 @@ import {
|
|
125
134
|
CodeEditor,
|
126
135
|
} from '@finos/legend-lego/code-editor';
|
127
136
|
import { DatabaseBuilder } from '../editor-group/connection-editor/DatabaseBuilder.js';
|
137
|
+
import { FunctionEditorState } from '../../../stores/editor/editor-state/element-editor-state/FunctionEditorState.js';
|
128
138
|
|
129
139
|
const ElementRenamer = observer(() => {
|
130
140
|
const editorStore = useEditorStore();
|
@@ -513,6 +523,15 @@ const ExplorerContextMenu = observer(
|
|
513
523
|
}
|
514
524
|
},
|
515
525
|
);
|
526
|
+
const openSQLPlayground = (): void => {
|
527
|
+
if (isRelationalDatabaseConnection(node?.packageableElement)) {
|
528
|
+
editorStore.panelGroupDisplayState.open();
|
529
|
+
editorStore.setActivePanelMode(PANEL_MODE.SQL_PLAYGROUND);
|
530
|
+
editorStore.sqlPlaygroundState.setConnection(
|
531
|
+
guaranteeType(node?.packageableElement, PackageableConnection),
|
532
|
+
);
|
533
|
+
}
|
534
|
+
};
|
516
535
|
const removeElement = (): void => {
|
517
536
|
if (node) {
|
518
537
|
flowResult(
|
@@ -663,6 +682,50 @@ const ExplorerContextMenu = observer(
|
|
663
682
|
).catch(applicationStore.alertUnhandledError);
|
664
683
|
}
|
665
684
|
};
|
685
|
+
const activateFunction = (): void => {
|
686
|
+
if (node?.packageableElement instanceof ConcreteFunctionDefinition) {
|
687
|
+
editorStore.setQuickInputState({
|
688
|
+
title: 'Activate function',
|
689
|
+
placeholder: 'Select an activation...',
|
690
|
+
options: editorStore.graphState.functionActivatorConfigurations.map(
|
691
|
+
(config) => ({
|
692
|
+
value: config,
|
693
|
+
label: (
|
694
|
+
<div
|
695
|
+
className="function-editor__activator__selector__option"
|
696
|
+
title={config.description}
|
697
|
+
>
|
698
|
+
<div className="function-editor__activator__selector__option__name">
|
699
|
+
{config.name}
|
700
|
+
</div>
|
701
|
+
<div className="function-editor__activator__selector__option__description">
|
702
|
+
{config.description}
|
703
|
+
</div>
|
704
|
+
</div>
|
705
|
+
),
|
706
|
+
}),
|
707
|
+
),
|
708
|
+
getSearchValue: (option: {
|
709
|
+
value: FunctionActivatorConfiguration;
|
710
|
+
label: React.ReactNode;
|
711
|
+
}): string => option.value.name,
|
712
|
+
onSelect: (option: {
|
713
|
+
value: FunctionActivatorConfiguration;
|
714
|
+
label: React.ReactNode;
|
715
|
+
}) => {
|
716
|
+
editorStore.graphEditorMode.openElement(node.packageableElement);
|
717
|
+
editorStore.tabManagerState
|
718
|
+
.getCurrentEditorState(FunctionEditorState)
|
719
|
+
.activatorBuilderState.setCurrentActivatorConfiguration(
|
720
|
+
option.value,
|
721
|
+
);
|
722
|
+
},
|
723
|
+
customization: {
|
724
|
+
rowHeight: 70,
|
725
|
+
},
|
726
|
+
});
|
727
|
+
}
|
728
|
+
};
|
666
729
|
|
667
730
|
if (isDependencyProjectRoot()) {
|
668
731
|
return (
|
@@ -722,8 +785,27 @@ const ExplorerContextMenu = observer(
|
|
722
785
|
<MenuContentDivider />
|
723
786
|
</>
|
724
787
|
)}
|
788
|
+
{node.packageableElement instanceof ConcreteFunctionDefinition && (
|
789
|
+
<>
|
790
|
+
{editorStore.applicationStore.config.options
|
791
|
+
.TEMPORARY__enableFunctionActivatorSupport && (
|
792
|
+
<>
|
793
|
+
<MenuContentItem onClick={activateFunction}>
|
794
|
+
Activate...
|
795
|
+
</MenuContentItem>
|
796
|
+
<MenuContentDivider />
|
797
|
+
</>
|
798
|
+
)}
|
799
|
+
</>
|
800
|
+
)}
|
725
801
|
{isRelationalDatabaseConnection(node.packageableElement) && (
|
726
802
|
<>
|
803
|
+
{editorStore.applicationStore.config.options
|
804
|
+
.TEMPORARY__enableRawSQLExecutor && (
|
805
|
+
<MenuContentItem onClick={openSQLPlayground}>
|
806
|
+
Execute SQL...
|
807
|
+
</MenuContentItem>
|
808
|
+
)}
|
727
809
|
<MenuContentItem onClick={buildDatabase}>
|
728
810
|
Build Database...
|
729
811
|
</MenuContentItem>
|
@@ -54,7 +54,6 @@ import {
|
|
54
54
|
type GeneratorFn,
|
55
55
|
isNonNullable,
|
56
56
|
prettyCONSTName,
|
57
|
-
toTitleCase,
|
58
57
|
} from '@finos/legend-shared';
|
59
58
|
import { observer } from 'mobx-react-lite';
|
60
59
|
import { forwardRef, useEffect, useState } from 'react';
|
@@ -429,23 +428,28 @@ export const GlobalTestRunner = observer(
|
|
429
428
|
const editorStore = useEditorStore();
|
430
429
|
const globalTestRunnerState = props.globalTestRunnerState;
|
431
430
|
const isDispatchingAction = globalTestRunnerState.isDispatchingAction;
|
432
|
-
const testRunnerTabs = (Object.values(TEST_RUNNER_TABS) as string[])
|
433
|
-
.concat(
|
434
|
-
editorStore.pluginManager
|
435
|
-
.getApplicationPlugins()
|
436
|
-
.flatMap(
|
437
|
-
(plugin) => plugin.getExtraTestRunnerTabClassifiers?.() ?? [],
|
438
|
-
),
|
439
|
-
)
|
440
|
-
.map((e) => ({
|
441
|
-
value: e,
|
442
|
-
label: prettyCONSTName(e),
|
443
|
-
}));
|
444
431
|
|
445
432
|
const [selectedTab, setSelectedTab] = useState(
|
446
433
|
TEST_RUNNER_TABS.TEST_RUNNER.valueOf(),
|
447
434
|
);
|
448
435
|
|
436
|
+
const extractTestRunnerTabConfigurations = editorStore.pluginManager
|
437
|
+
.getApplicationPlugins()
|
438
|
+
.flatMap((plugin) => plugin.getExtraTestRunnerTabConfigurations?.() ?? [])
|
439
|
+
.filter((configuration) => configuration.renderer(editorStore));
|
440
|
+
|
441
|
+
const testRunnerTabs = (Object.values(TEST_RUNNER_TABS) as string[])
|
442
|
+
.map((e) => ({
|
443
|
+
value: e,
|
444
|
+
label: prettyCONSTName(e),
|
445
|
+
}))
|
446
|
+
.concat(
|
447
|
+
extractTestRunnerTabConfigurations.map((config) => ({
|
448
|
+
value: config.key,
|
449
|
+
label: config.title,
|
450
|
+
})),
|
451
|
+
);
|
452
|
+
|
449
453
|
const changeTab = (tab: string): void => {
|
450
454
|
setSelectedTab(tab);
|
451
455
|
};
|
@@ -544,7 +548,7 @@ export const GlobalTestRunner = observer(
|
|
544
548
|
['panel__header__tab--active']: tab.value === selectedTab,
|
545
549
|
})}
|
546
550
|
>
|
547
|
-
{
|
551
|
+
{tab.label}
|
548
552
|
</div>
|
549
553
|
))}
|
550
554
|
</div>
|
@@ -578,15 +582,9 @@ export const GlobalTestRunner = observer(
|
|
578
582
|
</div>
|
579
583
|
);
|
580
584
|
} else {
|
581
|
-
const
|
582
|
-
.
|
583
|
-
|
584
|
-
(plugin) => plugin.getExtraTestRunnerTabEditorRenderers?.() ?? [],
|
585
|
-
);
|
586
|
-
for (const editorRenderer of extraTestRunnerTabEditorRenderers) {
|
587
|
-
const editor = editorRenderer(selectedTab, editorStore);
|
588
|
-
if (editor) {
|
589
|
-
return editor;
|
585
|
+
for (const testRunnerTabConfiguration of extractTestRunnerTabConfigurations) {
|
586
|
+
if (testRunnerTabConfiguration.key === selectedTab) {
|
587
|
+
return testRunnerTabConfiguration.renderer(editorStore);
|
590
588
|
}
|
591
589
|
}
|
592
590
|
return (
|
@@ -77,10 +77,11 @@ export type TestableMetadataGetter = (
|
|
77
77
|
editorStore: EditorStore,
|
78
78
|
) => TestableMetadata | undefined;
|
79
79
|
|
80
|
-
export type
|
81
|
-
|
82
|
-
|
83
|
-
) => React.ReactNode | undefined;
|
80
|
+
export type TestRunnerTabConfiguration = {
|
81
|
+
key: string;
|
82
|
+
title: string;
|
83
|
+
renderer: (editorStore: EditorStore) => React.ReactNode | undefined;
|
84
|
+
};
|
84
85
|
|
85
86
|
export abstract class LegendStudioApplicationPlugin extends LegendApplicationPlugin {
|
86
87
|
/**
|
@@ -126,14 +127,9 @@ export abstract class LegendStudioApplicationPlugin extends LegendApplicationPlu
|
|
126
127
|
getExtraTestableMetadata?(): TestableMetadataGetter[];
|
127
128
|
|
128
129
|
/**
|
129
|
-
* Get the list of the
|
130
|
-
*/
|
131
|
-
getExtraTestRunnerTabClassifiers?(): string[];
|
132
|
-
|
133
|
-
/**
|
134
|
-
* Get the list of renderers for the editor for a test runner tab.
|
130
|
+
* Get the list of configurations for the editor for a test runner tab.
|
135
131
|
*/
|
136
|
-
|
132
|
+
getExtraTestRunnerTabConfigurations?(): TestRunnerTabConfiguration[];
|
137
133
|
}
|
138
134
|
|
139
135
|
export type PureGrammarElementLabeler = (
|
@@ -671,6 +671,9 @@ export class EditorStore implements CommandRegistrar {
|
|
671
671
|
},
|
672
672
|
{
|
673
673
|
tracerService: this.applicationStore.tracerService,
|
674
|
+
TEMPORARY__enableNewServiceRegistrationInputCollectorMechanism:
|
675
|
+
this.applicationStore.config.options
|
676
|
+
.TEMPORARY__enableNewServiceRegistrationInputCollectorMechanism,
|
674
677
|
},
|
675
678
|
),
|
676
679
|
]);
|
@@ -66,7 +66,6 @@ import {
|
|
66
66
|
PackageableElementExplicitReference,
|
67
67
|
RelationalDatabaseConnection,
|
68
68
|
DatabaseType,
|
69
|
-
StaticDatasourceSpecification,
|
70
69
|
DefaultH2AuthenticationStrategy,
|
71
70
|
ModelGenerationSpecification,
|
72
71
|
DataElement,
|
@@ -74,6 +73,7 @@ import {
|
|
74
73
|
Measure,
|
75
74
|
Multiplicity,
|
76
75
|
PrimitiveType,
|
76
|
+
LocalH2DatasourceSpecification,
|
77
77
|
} from '@finos/legend-graph';
|
78
78
|
import type { DSL_Mapping_LegendStudioApplicationPlugin_Extension } from '../extensions/DSL_Mapping_LegendStudioApplicationPlugin_Extension.js';
|
79
79
|
import {
|
@@ -302,6 +302,8 @@ export class NewFlatDataConnectionDriver extends NewConnectionValueDriver<FlatDa
|
|
302
302
|
}
|
303
303
|
}
|
304
304
|
|
305
|
+
const DEFAULT_H2_SQL =
|
306
|
+
'-- loads sample data for getting started. See https://github.com/pthom/northwind_psql for more info\n call loadNorthwindData()';
|
305
307
|
export class NewRelationalDatabaseConnectionDriver extends NewConnectionValueDriver<RelationalDatabaseConnection> {
|
306
308
|
constructor(editorStore: EditorStore) {
|
307
309
|
super(editorStore);
|
@@ -327,10 +329,12 @@ export class NewRelationalDatabaseConnectionDriver extends NewConnectionValueDri
|
|
327
329
|
const dbs = this.editorStore.graphManagerState.usableDatabases;
|
328
330
|
selectedStore = dbs.length ? (dbs[0] as Database) : stub_Database();
|
329
331
|
}
|
332
|
+
const spec = new LocalH2DatasourceSpecification();
|
333
|
+
spec.testDataSetupSqls = [DEFAULT_H2_SQL];
|
330
334
|
return new RelationalDatabaseConnection(
|
331
335
|
PackageableElementExplicitReference.create(selectedStore),
|
332
336
|
DatabaseType.H2,
|
333
|
-
|
337
|
+
spec,
|
334
338
|
new DefaultH2AuthenticationStrategy(),
|
335
339
|
);
|
336
340
|
}
|
@@ -440,7 +444,6 @@ export class NewPackageableConnectionDriver extends NewElementDriver<Packageable
|
|
440
444
|
this.store = store;
|
441
445
|
this.newConnectionValueDriver = newDriver;
|
442
446
|
}
|
443
|
-
return;
|
444
447
|
}
|
445
448
|
|
446
449
|
get isValid(): boolean {
|
@@ -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
|
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
|
);
|
package/src/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.ts
CHANGED
@@ -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;
|