@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
|
@@ -50,8 +50,6 @@ import {
|
|
|
50
50
|
SDLCServerFeaturesConfiguration,
|
|
51
51
|
} from '@finos/legend-server-sdlc';
|
|
52
52
|
import {
|
|
53
|
-
type ImportConfigurationDescription,
|
|
54
|
-
type ImportMode,
|
|
55
53
|
type GenerationConfigurationDescription,
|
|
56
54
|
type GenerationMode,
|
|
57
55
|
type GraphManagerState,
|
|
@@ -109,20 +107,8 @@ export const TEST_DATA__DefaultSDLCInfo = {
|
|
|
109
107
|
version: 6,
|
|
110
108
|
extensionVersion: 3,
|
|
111
109
|
},
|
|
112
|
-
availableSchemaImports: [
|
|
113
|
-
|
|
114
|
-
label: 'XSD',
|
|
115
|
-
key: 'Xsd',
|
|
116
|
-
modelImportMode: 'schemaImport' as ImportMode,
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
availableCodeImports: [
|
|
120
|
-
{
|
|
121
|
-
label: 'Java',
|
|
122
|
-
key: 'java',
|
|
123
|
-
modelImportMode: 'codeImport' as ImportMode,
|
|
124
|
-
},
|
|
125
|
-
],
|
|
110
|
+
availableSchemaImports: [],
|
|
111
|
+
availableCodeImports: [],
|
|
126
112
|
availableSchemaGenerations: [
|
|
127
113
|
{
|
|
128
114
|
label: 'Avro',
|
|
@@ -237,7 +223,6 @@ export const TEST__setUpEditor = async (
|
|
|
237
223
|
projectConfiguration: PlainObject<ProjectConfiguration>;
|
|
238
224
|
latestProjectStructureVersion: PlainObject<ProjectStructureVersion>;
|
|
239
225
|
availableGenerationDescriptions: GenerationConfigurationDescription[];
|
|
240
|
-
availableImportDescriptions: ImportConfigurationDescription[];
|
|
241
226
|
projects: PlainObject<ProjectData>[];
|
|
242
227
|
projectData: PlainObject<ProjectData>[];
|
|
243
228
|
projectDependency: PlainObject<ProjectVersionEntities>[];
|
|
@@ -252,7 +237,6 @@ export const TEST__setUpEditor = async (
|
|
|
252
237
|
entities,
|
|
253
238
|
latestProjectStructureVersion,
|
|
254
239
|
availableGenerationDescriptions,
|
|
255
|
-
availableImportDescriptions,
|
|
256
240
|
projectData,
|
|
257
241
|
projects,
|
|
258
242
|
projectDependency,
|
|
@@ -322,12 +306,6 @@ export const TEST__setUpEditor = async (
|
|
|
322
306
|
'getAvailableGenerationConfigurationDescriptions',
|
|
323
307
|
)
|
|
324
308
|
.mockResolvedValue(availableGenerationDescriptions);
|
|
325
|
-
jest
|
|
326
|
-
.spyOn(
|
|
327
|
-
MOCK__editorStore.graphManagerState.graphManager,
|
|
328
|
-
'getAvailableImportConfigurationDescriptions',
|
|
329
|
-
)
|
|
330
|
-
.mockResolvedValue(availableImportDescriptions);
|
|
331
309
|
|
|
332
310
|
// mock change detections (since we do not test them now)
|
|
333
311
|
MOCK__editorStore.changeDetectionState.workspaceLocalLatestRevisionState.buildEntityHashesIndex =
|
|
@@ -422,7 +400,6 @@ export const TEST__setUpEditorWithDefaultSDLCData = (
|
|
|
422
400
|
projectConfiguration?: PlainObject<ProjectConfiguration>;
|
|
423
401
|
latestProjectStructureVersion?: PlainObject<ProjectStructureVersion>;
|
|
424
402
|
availableGenerationDescriptions?: GenerationConfigurationDescription[];
|
|
425
|
-
availableImportDescriptions?: ImportConfigurationDescription[];
|
|
426
403
|
projects?: PlainObject<ProjectData>[];
|
|
427
404
|
projectData?: PlainObject<ProjectData>[];
|
|
428
405
|
projectDependency?: PlainObject<ProjectVersionEntities>[];
|
|
@@ -441,10 +418,6 @@ export const TEST__setUpEditorWithDefaultSDLCData = (
|
|
|
441
418
|
...TEST_DATA__DefaultSDLCInfo.availableSchemaGenerations,
|
|
442
419
|
...TEST_DATA__DefaultSDLCInfo.availableCodeGenerations,
|
|
443
420
|
],
|
|
444
|
-
availableImportDescriptions: [
|
|
445
|
-
...TEST_DATA__DefaultSDLCInfo.availableSchemaImports,
|
|
446
|
-
...TEST_DATA__DefaultSDLCInfo.availableCodeImports,
|
|
447
|
-
],
|
|
448
421
|
projects: [],
|
|
449
422
|
projectData: [],
|
|
450
423
|
projectDependency: [],
|
|
@@ -119,12 +119,12 @@ export const LegendStudioApplicationRoot = observer(() => {
|
|
|
119
119
|
|
|
120
120
|
return (
|
|
121
121
|
<div className="app">
|
|
122
|
-
{!baseStore.
|
|
122
|
+
{!baseStore.isSDLCAuthorized && (
|
|
123
123
|
<div className="app__page">
|
|
124
124
|
<PanelLoadingIndicator isLoading={true} />
|
|
125
125
|
</div>
|
|
126
126
|
)}
|
|
127
|
-
{baseStore.
|
|
127
|
+
{baseStore.isSDLCAuthorized && (
|
|
128
128
|
<>
|
|
129
129
|
{/* TODO: consider moving this to `LegendApplicationComponentFrameworkProvider` */}
|
|
130
130
|
<VirtualAssistant />
|
|
@@ -40,8 +40,8 @@ import {
|
|
|
40
40
|
EntityDiffViewState,
|
|
41
41
|
} from '../../../stores/editor-state/entity-diff-editor-state/EntityDiffViewState.js';
|
|
42
42
|
import { EntityDiffView } from '../../editor/edit-panel/diff-editor/EntityDiffView.js';
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
43
|
+
import { ModelImporter } from './ModelImporter.js';
|
|
44
|
+
import { ModelImporterState } from '../../../stores/editor-state/ModelImporterState.js';
|
|
45
45
|
import { FunctionEditorState } from '../../../stores/editor-state/element-editor-state/FunctionEditorState.js';
|
|
46
46
|
import { ServiceEditorState } from '../../../stores/editor-state/element-editor-state/service/ServiceEditorState.js';
|
|
47
47
|
import { ProjectConfigurationEditorState } from '../../../stores/editor-state/ProjectConfigurationEditorState.js';
|
|
@@ -321,8 +321,8 @@ export const EditPanel = observer(() => {
|
|
|
321
321
|
);
|
|
322
322
|
} else if (currentEditorState instanceof FileGenerationViewerState) {
|
|
323
323
|
return <FileGenerationViewer key={currentEditorState.uuid} />;
|
|
324
|
-
} else if (currentEditorState instanceof
|
|
325
|
-
return <
|
|
324
|
+
} else if (currentEditorState instanceof ModelImporterState) {
|
|
325
|
+
return <ModelImporter />;
|
|
326
326
|
} else if (currentEditorState instanceof ProjectConfigurationEditorState) {
|
|
327
327
|
return <ProjectConfigurationEditor />;
|
|
328
328
|
}
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { observer } from 'mobx-react-lite';
|
|
18
|
+
import {
|
|
19
|
+
type ModelImporterEditorState,
|
|
20
|
+
ModelImporterState,
|
|
21
|
+
ExtensionModelImporterEditorState,
|
|
22
|
+
MODEL_IMPORT_NATIVE_INPUT_TYPE,
|
|
23
|
+
NativeModelImporterEditorState,
|
|
24
|
+
ExternalFormatModelImporterState,
|
|
25
|
+
} from '../../../stores/editor-state/ModelImporterState.js';
|
|
26
|
+
import { prettyCONSTName } from '@finos/legend-shared';
|
|
27
|
+
import {
|
|
28
|
+
DropdownMenu,
|
|
29
|
+
MenuContent,
|
|
30
|
+
MenuContentItem,
|
|
31
|
+
CaretDownIcon,
|
|
32
|
+
CheckSquareIcon,
|
|
33
|
+
TruckLoadingIcon,
|
|
34
|
+
EmptySquareIcon,
|
|
35
|
+
BlankPanelContent,
|
|
36
|
+
PanelLoadingIndicator,
|
|
37
|
+
clsx,
|
|
38
|
+
} from '@finos/legend-art';
|
|
39
|
+
import { flowResult } from 'mobx';
|
|
40
|
+
import { useEditorStore } from '../EditorStoreProvider.js';
|
|
41
|
+
import {
|
|
42
|
+
ActionAlertType,
|
|
43
|
+
ActionAlertActionType,
|
|
44
|
+
useApplicationStore,
|
|
45
|
+
EDITOR_LANGUAGE,
|
|
46
|
+
useApplicationNavigationContext,
|
|
47
|
+
} from '@finos/legend-application';
|
|
48
|
+
import { StudioTextInputEditor } from '../../shared/StudioTextInputEditor.js';
|
|
49
|
+
import type { ModelImporterExtensionConfiguration } from '../../../stores/LegendStudioApplicationPlugin.js';
|
|
50
|
+
import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../stores/LegendStudioApplicationNavigationContext.js';
|
|
51
|
+
import { SCHEMA_SET_TAB_TYPE } from '../../../stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.js';
|
|
52
|
+
import { SchemaSetModelGenerationEditor } from './external-format-editor/SchemaSetModelGenerationEditor.js';
|
|
53
|
+
import { SchemaSetGeneralEditor } from './external-format-editor/SchemaSetElementEditor.js';
|
|
54
|
+
|
|
55
|
+
const ExternalFormatModelImporterEditor = observer(
|
|
56
|
+
(props: { externalFormatState: ExternalFormatModelImporterState }) => {
|
|
57
|
+
const { externalFormatState } = props;
|
|
58
|
+
const schemaSetEditorState = externalFormatState.schemaSetEditorState;
|
|
59
|
+
const editorStore = schemaSetEditorState.editorStore;
|
|
60
|
+
const schemaSet = schemaSetEditorState.schemaSet;
|
|
61
|
+
const currentTab = schemaSetEditorState.selectedTab;
|
|
62
|
+
const isFetchingDescriptions =
|
|
63
|
+
editorStore.graphState.graphGenerationState.externalFormatState
|
|
64
|
+
.fetchingDescriptionsState.isInProgress;
|
|
65
|
+
const changeTab =
|
|
66
|
+
(tab: SCHEMA_SET_TAB_TYPE): (() => void) =>
|
|
67
|
+
(): void =>
|
|
68
|
+
schemaSetEditorState.setSelectedTab(tab);
|
|
69
|
+
const renderMainEditPanel = (): React.ReactNode => {
|
|
70
|
+
if (isFetchingDescriptions) {
|
|
71
|
+
return (
|
|
72
|
+
<BlankPanelContent>Fetching format descriptions</BlankPanelContent>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
if (currentTab === SCHEMA_SET_TAB_TYPE.SCHEMAS) {
|
|
76
|
+
return (
|
|
77
|
+
<SchemaSetGeneralEditor
|
|
78
|
+
schemaSetEditorState={schemaSetEditorState}
|
|
79
|
+
isReadOnly={false}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
const supportsModelGeneraiton =
|
|
84
|
+
schemaSetEditorState.schemaSetModelGenerationState.description
|
|
85
|
+
?.supportsModelGeneration;
|
|
86
|
+
return supportsModelGeneraiton ? (
|
|
87
|
+
<SchemaSetModelGenerationEditor
|
|
88
|
+
modelGenerationState={
|
|
89
|
+
schemaSetEditorState.schemaSetModelGenerationState
|
|
90
|
+
}
|
|
91
|
+
isReadOnly={false}
|
|
92
|
+
/>
|
|
93
|
+
) : (
|
|
94
|
+
<BlankPanelContent>
|
|
95
|
+
Format {schemaSet.format} does not support Model Generation
|
|
96
|
+
</BlankPanelContent>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
return (
|
|
100
|
+
<div className="panel schema-set-panel">
|
|
101
|
+
<div className="panel__content model-loader">
|
|
102
|
+
<PanelLoadingIndicator isLoading={isFetchingDescriptions} />
|
|
103
|
+
<div className="panel__header">
|
|
104
|
+
<div className="uml-element-editor__tabs">
|
|
105
|
+
{Object.values(SCHEMA_SET_TAB_TYPE).map((tab) => (
|
|
106
|
+
<div
|
|
107
|
+
key={tab}
|
|
108
|
+
onClick={changeTab(tab)}
|
|
109
|
+
className={clsx('relational-connection-editor__tab', {
|
|
110
|
+
'relational-connection-editor__tab--active':
|
|
111
|
+
tab === currentTab,
|
|
112
|
+
})}
|
|
113
|
+
>
|
|
114
|
+
{prettyCONSTName(tab)}
|
|
115
|
+
</div>
|
|
116
|
+
))}
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<div className="panel__content file-generation-editor__content">
|
|
121
|
+
{currentTab === SCHEMA_SET_TAB_TYPE.SCHEMAS && (
|
|
122
|
+
<SchemaSetGeneralEditor
|
|
123
|
+
schemaSetEditorState={schemaSetEditorState}
|
|
124
|
+
isReadOnly={false}
|
|
125
|
+
/>
|
|
126
|
+
)}
|
|
127
|
+
|
|
128
|
+
{currentTab === SCHEMA_SET_TAB_TYPE.GENERATE_MODEL &&
|
|
129
|
+
renderMainEditPanel()}
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
},
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
export const ModelImporter = observer(() => {
|
|
138
|
+
const editorStore = useEditorStore();
|
|
139
|
+
const applicationStore = useApplicationStore();
|
|
140
|
+
const modelImporterState =
|
|
141
|
+
editorStore.getCurrentEditorState(ModelImporterState);
|
|
142
|
+
const nativeInputTypes = Object.values(MODEL_IMPORT_NATIVE_INPUT_TYPE);
|
|
143
|
+
const extraModelImporterExtensionsConfigs =
|
|
144
|
+
modelImporterState.extensionConfigs;
|
|
145
|
+
const externalFormatDescriptions =
|
|
146
|
+
modelImporterState.editorStore.graphState.graphGenerationState
|
|
147
|
+
.externalFormatState.externalFormatDescriptionsWithModelGenerationSupport;
|
|
148
|
+
// replace flag
|
|
149
|
+
const replace = modelImporterState.replace;
|
|
150
|
+
const toggleReplace = (): void => modelImporterState.setReplaceFlag(!replace);
|
|
151
|
+
const label = modelImporterState.modelImportEditorState.label;
|
|
152
|
+
const modelImportEditorState = modelImporterState.modelImportEditorState;
|
|
153
|
+
const loadModel = (): void => {
|
|
154
|
+
if (editorStore.hasUnpushedChanges) {
|
|
155
|
+
editorStore.setActionAlertInfo({
|
|
156
|
+
message: 'You have unpushed changes',
|
|
157
|
+
prompt:
|
|
158
|
+
'This action will discard these changes and refresh the application',
|
|
159
|
+
type: ActionAlertType.CAUTION,
|
|
160
|
+
onEnter: (): void => editorStore.setBlockGlobalHotkeys(true),
|
|
161
|
+
onClose: (): void => editorStore.setBlockGlobalHotkeys(false),
|
|
162
|
+
actions: [
|
|
163
|
+
{
|
|
164
|
+
label: 'Proceed to load model',
|
|
165
|
+
type: ActionAlertActionType.PROCEED_WITH_CAUTION,
|
|
166
|
+
handler: (): void => {
|
|
167
|
+
editorStore.setIgnoreNavigationBlocking(true);
|
|
168
|
+
flowResult(
|
|
169
|
+
modelImporterState.modelImportEditorState.loadModel(),
|
|
170
|
+
).catch(applicationStore.alertUnhandledError);
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
label: 'Abort',
|
|
175
|
+
type: ActionAlertActionType.PROCEED,
|
|
176
|
+
default: true,
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
});
|
|
180
|
+
} else {
|
|
181
|
+
flowResult(modelImporterState.modelImportEditorState.loadModel()).catch(
|
|
182
|
+
applicationStore.alertUnhandledError,
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
useApplicationNavigationContext(
|
|
187
|
+
LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.MODEL_LOADER,
|
|
188
|
+
);
|
|
189
|
+
const renderExtraActions = (): React.ReactNode => {
|
|
190
|
+
if (modelImportEditorState instanceof NativeModelImporterEditorState) {
|
|
191
|
+
// actions
|
|
192
|
+
const loadCurrentProjectEntities = applicationStore.guardUnhandledError(
|
|
193
|
+
() => flowResult(modelImportEditorState.loadCurrentProjectEntities()),
|
|
194
|
+
);
|
|
195
|
+
return (
|
|
196
|
+
<button
|
|
197
|
+
className="model-loader__header__configs__load-project-entities-btn"
|
|
198
|
+
tabIndex={-1}
|
|
199
|
+
onClick={loadCurrentProjectEntities}
|
|
200
|
+
title="Load current project entities"
|
|
201
|
+
>
|
|
202
|
+
<TruckLoadingIcon />
|
|
203
|
+
</button>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
return null;
|
|
207
|
+
};
|
|
208
|
+
const renderModelImporterEditor = (): React.ReactNode => {
|
|
209
|
+
if (modelImportEditorState instanceof ExtensionModelImporterEditorState) {
|
|
210
|
+
return modelImportEditorState.config.renderer(
|
|
211
|
+
modelImportEditorState.rendererState,
|
|
212
|
+
);
|
|
213
|
+
} else if (
|
|
214
|
+
modelImportEditorState instanceof NativeModelImporterEditorState
|
|
215
|
+
) {
|
|
216
|
+
const updateModel = (val: string): void =>
|
|
217
|
+
modelImportEditorState.setModelText(val);
|
|
218
|
+
return (
|
|
219
|
+
<div className="panel__content model-loader__editor">
|
|
220
|
+
<StudioTextInputEditor
|
|
221
|
+
language={
|
|
222
|
+
modelImportEditorState.nativeType ===
|
|
223
|
+
MODEL_IMPORT_NATIVE_INPUT_TYPE.PURE_GRAMMAR
|
|
224
|
+
? EDITOR_LANGUAGE.PURE
|
|
225
|
+
: EDITOR_LANGUAGE.JSON
|
|
226
|
+
}
|
|
227
|
+
inputValue={modelImportEditorState.modelText}
|
|
228
|
+
updateInput={updateModel}
|
|
229
|
+
showMiniMap={true}
|
|
230
|
+
/>
|
|
231
|
+
</div>
|
|
232
|
+
);
|
|
233
|
+
} else if (
|
|
234
|
+
modelImportEditorState instanceof ExternalFormatModelImporterState
|
|
235
|
+
) {
|
|
236
|
+
return (
|
|
237
|
+
<ExternalFormatModelImporterEditor
|
|
238
|
+
externalFormatState={modelImportEditorState}
|
|
239
|
+
/>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
return null;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<div className="panel model-loader">
|
|
247
|
+
<div className="panel__header model-loader__header">
|
|
248
|
+
<div className="model-loader__header__configs">
|
|
249
|
+
<DropdownMenu
|
|
250
|
+
content={
|
|
251
|
+
<MenuContent className="model-loader__header__configs__type__menu">
|
|
252
|
+
<div className="model-loader__header__configs__type-option__group model-loader__header__configs__type-option__group--native">
|
|
253
|
+
<div className="model-loader__header__configs__type-option__group__name">
|
|
254
|
+
native
|
|
255
|
+
</div>
|
|
256
|
+
<div className="model-loader__header__configs__type-option__group__options">
|
|
257
|
+
{nativeInputTypes.map((inputType) => (
|
|
258
|
+
<MenuContentItem
|
|
259
|
+
key={inputType}
|
|
260
|
+
className="model-loader__header__configs__type-option__group__option"
|
|
261
|
+
onClick={(): ModelImporterEditorState =>
|
|
262
|
+
modelImporterState.setNativeImportType(inputType)
|
|
263
|
+
}
|
|
264
|
+
>
|
|
265
|
+
{prettyCONSTName(inputType)}
|
|
266
|
+
</MenuContentItem>
|
|
267
|
+
))}
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
270
|
+
{Boolean(externalFormatDescriptions.length) && (
|
|
271
|
+
<>
|
|
272
|
+
<div className="model-loader__header__configs__type-option__group__separator" />
|
|
273
|
+
<div className="model-loader__header__configs__type-option__group model-loader__header__configs__type-option__group--external">
|
|
274
|
+
<div className="model-loader__header__configs__type-option__group__name">
|
|
275
|
+
external
|
|
276
|
+
</div>
|
|
277
|
+
<div className="model-loader__header__configs__type-option__group__options">
|
|
278
|
+
{externalFormatDescriptions.map((inputType) => (
|
|
279
|
+
<MenuContentItem
|
|
280
|
+
key={inputType.name}
|
|
281
|
+
className="model-loader__header__configs__type-option__group__option"
|
|
282
|
+
onClick={() =>
|
|
283
|
+
modelImporterState.setExternalFormatImportFormat(
|
|
284
|
+
inputType,
|
|
285
|
+
)
|
|
286
|
+
}
|
|
287
|
+
>
|
|
288
|
+
{inputType.name}
|
|
289
|
+
</MenuContentItem>
|
|
290
|
+
))}
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
</>
|
|
294
|
+
)}
|
|
295
|
+
{Boolean(extraModelImporterExtensionsConfigs.length > 0) && (
|
|
296
|
+
<>
|
|
297
|
+
<div className="model-loader__header__configs__type-option__group__separator" />
|
|
298
|
+
<div className="model-loader__header__configs__type-option__group model-loader__header__configs__type-option__group--extension">
|
|
299
|
+
<div className="model-loader__header__configs__type-option__group__name">
|
|
300
|
+
extensions
|
|
301
|
+
</div>
|
|
302
|
+
<div className="model-loader__header__configs__type-option__group__options">
|
|
303
|
+
{extraModelImporterExtensionsConfigs.map(
|
|
304
|
+
(config: ModelImporterExtensionConfiguration) => (
|
|
305
|
+
<MenuContentItem
|
|
306
|
+
key={config.key}
|
|
307
|
+
className="model-loader__header__configs__type-option__group__option"
|
|
308
|
+
onClick={() =>
|
|
309
|
+
modelImporterState.setModelImporterExtension(
|
|
310
|
+
config,
|
|
311
|
+
)
|
|
312
|
+
}
|
|
313
|
+
>
|
|
314
|
+
{config.label ?? prettyCONSTName(config.key)}
|
|
315
|
+
</MenuContentItem>
|
|
316
|
+
),
|
|
317
|
+
)}
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
</>
|
|
321
|
+
)}
|
|
322
|
+
</MenuContent>
|
|
323
|
+
}
|
|
324
|
+
menuProps={{
|
|
325
|
+
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
|
326
|
+
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
|
327
|
+
}}
|
|
328
|
+
>
|
|
329
|
+
<div className="model-loader__header__configs__type">
|
|
330
|
+
<div className="model-loader__header__configs__type__label">
|
|
331
|
+
{prettyCONSTName(label)}
|
|
332
|
+
</div>
|
|
333
|
+
<div className="model-loader__header__configs__type__icon">
|
|
334
|
+
<CaretDownIcon />
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
337
|
+
</DropdownMenu>
|
|
338
|
+
{modelImportEditorState.allowHardReplace && (
|
|
339
|
+
<div
|
|
340
|
+
className="model-loader__header__configs__edit-mode"
|
|
341
|
+
onClick={toggleReplace}
|
|
342
|
+
>
|
|
343
|
+
<div className="model-loader__header__configs__edit-mode__icon">
|
|
344
|
+
{replace ? <CheckSquareIcon /> : <EmptySquareIcon />}
|
|
345
|
+
</div>
|
|
346
|
+
<div className="model-loader__header__configs__edit-mode__label">
|
|
347
|
+
replace
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
350
|
+
)}
|
|
351
|
+
{renderExtraActions()}
|
|
352
|
+
</div>
|
|
353
|
+
<div className="model-loader__header__action">
|
|
354
|
+
<button
|
|
355
|
+
className="btn--dark model-loader__header__load-btn"
|
|
356
|
+
onClick={loadModel}
|
|
357
|
+
disabled={
|
|
358
|
+
modelImportEditorState.loadModelActionState.isInProgress ||
|
|
359
|
+
modelImportEditorState.isLoadingDisabled
|
|
360
|
+
}
|
|
361
|
+
tabIndex={-1}
|
|
362
|
+
title="Load model"
|
|
363
|
+
>
|
|
364
|
+
Load
|
|
365
|
+
</button>
|
|
366
|
+
</div>
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
{renderModelImporterEditor()}
|
|
370
|
+
</div>
|
|
371
|
+
);
|
|
372
|
+
});
|
package/src/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.tsx
CHANGED
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
ApiTokenAuthenticationStrategy,
|
|
46
46
|
UsernamePasswordAuthenticationStrategy,
|
|
47
47
|
GCPWorkloadIdentityFederationAuthenticationStrategy,
|
|
48
|
+
MiddleTierUsernamePasswordAuthenticationStrategy,
|
|
48
49
|
EmbeddedH2DatasourceSpecification,
|
|
49
50
|
LocalH2DatasourceSpecification,
|
|
50
51
|
SnowflakeDatasourceSpecification,
|
|
@@ -114,6 +115,7 @@ import {
|
|
|
114
115
|
usernamePasswordAuthenticationStrategy_setUserNameVaultReference,
|
|
115
116
|
gcpWorkloadIdentityFederationAuthenticationStrategy_setServiceAccountEmail,
|
|
116
117
|
gcpWorkloadIdentityFederationAuthenticationStrategy_setAdditionalGcpScopes,
|
|
118
|
+
middleTierUsernamePasswordAuthenticationStrategy_setVaultReference,
|
|
117
119
|
} from '../../../../stores/graphModifier/StoreRelational_GraphModifierHelper.js';
|
|
118
120
|
|
|
119
121
|
/**
|
|
@@ -1014,6 +1016,31 @@ const UsernamePasswordAuthenticationStrategyEditor = observer(
|
|
|
1014
1016
|
);
|
|
1015
1017
|
},
|
|
1016
1018
|
);
|
|
1019
|
+
// Middle Tier Username Password Authentication Strategy obtains credentials(username and password) from the provided vault reference
|
|
1020
|
+
const MiddleTierUsernamePasswordAuthenticationStrategyEditor = observer(
|
|
1021
|
+
(props: {
|
|
1022
|
+
authSpec: MiddleTierUsernamePasswordAuthenticationStrategy;
|
|
1023
|
+
isReadOnly: boolean;
|
|
1024
|
+
}) => {
|
|
1025
|
+
const { authSpec, isReadOnly } = props;
|
|
1026
|
+
return (
|
|
1027
|
+
<>
|
|
1028
|
+
<ConnectionEditor_StringEditor
|
|
1029
|
+
isReadOnly={isReadOnly}
|
|
1030
|
+
value={authSpec.vaultReference}
|
|
1031
|
+
propertyName={'vault reference'}
|
|
1032
|
+
description="Specifies the cred vault reference containing connection credentials"
|
|
1033
|
+
update={(value: string | undefined): void =>
|
|
1034
|
+
middleTierUsernamePasswordAuthenticationStrategy_setVaultReference(
|
|
1035
|
+
authSpec,
|
|
1036
|
+
value ?? '',
|
|
1037
|
+
)
|
|
1038
|
+
}
|
|
1039
|
+
/>
|
|
1040
|
+
</>
|
|
1041
|
+
);
|
|
1042
|
+
},
|
|
1043
|
+
);
|
|
1017
1044
|
|
|
1018
1045
|
const GCPWorkloadIdentityFederationAuthenticationStrategyEditor = observer(
|
|
1019
1046
|
(props: {
|
|
@@ -1238,6 +1265,15 @@ const renderAuthenticationStrategyEditor = (
|
|
|
1238
1265
|
isReadOnly={isReadOnly}
|
|
1239
1266
|
/>
|
|
1240
1267
|
);
|
|
1268
|
+
} else if (
|
|
1269
|
+
authSpec instanceof MiddleTierUsernamePasswordAuthenticationStrategy
|
|
1270
|
+
) {
|
|
1271
|
+
return (
|
|
1272
|
+
<MiddleTierUsernamePasswordAuthenticationStrategyEditor
|
|
1273
|
+
authSpec={authSpec}
|
|
1274
|
+
isReadOnly={isReadOnly}
|
|
1275
|
+
/>
|
|
1276
|
+
);
|
|
1241
1277
|
} else if (
|
|
1242
1278
|
authSpec instanceof GCPWorkloadIdentityFederationAuthenticationStrategy
|
|
1243
1279
|
) {
|