@finos/legend-application-studio 28.18.148 → 28.19.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/application/LegendIngestionConfiguration.d.ts +1 -5
- package/lib/application/LegendIngestionConfiguration.d.ts.map +1 -1
- package/lib/application/LegendIngestionConfiguration.js +1 -8
- package/lib/application/LegendIngestionConfiguration.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 +2 -0
- package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.js +6 -0
- package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
- package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.js +140 -26
- package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts +1 -0
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js +21 -3
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js.map +1 -1
- package/lib/{stores/ingestion/AdhocDataProductDeployResponse.js → components/editor/editor-group/function-activator/MemSQLFunctionActivatorEditor.d.ts} +3 -8
- package/lib/components/editor/editor-group/function-activator/MemSQLFunctionActivatorEditor.d.ts.map +1 -0
- package/lib/components/editor/editor-group/function-activator/MemSQLFunctionActivatorEditor.js +89 -0
- package/lib/components/editor/editor-group/function-activator/MemSQLFunctionActivatorEditor.js.map +1 -0
- package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.js +1 -1
- package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.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 +1 -2
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.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 +2 -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/EditorStore.d.ts +2 -2
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +2 -2
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.js +5 -1
- package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
- package/lib/stores/editor/data-cube/LegendStudioDataCubeHelper.d.ts +2 -2
- package/lib/stores/editor/data-cube/LegendStudioDataCubeHelper.d.ts.map +1 -1
- package/lib/stores/editor/data-cube/LegendStudioDataCubeHelper.js +4 -3
- package/lib/stores/editor/data-cube/LegendStudioDataCubeHelper.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.js +14 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +3 -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 +24 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +9 -4
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +23 -4
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js +3 -3
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/MemSQLFunctionActivatorEditorState.d.ts +33 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/MemSQLFunctionActivatorEditorState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/MemSQLFunctionActivatorEditorState.js +86 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/MemSQLFunctionActivatorEditorState.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js +28 -2
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.d.ts +2 -3
- package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.d.ts +4 -1
- 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 +24 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.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_DataProduct_GraphModifierHelper.d.ts +3 -2
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js +7 -4
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js.map +1 -1
- package/package.json +9 -8
- package/src/application/LegendIngestionConfiguration.ts +1 -12
- package/src/components/ElementIconUtils.tsx +3 -0
- package/src/components/editor/editor-group/EditorGroup.tsx +10 -0
- package/src/components/editor/editor-group/dataProduct/DataPoductEditor.tsx +375 -65
- package/src/components/editor/editor-group/function-activator/FunctionEditor.tsx +40 -2
- package/src/components/editor/editor-group/function-activator/MemSQLFunctionActivatorEditor.tsx +269 -0
- package/src/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.tsx +1 -1
- package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +1 -2
- package/src/index.ts +2 -0
- package/src/stores/editor/EditorGraphState.ts +3 -0
- package/src/stores/editor/EditorStore.ts +7 -5
- package/src/stores/editor/EditorTabManagerState.ts +4 -0
- package/src/stores/editor/data-cube/LegendStudioDataCubeHelper.ts +14 -2
- package/src/stores/editor/editor-state/element-editor-state/FunctionActivatorState.ts +15 -0
- package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +50 -0
- package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +31 -5
- package/src/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.ts +3 -3
- package/src/stores/editor/editor-state/element-editor-state/function-activator/MemSQLFunctionActivatorEditorState.ts +130 -0
- package/src/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.ts +38 -7
- package/src/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.ts +3 -3
- package/src/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.ts +51 -0
- package/src/stores/editor/utils/ModelClassifierUtils.ts +1 -0
- package/src/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.ts +10 -4
- package/tsconfig.json +2 -5
- package/lib/stores/ingestion/AdhocDataProductDeployResponse.d.ts +0 -21
- package/lib/stores/ingestion/AdhocDataProductDeployResponse.d.ts.map +0 -1
- package/lib/stores/ingestion/AdhocDataProductDeployResponse.js.map +0 -1
- package/lib/stores/ingestion/IngestDeploymentServerClient.d.ts +0 -35
- package/lib/stores/ingestion/IngestDeploymentServerClient.d.ts.map +0 -1
- package/lib/stores/ingestion/IngestDeploymentServerClient.js +0 -58
- package/lib/stores/ingestion/IngestDeploymentServerClient.js.map +0 -1
- package/lib/stores/ingestion/IngestDiscoveryServerClient.d.ts +0 -26
- package/lib/stores/ingestion/IngestDiscoveryServerClient.d.ts.map +0 -1
- package/lib/stores/ingestion/IngestDiscoveryServerClient.js +0 -35
- package/lib/stores/ingestion/IngestDiscoveryServerClient.js.map +0 -1
- package/lib/stores/ingestion/IngestionDeploymentResponse.d.ts +0 -41
- package/lib/stores/ingestion/IngestionDeploymentResponse.d.ts.map +0 -1
- package/lib/stores/ingestion/IngestionDeploymentResponse.js +0 -56
- package/lib/stores/ingestion/IngestionDeploymentResponse.js.map +0 -1
- package/lib/stores/ingestion/IngestionManager.d.ts +0 -38
- package/lib/stores/ingestion/IngestionManager.d.ts.map +0 -1
- package/lib/stores/ingestion/IngestionManager.js +0 -111
- package/lib/stores/ingestion/IngestionManager.js.map +0 -1
- package/src/stores/ingestion/AdhocDataProductDeployResponse.ts +0 -29
- package/src/stores/ingestion/IngestDeploymentServerClient.ts +0 -112
- package/src/stores/ingestion/IngestDiscoveryServerClient.ts +0 -52
- package/src/stores/ingestion/IngestionDeploymentResponse.ts +0 -74
- package/src/stores/ingestion/IngestionManager.ts +0 -219
@@ -68,6 +68,7 @@ import {
|
|
68
68
|
LongArrowRightIcon,
|
69
69
|
CheckSquareIcon,
|
70
70
|
SquareIcon,
|
71
|
+
SinglestoreIcon,
|
71
72
|
} from '@finos/legend-art';
|
72
73
|
import { LEGEND_STUDIO_TEST_ID } from '../../../../__lib__/LegendStudioTesting.js';
|
73
74
|
import {
|
@@ -163,7 +164,6 @@ import type { FunctionActivatorState } from '../../../../stores/editor/editor-st
|
|
163
164
|
import { FunctionTestableEditor } from './testable/FunctionTestableEditor.js';
|
164
165
|
import { DocumentationLink } from '@finos/legend-lego/application';
|
165
166
|
import { LEGEND_STUDIO_DOCUMENTATION_KEY } from '../../../../__lib__/LegendStudioDocumentation.js';
|
166
|
-
import { openDataCube } from '../../../../stores/editor/data-cube/LegendStudioDataCubeHelper.js';
|
167
167
|
import {
|
168
168
|
DataGrid,
|
169
169
|
type DataGridColumnDefinition,
|
@@ -178,6 +178,7 @@ enum FUNCTION_PARAMETER_TYPE {
|
|
178
178
|
export enum FUNCTION_ACTIVATE_TYPE {
|
179
179
|
SNOWFLAKE_NATIVE_APP = 'Snowflake UDTF',
|
180
180
|
HOSTED_SERVICE = 'REST Service',
|
181
|
+
MEM_SQL_FUNCTION = 'Mem SQL Function',
|
181
182
|
SERVICE_JAR = 'Service JAR',
|
182
183
|
REFINER = 'Refiner',
|
183
184
|
BIG_QUERY_NATIVE_APP = 'BigQuery Native App',
|
@@ -756,6 +757,22 @@ const FunctionPromoteEditor = observer(
|
|
756
757
|
}
|
757
758
|
return false;
|
758
759
|
}
|
760
|
+
case FUNCTION_ACTIVATE_TYPE.MEM_SQL_FUNCTION: {
|
761
|
+
const availableConnections =
|
762
|
+
activatorPromoteState.functionEditorState.editorStore.graphManagerState.usableConnections.filter(
|
763
|
+
(connection) =>
|
764
|
+
connection.connectionValue instanceof
|
765
|
+
RelationalDatabaseConnection &&
|
766
|
+
connection.connectionValue.type === DatabaseType.MemSQL,
|
767
|
+
);
|
768
|
+
if (availableConnections.length > 0) {
|
769
|
+
return true;
|
770
|
+
} else {
|
771
|
+
validationMessage =
|
772
|
+
'There is no available connection of type MemSQL';
|
773
|
+
}
|
774
|
+
return false;
|
775
|
+
}
|
759
776
|
default:
|
760
777
|
return true;
|
761
778
|
}
|
@@ -798,6 +815,24 @@ const FunctionPromoteEditor = observer(
|
|
798
815
|
}}
|
799
816
|
/>
|
800
817
|
);
|
818
|
+
case FUNCTION_ACTIVATE_TYPE.MEM_SQL_FUNCTION:
|
819
|
+
return (
|
820
|
+
<BaseCard
|
821
|
+
key={FUNCTION_ACTIVATE_TYPE.MEM_SQL_FUNCTION}
|
822
|
+
cardMedia={
|
823
|
+
<SinglestoreIcon className="function-promote-editor__type-icon" />
|
824
|
+
}
|
825
|
+
cardName={type}
|
826
|
+
cardContent="Deploy the function as a UDF (user-defined function) in Mem SQL"
|
827
|
+
isActive={
|
828
|
+
activatorPromoteState.activateType ===
|
829
|
+
FUNCTION_ACTIVATE_TYPE.MEM_SQL_FUNCTION
|
830
|
+
}
|
831
|
+
onClick={() => {
|
832
|
+
activatorPromoteState.setAcitvateType(type);
|
833
|
+
}}
|
834
|
+
/>
|
835
|
+
);
|
801
836
|
case FUNCTION_ACTIVATE_TYPE.SERVICE_JAR:
|
802
837
|
return (
|
803
838
|
<BaseCard
|
@@ -1418,7 +1453,10 @@ export const FunctionEditor = observer(() => {
|
|
1418
1453
|
|
1419
1454
|
const openFunctionCubeViewer =
|
1420
1455
|
editorStore.applicationStore.guardUnhandledError(async () => {
|
1421
|
-
await
|
1456
|
+
await functionEditorState.handleOpeningDataCube(
|
1457
|
+
functionEditorState.element,
|
1458
|
+
editorStore,
|
1459
|
+
);
|
1422
1460
|
});
|
1423
1461
|
|
1424
1462
|
const visitActivator = (activator: FunctionActivator): void =>
|
package/src/components/editor/editor-group/function-activator/MemSQLFunctionActivatorEditor.tsx
ADDED
@@ -0,0 +1,269 @@
|
|
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
|
+
type SelectComponent,
|
19
|
+
Panel,
|
20
|
+
PanelHeader,
|
21
|
+
PanelContent,
|
22
|
+
PanelForm,
|
23
|
+
PanelFormTextField,
|
24
|
+
PURE_FunctionIcon,
|
25
|
+
LongArrowRightIcon,
|
26
|
+
PanelLoadingIndicator,
|
27
|
+
PURE_ConnectionIcon,
|
28
|
+
CustomSelectorInput,
|
29
|
+
createFilter,
|
30
|
+
} from '@finos/legend-art';
|
31
|
+
import {
|
32
|
+
type PackageableConnection,
|
33
|
+
generateFunctionPrettyName,
|
34
|
+
RelationalDatabaseConnection,
|
35
|
+
DatabaseType,
|
36
|
+
} from '@finos/legend-graph';
|
37
|
+
import { observer } from 'mobx-react-lite';
|
38
|
+
import { useApplicationStore } from '@finos/legend-application';
|
39
|
+
import { useEditorStore } from '../../EditorStoreProvider.js';
|
40
|
+
import { MemSQLFunctionActivatorEditorState } from '../../../../stores/editor/editor-state/element-editor-state/function-activator/MemSQLFunctionActivatorEditorState.js';
|
41
|
+
import { flowResult } from 'mobx';
|
42
|
+
import { useRef } from 'react';
|
43
|
+
import {
|
44
|
+
type RelationalDatabaseConnectionOption,
|
45
|
+
buildRelationalDatabaseConnectionOption,
|
46
|
+
} from '../connection-editor/RelationalDatabaseConnectionEditor.js';
|
47
|
+
import { ActivatorOwnershipForm } from './ActivatorFormComponents.js';
|
48
|
+
|
49
|
+
export const MemSQLFunctionActivatorEditor = observer(() => {
|
50
|
+
const editorStore = useEditorStore();
|
51
|
+
const applicationStore = useApplicationStore();
|
52
|
+
const editorState = editorStore.tabManagerState.getCurrentEditorState(
|
53
|
+
MemSQLFunctionActivatorEditorState,
|
54
|
+
);
|
55
|
+
const isReadOnly = editorState.isReadOnly;
|
56
|
+
const activator = editorState.activator;
|
57
|
+
|
58
|
+
const connectionSelectorRef = useRef<SelectComponent>(null);
|
59
|
+
const connectionFilterOption = createFilter({
|
60
|
+
ignoreCase: true,
|
61
|
+
ignoreAccents: false,
|
62
|
+
stringify: (option: { data: RelationalDatabaseConnectionOption }): string =>
|
63
|
+
option.data.value.path,
|
64
|
+
});
|
65
|
+
const connectionOptions = editorStore.graphManagerState.usableConnections
|
66
|
+
.filter(
|
67
|
+
(connection) =>
|
68
|
+
connection.connectionValue instanceof RelationalDatabaseConnection &&
|
69
|
+
connection.connectionValue.type === DatabaseType.MemSQL,
|
70
|
+
)
|
71
|
+
.map(buildRelationalDatabaseConnectionOption);
|
72
|
+
|
73
|
+
const initializeActivationConnection = (
|
74
|
+
val: PackageableConnection | undefined,
|
75
|
+
): PackageableConnection | undefined => {
|
76
|
+
if (val) {
|
77
|
+
editorState.updateConnection(val);
|
78
|
+
}
|
79
|
+
return !val
|
80
|
+
? undefined
|
81
|
+
: activator.activationConfiguration.activationConnection
|
82
|
+
?.packageableConnection.value;
|
83
|
+
};
|
84
|
+
|
85
|
+
const activationConnection = activator.activationConfiguration
|
86
|
+
.activationConnection
|
87
|
+
? activator.activationConfiguration.activationConnection
|
88
|
+
.packageableConnection.value
|
89
|
+
: initializeActivationConnection(connectionOptions.at(0)?.value);
|
90
|
+
|
91
|
+
const changeConnection = (val: RelationalDatabaseConnectionOption): void => {
|
92
|
+
if (!isReadOnly && val.value === activationConnection) {
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
editorState.updateConnection(val.value);
|
96
|
+
};
|
97
|
+
const changeDescription: React.ChangeEventHandler<HTMLTextAreaElement> = (
|
98
|
+
event,
|
99
|
+
) => {
|
100
|
+
if (!isReadOnly) {
|
101
|
+
editorState.updateAppDescription(event.target.value);
|
102
|
+
}
|
103
|
+
};
|
104
|
+
const visitFunction = (): void =>
|
105
|
+
editorState.editorStore.graphEditorMode.openElement(
|
106
|
+
activator.function.value,
|
107
|
+
);
|
108
|
+
const visitConnection = (): void => {
|
109
|
+
if (activationConnection) {
|
110
|
+
editorState.editorStore.graphEditorMode.openElement(activationConnection);
|
111
|
+
}
|
112
|
+
};
|
113
|
+
const validate = (): void => {
|
114
|
+
flowResult(editorState.validate()).catch(
|
115
|
+
applicationStore.alertUnhandledError,
|
116
|
+
);
|
117
|
+
};
|
118
|
+
const deploy = (): void => {
|
119
|
+
flowResult(editorState.deployToSandbox()).catch(
|
120
|
+
applicationStore.alertUnhandledError,
|
121
|
+
);
|
122
|
+
};
|
123
|
+
|
124
|
+
return (
|
125
|
+
<div className="mem-sql-function-activator-editor">
|
126
|
+
<Panel>
|
127
|
+
<PanelHeader title="Mem SQL Function" />
|
128
|
+
<PanelLoadingIndicator
|
129
|
+
isLoading={Boolean(
|
130
|
+
editorState.validateState.isInProgress ||
|
131
|
+
editorState.deployState.isInProgress,
|
132
|
+
)}
|
133
|
+
/>
|
134
|
+
<PanelContent>
|
135
|
+
<div className="mem-sql-function-activator-editor__header">
|
136
|
+
<div className="mem-sql-function-activator-editor__header__label">
|
137
|
+
Mem SQL Function
|
138
|
+
</div>
|
139
|
+
<div className="mem-sql-function-activator-editor__header__actions">
|
140
|
+
<button
|
141
|
+
className="mem-sql-function-activator-editor__header__actions__action mem-sql-function-activator-editor__header__actions__action--primary"
|
142
|
+
onClick={validate}
|
143
|
+
disabled={editorState.validateState.isInProgress}
|
144
|
+
tabIndex={-1}
|
145
|
+
title="Click Validate to verify your activator before deployment"
|
146
|
+
>
|
147
|
+
Validate
|
148
|
+
</button>
|
149
|
+
<button
|
150
|
+
className="mem-sql-function-activator-editor__header__actions__action mem-sql-function-activator-editor__header__actions__action--primary"
|
151
|
+
onClick={deploy}
|
152
|
+
disabled={editorState.deployState.isInProgress}
|
153
|
+
title="Deploy to sandbox"
|
154
|
+
tabIndex={-1}
|
155
|
+
>
|
156
|
+
Deploy to Sandbox
|
157
|
+
</button>
|
158
|
+
</div>
|
159
|
+
</div>
|
160
|
+
<PanelForm>
|
161
|
+
<div className="panel__content__form__section">
|
162
|
+
<div className="panel__content__form__section__header__label">
|
163
|
+
Function
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
<div className="mem-sql-function-activator-editor__configuration__items">
|
167
|
+
<div className="mem-sql-function-activator-editor__configuration__item">
|
168
|
+
<div className="btn--sm mem-sql-function-activator-editor__configuration__item__label">
|
169
|
+
<PURE_FunctionIcon />
|
170
|
+
</div>
|
171
|
+
<input
|
172
|
+
className="panel__content__form__section__input"
|
173
|
+
spellCheck={false}
|
174
|
+
disabled={true}
|
175
|
+
value={generateFunctionPrettyName(activator.function.value, {
|
176
|
+
fullPath: true,
|
177
|
+
spacing: false,
|
178
|
+
})}
|
179
|
+
/>
|
180
|
+
<button
|
181
|
+
className="btn--dark btn--sm mem-sql-function-activator-editor__configuration__item__btn"
|
182
|
+
onClick={visitFunction}
|
183
|
+
tabIndex={-1}
|
184
|
+
title="See Function"
|
185
|
+
>
|
186
|
+
<LongArrowRightIcon />
|
187
|
+
</button>
|
188
|
+
</div>
|
189
|
+
</div>
|
190
|
+
</PanelForm>
|
191
|
+
<PanelForm>
|
192
|
+
<div className="panel__content__form__section">
|
193
|
+
<div className="panel__content__form__section__header__label">
|
194
|
+
Connection
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
<div className="mem-sql-function-activator-editor__configuration__items">
|
198
|
+
<div className="mem-sql-function-activator-editor__configuration__item">
|
199
|
+
<div className="btn--sm mem-sql-function-activator-editor__configuration__item__label">
|
200
|
+
<PURE_ConnectionIcon />
|
201
|
+
</div>
|
202
|
+
<CustomSelectorInput
|
203
|
+
inputRef={connectionSelectorRef}
|
204
|
+
className="mem-sql-function-activator-editor__config__connection-selector__input"
|
205
|
+
options={connectionOptions}
|
206
|
+
onChange={changeConnection}
|
207
|
+
value={
|
208
|
+
activationConnection
|
209
|
+
? buildRelationalDatabaseConnectionOption(
|
210
|
+
activationConnection,
|
211
|
+
)
|
212
|
+
: undefined
|
213
|
+
}
|
214
|
+
darkMode={
|
215
|
+
!applicationStore.layoutService
|
216
|
+
.TEMPORARY__isLightColorThemeEnabled
|
217
|
+
}
|
218
|
+
placeholder="Choose a connection"
|
219
|
+
filterOption={connectionFilterOption}
|
220
|
+
/>
|
221
|
+
<button
|
222
|
+
className="btn--dark btn--sm mem-sql-function-activator-editor__configuration__item__btn"
|
223
|
+
onClick={visitConnection}
|
224
|
+
disabled={!activationConnection}
|
225
|
+
tabIndex={-1}
|
226
|
+
title="See Connection"
|
227
|
+
>
|
228
|
+
<LongArrowRightIcon />
|
229
|
+
</button>
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
</PanelForm>
|
233
|
+
<PanelForm>
|
234
|
+
<PanelFormTextField
|
235
|
+
value={activator.functionName}
|
236
|
+
isReadOnly={isReadOnly}
|
237
|
+
name="Activator Identifer"
|
238
|
+
placeholder="Specify the name of the UDF for this activator..."
|
239
|
+
update={(value: string | undefined): void =>
|
240
|
+
editorState.updateApplicationName(value ?? '')
|
241
|
+
}
|
242
|
+
/>
|
243
|
+
</PanelForm>
|
244
|
+
<PanelForm>
|
245
|
+
<div className="panel__content__form__section">
|
246
|
+
<div className="panel__content__form__section__header__label">
|
247
|
+
Description
|
248
|
+
</div>
|
249
|
+
<div className="panel__content__form__section__header__prompt">{`Provide a brief description of Mem SQL Function`}</div>
|
250
|
+
<textarea
|
251
|
+
className="panel__content__form__section__textarea service-editor__documentation__input"
|
252
|
+
spellCheck={false}
|
253
|
+
disabled={isReadOnly}
|
254
|
+
value={activator.description}
|
255
|
+
onChange={changeDescription}
|
256
|
+
/>
|
257
|
+
</div>
|
258
|
+
</PanelForm>
|
259
|
+
<PanelForm>
|
260
|
+
<ActivatorOwnershipForm
|
261
|
+
activator={activator}
|
262
|
+
isReadOnly={isReadOnly}
|
263
|
+
/>
|
264
|
+
</PanelForm>
|
265
|
+
</PanelContent>
|
266
|
+
</Panel>
|
267
|
+
</div>
|
268
|
+
);
|
269
|
+
});
|
@@ -43,7 +43,7 @@ import { useAuth } from 'react-oidc-context';
|
|
43
43
|
import {
|
44
44
|
IngestDefinitionDeploymentResponse,
|
45
45
|
IngestDefinitionValidationResponse,
|
46
|
-
} from '
|
46
|
+
} from '@finos/legend-server-lakehouse';
|
47
47
|
|
48
48
|
const IngestValidationError = observer(
|
49
49
|
(props: {
|
@@ -69,7 +69,6 @@ import { EXTERNAL_APPLICATION_NAVIGATION__generateServiceQueryCreatorUrl } from
|
|
69
69
|
import type { EditorStore } from '../../../../stores/editor/EditorStore.js';
|
70
70
|
import { pureExecution_setFunction } from '../../../../stores/graph-modifier/DSL_Service_GraphModifierHelper.js';
|
71
71
|
import { ServiceEditorState } from '../../../../stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js';
|
72
|
-
import { openDataCube } from '../../../../stores/editor/data-cube/LegendStudioDataCubeHelper.js';
|
73
72
|
|
74
73
|
const ServiceExecutionResultViewer = observer(
|
75
74
|
(props: { executionState: ServicePureExecutionState }) => {
|
@@ -238,7 +237,7 @@ export const ServiceExecutionQueryEditor = observer(
|
|
238
237
|
|
239
238
|
const openServiceCubeViewer =
|
240
239
|
editorStore.applicationStore.guardUnhandledError(async () => {
|
241
|
-
await
|
240
|
+
await executionState.handleOpeningDataCube(service, editorStore);
|
242
241
|
});
|
243
242
|
|
244
243
|
const openQueryInLegendQuery = (): void => {
|
package/src/index.ts
CHANGED
@@ -120,3 +120,5 @@ export type { EmbeddedDataTypeOption } from './stores/editor/editor-state/elemen
|
|
120
120
|
export { SnowflakeAppFunctionActivatorEdtiorState } from './stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js';
|
121
121
|
export { SnowflakeAppFunctionActivatorEditor } from './components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js';
|
122
122
|
export { HostedServiceFunctionActivatorEditorState } from './stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js';
|
123
|
+
export { MemSQLFunctionActivatorEditorState } from './stores/editor/editor-state/element-editor-state/function-activator/MemSQLFunctionActivatorEditorState.js';
|
124
|
+
export { MemSQLFunctionActivatorEditor } from './components/editor/editor-group/function-activator/MemSQLFunctionActivatorEditor.js';
|
@@ -92,6 +92,7 @@ import {
|
|
92
92
|
HostedService,
|
93
93
|
DataProduct,
|
94
94
|
IngestDefinition,
|
95
|
+
MemSQLFunction,
|
95
96
|
} from '@finos/legend-graph';
|
96
97
|
import { CONFIGURATION_EDITOR_TAB } from './editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js';
|
97
98
|
import { PACKAGEABLE_ELEMENT_TYPE } from './utils/ModelClassifierUtils.js';
|
@@ -860,6 +861,8 @@ export class EditorGraphState {
|
|
860
861
|
return PACKAGEABLE_ELEMENT_TYPE._DATA_PRODUCT;
|
861
862
|
} else if (element instanceof IngestDefinition) {
|
862
863
|
return PACKAGEABLE_ELEMENT_TYPE.INGEST_DEFINITION;
|
864
|
+
} else if (element instanceof MemSQLFunction) {
|
865
|
+
return PACKAGEABLE_ELEMENT_TYPE.MEM_SQL_FUNCTION;
|
863
866
|
}
|
864
867
|
const extraElementTypeLabelGetters = this.editorStore.pluginManager
|
865
868
|
.getApplicationPlugins()
|
@@ -121,8 +121,8 @@ import {
|
|
121
121
|
LazyTextEditorStore,
|
122
122
|
} from '../lazy-text-editor/LazyTextEditorStore.js';
|
123
123
|
import type { QueryBuilderDataCubeViewerState } from '@finos/legend-query-builder';
|
124
|
-
import { IngestionManager } from '../ingestion/IngestionManager.js';
|
125
124
|
import { EditorInitialConfiguration } from './editor-state/element-editor-state/ElementEditorInitialConfiguration.js';
|
125
|
+
import { LakehouseIngestionManager } from '@finos/legend-server-lakehouse';
|
126
126
|
|
127
127
|
export abstract class EditorExtensionState {
|
128
128
|
/**
|
@@ -138,7 +138,7 @@ export class EditorStore implements CommandRegistrar {
|
|
138
138
|
readonly applicationStore: LegendStudioApplicationStore;
|
139
139
|
readonly sdlcServerClient: SDLCServerClient;
|
140
140
|
readonly depotServerClient: DepotServerClient;
|
141
|
-
readonly ingestionManager:
|
141
|
+
readonly ingestionManager: LakehouseIngestionManager | undefined;
|
142
142
|
readonly pluginManager: LegendStudioPluginManager;
|
143
143
|
|
144
144
|
/**
|
@@ -314,9 +314,11 @@ export class EditorStore implements CommandRegistrar {
|
|
314
314
|
const ingestionConifg =
|
315
315
|
applicationStore.config.options.ingestDeploymentConfig;
|
316
316
|
if (ingestionConifg) {
|
317
|
-
this.ingestionManager = new
|
318
|
-
ingestionConifg,
|
319
|
-
|
317
|
+
this.ingestionManager = new LakehouseIngestionManager(
|
318
|
+
ingestionConifg.discoveryUrl,
|
319
|
+
ingestionConifg.deployment.defaultServer,
|
320
|
+
ingestionConifg.deployment.useDefaultServer,
|
321
|
+
this.applicationStore.tracerService,
|
320
322
|
);
|
321
323
|
}
|
322
324
|
|
@@ -37,6 +37,7 @@ import {
|
|
37
37
|
HostedService,
|
38
38
|
DataProduct,
|
39
39
|
IngestDefinition,
|
40
|
+
MemSQLFunction,
|
40
41
|
} from '@finos/legend-graph';
|
41
42
|
import {
|
42
43
|
type Clazz,
|
@@ -65,6 +66,7 @@ import { TabManagerState, type TabState } from '@finos/legend-lego/application';
|
|
65
66
|
import { INTERNAL__UnknownFunctionActivatorEdtiorState } from './editor-state/element-editor-state/function-activator/INTERNAL__UnknownFunctionActivatorEditorState.js';
|
66
67
|
import { SnowflakeAppFunctionActivatorEdtiorState } from './editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js';
|
67
68
|
import { HostedServiceFunctionActivatorEditorState } from './editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js';
|
69
|
+
import { MemSQLFunctionActivatorEditorState } from './editor-state/element-editor-state/function-activator/MemSQLFunctionActivatorEditorState.js';
|
68
70
|
import { ArtifactGenerationViewerState } from './editor-state/ArtifactGenerationViewerState.js';
|
69
71
|
import { DataProductEditorState } from './editor-state/element-editor-state/dataProduct/DataProductEditorState.js';
|
70
72
|
import { IngestDefinitionEditorState } from './editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js';
|
@@ -199,6 +201,8 @@ export class EditorTabManagerState extends TabManagerState {
|
|
199
201
|
this.editorStore,
|
200
202
|
element,
|
201
203
|
);
|
204
|
+
} else if (element instanceof MemSQLFunction) {
|
205
|
+
return new MemSQLFunctionActivatorEditorState(this.editorStore, element);
|
202
206
|
} else if (element instanceof INTERNAL__UnknownFunctionActivator) {
|
203
207
|
return new INTERNAL__UnknownFunctionActivatorEdtiorState(
|
204
208
|
this.editorStore,
|
@@ -24,6 +24,7 @@ import {
|
|
24
24
|
RawLambda,
|
25
25
|
RuntimePointer,
|
26
26
|
Service,
|
27
|
+
type ParameterValue,
|
27
28
|
} from '@finos/legend-graph';
|
28
29
|
import type { EditorStore } from '../EditorStore.js';
|
29
30
|
import {
|
@@ -46,6 +47,8 @@ export const isElementSupportedByDataCube = (
|
|
46
47
|
export const openDataCube = async (
|
47
48
|
element: PackageableElement,
|
48
49
|
editorStore: EditorStore,
|
50
|
+
parameterValues?: ParameterValue[],
|
51
|
+
letFuncsRawLambda?: RawLambda,
|
49
52
|
): Promise<void> => {
|
50
53
|
try {
|
51
54
|
let specification: DataCubeSpecification;
|
@@ -54,12 +57,19 @@ export const openDataCube = async (
|
|
54
57
|
if (element instanceof ConcreteFunctionDefinition) {
|
55
58
|
const body = element.expressionSequence;
|
56
59
|
const rawLambda = new RawLambda([], body);
|
60
|
+
rawLambda.parameters = element.parameters.map((parameter) =>
|
61
|
+
editorStore.graphManagerState.graphManager.serializeRawValueSpecification(
|
62
|
+
parameter,
|
63
|
+
),
|
64
|
+
);
|
57
65
|
engine = new QueryBuilderDataCubeEngine(
|
58
66
|
rawLambda,
|
59
|
-
|
67
|
+
parameterValues,
|
60
68
|
undefined,
|
61
69
|
undefined,
|
62
70
|
editorStore.graphManagerState,
|
71
|
+
undefined,
|
72
|
+
letFuncsRawLambda,
|
63
73
|
);
|
64
74
|
specification = await engine.generateInitialSpecification();
|
65
75
|
} else if (element instanceof Service) {
|
@@ -94,10 +104,12 @@ export const openDataCube = async (
|
|
94
104
|
}
|
95
105
|
engine = new QueryBuilderDataCubeEngine(
|
96
106
|
exec.func,
|
97
|
-
|
107
|
+
parameterValues,
|
98
108
|
mapping?.path,
|
99
109
|
runtime?.packageableRuntime.value.path,
|
100
110
|
editorStore.graphManagerState,
|
111
|
+
undefined,
|
112
|
+
letFuncsRawLambda,
|
101
113
|
);
|
102
114
|
specification = await engine.generateInitialSpecification();
|
103
115
|
} else {
|
@@ -26,6 +26,8 @@ import {
|
|
26
26
|
SnowflakeAppDeploymentConfiguration,
|
27
27
|
DeploymentOwner,
|
28
28
|
HostedService,
|
29
|
+
MemSQLFunction,
|
30
|
+
MemSQLDeploymentConfiguration,
|
29
31
|
} from '@finos/legend-graph';
|
30
32
|
import { uuid, type GeneratorFn } from '@finos/legend-shared';
|
31
33
|
import { FUNCTION_ACTIVATE_TYPE } from '../../../../components/editor/editor-group/function-activator/FunctionEditor.js';
|
@@ -116,6 +118,19 @@ export class FunctionActivatorState {
|
|
116
118
|
PackageableElementExplicitReference.create(functionElement);
|
117
119
|
return hostedService;
|
118
120
|
}
|
121
|
+
case FUNCTION_ACTIVATE_TYPE.MEM_SQL_FUNCTION: {
|
122
|
+
const activatorName = this.activatorPath.includes('::')
|
123
|
+
? extractElementNameFromPath(this.activatorPath)
|
124
|
+
: this.activatorPath;
|
125
|
+
const memSQLFun = new MemSQLFunction(activatorName);
|
126
|
+
memSQLFun.functionName = '';
|
127
|
+
memSQLFun.description = '';
|
128
|
+
memSQLFun.ownership = new DeploymentOwner('', memSQLFun);
|
129
|
+
memSQLFun.function =
|
130
|
+
PackageableElementExplicitReference.create(functionElement);
|
131
|
+
memSQLFun.activationConfiguration = new MemSQLDeploymentConfiguration();
|
132
|
+
return memSQLFun;
|
133
|
+
}
|
119
134
|
default:
|
120
135
|
return undefined;
|
121
136
|
}
|
@@ -68,9 +68,11 @@ import {
|
|
68
68
|
QueryBuilderTelemetryHelper,
|
69
69
|
buildExecutionParameterValues,
|
70
70
|
getExecutionQueryFromRawLambda,
|
71
|
+
getRawLambdaForLetFuncs,
|
71
72
|
} from '@finos/legend-query-builder';
|
72
73
|
import { FunctionActivatorState } from './FunctionActivatorState.js';
|
73
74
|
import { FunctionTestableState } from './function-activator/testable/FunctionTestableState.js';
|
75
|
+
import { openDataCube } from '../../data-cube/LegendStudioDataCubeHelper.js';
|
74
76
|
|
75
77
|
export enum FUNCTION_EDITOR_TAB {
|
76
78
|
DEFINITION = 'DEFINITION',
|
@@ -249,6 +251,24 @@ export class FunctionParametersState extends LambdaParametersState {
|
|
249
251
|
);
|
250
252
|
}
|
251
253
|
|
254
|
+
openDataCubeModal(
|
255
|
+
query: RawLambda,
|
256
|
+
element: PackageableElement,
|
257
|
+
editorStore: EditorStore,
|
258
|
+
): void {
|
259
|
+
this.parameterStates = this.build(query);
|
260
|
+
this.parameterValuesEditorState.open(
|
261
|
+
(): Promise<void> =>
|
262
|
+
this.functionEditorState
|
263
|
+
.openingDataCube(element, editorStore)
|
264
|
+
.catch(
|
265
|
+
this.functionEditorState.editorStore.applicationStore
|
266
|
+
.alertUnhandledError,
|
267
|
+
),
|
268
|
+
PARAMETER_SUBMIT_ACTION.RUN,
|
269
|
+
);
|
270
|
+
}
|
271
|
+
|
252
272
|
build(lambda: RawLambda): LambdaParameterState[] {
|
253
273
|
const parameters = buildLambdaVariableExpressions(
|
254
274
|
lambda,
|
@@ -531,6 +551,36 @@ export class FunctionEditorState extends ElementEditorState {
|
|
531
551
|
}
|
532
552
|
}
|
533
553
|
|
554
|
+
async handleOpeningDataCube(
|
555
|
+
element: PackageableElement,
|
556
|
+
editorStore: EditorStore,
|
557
|
+
): Promise<void> {
|
558
|
+
const query = this.bodyExpressionSequence;
|
559
|
+
const parameters = (query.parameters ?? []) as object[];
|
560
|
+
if (parameters.length) {
|
561
|
+
this.parametersState.openDataCubeModal(query, element, editorStore);
|
562
|
+
} else {
|
563
|
+
await openDataCube(element, editorStore);
|
564
|
+
}
|
565
|
+
}
|
566
|
+
|
567
|
+
async openingDataCube(
|
568
|
+
element: PackageableElement,
|
569
|
+
editorStore: EditorStore,
|
570
|
+
): Promise<void> {
|
571
|
+
const params = buildExecutionParameterValues(
|
572
|
+
this.parametersState.parameterStates,
|
573
|
+
this.editorStore.graphManagerState,
|
574
|
+
);
|
575
|
+
|
576
|
+
const letFuncsRawLambda = getRawLambdaForLetFuncs(
|
577
|
+
this.parametersState.parameterStates,
|
578
|
+
this.editorStore.graphManagerState,
|
579
|
+
);
|
580
|
+
|
581
|
+
await openDataCube(element, editorStore, params, letFuncsRawLambda);
|
582
|
+
}
|
583
|
+
|
534
584
|
*handleRunFunc(): GeneratorFn<void> {
|
535
585
|
if (this.isRunningFunc) {
|
536
586
|
return;
|