@finos/legend-application-studio 26.1.10 → 26.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/application/LegendStudioApplicationConfig.d.ts +4 -0
- package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.js +4 -0
- package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
- package/lib/components/editor/QuickInput.d.ts.map +1 -1
- package/lib/components/editor/QuickInput.js +4 -2
- package/lib/components/editor/QuickInput.js.map +1 -1
- package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/FunctionEditor.js +13 -6
- package/lib/components/editor/editor-group/FunctionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js +1 -1
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.js +6 -10
- package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js +1 -1
- package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.js +13 -12
- package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingExplorer.js +2 -2
- package/lib/components/editor/editor-group/mapping-editor/MappingExplorer.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js +3 -7
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js +10 -14
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +36 -4
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +2 -2
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +2 -0
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/lib/stores/editor/QuickInputState.d.ts +3 -0
- package/lib/stores/editor/QuickInputState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +14 -7
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js +48 -48
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts +4 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js +37 -12
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
- package/package.json +12 -12
- package/src/application/LegendStudioApplicationConfig.ts +5 -0
- package/src/components/editor/QuickInput.tsx +5 -1
- package/src/components/editor/editor-group/FunctionEditor.tsx +67 -55
- package/src/components/editor/editor-group/data-editor/RelationalCSVDataEditor.tsx +1 -0
- package/src/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.tsx +63 -69
- package/src/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.tsx +1 -1
- package/src/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.tsx +69 -48
- package/src/components/editor/editor-group/mapping-editor/MappingExplorer.tsx +2 -2
- package/src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx +8 -12
- package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +91 -99
- package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +3 -0
- package/src/components/editor/side-bar/Explorer.tsx +83 -1
- package/src/stores/editor/EditorStore.ts +3 -0
- package/src/stores/editor/QuickInputState.ts +3 -0
- package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +18 -8
- package/src/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.ts +70 -69
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts +62 -36
- package/src/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.ts +5 -5
@@ -31,7 +31,6 @@ import {
|
|
31
31
|
ModalBody,
|
32
32
|
ModalFooter,
|
33
33
|
ModalHeader,
|
34
|
-
MoreVerticalIcon,
|
35
34
|
} from '@finos/legend-art';
|
36
35
|
import { assertErrorThrown } from '@finos/legend-shared';
|
37
36
|
import { flowResult } from 'mobx';
|
@@ -287,24 +286,24 @@ export const ServiceExecutionQueryEditor = observer(
|
|
287
286
|
</div>
|
288
287
|
</div>
|
289
288
|
<div className="panel__header__actions">
|
290
|
-
<div className="
|
289
|
+
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
291
290
|
<button
|
292
|
-
className="
|
291
|
+
className="btn__dropdown-combo__label"
|
293
292
|
onClick={editWithQueryBuilder()}
|
294
293
|
title="Edit Query"
|
295
294
|
tabIndex={-1}
|
296
295
|
>
|
297
|
-
<PencilIcon className="
|
298
|
-
<div className="
|
296
|
+
<PencilIcon className="btn__dropdown-combo__label__icon" />
|
297
|
+
<div className="btn__dropdown-combo__label__title">
|
299
298
|
Edit Query
|
300
299
|
</div>
|
301
300
|
</button>
|
302
301
|
<DropdownMenu
|
303
|
-
className="
|
302
|
+
className="btn__dropdown-combo__dropdown-btn"
|
304
303
|
content={
|
305
304
|
<MenuContent>
|
306
305
|
<MenuContentItem
|
307
|
-
className="
|
306
|
+
className="btn__dropdown-combo__option"
|
308
307
|
onClick={editWithQueryBuilder(true)}
|
309
308
|
>
|
310
309
|
Text Mode
|
@@ -319,96 +318,97 @@ export const ServiceExecutionQueryEditor = observer(
|
|
319
318
|
<CaretDownIcon />
|
320
319
|
</DropdownMenu>
|
321
320
|
</div>
|
322
|
-
|
323
|
-
|
324
|
-
className="service-editor__execution__stop-btn"
|
325
|
-
onClick={cancelQuery}
|
326
|
-
tabIndex={-1}
|
327
|
-
>
|
328
|
-
<div className="btn--dark btn--caution service-editor__execution__stop-btn__label">
|
329
|
-
<PauseCircleIcon className="service-editor__execution__stop-btn__label__icon" />
|
330
|
-
<div className="service-editor__execution__stop-btn__label__title">
|
331
|
-
Stop
|
332
|
-
</div>
|
333
|
-
</div>
|
334
|
-
</button>
|
335
|
-
) : (
|
336
|
-
<div className="service-editor__execution__action-btn">
|
321
|
+
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
322
|
+
{executionState.isRunningQuery ? (
|
337
323
|
<button
|
338
|
-
className="
|
339
|
-
onClick={
|
340
|
-
title="Run Query"
|
341
|
-
disabled={executionIsRunning}
|
324
|
+
className="btn__dropdown-combo__canceler"
|
325
|
+
onClick={cancelQuery}
|
342
326
|
tabIndex={-1}
|
343
327
|
>
|
344
|
-
<
|
345
|
-
|
346
|
-
|
328
|
+
<div className="btn--dark btn--caution btn__dropdown-combo__canceler__label">
|
329
|
+
<PauseCircleIcon className="btn__dropdown-combo__canceler__label__icon" />
|
330
|
+
<div className="btn__dropdown-combo__canceler__label__title">
|
331
|
+
Stop
|
332
|
+
</div>
|
347
333
|
</div>
|
348
334
|
</button>
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
335
|
+
) : (
|
336
|
+
<>
|
337
|
+
<button
|
338
|
+
className="btn__dropdown-combo__label"
|
339
|
+
onClick={runQuery}
|
340
|
+
title="Run Query"
|
341
|
+
disabled={executionIsRunning}
|
342
|
+
tabIndex={-1}
|
343
|
+
>
|
344
|
+
<PlayIcon className="btn__dropdown-combo__label__icon" />
|
345
|
+
<div className="btn__dropdown-combo__label__title">
|
346
|
+
Run Query
|
347
|
+
</div>
|
348
|
+
</button>
|
349
|
+
<DropdownMenu
|
350
|
+
className="btn__dropdown-combo__dropdown-btn"
|
351
|
+
disabled={executionIsRunning}
|
352
|
+
content={
|
353
|
+
<MenuContent>
|
354
|
+
<MenuContentItem
|
355
|
+
className="btn__dropdown-combo__option"
|
356
|
+
onClick={generatePlan}
|
357
|
+
>
|
358
|
+
Generate Plan
|
359
|
+
</MenuContentItem>
|
360
|
+
<MenuContentItem
|
361
|
+
className="btn__dropdown-combo__option"
|
362
|
+
onClick={debugPlanGeneration}
|
363
|
+
>
|
364
|
+
Debug
|
365
|
+
</MenuContentItem>
|
366
|
+
</MenuContent>
|
367
|
+
}
|
368
|
+
menuProps={{
|
369
|
+
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
370
|
+
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
371
|
+
}}
|
372
|
+
>
|
373
|
+
<CaretDownIcon />
|
374
|
+
</DropdownMenu>
|
375
|
+
</>
|
376
|
+
)}
|
377
|
+
</div>
|
378
|
+
<DropdownMenu
|
379
|
+
className="btn__dropdown-combo"
|
380
|
+
disabled={executionIsRunning}
|
381
|
+
content={
|
382
|
+
<MenuContent>
|
383
|
+
<MenuContentItem
|
384
|
+
className="btn__dropdown-combo__option"
|
385
|
+
onClick={importQuery}
|
386
|
+
>
|
387
|
+
Import Query
|
388
|
+
</MenuContentItem>
|
389
|
+
<MenuContentItem
|
390
|
+
className="btn__dropdown-combo__option"
|
391
|
+
onClick={openQueryInLegendQuery}
|
392
|
+
disabled={!applicationStore.config.queryApplicationUrl}
|
393
|
+
>
|
394
|
+
Create an Ad-hoc Query
|
395
|
+
</MenuContentItem>
|
396
|
+
</MenuContent>
|
397
|
+
}
|
398
|
+
menuProps={{
|
399
|
+
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
400
|
+
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
401
|
+
}}
|
402
|
+
>
|
403
|
+
<div className="btn__dropdown-combo__label">
|
404
|
+
<div className="btn__dropdown-combo__label__title">
|
405
405
|
Advanced
|
406
406
|
</div>
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
</
|
411
|
-
</
|
407
|
+
</div>
|
408
|
+
<div className="btn__dropdown-combo__dropdown-btn">
|
409
|
+
<CaretDownIcon />
|
410
|
+
</div>
|
411
|
+
</DropdownMenu>
|
412
412
|
</div>
|
413
413
|
</div>
|
414
414
|
<div className="panel__content property-mapping-editor__entry__container">
|
@@ -417,15 +417,7 @@ export const ServiceExecutionQueryEditor = observer(
|
|
417
417
|
executionState.isOpeningQueryEditor || executionIsRunning
|
418
418
|
}
|
419
419
|
/>
|
420
|
-
<div
|
421
|
-
className="service-execution-query-editor__content"
|
422
|
-
title="Double click to edit in query builder"
|
423
|
-
onDoubleClick={(event) => {
|
424
|
-
event.preventDefault();
|
425
|
-
event.stopPropagation();
|
426
|
-
editWithQueryBuilder()();
|
427
|
-
}}
|
428
|
-
>
|
420
|
+
<div className="service-execution-query-editor__content">
|
429
421
|
<CodeEditor
|
430
422
|
inputValue={queryState.lambdaString}
|
431
423
|
isReadOnly={true}
|
@@ -248,6 +248,9 @@ const buildRelationalDatabaseConnectionOption = (
|
|
248
248
|
<div className="sql-playground__config__connection-selector__option__type">
|
249
249
|
{connectionValue.type}
|
250
250
|
</div>
|
251
|
+
<div className="sql-playground__config__connection-selector__option__path">
|
252
|
+
{connection.path}
|
253
|
+
</div>
|
251
254
|
</div>
|
252
255
|
),
|
253
256
|
};
|
@@ -14,7 +14,13 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import
|
17
|
+
import React, {
|
18
|
+
Fragment,
|
19
|
+
useRef,
|
20
|
+
useEffect,
|
21
|
+
useState,
|
22
|
+
forwardRef,
|
23
|
+
} from 'react';
|
18
24
|
import { observer } from 'mobx-react-lite';
|
19
25
|
import {
|
20
26
|
type TreeNodeContainerProps,
|
@@ -61,6 +67,7 @@ import { LEGEND_STUDIO_TEST_ID } from '../../../__lib__/LegendStudioTesting.js';
|
|
61
67
|
import {
|
62
68
|
ACTIVITY_MODE,
|
63
69
|
GRAPH_EDITOR_MODE,
|
70
|
+
PANEL_MODE,
|
64
71
|
} from '../../../stores/editor/EditorConfig.js';
|
65
72
|
import { getTreeChildNodes } from '../../../stores/editor/utils/PackageTreeUtils.js';
|
66
73
|
import type { PackageTreeNodeData } from '../../../stores/editor/utils/TreeUtils.js';
|
@@ -76,6 +83,7 @@ import {
|
|
76
83
|
import {
|
77
84
|
guaranteeNonEmptyString,
|
78
85
|
guaranteeNonNullable,
|
86
|
+
guaranteeType,
|
79
87
|
isNonNullable,
|
80
88
|
toTitleCase,
|
81
89
|
} from '@finos/legend-shared';
|
@@ -102,6 +110,7 @@ import {
|
|
102
110
|
RelationalDatabaseConnection,
|
103
111
|
guaranteeRelationalDatabaseConnection,
|
104
112
|
extractDependencyGACoordinateFromRootPackageName,
|
113
|
+
type FunctionActivatorConfiguration,
|
105
114
|
} from '@finos/legend-graph';
|
106
115
|
import { useApplicationStore } from '@finos/legend-application';
|
107
116
|
import {
|
@@ -125,6 +134,7 @@ import {
|
|
125
134
|
CodeEditor,
|
126
135
|
} from '@finos/legend-lego/code-editor';
|
127
136
|
import { DatabaseBuilder } from '../editor-group/connection-editor/DatabaseBuilder.js';
|
137
|
+
import { FunctionEditorState } from '../../../stores/editor/editor-state/element-editor-state/FunctionEditorState.js';
|
128
138
|
|
129
139
|
const ElementRenamer = observer(() => {
|
130
140
|
const editorStore = useEditorStore();
|
@@ -513,6 +523,15 @@ const ExplorerContextMenu = observer(
|
|
513
523
|
}
|
514
524
|
},
|
515
525
|
);
|
526
|
+
const openSQLPlayground = (): void => {
|
527
|
+
if (isRelationalDatabaseConnection(node?.packageableElement)) {
|
528
|
+
editorStore.panelGroupDisplayState.open();
|
529
|
+
editorStore.setActivePanelMode(PANEL_MODE.SQL_PLAYGROUND);
|
530
|
+
editorStore.sqlPlaygroundState.setConnection(
|
531
|
+
guaranteeType(node?.packageableElement, PackageableConnection),
|
532
|
+
);
|
533
|
+
}
|
534
|
+
};
|
516
535
|
const removeElement = (): void => {
|
517
536
|
if (node) {
|
518
537
|
flowResult(
|
@@ -663,6 +682,50 @@ const ExplorerContextMenu = observer(
|
|
663
682
|
).catch(applicationStore.alertUnhandledError);
|
664
683
|
}
|
665
684
|
};
|
685
|
+
const activateFunction = (): void => {
|
686
|
+
if (node?.packageableElement instanceof ConcreteFunctionDefinition) {
|
687
|
+
editorStore.setQuickInputState({
|
688
|
+
title: 'Activate function',
|
689
|
+
placeholder: 'Select an activation...',
|
690
|
+
options: editorStore.graphState.functionActivatorConfigurations.map(
|
691
|
+
(config) => ({
|
692
|
+
value: config,
|
693
|
+
label: (
|
694
|
+
<div
|
695
|
+
className="function-editor__activator__selector__option"
|
696
|
+
title={config.description}
|
697
|
+
>
|
698
|
+
<div className="function-editor__activator__selector__option__name">
|
699
|
+
{config.name}
|
700
|
+
</div>
|
701
|
+
<div className="function-editor__activator__selector__option__description">
|
702
|
+
{config.description}
|
703
|
+
</div>
|
704
|
+
</div>
|
705
|
+
),
|
706
|
+
}),
|
707
|
+
),
|
708
|
+
getSearchValue: (option: {
|
709
|
+
value: FunctionActivatorConfiguration;
|
710
|
+
label: React.ReactNode;
|
711
|
+
}): string => option.value.name,
|
712
|
+
onSelect: (option: {
|
713
|
+
value: FunctionActivatorConfiguration;
|
714
|
+
label: React.ReactNode;
|
715
|
+
}) => {
|
716
|
+
editorStore.graphEditorMode.openElement(node.packageableElement);
|
717
|
+
editorStore.tabManagerState
|
718
|
+
.getCurrentEditorState(FunctionEditorState)
|
719
|
+
.activatorBuilderState.setCurrentActivatorConfiguration(
|
720
|
+
option.value,
|
721
|
+
);
|
722
|
+
},
|
723
|
+
customization: {
|
724
|
+
rowHeight: 70,
|
725
|
+
},
|
726
|
+
});
|
727
|
+
}
|
728
|
+
};
|
666
729
|
|
667
730
|
if (isDependencyProjectRoot()) {
|
668
731
|
return (
|
@@ -722,8 +785,27 @@ const ExplorerContextMenu = observer(
|
|
722
785
|
<MenuContentDivider />
|
723
786
|
</>
|
724
787
|
)}
|
788
|
+
{node.packageableElement instanceof ConcreteFunctionDefinition && (
|
789
|
+
<>
|
790
|
+
{editorStore.applicationStore.config.options
|
791
|
+
.TEMPORARY__enableFunctionActivatorSupport && (
|
792
|
+
<>
|
793
|
+
<MenuContentItem onClick={activateFunction}>
|
794
|
+
Activate...
|
795
|
+
</MenuContentItem>
|
796
|
+
<MenuContentDivider />
|
797
|
+
</>
|
798
|
+
)}
|
799
|
+
</>
|
800
|
+
)}
|
725
801
|
{isRelationalDatabaseConnection(node.packageableElement) && (
|
726
802
|
<>
|
803
|
+
{editorStore.applicationStore.config.options
|
804
|
+
.TEMPORARY__enableRawSQLExecutor && (
|
805
|
+
<MenuContentItem onClick={openSQLPlayground}>
|
806
|
+
Execute SQL...
|
807
|
+
</MenuContentItem>
|
808
|
+
)}
|
727
809
|
<MenuContentItem onClick={buildDatabase}>
|
728
810
|
Build Database...
|
729
811
|
</MenuContentItem>
|
@@ -671,6 +671,9 @@ export class EditorStore implements CommandRegistrar {
|
|
671
671
|
},
|
672
672
|
{
|
673
673
|
tracerService: this.applicationStore.tracerService,
|
674
|
+
TEMPORARY__enableNewServiceRegistrationInputCollectorMechanism:
|
675
|
+
this.applicationStore.config.options
|
676
|
+
.TEMPORARY__enableNewServiceRegistrationInputCollectorMechanism,
|
674
677
|
},
|
675
678
|
),
|
676
679
|
]);
|
@@ -21,6 +21,7 @@ import {
|
|
21
21
|
makeObservable,
|
22
22
|
flow,
|
23
23
|
flowResult,
|
24
|
+
override,
|
24
25
|
} from 'mobx';
|
25
26
|
import type { EditorStore } from '../../EditorStore.js';
|
26
27
|
import {
|
@@ -50,6 +51,7 @@ import {
|
|
50
51
|
buildLambdaVariableExpressions,
|
51
52
|
VariableExpression,
|
52
53
|
observe_ValueSpecification,
|
54
|
+
generateFunctionPrettyName,
|
53
55
|
} from '@finos/legend-graph';
|
54
56
|
import {
|
55
57
|
ExecutionPlanState,
|
@@ -254,13 +256,14 @@ export class FunctionEditorState extends ElementEditorState {
|
|
254
256
|
|
255
257
|
makeObservable(this, {
|
256
258
|
selectedTab: observable,
|
257
|
-
functionElement: computed,
|
258
|
-
setSelectedTab: action,
|
259
|
-
reprocess: action,
|
260
259
|
isRunningQuery: observable,
|
261
260
|
isGeneratingPlan: observable,
|
262
261
|
executionResultText: observable,
|
263
262
|
executionPlanState: observable,
|
263
|
+
label: override,
|
264
|
+
functionElement: computed,
|
265
|
+
setSelectedTab: action,
|
266
|
+
reprocess: action,
|
264
267
|
setExecutionResultText: action,
|
265
268
|
setIsRunningQuery: action,
|
266
269
|
runQuery: flow,
|
@@ -287,6 +290,13 @@ export class FunctionEditorState extends ElementEditorState {
|
|
287
290
|
this.parametersState = new FunctionParametersState(this);
|
288
291
|
}
|
289
292
|
|
293
|
+
override get label(): string {
|
294
|
+
return generateFunctionPrettyName(this.functionElement, {
|
295
|
+
fullPath: true,
|
296
|
+
spacing: false,
|
297
|
+
});
|
298
|
+
}
|
299
|
+
|
290
300
|
get functionElement(): ConcreteFunctionDefinition {
|
291
301
|
return guaranteeType(
|
292
302
|
this.element,
|
@@ -512,15 +522,15 @@ export class FunctionEditorState extends ElementEditorState {
|
|
512
522
|
);
|
513
523
|
}
|
514
524
|
} catch (error) {
|
515
|
-
// When user cancels the query by calling the cancelQuery api, it will throw an
|
525
|
+
// When user cancels the query by calling the cancelQuery api, it will throw an execution failure error.
|
516
526
|
// For now, we don't want to notify users about this failure. Therefore we check to ensure the promise is still the same one.
|
517
527
|
// When cancelled the query, we set the queryRunPromise as undefined.
|
518
|
-
this.editorStore.applicationStore.logService.error(
|
519
|
-
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
|
520
|
-
error,
|
521
|
-
);
|
522
528
|
if (this.queryRunPromise === promise) {
|
523
529
|
assertErrorThrown(error);
|
530
|
+
this.editorStore.applicationStore.logService.error(
|
531
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
|
532
|
+
error,
|
533
|
+
);
|
524
534
|
this.editorStore.applicationStore.notificationService.notifyError(
|
525
535
|
error,
|
526
536
|
);
|
package/src/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.ts
CHANGED
@@ -476,6 +476,7 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
|
|
476
476
|
get label(): string {
|
477
477
|
return this.test.name;
|
478
478
|
}
|
479
|
+
|
479
480
|
setIsRunningTest(val: boolean): void {
|
480
481
|
this.isRunningTest = val;
|
481
482
|
}
|
@@ -703,75 +704,6 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
|
|
703
704
|
}
|
704
705
|
}
|
705
706
|
|
706
|
-
*runTest(): GeneratorFn<void> {
|
707
|
-
if (DEPRECATED__validate_MappingTest(this.test)) {
|
708
|
-
this.editorStore.applicationStore.notificationService.notifyError(
|
709
|
-
`Can't run test '${this.test.name}'. Please make sure that the test is valid`,
|
710
|
-
);
|
711
|
-
return;
|
712
|
-
} else if (this.isExecutingTest) {
|
713
|
-
this.editorStore.applicationStore.notificationService.notifyWarning(
|
714
|
-
`Test '${this.test.name}' is already running`,
|
715
|
-
);
|
716
|
-
return;
|
717
|
-
}
|
718
|
-
const startTime = Date.now();
|
719
|
-
let promise;
|
720
|
-
try {
|
721
|
-
const runtime = this.inputDataState.runtime;
|
722
|
-
this.isRunningTest = true;
|
723
|
-
promise = this.editorStore.graphManagerState.graphManager.runQuery(
|
724
|
-
this.test.query,
|
725
|
-
this.mappingEditorState.mapping,
|
726
|
-
runtime,
|
727
|
-
this.editorStore.graphManagerState.graph,
|
728
|
-
{
|
729
|
-
useLosslessParse: true,
|
730
|
-
},
|
731
|
-
);
|
732
|
-
this.setTestRunPromise(promise);
|
733
|
-
const result = (yield promise) as ExecutionResult;
|
734
|
-
if (this.testRunPromise === promise) {
|
735
|
-
this.handleResult(result);
|
736
|
-
}
|
737
|
-
} catch (error) {
|
738
|
-
// When user cancels the query by calling the cancelQuery api, it will throw an exeuction failure error.
|
739
|
-
// For now, we don't want to notify users about this failure. Therefore we check to ensure the promise is still the same one.
|
740
|
-
// When cancelled the query, we set the queryRunPromise as undefined.
|
741
|
-
if (this.testRunPromise === promise) {
|
742
|
-
assertErrorThrown(error);
|
743
|
-
this.handleError(error, promise);
|
744
|
-
}
|
745
|
-
} finally {
|
746
|
-
this.isRunningTest = false;
|
747
|
-
this.runTime = Date.now() - startTime;
|
748
|
-
// if the test is currently opened and ran but did not pass, switch to the result tab
|
749
|
-
if (
|
750
|
-
[TEST_RESULT.FAILED, TEST_RESULT.ERROR].includes(this.result) &&
|
751
|
-
this.testRunPromise === promise &&
|
752
|
-
this.mappingEditorState.currentTabState === this
|
753
|
-
) {
|
754
|
-
this.setSelectedTab(MAPPING_TEST_EDITOR_TAB_TYPE.RESULT);
|
755
|
-
}
|
756
|
-
}
|
757
|
-
}
|
758
|
-
|
759
|
-
*cancelTest(): GeneratorFn<void> {
|
760
|
-
this.setIsRunningTest(false);
|
761
|
-
this.setTestRunPromise(undefined);
|
762
|
-
try {
|
763
|
-
yield this.editorStore.graphManagerState.graphManager.cancelUserExecutions(
|
764
|
-
true,
|
765
|
-
);
|
766
|
-
} catch (error) {
|
767
|
-
// don't notify users about success or failure
|
768
|
-
this.editorStore.applicationStore.logService.error(
|
769
|
-
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
|
770
|
-
error,
|
771
|
-
);
|
772
|
-
}
|
773
|
-
}
|
774
|
-
|
775
707
|
handleResult(result: ExecutionResult): void {
|
776
708
|
this.testExecutionResultText = stringifyLosslessJSON(
|
777
709
|
extractExecutionResultValues(result),
|
@@ -843,6 +775,75 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
|
|
843
775
|
);
|
844
776
|
}
|
845
777
|
|
778
|
+
*runTest(): GeneratorFn<void> {
|
779
|
+
if (DEPRECATED__validate_MappingTest(this.test)) {
|
780
|
+
this.editorStore.applicationStore.notificationService.notifyError(
|
781
|
+
`Can't run test '${this.test.name}'. Please make sure that the test is valid`,
|
782
|
+
);
|
783
|
+
return;
|
784
|
+
} else if (this.isExecutingTest) {
|
785
|
+
this.editorStore.applicationStore.notificationService.notifyWarning(
|
786
|
+
`Test '${this.test.name}' is already running`,
|
787
|
+
);
|
788
|
+
return;
|
789
|
+
}
|
790
|
+
const startTime = Date.now();
|
791
|
+
let promise;
|
792
|
+
try {
|
793
|
+
const runtime = this.inputDataState.runtime;
|
794
|
+
this.isRunningTest = true;
|
795
|
+
promise = this.editorStore.graphManagerState.graphManager.runQuery(
|
796
|
+
this.test.query,
|
797
|
+
this.mappingEditorState.mapping,
|
798
|
+
runtime,
|
799
|
+
this.editorStore.graphManagerState.graph,
|
800
|
+
{
|
801
|
+
useLosslessParse: true,
|
802
|
+
},
|
803
|
+
);
|
804
|
+
this.setTestRunPromise(promise);
|
805
|
+
const result = (yield promise) as ExecutionResult;
|
806
|
+
if (this.testRunPromise === promise) {
|
807
|
+
this.handleResult(result);
|
808
|
+
}
|
809
|
+
} catch (error) {
|
810
|
+
// When user cancels the query by calling the cancelQuery api, it will throw an execution failure error.
|
811
|
+
// For now, we don't want to notify users about this failure. Therefore we check to ensure the promise is still the same one.
|
812
|
+
// When cancelled the query, we set the queryRunPromise as undefined.
|
813
|
+
if (this.testRunPromise === promise) {
|
814
|
+
assertErrorThrown(error);
|
815
|
+
this.handleError(error, promise);
|
816
|
+
}
|
817
|
+
} finally {
|
818
|
+
this.isRunningTest = false;
|
819
|
+
this.runTime = Date.now() - startTime;
|
820
|
+
// if the test is currently opened and ran but did not pass, switch to the result tab
|
821
|
+
if (
|
822
|
+
[TEST_RESULT.FAILED, TEST_RESULT.ERROR].includes(this.result) &&
|
823
|
+
this.testRunPromise === promise &&
|
824
|
+
this.mappingEditorState.currentTabState === this
|
825
|
+
) {
|
826
|
+
this.setSelectedTab(MAPPING_TEST_EDITOR_TAB_TYPE.RESULT);
|
827
|
+
}
|
828
|
+
}
|
829
|
+
}
|
830
|
+
|
831
|
+
*cancelTest(): GeneratorFn<void> {
|
832
|
+
this.setIsRunningTest(false);
|
833
|
+
this.setTestRunPromise(undefined);
|
834
|
+
try {
|
835
|
+
yield this.editorStore.graphManagerState.graphManager.cancelUserExecutions(
|
836
|
+
true,
|
837
|
+
);
|
838
|
+
} catch (error) {
|
839
|
+
// don't notify users about success or failure
|
840
|
+
this.editorStore.applicationStore.logService.error(
|
841
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
|
842
|
+
error,
|
843
|
+
);
|
844
|
+
}
|
845
|
+
}
|
846
|
+
|
846
847
|
*generatePlan(debug: boolean): GeneratorFn<void> {
|
847
848
|
try {
|
848
849
|
this.isGeneratingPlan = true;
|