@finos/legend-application-studio 28.5.3 → 28.5.4
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/editor-group/RuntimeEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/RuntimeEditor.js +3 -2
- package/lib/components/editor/editor-group/RuntimeEditor.js.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js +2 -2
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.d.ts.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.js +19 -5
- package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.js.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionEditor.js +2 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionEditor.js.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.js +11 -3
- package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/NewElementState.d.ts +9 -0
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +26 -5
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.js +2 -1
- package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.d.ts +3 -0
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.js +10 -3
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.js.map +1 -1
- package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.js +1 -1
- package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityDiffViewState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityDiffViewState.js +2 -2
- package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityDiffViewState.js.map +1 -1
- package/package.json +4 -4
- package/src/components/editor/editor-group/RuntimeEditor.tsx +3 -2
- package/src/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.tsx +3 -3
- package/src/components/editor/editor-group/connection-editor/DatabaseModelBuilder.tsx +57 -7
- package/src/components/editor/editor-group/service-editor/ServiceExecutionEditor.tsx +2 -1
- package/src/components/editor/side-bar/CreateNewElementModal.tsx +45 -11
- package/src/stores/editor/NewElementState.ts +40 -6
- package/src/stores/editor/editor-state/element-editor-state/ElementEditorState.ts +1 -0
- package/src/stores/editor/editor-state/element-editor-state/RuntimeEditorState.ts +2 -1
- package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.ts +1 -0
- package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.ts +12 -1
- package/src/stores/editor/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.ts +1 -0
- package/src/stores/editor/editor-state/entity-diff-editor-state/EntityDiffViewState.ts +2 -0
@@ -26,10 +26,15 @@ import {
|
|
26
26
|
NewDataElementDriver,
|
27
27
|
NewServiceDriver,
|
28
28
|
CONNECTION_TYPE,
|
29
|
+
type RuntimeOption,
|
29
30
|
} from '../../../stores/editor/NewElementState.js';
|
30
31
|
import { Dialog, compareLabelFn, CustomSelectorInput } from '@finos/legend-art';
|
31
32
|
import type { EditorStore } from '../../../stores/editor/EditorStore.js';
|
32
|
-
import {
|
33
|
+
import {
|
34
|
+
guaranteeNonNullable,
|
35
|
+
prettyCONSTName,
|
36
|
+
toTitleCase,
|
37
|
+
} from '@finos/legend-shared';
|
33
38
|
import type { DSL_LegendStudioApplicationPlugin_Extension } from '../../../stores/LegendStudioApplicationPlugin.js';
|
34
39
|
import { useEditorStore } from '../EditorStoreProvider.js';
|
35
40
|
import {
|
@@ -347,10 +352,16 @@ const NewConnectionDriverEditor = observer(() => {
|
|
347
352
|
|
348
353
|
const NewServiceDriverEditor = observer(() => {
|
349
354
|
const editorStore = useEditorStore();
|
355
|
+
const runtimeSelectorPlaceholder = 'Choose a compatible runtime...';
|
350
356
|
const newServiceDriver =
|
351
357
|
editorStore.newElementState.getNewElementDriver(NewServiceDriver);
|
358
|
+
// runtime
|
359
|
+
const onRuntimeChange = (val: RuntimeOption | null): void => {
|
360
|
+
if (val) {
|
361
|
+
newServiceDriver.setRuntimeOption(val);
|
362
|
+
}
|
363
|
+
};
|
352
364
|
// mapping
|
353
|
-
const currentMappingOption = newServiceDriver.mappingOption;
|
354
365
|
const mappingOptions =
|
355
366
|
editorStore.graphManagerState.usableMappings.map(buildElementOption);
|
356
367
|
const onMappingChange = (
|
@@ -361,17 +372,40 @@ const NewServiceDriverEditor = observer(() => {
|
|
361
372
|
} else {
|
362
373
|
newServiceDriver.setMappingOption(val);
|
363
374
|
}
|
375
|
+
//reset runtime
|
376
|
+
newServiceDriver.setRuntimeOption(
|
377
|
+
guaranteeNonNullable(newServiceDriver.runtimeOptions[0]),
|
378
|
+
);
|
364
379
|
};
|
380
|
+
|
365
381
|
return (
|
366
|
-
|
367
|
-
<
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
382
|
+
<>
|
383
|
+
<div className="panel__content__form__section__header__label">
|
384
|
+
Mapping
|
385
|
+
</div>
|
386
|
+
<div className="explorer__new-element-modal__driver">
|
387
|
+
<CustomSelectorInput
|
388
|
+
className="explorer__new-element-modal__driver__dropdown"
|
389
|
+
options={mappingOptions}
|
390
|
+
onChange={onMappingChange}
|
391
|
+
value={newServiceDriver.mappingOption}
|
392
|
+
darkMode={true}
|
393
|
+
/>
|
394
|
+
</div>
|
395
|
+
<div className="panel__content__form__section__header__label">
|
396
|
+
Runtime
|
397
|
+
</div>
|
398
|
+
<div className="explorer__new-element-modal__driver">
|
399
|
+
<CustomSelectorInput
|
400
|
+
className="explorer__new-element-modal__driver__dropdown"
|
401
|
+
options={newServiceDriver.runtimeOptions}
|
402
|
+
onChange={onRuntimeChange}
|
403
|
+
value={newServiceDriver.runtimeOption}
|
404
|
+
darkMode={true}
|
405
|
+
placeholder={runtimeSelectorPlaceholder}
|
406
|
+
/>
|
407
|
+
</div>
|
408
|
+
</>
|
375
409
|
);
|
376
410
|
});
|
377
411
|
|
@@ -80,6 +80,7 @@ import {
|
|
80
80
|
ConnectionPointer,
|
81
81
|
IdentifiedConnection,
|
82
82
|
generateIdentifiedConnectionId,
|
83
|
+
getMappingCompatibleRuntimes,
|
83
84
|
} from '@finos/legend-graph';
|
84
85
|
import type { DSL_Mapping_LegendStudioApplicationPlugin_Extension } from '../extensions/DSL_Mapping_LegendStudioApplicationPlugin_Extension.js';
|
85
86
|
import {
|
@@ -105,6 +106,13 @@ import {
|
|
105
106
|
import { EmbeddedDataType } from './editor-state/ExternalFormatState.js';
|
106
107
|
import { createEmbeddedData } from './editor-state/element-editor-state/data/EmbeddedDataState.js';
|
107
108
|
|
109
|
+
export const CUSTOM_LABEL = '(custom)';
|
110
|
+
|
111
|
+
export type RuntimeOption = {
|
112
|
+
label: string;
|
113
|
+
value: PackageableRuntime | undefined;
|
114
|
+
};
|
115
|
+
|
108
116
|
export const resolvePackageAndElementName = (
|
109
117
|
_package: Package,
|
110
118
|
isPackageRoot: boolean,
|
@@ -471,23 +479,53 @@ export class NewPackageableConnectionDriver extends NewElementDriver<Packageable
|
|
471
479
|
|
472
480
|
export class NewServiceDriver extends NewElementDriver<Service> {
|
473
481
|
mappingOption?: PackageableElementOption<Mapping> | undefined;
|
482
|
+
runtimeOption: RuntimeOption;
|
474
483
|
constructor(editorStore: EditorStore) {
|
475
484
|
super(editorStore);
|
476
485
|
|
477
486
|
makeObservable(this, {
|
478
487
|
mappingOption: observable,
|
488
|
+
runtimeOption: observable,
|
479
489
|
setMappingOption: action,
|
490
|
+
setRuntimeOption: action,
|
491
|
+
runtimeOptions: computed,
|
480
492
|
isValid: computed,
|
481
493
|
createElement: action,
|
482
494
|
});
|
483
495
|
this.mappingOption =
|
484
496
|
editorStore.graphManagerState.usableMappings.map(buildElementOption)[0];
|
497
|
+
this.runtimeOption = guaranteeNonNullable(this.runtimeOptions[0]);
|
485
498
|
}
|
486
499
|
|
487
500
|
setMappingOption(val: PackageableElementOption<Mapping> | undefined): void {
|
488
501
|
this.mappingOption = val;
|
489
502
|
}
|
490
503
|
|
504
|
+
setRuntimeOption(val: RuntimeOption): void {
|
505
|
+
this.runtimeOption = val;
|
506
|
+
}
|
507
|
+
|
508
|
+
get compatibleMappingRuntimes(): PackageableRuntime[] {
|
509
|
+
return this.mappingOption?.value
|
510
|
+
? getMappingCompatibleRuntimes(
|
511
|
+
this.mappingOption.value,
|
512
|
+
this.editorStore.graphManagerState.usableRuntimes,
|
513
|
+
)
|
514
|
+
: [];
|
515
|
+
}
|
516
|
+
|
517
|
+
get runtimeOptions(): RuntimeOption[] {
|
518
|
+
return [
|
519
|
+
...this.compatibleMappingRuntimes.map((runtime) =>
|
520
|
+
buildElementOption(runtime),
|
521
|
+
),
|
522
|
+
{
|
523
|
+
label: CUSTOM_LABEL,
|
524
|
+
value: undefined,
|
525
|
+
},
|
526
|
+
];
|
527
|
+
}
|
528
|
+
|
491
529
|
get isValid(): boolean {
|
492
530
|
return Boolean(this.mappingOption);
|
493
531
|
}
|
@@ -497,13 +535,9 @@ export class NewServiceDriver extends NewElementDriver<Service> {
|
|
497
535
|
const _mapping = mappingOption.value;
|
498
536
|
const mapping = PackageableElementExplicitReference.create(_mapping);
|
499
537
|
const service = new Service(name);
|
500
|
-
const runtimes = this.editorStore.graphManagerState.usableRuntimes;
|
501
|
-
const compatibleRuntimes = runtimes.filter((runtime) =>
|
502
|
-
runtime.runtimeValue.mappings.map((m) => m.value).includes(_mapping),
|
503
|
-
);
|
504
538
|
let runtimeValue: Runtime;
|
505
|
-
if (
|
506
|
-
runtimeValue =
|
539
|
+
if (this.runtimeOption.value) {
|
540
|
+
runtimeValue = this.runtimeOption.value.runtimeValue;
|
507
541
|
} else {
|
508
542
|
const engineRuntime = new EngineRuntime();
|
509
543
|
runtime_addMapping(engineRuntime, mapping);
|
@@ -75,6 +75,7 @@ import {
|
|
75
75
|
runtime_deleteIdentifiedConnection,
|
76
76
|
runtime_deleteMapping,
|
77
77
|
} from '../../../graph-modifier/DSL_Mapping_GraphModifierHelper.js';
|
78
|
+
import { CUSTOM_LABEL } from '../../NewElementState.js';
|
78
79
|
|
79
80
|
export const getClassMappingStore = (
|
80
81
|
setImplementation: SetImplementation,
|
@@ -276,7 +277,7 @@ export const getRuntimeExplorerTreeData = (
|
|
276
277
|
label:
|
277
278
|
runtime instanceof RuntimePointer
|
278
279
|
? runtime.packageableRuntime.value.name
|
279
|
-
:
|
280
|
+
: CUSTOM_LABEL,
|
280
281
|
isOpen: true,
|
281
282
|
childrenIds: [] as string[],
|
282
283
|
};
|
package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.ts
CHANGED
@@ -28,6 +28,8 @@ import type { EditorStore } from '../../../EditorStore.js';
|
|
28
28
|
import type { Database } from '@finos/legend-graph';
|
29
29
|
import { EntityChangeType, type EntityChange } from '@finos/legend-server-sdlc';
|
30
30
|
|
31
|
+
export const GENERATED = 'generated';
|
32
|
+
|
31
33
|
export class DatabaseModelBuilderState {
|
32
34
|
readonly editorStore: EditorStore;
|
33
35
|
readonly database: Database;
|
@@ -38,6 +40,7 @@ export class DatabaseModelBuilderState {
|
|
38
40
|
showModal = false;
|
39
41
|
generatedGrammarCode = '';
|
40
42
|
entities: Entity[] | undefined;
|
43
|
+
targetPackage: string;
|
41
44
|
|
42
45
|
constructor(
|
43
46
|
editorStore: EditorStore,
|
@@ -49,16 +52,19 @@ export class DatabaseModelBuilderState {
|
|
49
52
|
generatedGrammarCode: observable,
|
50
53
|
generatingModelState: observable,
|
51
54
|
saveModelState: observable,
|
55
|
+
targetPackage: observable,
|
52
56
|
close: action,
|
53
57
|
setShowModal: action,
|
54
58
|
setEntities: action,
|
55
59
|
setDatabaseGrammarCode: action,
|
60
|
+
setTargetPackage: action,
|
56
61
|
saveModels: flow,
|
57
62
|
previewDatabaseModels: flow,
|
58
63
|
});
|
59
64
|
this.editorStore = editorStore;
|
60
65
|
this.database = database;
|
61
66
|
this.isReadOnly = isReadOnly;
|
67
|
+
this.targetPackage = database.package?.path ?? GENERATED;
|
62
68
|
}
|
63
69
|
|
64
70
|
setShowModal(val: boolean): void {
|
@@ -78,14 +84,18 @@ export class DatabaseModelBuilderState {
|
|
78
84
|
this.editorStore.explorerTreeState.setDatabaseModelBuilderState(undefined);
|
79
85
|
}
|
80
86
|
|
87
|
+
setTargetPackage(val: string): void {
|
88
|
+
this.targetPackage = val;
|
89
|
+
}
|
90
|
+
|
81
91
|
*previewDatabaseModels(): GeneratorFn<void> {
|
82
92
|
try {
|
83
93
|
this.generatingModelState.isInProgress;
|
84
94
|
this.entities = [];
|
85
|
-
this.setDatabaseGrammarCode('');
|
86
95
|
const entities =
|
87
96
|
(yield this.editorStore.graphManagerState.graphManager.generateModelsFromDatabaseSpecification(
|
88
97
|
this.database.path,
|
98
|
+
this.targetPackage,
|
89
99
|
this.editorStore.graphManagerState.graph,
|
90
100
|
)) as Entity[];
|
91
101
|
|
@@ -93,6 +103,7 @@ export class DatabaseModelBuilderState {
|
|
93
103
|
this.setDatabaseGrammarCode(
|
94
104
|
(yield this.editorStore.graphManagerState.graphManager.entitiesToPureCode(
|
95
105
|
entities,
|
106
|
+
{ pretty: true },
|
96
107
|
)) as string,
|
97
108
|
);
|
98
109
|
} catch (error) {
|
package/src/stores/editor/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.ts
CHANGED
@@ -426,6 +426,7 @@ export class EntityChangeConflictEditorState extends EntityDiffViewerState {
|
|
426
426
|
const elementGrammar =
|
427
427
|
(yield this.editorStore.graphManagerState.graphManager.entitiesToPureCode(
|
428
428
|
[entity],
|
429
|
+
{ pretty: true },
|
429
430
|
)) as string;
|
430
431
|
return elementGrammar;
|
431
432
|
}
|
@@ -202,6 +202,7 @@ export class EntityDiffViewState extends EntityDiffViewerState {
|
|
202
202
|
const elementGrammar =
|
203
203
|
(yield this.editorStore.graphManagerState.graphManager.entitiesToPureCode(
|
204
204
|
[this.fromEntity],
|
205
|
+
{ pretty: true },
|
205
206
|
)) as string;
|
206
207
|
this.setFromGrammarText(elementGrammar);
|
207
208
|
} catch (error) {
|
@@ -225,6 +226,7 @@ export class EntityDiffViewState extends EntityDiffViewerState {
|
|
225
226
|
const elementGrammar =
|
226
227
|
(yield this.editorStore.graphManagerState.graphManager.entitiesToPureCode(
|
227
228
|
[this.toEntity],
|
229
|
+
{ pretty: true },
|
228
230
|
)) as string;
|
229
231
|
this.setToGrammarText(elementGrammar);
|
230
232
|
} catch (error) {
|