@finos/legend-application-studio 28.12.1 → 28.13.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/__lib__/LegendStudioTesting.d.ts +1 -0
- package/lib/__lib__/LegendStudioTesting.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioTesting.js +1 -0
- package/lib/__lib__/LegendStudioTesting.js.map +1 -1
- package/lib/components/ElementIconUtils.d.ts.map +1 -1
- package/lib/components/ElementIconUtils.js +3 -1
- package/lib/components/ElementIconUtils.js.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.js +3 -3
- package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.d.ts +7 -0
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +8 -1
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts +26 -0
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts.map +1 -0
- package/lib/components/editor/editor-group/{FunctionEditor.js → function-activator/FunctionEditor.js} +100 -18
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js.map +1 -0
- package/lib/components/editor/editor-group/function-activator/INTERNAL__UnknownFunctionActivatorEdtior.d.ts.map +1 -0
- package/lib/components/editor/editor-group/{INTERNAL__UnknownFunctionActivatorEdtior.js → function-activator/INTERNAL__UnknownFunctionActivatorEdtior.js} +3 -3
- package/lib/components/editor/editor-group/function-activator/INTERNAL__UnknownFunctionActivatorEdtior.js.map +1 -0
- package/lib/components/editor/editor-group/{FunctionEditor.d.ts → function-activator/SnowflakeAppFunctionActivatorEditor.d.ts} +2 -2
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.d.ts.map +1 -0
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js +84 -0
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js.map +1 -0
- package/lib/components/editor/editor-group/service-editor/ServiceEditor.js +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceEditor.js.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionEditor.js +5 -6
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionEditor.js.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +2 -8
- 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 +1 -3
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
- package/lib/stores/editor/EditorGraphState.js +4 -1
- package/lib/stores/editor/EditorGraphState.js.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.js +6 -2
- package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorPromoteState.d.ts +35 -0
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorPromoteState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorPromoteState.js +97 -0
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorPromoteState.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +2 -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 +4 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/{INTERNAL__UnknownFunctionActivatorEditorState.d.ts → function-activator/INTERNAL__UnknownFunctionActivatorEditorState.d.ts} +3 -3
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/INTERNAL__UnknownFunctionActivatorEditorState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/{INTERNAL__UnknownFunctionActivatorEditorState.js → function-activator/INTERNAL__UnknownFunctionActivatorEditorState.js} +4 -4
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/INTERNAL__UnknownFunctionActivatorEditorState.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.d.ts +33 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js +84 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js +2 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.d.ts +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js +6 -3
- 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/testable/ServiceTestDataState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/ModelClassifierUtils.js +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
- package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.d.ts +2 -2
- package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.js +4 -4
- package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.js.map +1 -1
- package/package.json +6 -6
- package/src/__lib__/LegendStudioTesting.ts +2 -0
- package/src/components/ElementIconUtils.tsx +3 -0
- package/src/components/editor/editor-group/EditorGroup.tsx +3 -3
- package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +29 -0
- package/src/components/editor/editor-group/{FunctionEditor.tsx → function-activator/FunctionEditor.tsx} +249 -16
- package/src/components/editor/editor-group/{INTERNAL__UnknownFunctionActivatorEdtior.tsx → function-activator/INTERNAL__UnknownFunctionActivatorEdtior.tsx} +3 -3
- package/src/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.tsx +260 -0
- package/src/components/editor/editor-group/service-editor/ServiceEditor.tsx +1 -1
- package/src/components/editor/editor-group/service-editor/ServiceExecutionEditor.tsx +17 -14
- package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +4 -27
- package/src/components/editor/side-bar/Explorer.tsx +3 -9
- package/src/index.ts +3 -0
- package/src/stores/editor/EditorGraphState.ts +9 -6
- package/src/stores/editor/EditorTabManagerState.ts +9 -2
- package/src/stores/editor/editor-state/element-editor-state/FunctionActivatorPromoteState.ts +127 -0
- package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +4 -1
- package/src/stores/editor/editor-state/element-editor-state/{INTERNAL__UnknownFunctionActivatorEditorState.ts → function-activator/INTERNAL__UnknownFunctionActivatorEditorState.ts} +5 -5
- package/src/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.ts +127 -0
- package/src/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.ts +4 -1
- package/src/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.ts +10 -4
- package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +1 -1
- package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +1 -1
- package/src/stores/editor/utils/ModelClassifierUtils.ts +1 -0
- package/src/stores/graph-modifier/DSL_Service_GraphModifierHelper.ts +7 -4
- package/tsconfig.json +6 -3
- package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +0 -1
- package/lib/components/editor/editor-group/FunctionEditor.js.map +0 -1
- package/lib/components/editor/editor-group/INTERNAL__UnknownFunctionActivatorEdtior.d.ts.map +0 -1
- package/lib/components/editor/editor-group/INTERNAL__UnknownFunctionActivatorEdtior.js.map +0 -1
- package/lib/stores/editor/editor-state/element-editor-state/INTERNAL__UnknownFunctionActivatorEditorState.d.ts.map +0 -1
- package/lib/stores/editor/editor-state/element-editor-state/INTERNAL__UnknownFunctionActivatorEditorState.js.map +0 -1
- /package/lib/components/editor/editor-group/{INTERNAL__UnknownFunctionActivatorEdtior.d.ts → function-activator/INTERNAL__UnknownFunctionActivatorEdtior.d.ts} +0 -0
@@ -366,14 +366,13 @@ export const ChangeExecutionModal = observer(
|
|
366
366
|
/>
|
367
367
|
);
|
368
368
|
} else if (executionState instanceof MultiServicePureExecutionState) {
|
369
|
-
const multiExec = executionState.execution;
|
370
369
|
const currentOption = executionState.singleExecutionKey
|
371
370
|
? {
|
372
371
|
value: executionState.singleExecutionKey,
|
373
372
|
label: executionState.singleExecutionKey.key,
|
374
373
|
}
|
375
374
|
: undefined;
|
376
|
-
const multiOptions =
|
375
|
+
const multiOptions = executionState.keyedExecutionParameters.map(
|
377
376
|
(keyExecutionParameter) => ({
|
378
377
|
value: keyExecutionParameter,
|
379
378
|
label: keyExecutionParameter.key,
|
@@ -554,7 +553,7 @@ export const NewExecutionParameterModal = observer(
|
|
554
553
|
const validationMessage =
|
555
554
|
keyValue === ''
|
556
555
|
? `Execution context key can't be empty`
|
557
|
-
: executionState.execution.executionParameters
|
556
|
+
: executionState.execution.executionParameters?.find(
|
558
557
|
(e) => e.key === keyValue,
|
559
558
|
)
|
560
559
|
? 'Execution context key already exists'
|
@@ -702,15 +701,19 @@ const MultiPureExecutionEditor = observer(
|
|
702
701
|
</PanelHeaderActions>
|
703
702
|
</PanelHeader>
|
704
703
|
|
705
|
-
{
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
704
|
+
{multiExecutionState.keyedExecutionParameters.map(
|
705
|
+
(executionParameter) => (
|
706
|
+
<KeyExecutionItem
|
707
|
+
key={executionParameter.key}
|
708
|
+
multiExecutionState={multiExecutionState}
|
709
|
+
keyExecutionParameter={executionParameter}
|
710
|
+
isReadOnly={
|
711
|
+
multiExecutionState.serviceEditorState.isReadOnly
|
712
|
+
}
|
713
|
+
/>
|
714
|
+
),
|
715
|
+
)}
|
716
|
+
{!multiExecutionState.keyedExecutionParameters.length && (
|
714
717
|
<BlankPanelPlaceholder
|
715
718
|
text="Add an execution context"
|
716
719
|
onClick={addExecutionKey}
|
@@ -780,7 +783,7 @@ const ServicePureExecutionEditor = observer(
|
|
780
783
|
const showChangeExecutionModal = (): void => {
|
781
784
|
if (servicePureExecutionState instanceof MultiServicePureExecutionState) {
|
782
785
|
servicePureExecutionState.setSingleExecutionKey(
|
783
|
-
servicePureExecutionState.
|
786
|
+
servicePureExecutionState.keyedExecutionParameters[0],
|
784
787
|
);
|
785
788
|
}
|
786
789
|
servicePureExecutionState.setShowChangeExecModal(true);
|
@@ -905,7 +908,7 @@ export const ServiceExecutionEditor = observer(() => {
|
|
905
908
|
}
|
906
909
|
return (
|
907
910
|
<UnsupportedEditorPanel
|
908
|
-
text="Can't display
|
911
|
+
text="Can't display this service execution in form-mode"
|
909
912
|
isReadOnly={serviceState.isReadOnly}
|
910
913
|
/>
|
911
914
|
);
|
@@ -54,7 +54,6 @@ import {
|
|
54
54
|
import {
|
55
55
|
PackageableConnection,
|
56
56
|
RelationalDatabaseConnection,
|
57
|
-
guaranteeRelationalDatabaseConnection,
|
58
57
|
} from '@finos/legend-graph';
|
59
58
|
import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../__lib__/LegendStudioApplicationNavigationContext.js';
|
60
59
|
import { type SQLPlaygroundPanelState } from '../../../stores/editor/panel-group/SQLPlaygroundPanelState.js';
|
@@ -81,6 +80,10 @@ import {
|
|
81
80
|
type DatabaseSchemaExplorerTreeNodeContainerProps,
|
82
81
|
} from '../editor-group/connection-editor/DatabaseSchemaExplorer.js';
|
83
82
|
import { DatabaseSchemaExplorerTreeTableNodeData } from '../../../stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js';
|
83
|
+
import {
|
84
|
+
buildRelationalDatabaseConnectionOption,
|
85
|
+
type RelationalDatabaseConnectionOption,
|
86
|
+
} from '../editor-group/connection-editor/RelationalDatabaseConnectionEditor.js';
|
84
87
|
|
85
88
|
const DATABASE_NODE_DND_TYPE = 'DATABASE_NODE_DND_TYPE';
|
86
89
|
type DatabaseNodeDragType = { text: string };
|
@@ -108,32 +111,6 @@ const SQLPlaygroundDatabaseSchemaExplorerTreeNodeContainer = observer(
|
|
108
111
|
},
|
109
112
|
);
|
110
113
|
|
111
|
-
type RelationalDatabaseConnectionOption = {
|
112
|
-
label: React.ReactNode;
|
113
|
-
value: PackageableConnection;
|
114
|
-
};
|
115
|
-
const buildRelationalDatabaseConnectionOption = (
|
116
|
-
connection: PackageableConnection,
|
117
|
-
): RelationalDatabaseConnectionOption => {
|
118
|
-
const connectionValue = guaranteeRelationalDatabaseConnection(connection);
|
119
|
-
return {
|
120
|
-
value: connection,
|
121
|
-
label: (
|
122
|
-
<div className="sql-playground__config__connection-selector__option">
|
123
|
-
<div className="sql-playground__config__connection-selector__option__label">
|
124
|
-
{connection.name}
|
125
|
-
</div>
|
126
|
-
<div className="sql-playground__config__connection-selector__option__type">
|
127
|
-
{connectionValue.type}
|
128
|
-
</div>
|
129
|
-
<div className="sql-playground__config__connection-selector__option__path">
|
130
|
-
{connection.path}
|
131
|
-
</div>
|
132
|
-
</div>
|
133
|
-
),
|
134
|
-
};
|
135
|
-
};
|
136
|
-
|
137
114
|
// List of most popular SQL keywords
|
138
115
|
// See https://www.w3schools.com/sql/sql_ref_keywords.asp
|
139
116
|
const SQL_KEYWORDS = [
|
@@ -90,6 +90,8 @@ import {
|
|
90
90
|
import { flowResult } from 'mobx';
|
91
91
|
import { useEditorStore } from '../EditorStoreProvider.js';
|
92
92
|
import {
|
93
|
+
type PackageableElement,
|
94
|
+
type FunctionActivatorConfiguration,
|
93
95
|
ELEMENT_PATH_DELIMITER,
|
94
96
|
ROOT_PACKAGE_NAME,
|
95
97
|
Package,
|
@@ -105,15 +107,13 @@ import {
|
|
105
107
|
getFunctionSignature,
|
106
108
|
getFunctionNameWithPath,
|
107
109
|
getElementRootPackage,
|
108
|
-
type PackageableElement,
|
109
110
|
PackageableConnection,
|
110
|
-
RelationalDatabaseConnection,
|
111
111
|
guaranteeRelationalDatabaseConnection,
|
112
112
|
extractDependencyGACoordinateFromRootPackageName,
|
113
|
-
type FunctionActivatorConfiguration,
|
114
113
|
Database,
|
115
114
|
DEPENDENCY_ROOT_PACKAGE_PREFIX,
|
116
115
|
Service,
|
116
|
+
isRelationalDatabaseConnection,
|
117
117
|
} from '@finos/legend-graph';
|
118
118
|
import {
|
119
119
|
ActionAlertActionType,
|
@@ -459,12 +459,6 @@ const SampleDataGenerator = observer(() => {
|
|
459
459
|
);
|
460
460
|
});
|
461
461
|
|
462
|
-
const isRelationalDatabaseConnection = (
|
463
|
-
val: PackageableElement | undefined,
|
464
|
-
): boolean =>
|
465
|
-
val instanceof PackageableConnection &&
|
466
|
-
val.connectionValue instanceof RelationalDatabaseConnection;
|
467
|
-
|
468
462
|
const isRelationalDatabase = (
|
469
463
|
val: PackageableElement | undefined,
|
470
464
|
): Database | undefined => (val instanceof Database ? val : undefined);
|
package/src/index.ts
CHANGED
@@ -113,3 +113,6 @@ export {
|
|
113
113
|
EmbeddedDataState,
|
114
114
|
} from './stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.js';
|
115
115
|
export type { EmbeddedDataTypeOption } from './stores/editor/editor-state/element-editor-state/data/DataEditorState.js';
|
116
|
+
|
117
|
+
export { SnowflakeAppFunctionActivatorEdtiorState } from './stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js';
|
118
|
+
export { SnowflakeAppFunctionActivatorEditor } from './components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js';
|
@@ -57,8 +57,13 @@ import {
|
|
57
57
|
buildDependencyReport,
|
58
58
|
} from '@finos/legend-server-depot';
|
59
59
|
import {
|
60
|
-
GRAPH_MANAGER_EVENT,
|
61
60
|
type EngineError,
|
61
|
+
type PackageableElement,
|
62
|
+
type CompilationWarning,
|
63
|
+
type PureModel,
|
64
|
+
type FunctionActivatorConfiguration,
|
65
|
+
type RelationalDatabaseTypeConfiguration,
|
66
|
+
GRAPH_MANAGER_EVENT,
|
62
67
|
Package,
|
63
68
|
Profile,
|
64
69
|
PrimitiveType,
|
@@ -80,13 +85,9 @@ import {
|
|
80
85
|
DependencyGraphBuilderError,
|
81
86
|
GraphDataDeserializationError,
|
82
87
|
DataElement,
|
83
|
-
type PackageableElement,
|
84
|
-
type CompilationWarning,
|
85
|
-
type PureModel,
|
86
88
|
createGraphBuilderReport,
|
87
89
|
ExecutionEnvironmentInstance,
|
88
|
-
|
89
|
-
type RelationalDatabaseTypeConfiguration,
|
90
|
+
SnowflakeApp,
|
90
91
|
} from '@finos/legend-graph';
|
91
92
|
import { CONFIGURATION_EDITOR_TAB } from './editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js';
|
92
93
|
import { PACKAGEABLE_ELEMENT_TYPE } from './utils/ModelClassifierUtils.js';
|
@@ -832,6 +833,8 @@ export class EditorGraphState {
|
|
832
833
|
return PACKAGEABLE_ELEMENT_TYPE.DATA;
|
833
834
|
} else if (element instanceof ExecutionEnvironmentInstance) {
|
834
835
|
return PACKAGEABLE_ELEMENT_TYPE.EXECUTION_ENVIRONMENT;
|
836
|
+
} else if (element instanceof SnowflakeApp) {
|
837
|
+
return PACKAGEABLE_ELEMENT_TYPE.SNOWFLAKE_APP;
|
835
838
|
}
|
836
839
|
const extraElementTypeLabelGetters = this.editorStore.pluginManager
|
837
840
|
.getApplicationPlugins()
|
@@ -15,6 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import {
|
18
|
+
type PackageableElement,
|
18
19
|
Association,
|
19
20
|
Class,
|
20
21
|
ConcreteFunctionDefinition,
|
@@ -31,8 +32,8 @@ import {
|
|
31
32
|
PrimitiveType,
|
32
33
|
Profile,
|
33
34
|
Service,
|
34
|
-
type PackageableElement,
|
35
35
|
INTERNAL__UnknownFunctionActivator,
|
36
|
+
SnowflakeApp,
|
36
37
|
} from '@finos/legend-graph';
|
37
38
|
import {
|
38
39
|
type Clazz,
|
@@ -58,7 +59,8 @@ import { UnsupportedElementEditorState } from './editor-state/UnsupportedElement
|
|
58
59
|
import type { EditorStore } from './EditorStore.js';
|
59
60
|
import type { DSL_LegendStudioApplicationPlugin_Extension } from '../LegendStudioApplicationPlugin.js';
|
60
61
|
import { TabManagerState } from '@finos/legend-lego/application';
|
61
|
-
import { INTERNAL__UnknownFunctionActivatorEdtiorState } from './editor-state/element-editor-state/INTERNAL__UnknownFunctionActivatorEditorState.js';
|
62
|
+
import { INTERNAL__UnknownFunctionActivatorEdtiorState } from './editor-state/element-editor-state/function-activator/INTERNAL__UnknownFunctionActivatorEditorState.js';
|
63
|
+
import { SnowflakeAppFunctionActivatorEdtiorState } from './editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js';
|
62
64
|
|
63
65
|
export class EditorTabManagerState extends TabManagerState {
|
64
66
|
readonly editorStore: EditorStore;
|
@@ -126,6 +128,11 @@ export class EditorTabManagerState extends TabManagerState {
|
|
126
128
|
return new FileGenerationEditorState(this.editorStore, element);
|
127
129
|
} else if (element instanceof DataElement) {
|
128
130
|
return new PackageableDataEditorState(this.editorStore, element);
|
131
|
+
} else if (element instanceof SnowflakeApp) {
|
132
|
+
return new SnowflakeAppFunctionActivatorEdtiorState(
|
133
|
+
this.editorStore,
|
134
|
+
element,
|
135
|
+
);
|
129
136
|
} else if (element instanceof INTERNAL__UnknownFunctionActivator) {
|
130
137
|
return new INTERNAL__UnknownFunctionActivatorEdtiorState(
|
131
138
|
this.editorStore,
|
@@ -0,0 +1,127 @@
|
|
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 { action, flow, flowResult, makeObservable, observable } from 'mobx';
|
18
|
+
import type { FunctionEditorState } from './FunctionEditorState.js';
|
19
|
+
import {
|
20
|
+
type ConcreteFunctionDefinition,
|
21
|
+
type FunctionActivator,
|
22
|
+
PackageableElementExplicitReference,
|
23
|
+
SnowflakeApp,
|
24
|
+
extractElementNameFromPath,
|
25
|
+
extractPackagePathFromPath,
|
26
|
+
SnowflakeAppDeploymentConfiguration,
|
27
|
+
} from '@finos/legend-graph';
|
28
|
+
import { type GeneratorFn } from '@finos/legend-shared';
|
29
|
+
import { FUNCTION_PROMOTE_TYPE } from '../../../../components/editor/editor-group/function-activator/FunctionEditor.js';
|
30
|
+
|
31
|
+
const BASE_ACTIVATOR_NAME = 'NewActivator';
|
32
|
+
|
33
|
+
export class FunctionActivatorPromoteState {
|
34
|
+
readonly functionEditorState: FunctionEditorState;
|
35
|
+
|
36
|
+
activatorPath: string;
|
37
|
+
isPromotingFunction = false;
|
38
|
+
isFunctionActivatorEditorOpen = false;
|
39
|
+
promoteType: string | undefined;
|
40
|
+
|
41
|
+
constructor(functionEditorState: FunctionEditorState) {
|
42
|
+
makeObservable(this, {
|
43
|
+
activatorPath: observable,
|
44
|
+
isPromotingFunction: observable,
|
45
|
+
isFunctionActivatorEditorOpen: observable,
|
46
|
+
promoteType: observable,
|
47
|
+
setPromoteType: action,
|
48
|
+
updateActivatorPath: action,
|
49
|
+
setIsPromotingFunction: action,
|
50
|
+
setIsFunctionActivatorEditorOpen: action,
|
51
|
+
promote: flow,
|
52
|
+
});
|
53
|
+
|
54
|
+
this.functionEditorState = functionEditorState;
|
55
|
+
this.activatorPath = `${this.functionEditorState.functionElement.package?.path}::${BASE_ACTIVATOR_NAME}`;
|
56
|
+
}
|
57
|
+
|
58
|
+
setIsPromotingFunction(val: boolean): void {
|
59
|
+
this.isPromotingFunction = val;
|
60
|
+
}
|
61
|
+
|
62
|
+
setIsFunctionActivatorEditorOpen(val: boolean): void {
|
63
|
+
this.isFunctionActivatorEditorOpen = val;
|
64
|
+
}
|
65
|
+
|
66
|
+
setPromoteType(val: string | undefined): void {
|
67
|
+
this.promoteType = val;
|
68
|
+
}
|
69
|
+
|
70
|
+
showFunctionPromoteModal(): void {
|
71
|
+
this.setIsPromotingFunction(true);
|
72
|
+
}
|
73
|
+
|
74
|
+
closeFunctionPromoteModal(): void {
|
75
|
+
this.setIsPromotingFunction(false);
|
76
|
+
}
|
77
|
+
|
78
|
+
updateActivatorPath(val: string): void {
|
79
|
+
this.activatorPath = val;
|
80
|
+
}
|
81
|
+
|
82
|
+
createFunctionActivator(
|
83
|
+
functionElement: ConcreteFunctionDefinition,
|
84
|
+
): FunctionActivator | undefined {
|
85
|
+
const type = this.promoteType;
|
86
|
+
switch (type) {
|
87
|
+
case FUNCTION_PROMOTE_TYPE.SNOWFLAKE_NATIVE_APP: {
|
88
|
+
const activatorName = this.activatorPath.includes('::')
|
89
|
+
? extractElementNameFromPath(this.activatorPath)
|
90
|
+
: this.activatorPath;
|
91
|
+
const snowflakeApp = new SnowflakeApp(activatorName);
|
92
|
+
snowflakeApp.applicationName = '';
|
93
|
+
snowflakeApp.description = '';
|
94
|
+
snowflakeApp.owner = undefined;
|
95
|
+
snowflakeApp.function =
|
96
|
+
PackageableElementExplicitReference.create(functionElement);
|
97
|
+
snowflakeApp.activationConfiguration =
|
98
|
+
new SnowflakeAppDeploymentConfiguration();
|
99
|
+
return snowflakeApp;
|
100
|
+
}
|
101
|
+
default:
|
102
|
+
return undefined;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
*promote(functionElement: ConcreteFunctionDefinition): GeneratorFn<void> {
|
107
|
+
const functionActivator = this.createFunctionActivator(functionElement);
|
108
|
+
if (!functionActivator) {
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
try {
|
112
|
+
yield flowResult(
|
113
|
+
this.functionEditorState.editorStore.graphEditorMode.addElement(
|
114
|
+
functionActivator,
|
115
|
+
extractPackagePathFromPath(this.activatorPath) ?? this.activatorPath,
|
116
|
+
true,
|
117
|
+
),
|
118
|
+
);
|
119
|
+
} catch {
|
120
|
+
this.functionEditorState.editorStore.applicationStore.notificationService.notifyError(
|
121
|
+
`Can't promote function`,
|
122
|
+
);
|
123
|
+
} finally {
|
124
|
+
this.setPromoteType(undefined);
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
@@ -66,6 +66,7 @@ import {
|
|
66
66
|
getExecutionQueryFromRawLambda,
|
67
67
|
} from '@finos/legend-query-builder';
|
68
68
|
import { FunctionActivatorBuilderState } from './FunctionActivatorBuilderState.js';
|
69
|
+
import { FunctionActivatorPromoteState } from './FunctionActivatorPromoteState.js';
|
69
70
|
|
70
71
|
export enum FUNCTION_EDITOR_TAB {
|
71
72
|
DEFINITION = 'DEFINITION',
|
@@ -243,7 +244,8 @@ export class FunctionParametersState extends LambdaParametersState {
|
|
243
244
|
|
244
245
|
export class FunctionEditorState extends ElementEditorState {
|
245
246
|
readonly functionDefinitionEditorState: FunctionDefinitionEditorState;
|
246
|
-
readonly activatorBuilderState: FunctionActivatorBuilderState;
|
247
|
+
readonly activatorBuilderState: FunctionActivatorBuilderState; // to be removed
|
248
|
+
readonly activatorPromoteState: FunctionActivatorPromoteState;
|
247
249
|
|
248
250
|
selectedTab: FUNCTION_EDITOR_TAB;
|
249
251
|
|
@@ -287,6 +289,7 @@ export class FunctionEditorState extends ElementEditorState {
|
|
287
289
|
this.editorStore,
|
288
290
|
);
|
289
291
|
this.activatorBuilderState = new FunctionActivatorBuilderState(this);
|
292
|
+
this.activatorPromoteState = new FunctionActivatorPromoteState(this);
|
290
293
|
this.executionPlanState = new ExecutionPlanState(
|
291
294
|
this.editorStore.applicationStore,
|
292
295
|
this.editorStore.graphManagerState,
|
@@ -19,8 +19,8 @@ import {
|
|
19
19
|
InMemoryGraphData,
|
20
20
|
type INTERNAL__UnknownFunctionActivator,
|
21
21
|
} from '@finos/legend-graph';
|
22
|
-
import type { EditorStore } from '
|
23
|
-
import { ElementEditorState } from '
|
22
|
+
import type { EditorStore } from '../../../EditorStore.js';
|
23
|
+
import { ElementEditorState } from '../ElementEditorState.js';
|
24
24
|
import { action, flow, makeObservable } from 'mobx';
|
25
25
|
import {
|
26
26
|
ActionState,
|
@@ -28,9 +28,9 @@ import {
|
|
28
28
|
type GeneratorFn,
|
29
29
|
type PlainObject,
|
30
30
|
} from '@finos/legend-shared';
|
31
|
-
import { ProtocolValueBuilderState } from '
|
32
|
-
import { INTERNAL__UnknownFunctionActivator_setContent } from '
|
33
|
-
import { FUNCTION_ACTIVATOR_EXCLUDED_PATHS } from '
|
31
|
+
import { ProtocolValueBuilderState } from '../ProtocolValueBuilderState.js';
|
32
|
+
import { INTERNAL__UnknownFunctionActivator_setContent } from '../../../../graph-modifier/DomainGraphModifierHelper.js';
|
33
|
+
import { FUNCTION_ACTIVATOR_EXCLUDED_PATHS } from '../FunctionActivatorBuilderState.js';
|
34
34
|
|
35
35
|
export class INTERNAL__UnknownFunctionActivatorEdtiorState extends ElementEditorState {
|
36
36
|
readonly activator: INTERNAL__UnknownFunctionActivator;
|
@@ -0,0 +1,127 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import {
|
18
|
+
SnowflakeApp,
|
19
|
+
type PackageableConnection,
|
20
|
+
ConnectionPointer,
|
21
|
+
InMemoryGraphData,
|
22
|
+
PackageableElementExplicitReference,
|
23
|
+
observe_SnowflakeAppDeploymentConfiguration,
|
24
|
+
observe_SnowflakeApp,
|
25
|
+
} from '@finos/legend-graph';
|
26
|
+
import {
|
27
|
+
ActionState,
|
28
|
+
assertErrorThrown,
|
29
|
+
guaranteeType,
|
30
|
+
type GeneratorFn,
|
31
|
+
} from '@finos/legend-shared';
|
32
|
+
import { makeObservable, action, flow, computed } from 'mobx';
|
33
|
+
import type { EditorStore } from '../../../EditorStore.js';
|
34
|
+
import { ElementEditorState } from '../ElementEditorState.js';
|
35
|
+
|
36
|
+
export class SnowflakeAppFunctionActivatorEdtiorState extends ElementEditorState {
|
37
|
+
readonly validateState = ActionState.create();
|
38
|
+
readonly deployState = ActionState.create();
|
39
|
+
|
40
|
+
constructor(editorStore: EditorStore, element: SnowflakeApp) {
|
41
|
+
super(editorStore, element);
|
42
|
+
|
43
|
+
makeObservable(this, {
|
44
|
+
activator: computed,
|
45
|
+
reprocess: action,
|
46
|
+
updateOwner: action,
|
47
|
+
updateAppDescription: action,
|
48
|
+
updateApplicationName: action,
|
49
|
+
updateConnection: action,
|
50
|
+
validate: flow,
|
51
|
+
deploy: flow,
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
get activator(): SnowflakeApp {
|
56
|
+
return observe_SnowflakeApp(
|
57
|
+
guaranteeType(
|
58
|
+
this.element,
|
59
|
+
SnowflakeApp,
|
60
|
+
'Element inside snowflake app function editor state must be a SnowflakeApp',
|
61
|
+
),
|
62
|
+
);
|
63
|
+
}
|
64
|
+
|
65
|
+
updateConnection(val: PackageableConnection): void {
|
66
|
+
this.activator.activationConfiguration.activationConnection =
|
67
|
+
new ConnectionPointer(PackageableElementExplicitReference.create(val));
|
68
|
+
observe_SnowflakeAppDeploymentConfiguration(
|
69
|
+
this.activator.activationConfiguration,
|
70
|
+
);
|
71
|
+
}
|
72
|
+
|
73
|
+
updateOwner(val: string): void {
|
74
|
+
this.activator.owner = val;
|
75
|
+
}
|
76
|
+
|
77
|
+
updateApplicationName(val: string): void {
|
78
|
+
this.activator.applicationName = val;
|
79
|
+
}
|
80
|
+
|
81
|
+
updateAppDescription(val: string): void {
|
82
|
+
this.activator.description = val;
|
83
|
+
}
|
84
|
+
|
85
|
+
*validate(): GeneratorFn<void> {
|
86
|
+
this.validateState.inProgress();
|
87
|
+
try {
|
88
|
+
yield this.editorStore.graphManagerState.graphManager.validateFunctionActivator(
|
89
|
+
this.activator,
|
90
|
+
new InMemoryGraphData(this.editorStore.graphManagerState.graph),
|
91
|
+
);
|
92
|
+
this.editorStore.applicationStore.notificationService.notifySuccess(
|
93
|
+
`Function activator is valid`,
|
94
|
+
);
|
95
|
+
} catch (error) {
|
96
|
+
assertErrorThrown(error);
|
97
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
98
|
+
} finally {
|
99
|
+
this.validateState.complete();
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
*deploy(): GeneratorFn<void> {
|
104
|
+
this.deployState.inProgress();
|
105
|
+
try {
|
106
|
+
yield this.editorStore.graphManagerState.graphManager.publishFunctionActivatorToSandbox(
|
107
|
+
this.activator,
|
108
|
+
new InMemoryGraphData(this.editorStore.graphManagerState.graph),
|
109
|
+
);
|
110
|
+
} catch (error) {
|
111
|
+
assertErrorThrown(error);
|
112
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
113
|
+
} finally {
|
114
|
+
this.deployState.complete();
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
reprocess(
|
119
|
+
newElement: SnowflakeApp,
|
120
|
+
editorStore: EditorStore,
|
121
|
+
): SnowflakeAppFunctionActivatorEdtiorState {
|
122
|
+
return new SnowflakeAppFunctionActivatorEdtiorState(
|
123
|
+
editorStore,
|
124
|
+
newElement,
|
125
|
+
);
|
126
|
+
}
|
127
|
+
}
|
@@ -249,7 +249,10 @@ export class ServiceEditorState extends ElementEditorState {
|
|
249
249
|
this,
|
250
250
|
execution,
|
251
251
|
);
|
252
|
-
} else if (
|
252
|
+
} else if (
|
253
|
+
execution instanceof PureMultiExecution &&
|
254
|
+
execution.executionParameters
|
255
|
+
) {
|
253
256
|
return new MultiServicePureExecutionState(
|
254
257
|
this.editorStore,
|
255
258
|
this,
|
package/src/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.ts
CHANGED
@@ -927,7 +927,6 @@ export class MultiServicePureExecutionState extends ServicePureExecutionState {
|
|
927
927
|
handleRunQuery: flow,
|
928
928
|
runQuery: flow,
|
929
929
|
});
|
930
|
-
|
931
930
|
this.execution = execution;
|
932
931
|
this.selectedExecutionContextState =
|
933
932
|
this.getInitiallySelectedExecutionContextState();
|
@@ -941,6 +940,10 @@ export class MultiServicePureExecutionState extends ServicePureExecutionState {
|
|
941
940
|
);
|
942
941
|
}
|
943
942
|
|
943
|
+
get keyedExecutionParameters(): KeyedExecutionParameter[] {
|
944
|
+
return this.execution.executionParameters ?? [];
|
945
|
+
}
|
946
|
+
|
944
947
|
setSingleExecutionKey(val: KeyedExecutionParameter | undefined): void {
|
945
948
|
this.singleExecutionKey = val;
|
946
949
|
}
|
@@ -980,7 +983,7 @@ export class MultiServicePureExecutionState extends ServicePureExecutionState {
|
|
980
983
|
getInitiallySelectedExecutionContextState():
|
981
984
|
| ServiceExecutionContextState
|
982
985
|
| undefined {
|
983
|
-
const parameter = this.
|
986
|
+
const parameter = this.keyedExecutionParameters[0];
|
984
987
|
return parameter
|
985
988
|
? new KeyedExecutionContextState(parameter, this)
|
986
989
|
: undefined;
|
@@ -994,7 +997,10 @@ export class MultiServicePureExecutionState extends ServicePureExecutionState {
|
|
994
997
|
}
|
995
998
|
|
996
999
|
deleteKeyExecutionParameter(value: KeyedExecutionParameter): void {
|
997
|
-
pureMultiExecution_deleteExecutionParameter(
|
1000
|
+
pureMultiExecution_deleteExecutionParameter(
|
1001
|
+
this.keyedExecutionParameters,
|
1002
|
+
value,
|
1003
|
+
);
|
998
1004
|
if (value === this.selectedExecutionContextState?.executionContext) {
|
999
1005
|
this.selectedExecutionContextState =
|
1000
1006
|
this.getInitiallySelectedExecutionContextState();
|
@@ -1010,7 +1016,7 @@ export class MultiServicePureExecutionState extends ServicePureExecutionState {
|
|
1010
1016
|
stub_PackageableRuntime(),
|
1011
1017
|
);
|
1012
1018
|
pureMultiExecution_addExecutionParameter(
|
1013
|
-
this.
|
1019
|
+
this.keyedExecutionParameters,
|
1014
1020
|
_key,
|
1015
1021
|
this.editorStore.changeDetectionState.observerContext,
|
1016
1022
|
);
|
package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts
CHANGED
@@ -788,7 +788,7 @@ export class ConnectionTestDataState {
|
|
788
788
|
if (execution instanceof PureSingleExecution && execution.runtime) {
|
789
789
|
runtimes = [execution.runtime];
|
790
790
|
} else if (execution instanceof PureMultiExecution) {
|
791
|
-
runtimes = execution.executionParameters
|
791
|
+
runtimes = execution.executionParameters?.map((t) => t.runtime) ?? [];
|
792
792
|
}
|
793
793
|
return runtimes.flatMap(getAllIdentifiedConnectionsFromRuntime);
|
794
794
|
}
|
@@ -226,7 +226,7 @@ export class ServiceTestSetupState {
|
|
226
226
|
get keyOptions(): KeyOption[] {
|
227
227
|
const keys =
|
228
228
|
this.testState.testable.execution instanceof PureMultiExecution
|
229
|
-
? this.testState.testable.execution.executionParameters.map(
|
229
|
+
? (this.testState.testable.execution.executionParameters ?? []).map(
|
230
230
|
(p) => p.key,
|
231
231
|
)
|
232
232
|
: [];
|
@@ -69,6 +69,7 @@ export enum PACKAGEABLE_ELEMENT_TYPE {
|
|
69
69
|
GENERATION_SPECIFICATION = 'GENERATION_SPECIFICATION',
|
70
70
|
SECTION_INDEX = 'SECTION_INDEX',
|
71
71
|
DATA = 'DATA',
|
72
|
+
SNOWFLAKE_APP = 'SNOWFLAKE_APP',
|
72
73
|
|
73
74
|
TEMPORARY__LOCAL_CONNECTION = 'LOCAL_CONNECTION',
|
74
75
|
INTERNAL__UNKNOWN = 'UNKNOWN',
|
@@ -287,19 +287,22 @@ export const pureMultiExecution_setExecutionKey = action(
|
|
287
287
|
);
|
288
288
|
export const pureMultiExecution_addExecutionParameter = action(
|
289
289
|
(
|
290
|
-
|
290
|
+
executionParameters: KeyedExecutionParameter[],
|
291
291
|
value: KeyedExecutionParameter,
|
292
292
|
context: ObserverContext,
|
293
293
|
): void => {
|
294
294
|
addUniqueEntry(
|
295
|
-
|
295
|
+
executionParameters,
|
296
296
|
observe_KeyedExecutionParameter(value, context),
|
297
297
|
);
|
298
298
|
},
|
299
299
|
);
|
300
300
|
export const pureMultiExecution_deleteExecutionParameter = action(
|
301
|
-
(
|
302
|
-
|
301
|
+
(
|
302
|
+
executionParameters: KeyedExecutionParameter[],
|
303
|
+
value: KeyedExecutionParameter,
|
304
|
+
): void => {
|
305
|
+
deleteEntry(executionParameters, value);
|
303
306
|
},
|
304
307
|
);
|
305
308
|
|