@finos/legend-application-studio 28.12.1 → 28.13.1
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.d.ts.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.js +8 -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 +99 -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 +100 -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 +34 -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 +88 -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/lib/stores/showcase/ShowcaseViewerStore.d.ts.map +1 -1
- package/lib/stores/showcase/ShowcaseViewerStore.js +0 -1
- package/lib/stores/showcase/ShowcaseViewerStore.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 +11 -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 +304 -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 +133 -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 +133 -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/src/stores/showcase/ShowcaseViewerStore.ts +0 -1
- 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
package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx
CHANGED
@@ -61,6 +61,7 @@ import {
|
|
61
61
|
type PostProcessor,
|
62
62
|
type DatasourceSpecification,
|
63
63
|
type AuthenticationStrategy,
|
64
|
+
type PackageableConnection,
|
64
65
|
DatabaseType,
|
65
66
|
DelegatedKerberosAuthenticationStrategy,
|
66
67
|
OAuthAuthenticationStrategy,
|
@@ -81,6 +82,7 @@ import {
|
|
81
82
|
MapperPostProcessor,
|
82
83
|
SpannerDatasourceSpecification,
|
83
84
|
TrinoDatasourceSpecification,
|
85
|
+
guaranteeRelationalDatabaseConnection,
|
84
86
|
} from '@finos/legend-graph';
|
85
87
|
import type { LegendStudioApplicationPlugin } from '../../../../stores/LegendStudioApplicationPlugin.js';
|
86
88
|
import type { STO_Relational_LegendStudioApplicationPlugin_Extension } from '../../../../stores/extensions/STO_Relational_LegendStudioApplicationPlugin_Extension.js';
|
@@ -167,6 +169,33 @@ import { UnsupportedEditorPanel } from '../UnsupportedElementEditor.js';
|
|
167
169
|
import type { MapperPostProcessorEditorState } from '../../../../stores/editor/editor-state/element-editor-state/connection/PostProcessorEditorState.js';
|
168
170
|
import { prettyCONSTName, uniq } from '@finos/legend-shared';
|
169
171
|
|
172
|
+
export type RelationalDatabaseConnectionOption = {
|
173
|
+
label: React.ReactNode;
|
174
|
+
value: PackageableConnection;
|
175
|
+
};
|
176
|
+
|
177
|
+
export const buildRelationalDatabaseConnectionOption = (
|
178
|
+
connection: PackageableConnection,
|
179
|
+
): RelationalDatabaseConnectionOption => {
|
180
|
+
const connectionValue = guaranteeRelationalDatabaseConnection(connection);
|
181
|
+
return {
|
182
|
+
value: connection,
|
183
|
+
label: (
|
184
|
+
<div className="sql-playground__config__connection-selector__option">
|
185
|
+
<div className="sql-playground__config__connection-selector__option__label">
|
186
|
+
{connection.name}
|
187
|
+
</div>
|
188
|
+
<div className="sql-playground__config__connection-selector__option__type">
|
189
|
+
{connectionValue.type}
|
190
|
+
</div>
|
191
|
+
<div className="sql-playground__config__connection-selector__option__path">
|
192
|
+
{connection.path}
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
),
|
196
|
+
};
|
197
|
+
};
|
198
|
+
|
170
199
|
const LocalH2DatasourceSpecificationEditor = observer(
|
171
200
|
(props: {
|
172
201
|
sourceSpec: LocalH2DatasourceSpecification;
|
@@ -19,12 +19,12 @@ import { observer } from 'mobx-react-lite';
|
|
19
19
|
import {
|
20
20
|
FunctionEditorState,
|
21
21
|
FUNCTION_EDITOR_TAB,
|
22
|
-
} from '
|
22
|
+
} from '../../../../stores/editor/editor-state/element-editor-state/FunctionEditorState.js';
|
23
23
|
import {
|
24
24
|
CORE_DND_TYPE,
|
25
25
|
type UMLEditorElementDropTarget,
|
26
26
|
type ElementDragSource,
|
27
|
-
} from '
|
27
|
+
} from '../../../../stores/editor/utils/DnDUtils.js';
|
28
28
|
import {
|
29
29
|
assertErrorThrown,
|
30
30
|
assertTrue,
|
@@ -63,18 +63,23 @@ import {
|
|
63
63
|
PlayIcon,
|
64
64
|
PanelLoadingIndicator,
|
65
65
|
PencilIcon,
|
66
|
+
RocketIcon,
|
67
|
+
ModalFooterButton,
|
68
|
+
BaseCard,
|
69
|
+
Snowflake_BrandIcon,
|
70
|
+
InputWithInlineValidation,
|
66
71
|
} from '@finos/legend-art';
|
67
|
-
import { LEGEND_STUDIO_TEST_ID } from '
|
72
|
+
import { LEGEND_STUDIO_TEST_ID } from '../../../../__lib__/LegendStudioTesting.js';
|
68
73
|
import {
|
69
74
|
StereotypeDragPreviewLayer,
|
70
75
|
StereotypeSelector,
|
71
|
-
} from '
|
76
|
+
} from '../uml-editor/StereotypeSelector.js';
|
72
77
|
import {
|
73
78
|
TaggedValueDragPreviewLayer,
|
74
79
|
TaggedValueEditor,
|
75
|
-
} from '
|
80
|
+
} from '../uml-editor/TaggedValueEditor.js';
|
76
81
|
import { flowResult } from 'mobx';
|
77
|
-
import { useEditorStore } from '
|
82
|
+
import { useEditorStore } from '../../EditorStoreProvider.js';
|
78
83
|
import {
|
79
84
|
type ConcreteFunctionDefinition,
|
80
85
|
type StereotypeReference,
|
@@ -101,6 +106,8 @@ import {
|
|
101
106
|
RawExecutionResult,
|
102
107
|
extractExecutionResultValues,
|
103
108
|
RawLambda,
|
109
|
+
DatabaseType,
|
110
|
+
RelationalDatabaseConnection,
|
104
111
|
} from '@finos/legend-graph';
|
105
112
|
import {
|
106
113
|
type ApplicationStore,
|
@@ -115,7 +122,7 @@ import {
|
|
115
122
|
type PackageableElementOption,
|
116
123
|
buildElementOption,
|
117
124
|
} from '@finos/legend-lego/graph-editor';
|
118
|
-
import { getElementIcon } from '
|
125
|
+
import { getElementIcon } from '../../../ElementIconUtils.js';
|
119
126
|
import {
|
120
127
|
function_setReturnType,
|
121
128
|
function_setReturnMultiplicity,
|
@@ -126,13 +133,13 @@ import {
|
|
126
133
|
annotatedElement_deleteStereotype,
|
127
134
|
annotatedElement_deleteTaggedValue,
|
128
135
|
function_swapParameters,
|
129
|
-
} from '
|
136
|
+
} from '../../../../stores/graph-modifier/DomainGraphModifierHelper.js';
|
130
137
|
import {
|
131
138
|
rawVariableExpression_setMultiplicity,
|
132
139
|
rawVariableExpression_setName,
|
133
140
|
rawVariableExpression_setType,
|
134
|
-
} from '
|
135
|
-
import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '
|
141
|
+
} from '../../../../stores/graph-modifier/RawValueSpecificationGraphModifierHelper.js';
|
142
|
+
import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../../__lib__/LegendStudioApplicationNavigationContext.js';
|
136
143
|
import {
|
137
144
|
type QueryBuilderState,
|
138
145
|
ExecutionPlanViewer,
|
@@ -140,15 +147,16 @@ import {
|
|
140
147
|
LambdaEditor,
|
141
148
|
LambdaParameterValuesEditor,
|
142
149
|
} from '@finos/legend-query-builder';
|
143
|
-
import type { EditorStore } from '
|
144
|
-
import { graph_renameElement } from '
|
145
|
-
import { ProtocolValueBuilder } from '
|
146
|
-
import type { ProtocolValueBuilderState } from '
|
150
|
+
import type { EditorStore } from '../../../../stores/editor/EditorStore.js';
|
151
|
+
import { graph_renameElement } from '../../../../stores/graph-modifier/GraphModifierHelper.js';
|
152
|
+
import { ProtocolValueBuilder } from '../ProtocolValueBuilder.js';
|
153
|
+
import type { ProtocolValueBuilderState } from '../../../../stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.js';
|
147
154
|
import {
|
148
155
|
CODE_EDITOR_LANGUAGE,
|
149
156
|
CodeEditor,
|
150
157
|
} from '@finos/legend-lego/code-editor';
|
151
|
-
import { PanelGroupItemExperimentalBadge } from '
|
158
|
+
import { PanelGroupItemExperimentalBadge } from '../../panel-group/PanelGroup.js';
|
159
|
+
import type { FunctionActivatorPromoteState } from '../../../../stores/editor/editor-state/element-editor-state/FunctionActivatorPromoteState.js';
|
152
160
|
|
153
161
|
enum FUNCTION_PARAMETER_TYPE {
|
154
162
|
CLASS = 'CLASS',
|
@@ -156,6 +164,14 @@ enum FUNCTION_PARAMETER_TYPE {
|
|
156
164
|
PRIMITIVE = 'PRIMITIVE',
|
157
165
|
}
|
158
166
|
|
167
|
+
export enum FUNCTION_PROMOTE_TYPE {
|
168
|
+
SNOWFLAKE_NATIVE_APP = 'Snowflake Native App',
|
169
|
+
REST_SERVICE = 'REST Service',
|
170
|
+
SERVICE_JAR = 'Service JAR',
|
171
|
+
REFINER = 'Refiner',
|
172
|
+
BIG_QUERY_NATIVE_APP = 'BigQuery Native App',
|
173
|
+
}
|
174
|
+
|
159
175
|
const getFunctionParameterType = (type: Type): FUNCTION_PARAMETER_TYPE => {
|
160
176
|
if (type instanceof PrimitiveType) {
|
161
177
|
return FUNCTION_PARAMETER_TYPE.PRIMITIVE;
|
@@ -661,6 +677,199 @@ const ReturnTypeEditor = observer(
|
|
661
677
|
},
|
662
678
|
);
|
663
679
|
|
680
|
+
const FunctionPromoteEditor = observer(
|
681
|
+
(props: {
|
682
|
+
functionElement: ConcreteFunctionDefinition;
|
683
|
+
activatorPromoteState: FunctionActivatorPromoteState;
|
684
|
+
}) => {
|
685
|
+
const { functionElement, activatorPromoteState } = props;
|
686
|
+
const applicationStore = useApplicationStore();
|
687
|
+
const elementAlreadyExistsMessage =
|
688
|
+
activatorPromoteState.functionEditorState.editorStore.graphManagerState.graph.allElements
|
689
|
+
.map((s) => s.path)
|
690
|
+
.includes(activatorPromoteState.activatorPath)
|
691
|
+
? 'Element with same path already exists'
|
692
|
+
: undefined;
|
693
|
+
let validationMessage = '';
|
694
|
+
const closeModal = (): void => {
|
695
|
+
activatorPromoteState.closeFunctionPromoteModal();
|
696
|
+
activatorPromoteState.setPromoteType(undefined);
|
697
|
+
};
|
698
|
+
const promoteFunction = (): void => {
|
699
|
+
flowResult(activatorPromoteState.promote(functionElement))
|
700
|
+
.then(() => {
|
701
|
+
activatorPromoteState.closeFunctionPromoteModal();
|
702
|
+
})
|
703
|
+
.catch(applicationStore.alertUnhandledError);
|
704
|
+
};
|
705
|
+
const onTargetPathChange: React.ChangeEventHandler<HTMLInputElement> = (
|
706
|
+
event,
|
707
|
+
) => {
|
708
|
+
activatorPromoteState.updateActivatorPath(event.target.value);
|
709
|
+
};
|
710
|
+
const validateFunctionActivator = (type: string): boolean => {
|
711
|
+
switch (type) {
|
712
|
+
case FUNCTION_PROMOTE_TYPE.SNOWFLAKE_NATIVE_APP: {
|
713
|
+
const availableConnections =
|
714
|
+
activatorPromoteState.functionEditorState.editorStore.graphManagerState.usableConnections.filter(
|
715
|
+
(connection) =>
|
716
|
+
connection.connectionValue instanceof
|
717
|
+
RelationalDatabaseConnection &&
|
718
|
+
connection.connectionValue.type === DatabaseType.Snowflake,
|
719
|
+
);
|
720
|
+
if (availableConnections.length > 0) {
|
721
|
+
return true;
|
722
|
+
} else {
|
723
|
+
validationMessage =
|
724
|
+
'There is no available connection of type Snowflake';
|
725
|
+
}
|
726
|
+
return false;
|
727
|
+
}
|
728
|
+
default:
|
729
|
+
return true;
|
730
|
+
}
|
731
|
+
};
|
732
|
+
const renderFunctionPromoteTypes = (type: string): React.ReactNode => {
|
733
|
+
switch (type) {
|
734
|
+
case FUNCTION_PROMOTE_TYPE.SNOWFLAKE_NATIVE_APP:
|
735
|
+
return (
|
736
|
+
<BaseCard
|
737
|
+
key={FUNCTION_PROMOTE_TYPE.SNOWFLAKE_NATIVE_APP}
|
738
|
+
cardMedia={
|
739
|
+
<Snowflake_BrandIcon className="function-promote-editor__type-icon" />
|
740
|
+
}
|
741
|
+
cardName={type}
|
742
|
+
cardContent="Deploy the function as a UDTF(user-defined table function) in snowflake"
|
743
|
+
isActive={
|
744
|
+
activatorPromoteState.promoteType ===
|
745
|
+
FUNCTION_PROMOTE_TYPE.SNOWFLAKE_NATIVE_APP
|
746
|
+
}
|
747
|
+
onClick={() => {
|
748
|
+
activatorPromoteState.setPromoteType(type);
|
749
|
+
}}
|
750
|
+
/>
|
751
|
+
);
|
752
|
+
case FUNCTION_PROMOTE_TYPE.REST_SERVICE:
|
753
|
+
return (
|
754
|
+
<BaseCard
|
755
|
+
key={FUNCTION_PROMOTE_TYPE.REST_SERVICE}
|
756
|
+
cardMedia={<div className="coming-soon-label">Coming Soon</div>}
|
757
|
+
cardName={type}
|
758
|
+
cardContent="Create a HostedService that will be deployed to a server environment and executed with a pattern"
|
759
|
+
isDisable={true}
|
760
|
+
isActive={
|
761
|
+
activatorPromoteState.promoteType ===
|
762
|
+
FUNCTION_PROMOTE_TYPE.REST_SERVICE
|
763
|
+
}
|
764
|
+
/>
|
765
|
+
);
|
766
|
+
case FUNCTION_PROMOTE_TYPE.SERVICE_JAR:
|
767
|
+
return (
|
768
|
+
<BaseCard
|
769
|
+
key={FUNCTION_PROMOTE_TYPE.SERVICE_JAR}
|
770
|
+
cardMedia={<div className="coming-soon-label">Coming Soon</div>}
|
771
|
+
cardName={type}
|
772
|
+
cardContent="Deploy the function in the definition of a Store persistence"
|
773
|
+
isDisable={true}
|
774
|
+
isActive={
|
775
|
+
activatorPromoteState.promoteType ===
|
776
|
+
FUNCTION_PROMOTE_TYPE.SERVICE_JAR
|
777
|
+
}
|
778
|
+
/>
|
779
|
+
);
|
780
|
+
case FUNCTION_PROMOTE_TYPE.REFINER:
|
781
|
+
return (
|
782
|
+
<BaseCard
|
783
|
+
key={FUNCTION_PROMOTE_TYPE.REFINER}
|
784
|
+
cardMedia={<div className="coming-soon-label">Coming Soon</div>}
|
785
|
+
cardName={type}
|
786
|
+
cardContent="Use the service in a refiner context"
|
787
|
+
isDisable={true}
|
788
|
+
isActive={
|
789
|
+
activatorPromoteState.promoteType ===
|
790
|
+
FUNCTION_PROMOTE_TYPE.REFINER
|
791
|
+
}
|
792
|
+
/>
|
793
|
+
);
|
794
|
+
case FUNCTION_PROMOTE_TYPE.BIG_QUERY_NATIVE_APP:
|
795
|
+
return (
|
796
|
+
<BaseCard
|
797
|
+
key={FUNCTION_PROMOTE_TYPE.BIG_QUERY_NATIVE_APP}
|
798
|
+
cardMedia={<div className="coming-soon-label">Coming Soon</div>}
|
799
|
+
cardName={type}
|
800
|
+
cardContent="Deploy the function as a UDTF(user-defined table function) in BigQuery"
|
801
|
+
isDisable={true}
|
802
|
+
isActive={
|
803
|
+
activatorPromoteState.promoteType ===
|
804
|
+
FUNCTION_PROMOTE_TYPE.BIG_QUERY_NATIVE_APP
|
805
|
+
}
|
806
|
+
/>
|
807
|
+
);
|
808
|
+
default:
|
809
|
+
return <></>;
|
810
|
+
}
|
811
|
+
};
|
812
|
+
|
813
|
+
return (
|
814
|
+
<Dialog
|
815
|
+
open={activatorPromoteState.isPromotingFunction}
|
816
|
+
onClose={closeModal}
|
817
|
+
classes={{ container: 'search-modal__container' }}
|
818
|
+
PaperProps={{ classes: { root: 'search-modal__inner-container' } }}
|
819
|
+
>
|
820
|
+
<Modal darkMode={true} className="function-promote-editor">
|
821
|
+
<ModalBody className="function-promote-editor__content">
|
822
|
+
<div className="function-promote-editor__content__prompt">
|
823
|
+
Select any one of the following activator types to continue
|
824
|
+
</div>
|
825
|
+
<div className="function-promote-editor__content__activator-types">
|
826
|
+
{Object.values(FUNCTION_PROMOTE_TYPE).map((type) =>
|
827
|
+
renderFunctionPromoteTypes(type),
|
828
|
+
)}
|
829
|
+
</div>
|
830
|
+
<div className="function-promote-editor__content__prompt">
|
831
|
+
Target Path
|
832
|
+
</div>
|
833
|
+
<InputWithInlineValidation
|
834
|
+
className="panel__content__form__section__input"
|
835
|
+
spellCheck={false}
|
836
|
+
onChange={onTargetPathChange}
|
837
|
+
value={activatorPromoteState.activatorPath}
|
838
|
+
error={elementAlreadyExistsMessage}
|
839
|
+
showEditableIcon={true}
|
840
|
+
/>
|
841
|
+
</ModalBody>
|
842
|
+
<ModalFooter>
|
843
|
+
<ModalFooterButton
|
844
|
+
className="function-promote-editor__action-btn"
|
845
|
+
onClick={closeModal}
|
846
|
+
title="Close"
|
847
|
+
>
|
848
|
+
Cancel
|
849
|
+
</ModalFooterButton>
|
850
|
+
<ModalFooterButton
|
851
|
+
className=" function-promote-editor__action-btn function-promote-editor__action-btn--primitive"
|
852
|
+
disabled={
|
853
|
+
!activatorPromoteState.promoteType ||
|
854
|
+
!validateFunctionActivator(activatorPromoteState.promoteType)
|
855
|
+
}
|
856
|
+
title={
|
857
|
+
activatorPromoteState.promoteType &&
|
858
|
+
validateFunctionActivator(activatorPromoteState.promoteType)
|
859
|
+
? ''
|
860
|
+
: validationMessage
|
861
|
+
}
|
862
|
+
onClick={promoteFunction}
|
863
|
+
>
|
864
|
+
Promote
|
865
|
+
</ModalFooterButton>
|
866
|
+
</ModalFooter>
|
867
|
+
</Modal>
|
868
|
+
</Dialog>
|
869
|
+
);
|
870
|
+
},
|
871
|
+
);
|
872
|
+
|
664
873
|
const FunctionDefinitionEditor = observer(
|
665
874
|
(props: {
|
666
875
|
functionEditorState: FunctionEditorState;
|
@@ -1159,8 +1368,15 @@ export const FunctionEditor = observer(() => {
|
|
1159
1368
|
}
|
1160
1369
|
});
|
1161
1370
|
|
1371
|
+
const openFunctionPromoteModal = (): void => {
|
1372
|
+
functionEditorState.activatorPromoteState.showFunctionPromoteModal();
|
1373
|
+
};
|
1374
|
+
|
1162
1375
|
return (
|
1163
|
-
<div
|
1376
|
+
<div
|
1377
|
+
data-testid={LEGEND_STUDIO_TEST_ID.FUNCTION_EDITOR}
|
1378
|
+
className="function-editor uml-editor uml-editor--dark"
|
1379
|
+
>
|
1164
1380
|
<Panel>
|
1165
1381
|
<div className="panel__header">
|
1166
1382
|
<div className="panel__header__title">
|
@@ -1262,6 +1478,17 @@ export const FunctionEditor = observer(() => {
|
|
1262
1478
|
</>
|
1263
1479
|
)}
|
1264
1480
|
</div>
|
1481
|
+
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
1482
|
+
<button
|
1483
|
+
className="btn__dropdown-combo__label"
|
1484
|
+
onClick={openFunctionPromoteModal}
|
1485
|
+
title="Promote function"
|
1486
|
+
tabIndex={-1}
|
1487
|
+
>
|
1488
|
+
<RocketIcon className="btn__dropdown-combo__label__icon" />
|
1489
|
+
<div className="btn__dropdown-combo__label__title">Promote</div>
|
1490
|
+
</button>
|
1491
|
+
</div>
|
1265
1492
|
{editorStore.applicationStore.config.options
|
1266
1493
|
.TEMPORARY__enableFunctionActivatorSupport && (
|
1267
1494
|
<>
|
@@ -1472,6 +1699,12 @@ export const FunctionEditor = observer(() => {
|
|
1472
1699
|
/>
|
1473
1700
|
)}
|
1474
1701
|
</PanelContent>
|
1702
|
+
{functionEditorState.activatorPromoteState.isPromotingFunction && (
|
1703
|
+
<FunctionPromoteEditor
|
1704
|
+
functionElement={functionElement}
|
1705
|
+
activatorPromoteState={functionEditorState.activatorPromoteState}
|
1706
|
+
/>
|
1707
|
+
)}
|
1475
1708
|
</Panel>
|
1476
1709
|
</div>
|
1477
1710
|
);
|
@@ -15,8 +15,8 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import { observer } from 'mobx-react-lite';
|
18
|
-
import { useEditorStore } from '
|
19
|
-
import { INTERNAL__UnknownFunctionActivatorEdtiorState } from '
|
18
|
+
import { useEditorStore } from '../../EditorStoreProvider.js';
|
19
|
+
import { INTERNAL__UnknownFunctionActivatorEdtiorState } from '../../../../stores/editor/editor-state/element-editor-state/function-activator/INTERNAL__UnknownFunctionActivatorEditorState.js';
|
20
20
|
import {
|
21
21
|
ArrowRightIcon,
|
22
22
|
BlankPanelContent,
|
@@ -26,7 +26,7 @@ import {
|
|
26
26
|
} from '@finos/legend-art';
|
27
27
|
import { useApplicationStore } from '@finos/legend-application';
|
28
28
|
import { flowResult } from 'mobx';
|
29
|
-
import { ProtocolValueBuilder } from '
|
29
|
+
import { ProtocolValueBuilder } from '../ProtocolValueBuilder.js';
|
30
30
|
import {
|
31
31
|
extractAnnotatedElementDocumentation,
|
32
32
|
generateFunctionPrettyName,
|