@finos/legend-application-studio 13.1.1 → 15.0.0
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/EditorComponentTestUtils.d.ts +3 -13
- package/lib/components/EditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/EditorComponentTestUtils.js +3 -22
- package/lib/components/EditorComponentTestUtils.js.map +1 -1
- package/lib/components/LegendStudioApplication.js +1 -1
- package/lib/components/LegendStudioApplication.js.map +1 -1
- package/lib/components/editor/edit-panel/EditPanel.js +4 -4
- package/lib/components/editor/edit-panel/EditPanel.js.map +1 -1
- package/lib/components/editor/edit-panel/{ModelLoader.d.ts → ModelImporter.d.ts} +2 -2
- package/lib/components/editor/edit-panel/ModelImporter.d.ts.map +1 -0
- package/lib/components/editor/edit-panel/ModelImporter.js +127 -0
- package/lib/components/editor/edit-panel/ModelImporter.js.map +1 -0
- package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js +10 -2
- package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.d.ts +7 -0
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js +18 -42
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.d.ts +24 -0
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.d.ts.map +1 -0
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.js +75 -0
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.js.map +1 -0
- package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js +1 -2
- package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js +6 -4
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js +2 -4
- package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +4 -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/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +6 -6
- package/lib/stores/EditorGraphState.d.ts +1 -1
- package/lib/stores/EditorGraphState.d.ts.map +1 -1
- package/lib/stores/EditorGraphState.js +10 -10
- package/lib/stores/EditorGraphState.js.map +1 -1
- package/lib/stores/EditorStore.d.ts +3 -3
- package/lib/stores/EditorStore.d.ts.map +1 -1
- package/lib/stores/EditorStore.js +6 -8
- package/lib/stores/EditorStore.js.map +1 -1
- package/lib/stores/LegendStudioApplicationPlugin.d.ts +7 -5
- package/lib/stores/LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendStudioApplicationPlugin.js.map +1 -1
- package/lib/stores/LegendStudioBaseStore.d.ts +8 -3
- package/lib/stores/LegendStudioBaseStore.d.ts.map +1 -1
- package/lib/stores/LegendStudioBaseStore.js +105 -9
- package/lib/stores/LegendStudioBaseStore.js.map +1 -1
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +4 -3
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/lib/stores/editor-state/ExternalFormatState.d.ts +3 -2
- package/lib/stores/editor-state/ExternalFormatState.d.ts.map +1 -1
- package/lib/stores/editor-state/ExternalFormatState.js +11 -8
- package/lib/stores/editor-state/ExternalFormatState.js.map +1 -1
- package/lib/stores/editor-state/ModelImporterState.d.ts +100 -0
- package/lib/stores/editor-state/ModelImporterState.d.ts.map +1 -0
- package/lib/stores/editor-state/ModelImporterState.js +358 -0
- package/lib/stores/editor-state/ModelImporterState.js.map +1 -0
- package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts +2 -1
- package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.js +9 -1
- package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.d.ts +35 -12
- package/lib/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.js +141 -34
- package/lib/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +1 -1
- package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +2 -2
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +3 -3
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
- package/lib/stores/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.js +1 -1
- package/lib/stores/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.js.map +1 -1
- package/lib/stores/graphModifier/DSLExternalFormat_GraphModifierHelper.d.ts +1 -0
- package/lib/stores/graphModifier/DSLExternalFormat_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graphModifier/DSLExternalFormat_GraphModifierHelper.js +3 -0
- package/lib/stores/graphModifier/DSLExternalFormat_GraphModifierHelper.js.map +1 -1
- package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.d.ts +2 -1
- package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.js +3 -0
- package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.js.map +1 -1
- package/lib/stores/shared/testable/TestableUtils.d.ts.map +1 -1
- package/lib/stores/shared/testable/TestableUtils.js +2 -3
- package/lib/stores/shared/testable/TestableUtils.js.map +1 -1
- package/package.json +14 -14
- package/src/components/EditorComponentTestUtils.tsx +2 -29
- package/src/components/LegendStudioApplication.tsx +2 -2
- package/src/components/editor/edit-panel/EditPanel.tsx +4 -4
- package/src/components/editor/edit-panel/ModelImporter.tsx +372 -0
- package/src/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.tsx +36 -0
- package/src/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.tsx +47 -163
- package/src/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.tsx +226 -0
- package/src/components/editor/edit-panel/mapping-editor/NewMappingElementModal.tsx +1 -2
- package/src/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.tsx +63 -36
- package/src/components/editor/edit-panel/uml-editor/AssociationEditor.tsx +1 -7
- package/src/components/editor/side-bar/Explorer.tsx +8 -8
- package/src/index.ts +5 -0
- package/src/stores/EditorGraphState.ts +13 -12
- package/src/stores/EditorStore.ts +7 -9
- package/src/stores/LegendStudioApplicationPlugin.ts +16 -7
- package/src/stores/LegendStudioBaseStore.ts +147 -20
- package/src/stores/editor/NewElementState.ts +4 -3
- package/src/stores/editor-state/ExternalFormatState.ts +15 -12
- package/src/stores/editor-state/ModelImporterState.ts +516 -0
- package/src/stores/editor-state/element-editor-state/connection/ConnectionEditorState.ts +10 -0
- package/src/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.ts +203 -46
- package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +1 -0
- package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +2 -1
- package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +12 -3
- package/src/stores/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.ts +1 -1
- package/src/stores/graphModifier/DSLExternalFormat_GraphModifierHelper.ts +5 -0
- package/src/stores/graphModifier/StoreRelational_GraphModifierHelper.ts +10 -0
- package/src/stores/shared/testable/TestableUtils.ts +4 -3
- package/tsconfig.json +3 -2
- package/lib/components/editor/edit-panel/ModelLoader.d.ts.map +0 -1
- package/lib/components/editor/edit-panel/ModelLoader.js +0 -95
- package/lib/components/editor/edit-panel/ModelLoader.js.map +0 -1
- package/lib/stores/editor-state/ModelLoaderState.d.ts +0 -52
- package/lib/stores/editor-state/ModelLoaderState.d.ts.map +0 -1
- package/lib/stores/editor-state/ModelLoaderState.js +0 -199
- package/lib/stores/editor-state/ModelLoaderState.js.map +0 -1
- package/src/components/editor/edit-panel/ModelLoader.tsx +0 -259
- package/src/stores/editor-state/ModelLoaderState.ts +0 -280
|
@@ -74,7 +74,6 @@ import {
|
|
|
74
74
|
stub_Stereotype,
|
|
75
75
|
getFirstAssociatedProperty,
|
|
76
76
|
getSecondAssociatedProperty,
|
|
77
|
-
getOtherAssociatedProperty,
|
|
78
77
|
} from '@finos/legend-graph';
|
|
79
78
|
import {
|
|
80
79
|
property_setName,
|
|
@@ -120,12 +119,7 @@ const AssociationPropertyBasicEditor = observer(
|
|
|
120
119
|
// Generic Type
|
|
121
120
|
const [isEditingType, setIsEditingType] = useState(false);
|
|
122
121
|
// TODO: make this so that association can only refer to classes from the same graph space
|
|
123
|
-
const propertyTypeOptions = editorStore.classOptions
|
|
124
|
-
(classOption) =>
|
|
125
|
-
classOption.value !==
|
|
126
|
-
getOtherAssociatedProperty(association, property).genericType.value
|
|
127
|
-
.rawType,
|
|
128
|
-
);
|
|
122
|
+
const propertyTypeOptions = editorStore.classOptions;
|
|
129
123
|
const propertyType = property.genericType.value.rawType;
|
|
130
124
|
const propertyTypeName = getClassPropertyType(propertyType);
|
|
131
125
|
const filterOption = createFilter({
|
|
@@ -483,8 +483,8 @@ const ExplorerDropdownMenu = observer(() => {
|
|
|
483
483
|
const ExplorerTrees = observer(() => {
|
|
484
484
|
const editorStore = useEditorStore();
|
|
485
485
|
const { isInGrammarTextMode, isInViewerMode } = editorStore;
|
|
486
|
-
const
|
|
487
|
-
editorStore.openSingletonEditorState(editorStore.
|
|
486
|
+
const openModelImport = (): void =>
|
|
487
|
+
editorStore.openSingletonEditorState(editorStore.modelImporterState);
|
|
488
488
|
const graph = editorStore.graphManagerState.graph;
|
|
489
489
|
// Explorer tree
|
|
490
490
|
const treeData = editorStore.explorerTreeState.getTreeData();
|
|
@@ -661,9 +661,9 @@ const ExplorerTrees = observer(() => {
|
|
|
661
661
|
</div>
|
|
662
662
|
<button
|
|
663
663
|
className="btn--dark explorer__content--empty__btn"
|
|
664
|
-
onClick={
|
|
664
|
+
onClick={openModelImport}
|
|
665
665
|
>
|
|
666
|
-
Open Model
|
|
666
|
+
Open Model Importer
|
|
667
667
|
</button>
|
|
668
668
|
</div>
|
|
669
669
|
)}
|
|
@@ -688,8 +688,8 @@ const ProjectExplorerActionPanel = observer((props: { disabled: boolean }) => {
|
|
|
688
688
|
});
|
|
689
689
|
editorStore.explorerTreeState.setTreeData({ ...treeData });
|
|
690
690
|
};
|
|
691
|
-
const
|
|
692
|
-
editorStore.openState(editorStore.
|
|
691
|
+
const showModelImporter = (): void =>
|
|
692
|
+
editorStore.openState(editorStore.modelImporterState);
|
|
693
693
|
|
|
694
694
|
return (
|
|
695
695
|
<div className="panel__header__actions">
|
|
@@ -697,8 +697,8 @@ const ProjectExplorerActionPanel = observer((props: { disabled: boolean }) => {
|
|
|
697
697
|
<button
|
|
698
698
|
className="panel__header__action"
|
|
699
699
|
disabled={disabled}
|
|
700
|
-
title="Open Model
|
|
701
|
-
onClick={
|
|
700
|
+
title="Open Model Importer (F2)"
|
|
701
|
+
onClick={showModelImporter}
|
|
702
702
|
>
|
|
703
703
|
<FileImportIcon />
|
|
704
704
|
</button>
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,11 @@ export * from './stores/LegendStudioAppEvent.js';
|
|
|
26
26
|
export * from './stores/LegendStudioApplicationPlugin.js';
|
|
27
27
|
export * from './stores/EditorStore.js';
|
|
28
28
|
export * from './stores/EditorConfig.js';
|
|
29
|
+
export {
|
|
30
|
+
ExtensionModelImportRendererState,
|
|
31
|
+
ExtensionModelImporterEditorState,
|
|
32
|
+
ModelImporterEditorState,
|
|
33
|
+
} from './stores/editor-state/ModelImporterState.js';
|
|
29
34
|
export { ClassEditorState } from './stores/editor-state/element-editor-state/ClassEditorState.js';
|
|
30
35
|
export { ElementEditorState } from './stores/editor-state/element-editor-state/ElementEditorState.js';
|
|
31
36
|
export { UnsupportedElementEditorState } from './stores/editor-state/UnsupportedElementEditorState.js';
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
import type { EditorStore } from './EditorStore.js';
|
|
36
36
|
import { ElementEditorState } from './editor-state/element-editor-state/ElementEditorState.js';
|
|
37
37
|
import { GraphGenerationState } from './editor-state/GraphGenerationState.js';
|
|
38
|
-
import {
|
|
38
|
+
import { MODEL_IMPORT_NATIVE_INPUT_TYPE } from './editor-state/ModelImporterState.js';
|
|
39
39
|
import type { DSL_LegendStudioApplicationPlugin_Extension } from './LegendStudioApplicationPlugin.js';
|
|
40
40
|
import type { Entity } from '@finos/legend-storage';
|
|
41
41
|
import {
|
|
@@ -303,8 +303,8 @@ export class EditorGraphState {
|
|
|
303
303
|
);
|
|
304
304
|
this.editorStore.setCurrentEditorState(projectConfigurationEditorState);
|
|
305
305
|
} else if (error instanceof GraphDataDeserializationError) {
|
|
306
|
-
// if something goes wrong with de-serialization, redirect to model
|
|
307
|
-
this.
|
|
306
|
+
// if something goes wrong with de-serialization, redirect to model importer to fix
|
|
307
|
+
this.redirectToModelImporterForDebugging(error);
|
|
308
308
|
} else if (error instanceof NetworkClientError) {
|
|
309
309
|
this.editorStore.graphManagerState.graphBuildState.fail();
|
|
310
310
|
this.editorStore.applicationStore.notifyWarning(
|
|
@@ -332,8 +332,8 @@ export class EditorGraphState {
|
|
|
332
332
|
error2,
|
|
333
333
|
);
|
|
334
334
|
if (error2 instanceof NetworkClientError) {
|
|
335
|
-
// in case the server cannot even transform the JSON due to corrupted protocol, we can redirect to model
|
|
336
|
-
this.
|
|
335
|
+
// in case the server cannot even transform the JSON due to corrupted protocol, we can redirect to model importer
|
|
336
|
+
this.redirectToModelImporterForDebugging(error2);
|
|
337
337
|
return {
|
|
338
338
|
status: GraphBuilderStatus.FAILED,
|
|
339
339
|
error: error2,
|
|
@@ -361,7 +361,7 @@ export class EditorGraphState {
|
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
-
private
|
|
364
|
+
private redirectToModelImporterForDebugging(error: Error): void {
|
|
365
365
|
if (this.editorStore.isInConflictResolutionMode) {
|
|
366
366
|
this.editorStore.setBlockingAlert({
|
|
367
367
|
message: `Can't de-serialize graph model from entities`,
|
|
@@ -370,14 +370,15 @@ export class EditorGraphState {
|
|
|
370
370
|
return;
|
|
371
371
|
}
|
|
372
372
|
this.editorStore.applicationStore.notifyWarning(
|
|
373
|
-
`Can't de-serialize graph model from entities. Redirected to model
|
|
374
|
-
);
|
|
375
|
-
this.editorStore.modelLoaderState.setCurrentModelLoadType(
|
|
376
|
-
MODEL_UPDATER_INPUT_TYPE.ENTITIES,
|
|
373
|
+
`Can't de-serialize graph model from entities. Redirected to model importer for debugging. Error: ${error.message}`,
|
|
377
374
|
);
|
|
375
|
+
const nativeImporterState =
|
|
376
|
+
this.editorStore.modelImporterState.setNativeImportType(
|
|
377
|
+
MODEL_IMPORT_NATIVE_INPUT_TYPE.ENTITIES,
|
|
378
|
+
);
|
|
378
379
|
// Making an async call
|
|
379
|
-
|
|
380
|
-
this.editorStore.openState(this.editorStore.
|
|
380
|
+
nativeImporterState.loadCurrentProjectEntities();
|
|
381
|
+
this.editorStore.openState(this.editorStore.modelImporterState);
|
|
381
382
|
}
|
|
382
383
|
|
|
383
384
|
/**
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
import { UMLEditorState } from './editor-state/element-editor-state/UMLEditorState.js';
|
|
60
60
|
import { ServiceEditorState } from './editor-state/element-editor-state/service/ServiceEditorState.js';
|
|
61
61
|
import { EditorSDLCState } from './EditorSDLCState.js';
|
|
62
|
-
import {
|
|
62
|
+
import { ModelImporterState } from './editor-state/ModelImporterState.js';
|
|
63
63
|
import type { EditorState } from './editor-state/EditorState.js';
|
|
64
64
|
import { EntityDiffViewState } from './editor-state/entity-diff-editor-state/EntityDiffViewState.js';
|
|
65
65
|
import { FunctionEditorState } from './editor-state/element-editor-state/FunctionEditorState.js';
|
|
@@ -186,7 +186,7 @@ export class EditorStore {
|
|
|
186
186
|
graphManagerState: GraphManagerState;
|
|
187
187
|
changeDetectionState: ChangeDetectionState;
|
|
188
188
|
grammarTextEditorState: GrammarTextEditorState;
|
|
189
|
-
|
|
189
|
+
modelImporterState: ModelImporterState;
|
|
190
190
|
projectConfigurationEditorState: ProjectConfigurationEditorState;
|
|
191
191
|
projectOverviewState: ProjectOverviewState;
|
|
192
192
|
workspaceWorkflowManagerState: WorkspaceWorkflowManagerState;
|
|
@@ -315,7 +315,7 @@ export class EditorStore {
|
|
|
315
315
|
this.newElementState = new NewElementState(this);
|
|
316
316
|
// special (singleton) editors
|
|
317
317
|
this.grammarTextEditorState = new GrammarTextEditorState(this);
|
|
318
|
-
this.
|
|
318
|
+
this.modelImporterState = new ModelImporterState(this);
|
|
319
319
|
this.projectConfigurationEditorState = new ProjectConfigurationEditorState(
|
|
320
320
|
this,
|
|
321
321
|
this.sdlcState,
|
|
@@ -375,7 +375,7 @@ export class EditorStore {
|
|
|
375
375
|
LEGEND_STUDIO_HOTKEY.TOGGLE_MODEL_LOADER,
|
|
376
376
|
[LEGEND_STUDIO_HOTKEY_MAP.TOGGLE_MODEL_LOADER],
|
|
377
377
|
this.createGlobalHotKeyAction(() =>
|
|
378
|
-
this.openState(this.
|
|
378
|
+
this.openState(this.modelImporterState),
|
|
379
379
|
),
|
|
380
380
|
),
|
|
381
381
|
new HotkeyConfiguration(
|
|
@@ -736,7 +736,6 @@ export class EditorStore {
|
|
|
736
736
|
this.projectConfigurationEditorState.fetchLatestProjectStructureVersion(),
|
|
737
737
|
this.graphState.graphGenerationState.fetchAvailableFileGenerationDescriptions(),
|
|
738
738
|
this.graphState.graphGenerationState.externalFormatState.fetchExternalFormatsDescriptions(),
|
|
739
|
-
this.modelLoaderState.fetchAvailableModelImportDescriptions(),
|
|
740
739
|
this.sdlcState.fetchProjectVersions(),
|
|
741
740
|
]);
|
|
742
741
|
}
|
|
@@ -775,7 +774,6 @@ export class EditorStore {
|
|
|
775
774
|
this.projectConfigurationEditorState.fetchLatestProjectStructureVersion(),
|
|
776
775
|
this.graphState.graphGenerationState.fetchAvailableFileGenerationDescriptions(),
|
|
777
776
|
this.graphState.graphGenerationState.externalFormatState.fetchExternalFormatsDescriptions(),
|
|
778
|
-
this.modelLoaderState.fetchAvailableModelImportDescriptions(),
|
|
779
777
|
this.sdlcState.fetchProjectVersions(),
|
|
780
778
|
]);
|
|
781
779
|
}
|
|
@@ -959,8 +957,8 @@ export class EditorStore {
|
|
|
959
957
|
this.openEntityChangeConflict(editorState);
|
|
960
958
|
} else if (editorState instanceof FileGenerationViewerState) {
|
|
961
959
|
this.openGeneratedFile(editorState.generatedFile);
|
|
962
|
-
} else if (editorState === this.
|
|
963
|
-
this.openSingletonEditorState(this.
|
|
960
|
+
} else if (editorState === this.modelImporterState) {
|
|
961
|
+
this.openSingletonEditorState(this.modelImporterState);
|
|
964
962
|
} else if (editorState === this.projectConfigurationEditorState) {
|
|
965
963
|
this.openSingletonEditorState(this.projectConfigurationEditorState);
|
|
966
964
|
} else {
|
|
@@ -1008,7 +1006,7 @@ export class EditorStore {
|
|
|
1008
1006
|
* This method helps open editor that only exists one instance at at time such as model-loader, project config, settings ...
|
|
1009
1007
|
*/
|
|
1010
1008
|
openSingletonEditorState(
|
|
1011
|
-
singularEditorState:
|
|
1009
|
+
singularEditorState: ModelImporterState | ProjectConfigurationEditorState,
|
|
1012
1010
|
): void {
|
|
1013
1011
|
const existingEditorState = this.openedEditorStates.find(
|
|
1014
1012
|
(e) => e === singularEditorState,
|
|
@@ -27,6 +27,10 @@ import {
|
|
|
27
27
|
LegendApplicationPlugin,
|
|
28
28
|
} from '@finos/legend-application';
|
|
29
29
|
import type { TestableMetadata } from './sidebar-state/testable/GlobalTestRunnerState.js';
|
|
30
|
+
import type {
|
|
31
|
+
ExtensionModelImportRendererState,
|
|
32
|
+
ModelImporterState,
|
|
33
|
+
} from './editor-state/ModelImporterState.js';
|
|
30
34
|
|
|
31
35
|
export type ExplorerContextMenuItemRendererConfiguration = {
|
|
32
36
|
key: string;
|
|
@@ -49,14 +53,19 @@ export type ClassPreviewRenderer = (
|
|
|
49
53
|
_class: Class,
|
|
50
54
|
) => React.ReactNode | undefined;
|
|
51
55
|
|
|
52
|
-
export type
|
|
56
|
+
export type ModelImporterExtensionConfiguration = {
|
|
53
57
|
key: string;
|
|
54
58
|
label?: string | undefined;
|
|
55
59
|
allowHardReplace?: boolean;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
renderer: (
|
|
60
|
+
getExtensionModelImportRendererStateCreator: (
|
|
61
|
+
modelImporterState: ModelImporterState,
|
|
62
|
+
) => ExtensionModelImportRendererState;
|
|
63
|
+
renderer: (
|
|
64
|
+
rendererState: ExtensionModelImportRendererState,
|
|
65
|
+
) => React.ReactNode | undefined;
|
|
66
|
+
loadModel: (
|
|
67
|
+
rendererState: ExtensionModelImportRendererState,
|
|
68
|
+
) => Promise<void>;
|
|
60
69
|
};
|
|
61
70
|
|
|
62
71
|
export type TestableMetadataGetter = (
|
|
@@ -98,9 +107,9 @@ export abstract class LegendStudioApplicationPlugin extends LegendApplicationPlu
|
|
|
98
107
|
getExtraEditorExtensionComponentRendererConfigurations?(): EditorExtensionComponentRendererConfiguration[];
|
|
99
108
|
|
|
100
109
|
/**
|
|
101
|
-
* Get the list of extension configurations for model
|
|
110
|
+
* Get the list of extension configurations for model importer.
|
|
102
111
|
*/
|
|
103
|
-
|
|
112
|
+
getExtraModelImporterExtensionConfigurations?(): ModelImporterExtensionConfiguration[];
|
|
104
113
|
|
|
105
114
|
/**
|
|
106
115
|
* Get the list of extension for testables
|
|
@@ -14,14 +14,31 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
type GeneratorFn,
|
|
19
|
+
type PlainObject,
|
|
20
|
+
HttpStatus,
|
|
21
|
+
NetworkClientError,
|
|
22
|
+
ActionState,
|
|
23
|
+
LogEvent,
|
|
24
|
+
assertErrorThrown,
|
|
25
|
+
} from '@finos/legend-shared';
|
|
18
26
|
import {
|
|
19
27
|
type ApplicationStore,
|
|
28
|
+
ActionAlertActionType,
|
|
29
|
+
ActionAlertType,
|
|
20
30
|
ApplicationTelemetry,
|
|
21
|
-
LegendApplicationSDLCSetupState,
|
|
22
31
|
} from '@finos/legend-application';
|
|
23
|
-
import {
|
|
24
|
-
|
|
32
|
+
import {
|
|
33
|
+
action,
|
|
34
|
+
computed,
|
|
35
|
+
flow,
|
|
36
|
+
flowResult,
|
|
37
|
+
makeObservable,
|
|
38
|
+
observable,
|
|
39
|
+
} from 'mobx';
|
|
40
|
+
import { User, SDLCServerClient } from '@finos/legend-server-sdlc';
|
|
41
|
+
import { LEGEND_STUDIO_APP_EVENT } from './LegendStudioAppEvent.js';
|
|
25
42
|
import type { DepotServerClient } from '@finos/legend-server-depot';
|
|
26
43
|
import type { LegendStudioPluginManager } from '../application/LegendStudioPluginManager.js';
|
|
27
44
|
import type { LegendStudioApplicationConfig } from '../application/LegendStudioApplicationConfig.js';
|
|
@@ -37,11 +54,14 @@ export type LegendStudioApplicationStore = ApplicationStore<
|
|
|
37
54
|
|
|
38
55
|
export class LegendStudioBaseStore {
|
|
39
56
|
applicationStore: LegendStudioApplicationStore;
|
|
57
|
+
sdlcServerClient: SDLCServerClient;
|
|
40
58
|
depotServerClient: DepotServerClient;
|
|
41
59
|
pluginManager: LegendStudioPluginManager;
|
|
42
60
|
|
|
43
61
|
initState = ActionState.create();
|
|
44
|
-
|
|
62
|
+
|
|
63
|
+
isSDLCAuthorized = false;
|
|
64
|
+
SDLCServerTermsOfServicesUrlsToView: string[] = [];
|
|
45
65
|
|
|
46
66
|
constructor(
|
|
47
67
|
applicationStore: LegendStudioApplicationStore,
|
|
@@ -49,23 +69,23 @@ export class LegendStudioBaseStore {
|
|
|
49
69
|
depotServerClient: DepotServerClient,
|
|
50
70
|
pluginManager: LegendStudioPluginManager,
|
|
51
71
|
) {
|
|
52
|
-
makeObservable(this, {
|
|
72
|
+
makeObservable<LegendStudioBaseStore, 'initializeSDLCServerClient'>(this, {
|
|
73
|
+
isSDLCAuthorized: observable,
|
|
74
|
+
SDLCServerTermsOfServicesUrlsToView: observable,
|
|
75
|
+
needsToAcceptSDLCServerTermsOfServices: computed,
|
|
53
76
|
initialize: flow,
|
|
77
|
+
initializeSDLCServerClient: flow,
|
|
78
|
+
dismissSDLCServerTermsOfServicesAlert: action,
|
|
54
79
|
});
|
|
55
80
|
|
|
56
81
|
this.applicationStore = applicationStore;
|
|
57
|
-
this.
|
|
58
|
-
applicationStore,
|
|
59
|
-
sdlcServerClient,
|
|
60
|
-
);
|
|
82
|
+
this.sdlcServerClient = sdlcServerClient;
|
|
61
83
|
this.depotServerClient = depotServerClient;
|
|
62
84
|
|
|
63
85
|
this.pluginManager = pluginManager;
|
|
64
86
|
|
|
65
87
|
// Register plugins
|
|
66
|
-
this.
|
|
67
|
-
this.applicationStore.tracerService,
|
|
68
|
-
);
|
|
88
|
+
this.sdlcServerClient.setTracerService(this.applicationStore.tracerService);
|
|
69
89
|
this.depotServerClient.setTracerService(
|
|
70
90
|
this.applicationStore.tracerService,
|
|
71
91
|
);
|
|
@@ -81,15 +101,26 @@ export class LegendStudioBaseStore {
|
|
|
81
101
|
this.initState.inProgress();
|
|
82
102
|
|
|
83
103
|
// setup SDLC server client
|
|
84
|
-
yield flowResult(
|
|
85
|
-
|
|
86
|
-
|
|
104
|
+
yield flowResult(this.initializeSDLCServerClient());
|
|
105
|
+
|
|
106
|
+
let currentUserID = UNKNOWN_USER_ID;
|
|
107
|
+
try {
|
|
108
|
+
const currentUser = User.serialization.fromJson(
|
|
109
|
+
(yield this.sdlcServerClient.getCurrentUser()) as PlainObject<User>,
|
|
110
|
+
);
|
|
111
|
+
this.sdlcServerClient.setCurrentUser(currentUser);
|
|
112
|
+
currentUserID = currentUser.userId;
|
|
113
|
+
} catch (error) {
|
|
114
|
+
assertErrorThrown(error);
|
|
115
|
+
this.applicationStore.log.error(
|
|
116
|
+
LogEvent.create(LEGEND_STUDIO_APP_EVENT.SDLC_MANAGER_FAILURE),
|
|
117
|
+
error,
|
|
118
|
+
);
|
|
119
|
+
this.applicationStore.notifyWarning(error.message);
|
|
120
|
+
}
|
|
87
121
|
|
|
88
122
|
// setup telemetry service
|
|
89
|
-
this.applicationStore.telemetryService.setUserId(
|
|
90
|
-
this.applicationSDLCSetupState.sdlcServerClient.currentUser?.userId ??
|
|
91
|
-
UNKNOWN_USER_ID,
|
|
92
|
-
);
|
|
123
|
+
this.applicationStore.telemetryService.setUserId(currentUserID);
|
|
93
124
|
|
|
94
125
|
ApplicationTelemetry.logEvent_ApplicationInitialized(
|
|
95
126
|
this.applicationStore.telemetryService,
|
|
@@ -109,4 +140,100 @@ export class LegendStudioBaseStore {
|
|
|
109
140
|
|
|
110
141
|
this.initState.complete();
|
|
111
142
|
}
|
|
143
|
+
|
|
144
|
+
private *initializeSDLCServerClient(): GeneratorFn<void> {
|
|
145
|
+
try {
|
|
146
|
+
this.isSDLCAuthorized =
|
|
147
|
+
(yield this.sdlcServerClient.isAuthorized()) as boolean;
|
|
148
|
+
if (!this.isSDLCAuthorized) {
|
|
149
|
+
this.applicationStore.navigator.jumpTo(
|
|
150
|
+
SDLCServerClient.authorizeCallbackUrl(
|
|
151
|
+
this.applicationStore.config.sdlcServerUrl,
|
|
152
|
+
this.applicationStore.navigator.getCurrentLocation(),
|
|
153
|
+
),
|
|
154
|
+
);
|
|
155
|
+
} else {
|
|
156
|
+
// Only proceed intialization after passing authorization check
|
|
157
|
+
|
|
158
|
+
// check terms of service agreement status
|
|
159
|
+
this.SDLCServerTermsOfServicesUrlsToView =
|
|
160
|
+
(yield this.sdlcServerClient.hasAcceptedTermsOfService()) as string[];
|
|
161
|
+
if (this.SDLCServerTermsOfServicesUrlsToView.length) {
|
|
162
|
+
this.applicationStore.setActionAlertInfo({
|
|
163
|
+
message: `Please read and accept the SDLC servers' terms of service`,
|
|
164
|
+
prompt: `Click 'Done' when you have accepted all the terms`,
|
|
165
|
+
type: ActionAlertType.CAUTION,
|
|
166
|
+
actions: [
|
|
167
|
+
{
|
|
168
|
+
label: 'See terms of services',
|
|
169
|
+
default: true,
|
|
170
|
+
handler: (): void =>
|
|
171
|
+
this.SDLCServerTermsOfServicesUrlsToView.forEach((url) =>
|
|
172
|
+
this.applicationStore.navigator.openNewWindow(url),
|
|
173
|
+
),
|
|
174
|
+
type: ActionAlertActionType.PROCEED,
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
label: 'Done',
|
|
178
|
+
type: ActionAlertActionType.PROCEED_WITH_CAUTION,
|
|
179
|
+
handler: (): void => {
|
|
180
|
+
this.dismissSDLCServerTermsOfServicesAlert();
|
|
181
|
+
this.applicationStore.navigator.reload();
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// fetch server features config
|
|
189
|
+
yield this.sdlcServerClient.fetchServerFeaturesConfiguration();
|
|
190
|
+
}
|
|
191
|
+
} catch (error) {
|
|
192
|
+
assertErrorThrown(error);
|
|
193
|
+
if (
|
|
194
|
+
// eslint-disable-next-line no-process-env
|
|
195
|
+
process.env.NODE_ENV === 'development' &&
|
|
196
|
+
error instanceof NetworkClientError &&
|
|
197
|
+
error.response.status === HttpStatus.UNAUTHORIZED
|
|
198
|
+
) {
|
|
199
|
+
this.applicationStore.setActionAlertInfo({
|
|
200
|
+
message:
|
|
201
|
+
'The first time the application starts in development mode, the developer would need to authenticate using SDLC server. Please do so then manually reload the app',
|
|
202
|
+
type: ActionAlertType.STANDARD,
|
|
203
|
+
actions: [
|
|
204
|
+
{
|
|
205
|
+
label: 'Authenticate using SDLC',
|
|
206
|
+
type: ActionAlertActionType.PROCEED,
|
|
207
|
+
default: true,
|
|
208
|
+
handler: (): void => {
|
|
209
|
+
this.applicationStore.navigator.openNewWindow(
|
|
210
|
+
this.sdlcServerClient.currentUserUrl,
|
|
211
|
+
);
|
|
212
|
+
this.applicationStore.setBlockingAlert({
|
|
213
|
+
message:
|
|
214
|
+
'Waiting for the developer to authenticate using SDLC server',
|
|
215
|
+
prompt:
|
|
216
|
+
'Please manually reload the application after authentication',
|
|
217
|
+
});
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
});
|
|
222
|
+
} else {
|
|
223
|
+
this.applicationStore.log.error(
|
|
224
|
+
LogEvent.create(LEGEND_STUDIO_APP_EVENT.SDLC_MANAGER_FAILURE),
|
|
225
|
+
error,
|
|
226
|
+
);
|
|
227
|
+
this.applicationStore.notifyError(error);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
get needsToAcceptSDLCServerTermsOfServices(): boolean {
|
|
233
|
+
return Boolean(this.SDLCServerTermsOfServicesUrlsToView.length);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
dismissSDLCServerTermsOfServicesAlert(): void {
|
|
237
|
+
this.SDLCServerTermsOfServicesUrlsToView = [];
|
|
238
|
+
}
|
|
112
239
|
}
|
|
@@ -190,7 +190,7 @@ export class NewPackageableRuntimeDriver extends NewElementDriver<PackageableRun
|
|
|
190
190
|
isValid: computed,
|
|
191
191
|
});
|
|
192
192
|
|
|
193
|
-
const mappings = this.editorStore.graphManagerState.graph.
|
|
193
|
+
const mappings = this.editorStore.graphManagerState.graph.mappings;
|
|
194
194
|
if (mappings.length) {
|
|
195
195
|
this.mapping = mappings[0];
|
|
196
196
|
}
|
|
@@ -240,7 +240,7 @@ export class NewPureModelConnectionDriver extends NewConnectionValueDriver<PureM
|
|
|
240
240
|
isValid: computed,
|
|
241
241
|
});
|
|
242
242
|
|
|
243
|
-
const classes = this.editorStore.graphManagerState.graph.
|
|
243
|
+
const classes = this.editorStore.graphManagerState.graph.classes;
|
|
244
244
|
if (classes.length) {
|
|
245
245
|
this.class = classes[0];
|
|
246
246
|
}
|
|
@@ -302,7 +302,7 @@ export class NewRelationalDatabaseConnectionDriver extends NewConnectionValueDri
|
|
|
302
302
|
if (store instanceof Database) {
|
|
303
303
|
selectedStore = store;
|
|
304
304
|
} else {
|
|
305
|
-
const dbs = this.editorStore.graphManagerState.graph.
|
|
305
|
+
const dbs = this.editorStore.graphManagerState.graph.databases;
|
|
306
306
|
selectedStore = dbs.length ? (dbs[0] as Database) : stub_Database();
|
|
307
307
|
}
|
|
308
308
|
return new RelationalDatabaseConnection(
|
|
@@ -533,6 +533,7 @@ export class NewGenerationSpecificationDriver extends NewElementDriver<Generatio
|
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
get isValid(): boolean {
|
|
536
|
+
// only one generation specification should exist
|
|
536
537
|
return !this.editorStore.graphManagerState.graph.ownGenerationSpecifications
|
|
537
538
|
.length;
|
|
538
539
|
}
|
|
@@ -18,7 +18,6 @@ import type { ExternalFormatDescription } from '@finos/legend-graph';
|
|
|
18
18
|
import {
|
|
19
19
|
type GeneratorFn,
|
|
20
20
|
assertErrorThrown,
|
|
21
|
-
guaranteeNonNullable,
|
|
22
21
|
LogEvent,
|
|
23
22
|
ActionState,
|
|
24
23
|
} from '@finos/legend-shared';
|
|
@@ -58,12 +57,22 @@ export class ExternalFormatState {
|
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
get formatTypeOptions(): ExternalFormatTypeOption[] {
|
|
61
|
-
return this.externalFormatsDescriptions.map((
|
|
62
|
-
value:
|
|
63
|
-
label:
|
|
60
|
+
return this.externalFormatsDescriptions.map((types) => ({
|
|
61
|
+
value: types.name,
|
|
62
|
+
label: types.name,
|
|
64
63
|
}));
|
|
65
64
|
}
|
|
66
65
|
|
|
66
|
+
get formatContentTypes(): string[] {
|
|
67
|
+
return this.externalFormatsDescriptions.map((e) => e.contentTypes).flat();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get externalFormatDescriptionsWithModelGenerationSupport(): ExternalFormatDescription[] {
|
|
71
|
+
return this.externalFormatsDescriptions.filter(
|
|
72
|
+
(d) => d.supportsModelGeneration,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
67
76
|
getFormatTypeForContentType(contentType: string): string | undefined {
|
|
68
77
|
return this.externalFormatsDescriptions.find(
|
|
69
78
|
(externalFormatDescription) =>
|
|
@@ -71,10 +80,6 @@ export class ExternalFormatState {
|
|
|
71
80
|
)?.name;
|
|
72
81
|
}
|
|
73
82
|
|
|
74
|
-
get formatContentTypes(): string[] {
|
|
75
|
-
return this.externalFormatsDescriptions.map((e) => e.contentTypes).flat();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
83
|
setExternalFormatsDescriptions(
|
|
79
84
|
externalFormatsDescriptions: ExternalFormatDescription[],
|
|
80
85
|
): void {
|
|
@@ -99,9 +104,7 @@ export class ExternalFormatState {
|
|
|
99
104
|
}
|
|
100
105
|
}
|
|
101
106
|
|
|
102
|
-
getTypeDescription(type: string): ExternalFormatDescription {
|
|
103
|
-
return
|
|
104
|
-
this.externalFormatsDescriptions.find((e) => e.name === type),
|
|
105
|
-
);
|
|
107
|
+
getTypeDescription(type: string): ExternalFormatDescription | undefined {
|
|
108
|
+
return this.externalFormatsDescriptions.find((e) => e.name === type);
|
|
106
109
|
}
|
|
107
110
|
}
|