@finos/legend-application-studio 28.1.4 → 28.2.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/components/editor/__test-utils__/EditorComponentTestUtils.d.ts +0 -1
- package/lib/components/editor/__test-utils__/EditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js +1 -3
- package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js.map +1 -1
- package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/FunctionEditor.js +43 -6
- package/lib/components/editor/editor-group/FunctionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js +4 -9
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js +36 -47
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.js +12 -3
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.js.map +1 -1
- package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.js +6 -6
- package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +1 -1
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
- package/lib/stores/editor/EditorGraphState.js +3 -27
- package/lib/stores/editor/EditorGraphState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +16 -2
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.js.map +1 -1
- 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 +5 -3
- 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/testable/ServiceTestDataState.d.ts +2 -0
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +29 -2
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
- package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js +0 -11
- package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js.map +1 -1
- package/package.json +6 -6
- package/src/components/editor/__test-utils__/EditorComponentTestUtils.tsx +0 -7
- package/src/components/editor/editor-group/FunctionEditor.tsx +100 -2
- package/src/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.tsx +11 -18
- package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +69 -83
- package/src/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.tsx +55 -18
- package/src/components/editor/editor-group/uml-editor/ClassQueryBuilder.tsx +6 -6
- package/src/components/editor/side-bar/Explorer.tsx +1 -1
- package/src/stores/editor/EditorGraphState.ts +10 -53
- package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +29 -0
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.ts +1 -2
- package/src/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.ts +6 -2
- package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +61 -0
- package/src/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.ts +0 -16
@@ -14,7 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import { useState, useEffect, useCallback, useRef } from 'react';
|
17
|
+
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
18
18
|
import { observer } from 'mobx-react-lite';
|
19
19
|
import {
|
20
20
|
FunctionEditorState,
|
@@ -27,6 +27,7 @@ import {
|
|
27
27
|
} from '../../../stores/editor/utils/DnDUtils.js';
|
28
28
|
import {
|
29
29
|
assertErrorThrown,
|
30
|
+
assertTrue,
|
30
31
|
prettyCONSTName,
|
31
32
|
returnUndefOnError,
|
32
33
|
UnsupportedOperationError,
|
@@ -61,6 +62,7 @@ import {
|
|
61
62
|
PauseCircleIcon,
|
62
63
|
PlayIcon,
|
63
64
|
PanelLoadingIndicator,
|
65
|
+
PencilIcon,
|
64
66
|
} from '@finos/legend-art';
|
65
67
|
import { LEGEND_STUDIO_TEST_ID } from '../../../__lib__/LegendStudioTesting.js';
|
66
68
|
import {
|
@@ -98,6 +100,7 @@ import {
|
|
98
100
|
getClassProperty,
|
99
101
|
RawExecutionResult,
|
100
102
|
extractExecutionResultValues,
|
103
|
+
RawLambda,
|
101
104
|
} from '@finos/legend-graph';
|
102
105
|
import {
|
103
106
|
type ApplicationStore,
|
@@ -131,7 +134,9 @@ import {
|
|
131
134
|
} from '../../../stores/graph-modifier/RawValueSpecificationGraphModifierHelper.js';
|
132
135
|
import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../__lib__/LegendStudioApplicationNavigationContext.js';
|
133
136
|
import {
|
137
|
+
type QueryBuilderState,
|
134
138
|
ExecutionPlanViewer,
|
139
|
+
FunctionQueryBuilderState,
|
135
140
|
LambdaEditor,
|
136
141
|
LambdaParameterValuesEditor,
|
137
142
|
} from '@finos/legend-query-builder';
|
@@ -1055,7 +1060,7 @@ export const FunctionEditor = observer(() => {
|
|
1055
1060
|
const debugPlanGeneration = applicationStore.guardUnhandledError(() =>
|
1056
1061
|
flowResult(functionEditorState.generatePlan(true)),
|
1057
1062
|
);
|
1058
|
-
|
1063
|
+
const embeddedQueryBuilderState = editorStore.embeddedQueryBuilderState;
|
1059
1064
|
useEffect(() => {
|
1060
1065
|
flowResult(
|
1061
1066
|
functionEditorState.functionDefinitionEditorState.convertLambdaObjectToGrammarString(
|
@@ -1071,6 +1076,88 @@ export const FunctionEditor = observer(() => {
|
|
1071
1076
|
LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.FUNCTION_EDITOR,
|
1072
1077
|
);
|
1073
1078
|
|
1079
|
+
const editWithQueryBuilder = (): (() => void) =>
|
1080
|
+
applicationStore.guardUnhandledError(async () => {
|
1081
|
+
try {
|
1082
|
+
const functionQueryBuilderState = new FunctionQueryBuilderState(
|
1083
|
+
embeddedQueryBuilderState.editorStore.applicationStore,
|
1084
|
+
embeddedQueryBuilderState.editorStore.graphManagerState,
|
1085
|
+
functionEditorState.functionElement,
|
1086
|
+
);
|
1087
|
+
functionQueryBuilderState.initializeWithQuery(
|
1088
|
+
new RawLambda(
|
1089
|
+
functionEditorState.functionElement.parameters.map((_param) =>
|
1090
|
+
functionEditorState.editorStore.graphManagerState.graphManager.serializeRawValueSpecification(
|
1091
|
+
_param,
|
1092
|
+
),
|
1093
|
+
),
|
1094
|
+
functionEditorState.functionElement.expressionSequence,
|
1095
|
+
),
|
1096
|
+
);
|
1097
|
+
assertTrue(
|
1098
|
+
Boolean(
|
1099
|
+
functionQueryBuilderState.isQuerySupported &&
|
1100
|
+
functionQueryBuilderState.executionContextState.mapping &&
|
1101
|
+
functionQueryBuilderState.executionContextState.runtimeValue,
|
1102
|
+
),
|
1103
|
+
`Only functions returning TDS/graph fetch using the from() function can be edited via query builder`,
|
1104
|
+
);
|
1105
|
+
await flowResult(
|
1106
|
+
embeddedQueryBuilderState.setEmbeddedQueryBuilderConfiguration({
|
1107
|
+
setupQueryBuilderState: (): QueryBuilderState =>
|
1108
|
+
functionQueryBuilderState,
|
1109
|
+
actionConfigs: [
|
1110
|
+
{
|
1111
|
+
key: 'save-query-btn',
|
1112
|
+
renderer: (
|
1113
|
+
queryBuilderState: QueryBuilderState,
|
1114
|
+
): React.ReactNode => {
|
1115
|
+
const save = applicationStore.guardUnhandledError(
|
1116
|
+
async () => {
|
1117
|
+
try {
|
1118
|
+
const rawLambda = queryBuilderState.buildQuery();
|
1119
|
+
await flowResult(
|
1120
|
+
functionEditorState.updateFunctionWithQuery(
|
1121
|
+
rawLambda,
|
1122
|
+
),
|
1123
|
+
);
|
1124
|
+
applicationStore.notificationService.notifySuccess(
|
1125
|
+
`Function query is updated`,
|
1126
|
+
);
|
1127
|
+
embeddedQueryBuilderState.setEmbeddedQueryBuilderConfiguration(
|
1128
|
+
undefined,
|
1129
|
+
);
|
1130
|
+
} catch (error) {
|
1131
|
+
assertErrorThrown(error);
|
1132
|
+
applicationStore.notificationService.notifyError(
|
1133
|
+
`Can't save query: ${error.message}`,
|
1134
|
+
);
|
1135
|
+
}
|
1136
|
+
},
|
1137
|
+
);
|
1138
|
+
return (
|
1139
|
+
<button
|
1140
|
+
className="query-builder__dialog__header__custom-action"
|
1141
|
+
tabIndex={-1}
|
1142
|
+
disabled={isReadOnly}
|
1143
|
+
onClick={save}
|
1144
|
+
>
|
1145
|
+
Save Query
|
1146
|
+
</button>
|
1147
|
+
);
|
1148
|
+
},
|
1149
|
+
},
|
1150
|
+
],
|
1151
|
+
}),
|
1152
|
+
);
|
1153
|
+
} catch (error) {
|
1154
|
+
assertErrorThrown(error);
|
1155
|
+
applicationStore.notificationService.notifyError(
|
1156
|
+
`Unable to edit via query builder: ${error.message}`,
|
1157
|
+
);
|
1158
|
+
}
|
1159
|
+
});
|
1160
|
+
|
1074
1161
|
return (
|
1075
1162
|
<div className="function-editor uml-editor uml-editor--dark">
|
1076
1163
|
<Panel>
|
@@ -1102,6 +1189,17 @@ export const FunctionEditor = observer(() => {
|
|
1102
1189
|
))}
|
1103
1190
|
</div>
|
1104
1191
|
<div className="panel__header__actions">
|
1192
|
+
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
1193
|
+
<button
|
1194
|
+
className="btn__dropdown-combo__label"
|
1195
|
+
onClick={editWithQueryBuilder()}
|
1196
|
+
title="Edit Query"
|
1197
|
+
tabIndex={-1}
|
1198
|
+
>
|
1199
|
+
<PencilIcon className="btn__dropdown-combo__label__icon" />
|
1200
|
+
<div className="btn__dropdown-combo__label__title">Edit</div>
|
1201
|
+
</button>
|
1202
|
+
</div>
|
1105
1203
|
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
1106
1204
|
{functionEditorState.isRunningFunc ? (
|
1107
1205
|
<button
|
package/src/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.tsx
CHANGED
@@ -850,19 +850,17 @@ const ProjectVersionDependencyEditor = observer(
|
|
850
850
|
}
|
851
851
|
};
|
852
852
|
const viewProject = (): void => {
|
853
|
-
|
854
|
-
applicationStore.navigationService.navigator.
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
: projectDependency.versionId,
|
862
|
-
),
|
853
|
+
applicationStore.navigationService.navigator.visitAddress(
|
854
|
+
applicationStore.navigationService.navigator.generateAddress(
|
855
|
+
generateViewProjectByGAVRoute(
|
856
|
+
guaranteeNonNullable(projectDependency.groupId),
|
857
|
+
guaranteeNonNullable(projectDependency.artifactId),
|
858
|
+
projectDependency.versionId === MASTER_SNAPSHOT_ALIAS
|
859
|
+
? SNAPSHOT_VERSION_ALIAS
|
860
|
+
: projectDependency.versionId,
|
863
861
|
),
|
864
|
-
)
|
865
|
-
|
862
|
+
),
|
863
|
+
);
|
866
864
|
};
|
867
865
|
// NOTE: This assumes that the dependant project is in the same studio instance as the current project
|
868
866
|
// In the future, the studio instance may be part of the project data
|
@@ -927,11 +925,7 @@ const ProjectVersionDependencyEditor = observer(
|
|
927
925
|
content={
|
928
926
|
<MenuContent>
|
929
927
|
<MenuContentItem
|
930
|
-
disabled={
|
931
|
-
projectDependency.isLegacyDependency ||
|
932
|
-
!selectedProject ||
|
933
|
-
!selectedVersionOption
|
934
|
-
}
|
928
|
+
disabled={!selectedProject || !selectedVersionOption}
|
935
929
|
onClick={viewProject}
|
936
930
|
title="View project"
|
937
931
|
>
|
@@ -940,7 +934,6 @@ const ProjectVersionDependencyEditor = observer(
|
|
940
934
|
<MenuContentItem
|
941
935
|
title="View SDLC project"
|
942
936
|
disabled={
|
943
|
-
projectDependency.isLegacyDependency ||
|
944
937
|
!selectedProject ||
|
945
938
|
!selectedVersionOption ||
|
946
939
|
!projectDependencyData
|
@@ -36,7 +36,6 @@ import { assertErrorThrown } from '@finos/legend-shared';
|
|
36
36
|
import { flowResult } from 'mobx';
|
37
37
|
import { useEditorStore } from '../../EditorStoreProvider.js';
|
38
38
|
import {
|
39
|
-
isStubbed_PackageableElement,
|
40
39
|
isStubbed_RawLambda,
|
41
40
|
KeyedExecutionParameter,
|
42
41
|
} from '@finos/legend-graph';
|
@@ -115,91 +114,78 @@ export const ServiceExecutionQueryEditor = observer(
|
|
115
114
|
applicationStore.guardUnhandledError(async () => {
|
116
115
|
const selectedExecutionState =
|
117
116
|
executionState.selectedExecutionContextState;
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
117
|
+
|
118
|
+
await flowResult(
|
119
|
+
embeddedQueryBuilderState.setEmbeddedQueryBuilderConfiguration({
|
120
|
+
setupQueryBuilderState: (): QueryBuilderState => {
|
121
|
+
const queryBuilderState = new ServiceQueryBuilderState(
|
122
|
+
embeddedQueryBuilderState.editorStore.applicationStore,
|
123
|
+
embeddedQueryBuilderState.editorStore.graphManagerState,
|
124
|
+
service,
|
125
|
+
undefined,
|
126
|
+
selectedExecutionState?.executionContext instanceof
|
127
|
+
KeyedExecutionParameter
|
128
|
+
? selectedExecutionState.executionContext.key
|
129
|
+
: undefined,
|
130
|
+
);
|
131
|
+
queryBuilderState.initializeWithQuery(
|
132
|
+
executionState.execution.func,
|
133
|
+
);
|
134
|
+
if (openInTextMode) {
|
135
|
+
queryBuilderState.textEditorState.openModal(
|
136
|
+
QueryBuilderTextEditorMode.TEXT,
|
137
|
+
);
|
138
|
+
}
|
139
|
+
return queryBuilderState;
|
140
|
+
},
|
141
|
+
actionConfigs: [
|
142
|
+
{
|
143
|
+
key: 'save-query-btn',
|
144
|
+
renderer: (
|
145
|
+
queryBuilderState: QueryBuilderState,
|
146
|
+
): React.ReactNode => {
|
147
|
+
const save = applicationStore.guardUnhandledError(
|
148
|
+
async () => {
|
149
|
+
try {
|
150
|
+
const rawLambda = queryBuilderState.buildQuery();
|
151
|
+
await flowResult(
|
152
|
+
executionState.queryState.updateLamba(rawLambda),
|
153
|
+
);
|
154
|
+
applicationStore.notificationService.notifySuccess(
|
155
|
+
`Service query is updated`,
|
156
|
+
);
|
157
|
+
embeddedQueryBuilderState.setEmbeddedQueryBuilderConfiguration(
|
158
|
+
undefined,
|
159
|
+
);
|
160
|
+
} catch (error) {
|
161
|
+
assertErrorThrown(error);
|
162
|
+
applicationStore.notificationService.notifyError(
|
163
|
+
`Can't save query: ${error.message}`,
|
164
|
+
);
|
165
|
+
}
|
166
|
+
},
|
138
167
|
);
|
139
|
-
|
140
|
-
|
168
|
+
|
169
|
+
return (
|
170
|
+
<button
|
171
|
+
className="query-builder__dialog__header__custom-action"
|
172
|
+
tabIndex={-1}
|
173
|
+
disabled={isReadOnly}
|
174
|
+
onClick={save}
|
175
|
+
>
|
176
|
+
Save Query
|
177
|
+
</button>
|
141
178
|
);
|
142
|
-
if (openInTextMode) {
|
143
|
-
queryBuilderState.textEditorState.openModal(
|
144
|
-
QueryBuilderTextEditorMode.TEXT,
|
145
|
-
);
|
146
|
-
}
|
147
|
-
return queryBuilderState;
|
148
179
|
},
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
const rawLambda = queryBuilderState.buildQuery();
|
159
|
-
await flowResult(
|
160
|
-
executionState.queryState.updateLamba(rawLambda),
|
161
|
-
);
|
162
|
-
applicationStore.notificationService.notifySuccess(
|
163
|
-
`Service query is updated`,
|
164
|
-
);
|
165
|
-
embeddedQueryBuilderState.setEmbeddedQueryBuilderConfiguration(
|
166
|
-
undefined,
|
167
|
-
);
|
168
|
-
} catch (error) {
|
169
|
-
assertErrorThrown(error);
|
170
|
-
applicationStore.notificationService.notifyError(
|
171
|
-
`Can't save query: ${error.message}`,
|
172
|
-
);
|
173
|
-
}
|
174
|
-
},
|
175
|
-
);
|
176
|
-
|
177
|
-
return (
|
178
|
-
<button
|
179
|
-
className="query-builder__dialog__header__custom-action"
|
180
|
-
tabIndex={-1}
|
181
|
-
disabled={isReadOnly}
|
182
|
-
onClick={save}
|
183
|
-
>
|
184
|
-
Save Query
|
185
|
-
</button>
|
186
|
-
);
|
187
|
-
},
|
188
|
-
},
|
189
|
-
],
|
190
|
-
disableCompile: isStubbed_RawLambda(
|
191
|
-
executionState.queryState.query,
|
192
|
-
),
|
193
|
-
}),
|
194
|
-
);
|
195
|
-
executionState.setOpeningQueryEditor(false);
|
196
|
-
return;
|
197
|
-
}
|
198
|
-
applicationStore.notificationService.notifyWarning(
|
199
|
-
'Please specify a mapping and a runtime for the execution context to edit with query builder',
|
200
|
-
);
|
201
|
-
executionState.setOpeningQueryEditor(false);
|
202
|
-
}
|
180
|
+
},
|
181
|
+
],
|
182
|
+
disableCompile: isStubbed_RawLambda(
|
183
|
+
executionState.queryState.query,
|
184
|
+
),
|
185
|
+
}),
|
186
|
+
);
|
187
|
+
executionState.setOpeningQueryEditor(false);
|
188
|
+
return;
|
203
189
|
});
|
204
190
|
|
205
191
|
const importQuery = (): void =>
|
package/src/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.tsx
CHANGED
@@ -16,10 +16,12 @@
|
|
16
16
|
|
17
17
|
import {
|
18
18
|
BlankPanelPlaceholder,
|
19
|
+
CaretDownIcon,
|
19
20
|
clsx,
|
20
21
|
ContextMenu,
|
21
22
|
CustomSelectorInput,
|
22
23
|
Dialog,
|
24
|
+
DropdownMenu,
|
23
25
|
InfoCircleIcon,
|
24
26
|
MaskIcon,
|
25
27
|
MenuContent,
|
@@ -199,6 +201,12 @@ export const ConnectionTestDataEditor = observer(
|
|
199
201
|
}
|
200
202
|
};
|
201
203
|
|
204
|
+
const generateQuerySchemas = (): void => {
|
205
|
+
flowResult(connectionTestDataState.generateQuerySchemas()).catch(
|
206
|
+
applicationStore.alertUnhandledError,
|
207
|
+
);
|
208
|
+
};
|
209
|
+
|
202
210
|
return (
|
203
211
|
<div className="service-test-data-editor">
|
204
212
|
<div className="service-test-suite-editor__header">
|
@@ -231,22 +239,45 @@ export const ConnectionTestDataEditor = observer(
|
|
231
239
|
<MaskIcon />
|
232
240
|
</button>
|
233
241
|
</div>
|
234
|
-
<
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
<RefreshIcon className="
|
245
|
-
<div className="
|
242
|
+
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
243
|
+
<button
|
244
|
+
className="btn__dropdown-combo__label"
|
245
|
+
onClick={generateTestData}
|
246
|
+
title="Generate test data if possible"
|
247
|
+
disabled={
|
248
|
+
connectionTestDataState.generatingTestDataState.isInProgress
|
249
|
+
}
|
250
|
+
tabIndex={-1}
|
251
|
+
>
|
252
|
+
<RefreshIcon className="btn__dropdown-combo__label__icon" />
|
253
|
+
<div className="btn__dropdown-combo__label__title">
|
246
254
|
Generate
|
247
255
|
</div>
|
248
|
-
</
|
249
|
-
|
256
|
+
</button>
|
257
|
+
<DropdownMenu
|
258
|
+
className="btn__dropdown-combo__dropdown-btn"
|
259
|
+
content={
|
260
|
+
<MenuContent>
|
261
|
+
<MenuContentItem
|
262
|
+
className="btn__dropdown-combo__option"
|
263
|
+
onClick={generateQuerySchemas}
|
264
|
+
disabled={
|
265
|
+
connectionTestDataState.generateSchemaQueryState
|
266
|
+
.isInProgress
|
267
|
+
}
|
268
|
+
>
|
269
|
+
Generate Query Schemas
|
270
|
+
</MenuContentItem>
|
271
|
+
</MenuContent>
|
272
|
+
}
|
273
|
+
menuProps={{
|
274
|
+
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
275
|
+
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
276
|
+
}}
|
277
|
+
>
|
278
|
+
<CaretDownIcon />
|
279
|
+
</DropdownMenu>
|
280
|
+
</div>
|
250
281
|
<button
|
251
282
|
className="panel__header__action service-execution-editor__test-data__generate-btn"
|
252
283
|
onClick={openShared}
|
@@ -631,10 +662,16 @@ export const ServiceTestDataEditor = observer(
|
|
631
662
|
</ResizablePanelSplitter>
|
632
663
|
<ResizablePanel minSize={600}>
|
633
664
|
<PanelLoadingIndicator
|
634
|
-
isLoading={
|
635
|
-
|
636
|
-
.
|
637
|
-
|
665
|
+
isLoading={
|
666
|
+
Boolean(
|
667
|
+
testDataState.selectedDataState?.generatingTestDataState
|
668
|
+
.isInProgress,
|
669
|
+
) ||
|
670
|
+
Boolean(
|
671
|
+
testDataState.selectedDataState?.generateSchemaQueryState
|
672
|
+
.isInProgress,
|
673
|
+
)
|
674
|
+
}
|
638
675
|
/>
|
639
676
|
{testDataState.selectedDataState && (
|
640
677
|
<ConnectionTestDataEditor
|
@@ -68,11 +68,11 @@ const promoteQueryToService = async (
|
|
68
68
|
const applicationStore = editorStore.applicationStore;
|
69
69
|
try {
|
70
70
|
const mapping = guaranteeNonNullable(
|
71
|
-
queryBuilderState.mapping,
|
71
|
+
queryBuilderState.executionContextState.mapping,
|
72
72
|
'Mapping is required to create service execution',
|
73
73
|
);
|
74
74
|
const runtime = guaranteeNonNullable(
|
75
|
-
queryBuilderState.runtimeValue,
|
75
|
+
queryBuilderState.executionContextState.runtimeValue,
|
76
76
|
'Runtime is required to create service execution',
|
77
77
|
);
|
78
78
|
const query = queryBuilderState.buildQuery();
|
@@ -269,15 +269,15 @@ const PromoteToServiceQueryBuilderAction = observer(
|
|
269
269
|
setPromoteQueryType(type);
|
270
270
|
const closeNewServiceModal = (): void => setPromoteQueryType(undefined);
|
271
271
|
const allowPromotion = Boolean(
|
272
|
-
queryBuilderState.mapping &&
|
273
|
-
queryBuilderState.runtimeValue &&
|
272
|
+
queryBuilderState.executionContextState.mapping &&
|
273
|
+
queryBuilderState.executionContextState.runtimeValue &&
|
274
274
|
!queryBuilderState.allValidationIssues.length,
|
275
275
|
);
|
276
276
|
|
277
277
|
const renderSaveAsModal = (): React.ReactNode => {
|
278
278
|
if (
|
279
279
|
promoteQueryModal === PROMOTE_QUERY_TYPE.SERVICE &&
|
280
|
-
queryBuilderState.mapping
|
280
|
+
queryBuilderState.executionContextState.mapping
|
281
281
|
) {
|
282
282
|
const promoteToService = async (
|
283
283
|
packagePath: string,
|
@@ -295,7 +295,7 @@ const PromoteToServiceQueryBuilderAction = observer(
|
|
295
295
|
|
296
296
|
return (
|
297
297
|
<NewServiceModal
|
298
|
-
mapping={queryBuilderState.mapping}
|
298
|
+
mapping={queryBuilderState.executionContextState.mapping}
|
299
299
|
close={closeNewServiceModal}
|
300
300
|
showModal={true}
|
301
301
|
promoteToService={promoteToService}
|
@@ -698,7 +698,7 @@ const ExplorerContextMenu = observer(
|
|
698
698
|
editorStore.projectConfigurationEditorState.projectConfiguration?.projectDependencies.find(
|
699
699
|
(dep) => dep.projectId === node?.packageableElement.name,
|
700
700
|
);
|
701
|
-
if (projectDependency
|
701
|
+
if (projectDependency) {
|
702
702
|
applicationStore.navigationService.navigator.visitAddress(
|
703
703
|
applicationStore.navigationService.navigator.generateAddress(
|
704
704
|
generateViewProjectByGAVRoute(
|
@@ -42,11 +42,7 @@ import { ElementEditorState } from './editor-state/element-editor-state/ElementE
|
|
42
42
|
import { GraphGenerationState } from './editor-state/GraphGenerationState.js';
|
43
43
|
import { MODEL_IMPORT_NATIVE_INPUT_TYPE } from './editor-state/ModelImporterState.js';
|
44
44
|
import type { DSL_LegendStudioApplicationPlugin_Extension } from '../LegendStudioApplicationPlugin.js';
|
45
|
-
import {
|
46
|
-
type Entity,
|
47
|
-
EntitiesWithOrigin,
|
48
|
-
generateGAVCoordinates,
|
49
|
-
} from '@finos/legend-storage';
|
45
|
+
import { type Entity, EntitiesWithOrigin } from '@finos/legend-storage';
|
50
46
|
import {
|
51
47
|
type EntityChange,
|
52
48
|
type ProjectDependency,
|
@@ -59,7 +55,6 @@ import {
|
|
59
55
|
ProjectDependencyCoordinates,
|
60
56
|
RawProjectDependencyReport,
|
61
57
|
buildDependencyReport,
|
62
|
-
StoreProjectData,
|
63
58
|
} from '@finos/legend-server-depot';
|
64
59
|
import {
|
65
60
|
GRAPH_MANAGER_EVENT,
|
@@ -752,53 +747,15 @@ export class EditorGraphState {
|
|
752
747
|
projectDependencies: ProjectDependency[],
|
753
748
|
): Promise<ProjectDependencyCoordinates[]> {
|
754
749
|
return Promise.all(
|
755
|
-
projectDependencies.map(async (dep) =>
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
.getProjectById(dep.projectId)
|
765
|
-
.then((projects) => {
|
766
|
-
const projectsData = projects.map((p) =>
|
767
|
-
StoreProjectData.serialization.fromJson(p),
|
768
|
-
);
|
769
|
-
if (projectsData.length !== 1) {
|
770
|
-
throw new Error(
|
771
|
-
`Expected 1 project for project ID '${dep.projectId}'. Got ${
|
772
|
-
projectsData.length
|
773
|
-
} projects with coordinates ${projectsData
|
774
|
-
.map(
|
775
|
-
(i) =>
|
776
|
-
`'${generateGAVCoordinates(
|
777
|
-
i.groupId,
|
778
|
-
i.artifactId,
|
779
|
-
undefined,
|
780
|
-
)}'`,
|
781
|
-
)
|
782
|
-
.join(', ')}.`,
|
783
|
-
);
|
784
|
-
}
|
785
|
-
const project = projectsData[0] as StoreProjectData;
|
786
|
-
return new ProjectDependencyCoordinates(
|
787
|
-
project.groupId,
|
788
|
-
project.artifactId,
|
789
|
-
dep.versionId,
|
790
|
-
);
|
791
|
-
});
|
792
|
-
} else {
|
793
|
-
return Promise.resolve(
|
794
|
-
new ProjectDependencyCoordinates(
|
795
|
-
guaranteeNonNullable(dep.groupId),
|
796
|
-
guaranteeNonNullable(dep.artifactId),
|
797
|
-
dep.versionId,
|
798
|
-
),
|
799
|
-
);
|
800
|
-
}
|
801
|
-
}),
|
750
|
+
projectDependencies.map(async (dep) =>
|
751
|
+
Promise.resolve(
|
752
|
+
new ProjectDependencyCoordinates(
|
753
|
+
guaranteeNonNullable(dep.groupId),
|
754
|
+
guaranteeNonNullable(dep.artifactId),
|
755
|
+
dep.versionId,
|
756
|
+
),
|
757
|
+
),
|
758
|
+
),
|
802
759
|
);
|
803
760
|
}
|
804
761
|
|
@@ -32,6 +32,7 @@ import {
|
|
32
32
|
assertType,
|
33
33
|
StopWatch,
|
34
34
|
filterByType,
|
35
|
+
assertTrue,
|
35
36
|
} from '@finos/legend-shared';
|
36
37
|
import { ElementEditorState } from './ElementEditorState.js';
|
37
38
|
import {
|
@@ -51,6 +52,7 @@ import {
|
|
51
52
|
VariableExpression,
|
52
53
|
observe_ValueSpecification,
|
53
54
|
generateFunctionPrettyName,
|
55
|
+
RawVariableExpression,
|
54
56
|
} from '@finos/legend-graph';
|
55
57
|
import {
|
56
58
|
ExecutionPlanState,
|
@@ -271,6 +273,7 @@ export class FunctionEditorState extends ElementEditorState {
|
|
271
273
|
generatePlan: flow,
|
272
274
|
handleRunFunc: flow,
|
273
275
|
cancelFuncRun: flow,
|
276
|
+
updateFunctionWithQuery: flow,
|
274
277
|
});
|
275
278
|
|
276
279
|
assertType(
|
@@ -335,6 +338,32 @@ export class FunctionEditorState extends ElementEditorState {
|
|
335
338
|
this.functionDefinitionEditorState.setCompilationError(undefined);
|
336
339
|
}
|
337
340
|
|
341
|
+
*updateFunctionWithQuery(val: RawLambda): GeneratorFn<void> {
|
342
|
+
const lambdaParam = val.parameters ? (val.parameters as object[]) : [];
|
343
|
+
const parameters = lambdaParam
|
344
|
+
.map((param) =>
|
345
|
+
this.editorStore.graphManagerState.graphManager.buildRawValueSpecification(
|
346
|
+
param,
|
347
|
+
this.editorStore.graphManagerState.graph,
|
348
|
+
),
|
349
|
+
)
|
350
|
+
.map((rawValueSpec) =>
|
351
|
+
guaranteeType(rawValueSpec, RawVariableExpression),
|
352
|
+
);
|
353
|
+
assertTrue(
|
354
|
+
Array.isArray(val.body),
|
355
|
+
`Query body expected to be a list of expressions`,
|
356
|
+
);
|
357
|
+
this.functionElement.expressionSequence = val.body as object[];
|
358
|
+
this.functionElement.parameters = parameters;
|
359
|
+
yield flowResult(
|
360
|
+
this.functionDefinitionEditorState.convertLambdaObjectToGrammarString({
|
361
|
+
pretty: true,
|
362
|
+
firstLoad: true,
|
363
|
+
}),
|
364
|
+
);
|
365
|
+
}
|
366
|
+
|
338
367
|
reprocess(
|
339
368
|
newElement: ConcreteFunctionDefinition,
|
340
369
|
editorStore: EditorStore,
|