@finos/legend-application-studio 13.1.0 → 14.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/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 +132 -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/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/package.json +1 -1
- 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 +3 -3
- package/lib/stores/LegendStudioApplicationPlugin.d.ts.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 +95 -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/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 +9 -9
- package/src/components/EditorComponentTestUtils.tsx +2 -29
- package/src/components/editor/edit-panel/EditPanel.tsx +4 -4
- package/src/components/editor/edit-panel/ModelImporter.tsx +376 -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/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/stores/EditorGraphState.ts +13 -12
- package/src/stores/EditorStore.ts +7 -9
- package/src/stores/LegendStudioApplicationPlugin.ts +4 -4
- package/src/stores/editor/NewElementState.ts +4 -3
- package/src/stores/editor-state/ExternalFormatState.ts +15 -12
- package/src/stores/editor-state/ModelImporterState.ts +506 -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/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
|
@@ -0,0 +1,376 @@
|
|
|
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 (modelImportEditorState instanceof ExtensionModelImporterEditorState) {
|
|
155
|
+
modelImportEditorState.extensionConfiguration
|
|
156
|
+
.load(editorStore)
|
|
157
|
+
.catch(applicationStore.alertUnhandledError);
|
|
158
|
+
} else if (editorStore.hasUnpushedChanges) {
|
|
159
|
+
editorStore.setActionAlertInfo({
|
|
160
|
+
message: 'You have unpushed changes',
|
|
161
|
+
prompt:
|
|
162
|
+
'This action will discard these changes and refresh the application',
|
|
163
|
+
type: ActionAlertType.CAUTION,
|
|
164
|
+
onEnter: (): void => editorStore.setBlockGlobalHotkeys(true),
|
|
165
|
+
onClose: (): void => editorStore.setBlockGlobalHotkeys(false),
|
|
166
|
+
actions: [
|
|
167
|
+
{
|
|
168
|
+
label: 'Proceed to load model',
|
|
169
|
+
type: ActionAlertActionType.PROCEED_WITH_CAUTION,
|
|
170
|
+
handler: (): void => {
|
|
171
|
+
editorStore.setIgnoreNavigationBlocking(true);
|
|
172
|
+
flowResult(
|
|
173
|
+
modelImporterState.modelImportEditorState.loadModel(),
|
|
174
|
+
).catch(applicationStore.alertUnhandledError);
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
label: 'Abort',
|
|
179
|
+
type: ActionAlertActionType.PROCEED,
|
|
180
|
+
default: true,
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
});
|
|
184
|
+
} else {
|
|
185
|
+
flowResult(modelImporterState.modelImportEditorState.loadModel()).catch(
|
|
186
|
+
applicationStore.alertUnhandledError,
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
useApplicationNavigationContext(
|
|
191
|
+
LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.MODEL_LOADER,
|
|
192
|
+
);
|
|
193
|
+
const renderExtraActions = (): React.ReactNode => {
|
|
194
|
+
if (modelImportEditorState instanceof NativeModelImporterEditorState) {
|
|
195
|
+
// actions
|
|
196
|
+
const loadCurrentProjectEntities = applicationStore.guardUnhandledError(
|
|
197
|
+
() => flowResult(modelImportEditorState.loadCurrentProjectEntities()),
|
|
198
|
+
);
|
|
199
|
+
return (
|
|
200
|
+
<button
|
|
201
|
+
className="model-loader__header__configs__load-project-entities-btn"
|
|
202
|
+
tabIndex={-1}
|
|
203
|
+
onClick={loadCurrentProjectEntities}
|
|
204
|
+
title="Load current project entities"
|
|
205
|
+
>
|
|
206
|
+
<TruckLoadingIcon />
|
|
207
|
+
</button>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
};
|
|
212
|
+
const renderModelImporterEditor = (): React.ReactNode => {
|
|
213
|
+
if (modelImportEditorState instanceof ExtensionModelImporterEditorState) {
|
|
214
|
+
return modelImportEditorState.extensionConfiguration.renderer(
|
|
215
|
+
editorStore,
|
|
216
|
+
);
|
|
217
|
+
} else if (
|
|
218
|
+
modelImportEditorState instanceof NativeModelImporterEditorState
|
|
219
|
+
) {
|
|
220
|
+
const updateModel = (val: string): void =>
|
|
221
|
+
modelImportEditorState.setModelText(val);
|
|
222
|
+
return (
|
|
223
|
+
<div className="panel__content model-loader__editor">
|
|
224
|
+
<StudioTextInputEditor
|
|
225
|
+
language={
|
|
226
|
+
modelImportEditorState.nativeType ===
|
|
227
|
+
MODEL_IMPORT_NATIVE_INPUT_TYPE.PURE_GRAMMAR
|
|
228
|
+
? EDITOR_LANGUAGE.PURE
|
|
229
|
+
: EDITOR_LANGUAGE.JSON
|
|
230
|
+
}
|
|
231
|
+
inputValue={modelImportEditorState.modelText}
|
|
232
|
+
updateInput={updateModel}
|
|
233
|
+
showMiniMap={true}
|
|
234
|
+
/>
|
|
235
|
+
</div>
|
|
236
|
+
);
|
|
237
|
+
} else if (
|
|
238
|
+
modelImportEditorState instanceof ExternalFormatModelImporterState
|
|
239
|
+
) {
|
|
240
|
+
return (
|
|
241
|
+
<ExternalFormatModelImporterEditor
|
|
242
|
+
externalFormatState={modelImportEditorState}
|
|
243
|
+
/>
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
return null;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
return (
|
|
250
|
+
<div className="panel model-loader">
|
|
251
|
+
<div className="panel__header model-loader__header">
|
|
252
|
+
<div className="model-loader__header__configs">
|
|
253
|
+
<DropdownMenu
|
|
254
|
+
content={
|
|
255
|
+
<MenuContent className="model-loader__header__configs__type__menu">
|
|
256
|
+
<div className="model-loader__header__configs__type-option__group model-loader__header__configs__type-option__group--native">
|
|
257
|
+
<div className="model-loader__header__configs__type-option__group__name">
|
|
258
|
+
native
|
|
259
|
+
</div>
|
|
260
|
+
<div className="model-loader__header__configs__type-option__group__options">
|
|
261
|
+
{nativeInputTypes.map((inputType) => (
|
|
262
|
+
<MenuContentItem
|
|
263
|
+
key={inputType}
|
|
264
|
+
className="model-loader__header__configs__type-option__group__option"
|
|
265
|
+
onClick={(): ModelImporterEditorState =>
|
|
266
|
+
modelImporterState.setNativeImportType(inputType)
|
|
267
|
+
}
|
|
268
|
+
>
|
|
269
|
+
{prettyCONSTName(inputType)}
|
|
270
|
+
</MenuContentItem>
|
|
271
|
+
))}
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
{Boolean(externalFormatDescriptions.length) && (
|
|
275
|
+
<>
|
|
276
|
+
<div className="model-loader__header__configs__type-option__group__separator" />
|
|
277
|
+
<div className="model-loader__header__configs__type-option__group model-loader__header__configs__type-option__group--external">
|
|
278
|
+
<div className="model-loader__header__configs__type-option__group__name">
|
|
279
|
+
external
|
|
280
|
+
</div>
|
|
281
|
+
<div className="model-loader__header__configs__type-option__group__options">
|
|
282
|
+
{externalFormatDescriptions.map((inputType) => (
|
|
283
|
+
<MenuContentItem
|
|
284
|
+
key={inputType.name}
|
|
285
|
+
className="model-loader__header__configs__type-option__group__option"
|
|
286
|
+
onClick={() =>
|
|
287
|
+
modelImporterState.setExternalFormatImportFormat(
|
|
288
|
+
inputType,
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
>
|
|
292
|
+
{inputType.name}
|
|
293
|
+
</MenuContentItem>
|
|
294
|
+
))}
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
</>
|
|
298
|
+
)}
|
|
299
|
+
{Boolean(extraModelImporterExtensionsConfigs.length > 0) && (
|
|
300
|
+
<>
|
|
301
|
+
<div className="model-loader__header__configs__type-option__group__separator" />
|
|
302
|
+
<div className="model-loader__header__configs__type-option__group model-loader__header__configs__type-option__group--extension">
|
|
303
|
+
<div className="model-loader__header__configs__type-option__group__name">
|
|
304
|
+
extensions
|
|
305
|
+
</div>
|
|
306
|
+
<div className="model-loader__header__configs__type-option__group__options">
|
|
307
|
+
{extraModelImporterExtensionsConfigs.map(
|
|
308
|
+
(config: ModelImporterExtensionConfiguration) => (
|
|
309
|
+
<MenuContentItem
|
|
310
|
+
key={config.key}
|
|
311
|
+
className="model-loader__header__configs__type-option__group__option"
|
|
312
|
+
onClick={() =>
|
|
313
|
+
modelImporterState.setModelImporterExtension(
|
|
314
|
+
config,
|
|
315
|
+
)
|
|
316
|
+
}
|
|
317
|
+
>
|
|
318
|
+
{config.label ?? prettyCONSTName(config.key)}
|
|
319
|
+
</MenuContentItem>
|
|
320
|
+
),
|
|
321
|
+
)}
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
</>
|
|
325
|
+
)}
|
|
326
|
+
</MenuContent>
|
|
327
|
+
}
|
|
328
|
+
menuProps={{
|
|
329
|
+
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
|
330
|
+
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
|
331
|
+
}}
|
|
332
|
+
>
|
|
333
|
+
<div className="model-loader__header__configs__type">
|
|
334
|
+
<div className="model-loader__header__configs__type__label">
|
|
335
|
+
{prettyCONSTName(label)}
|
|
336
|
+
</div>
|
|
337
|
+
<div className="model-loader__header__configs__type__icon">
|
|
338
|
+
<CaretDownIcon />
|
|
339
|
+
</div>
|
|
340
|
+
</div>
|
|
341
|
+
</DropdownMenu>
|
|
342
|
+
{modelImportEditorState.allowHardReplace && (
|
|
343
|
+
<div
|
|
344
|
+
className="model-loader__header__configs__edit-mode"
|
|
345
|
+
onClick={toggleReplace}
|
|
346
|
+
>
|
|
347
|
+
<div className="model-loader__header__configs__edit-mode__icon">
|
|
348
|
+
{replace ? <CheckSquareIcon /> : <EmptySquareIcon />}
|
|
349
|
+
</div>
|
|
350
|
+
<div className="model-loader__header__configs__edit-mode__label">
|
|
351
|
+
replace
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
)}
|
|
355
|
+
{renderExtraActions()}
|
|
356
|
+
</div>
|
|
357
|
+
<div className="model-loader__header__action">
|
|
358
|
+
<button
|
|
359
|
+
className="btn--dark model-loader__header__load-btn"
|
|
360
|
+
onClick={loadModel}
|
|
361
|
+
disabled={
|
|
362
|
+
modelImportEditorState.loadModelActionState.isInProgress ||
|
|
363
|
+
modelImportEditorState.isLoadingDisabled
|
|
364
|
+
}
|
|
365
|
+
tabIndex={-1}
|
|
366
|
+
title="Load model"
|
|
367
|
+
>
|
|
368
|
+
Load
|
|
369
|
+
</button>
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
|
|
373
|
+
{renderModelImporterEditor()}
|
|
374
|
+
</div>
|
|
375
|
+
);
|
|
376
|
+
});
|
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
|
) {
|