@finos/legend-application-studio 13.1.2 → 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/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/side-bar/Explorer.js +4 -4
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/index.css +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-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/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/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/package.json +3 -3
- 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/external-format-editor/SchemaSetElementEditor.tsx +47 -163
- package/src/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.tsx +226 -0
- 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-state/ExternalFormatState.ts +15 -12
- package/src/stores/editor-state/ModelImporterState.ts +506 -0
- package/src/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.ts +203 -46
- package/src/stores/graphModifier/DSLExternalFormat_GraphModifierHelper.ts +5 -0
- 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,358 @@
|
|
|
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
|
+
import { observable, action, flow, makeObservable, computed, flowResult, } from 'mobx';
|
|
17
|
+
import { EditorState } from './EditorState.js';
|
|
18
|
+
import { assertErrorThrown, LogEvent, UnsupportedOperationError, isNonNullable, ActionState, assertTrue, } from '@finos/legend-shared';
|
|
19
|
+
import { LEGEND_STUDIO_APP_EVENT } from '../LegendStudioAppEvent.js';
|
|
20
|
+
import { TAB_SIZE } from '@finos/legend-application';
|
|
21
|
+
import { SchemaSet, observe_SchemaSet, } from '@finos/legend-graph';
|
|
22
|
+
import { externalFormat_schemaSet_setFormat, externalFormat_schemaSet_setSchemas, } from '../graphModifier/DSLExternalFormat_GraphModifierHelper.js';
|
|
23
|
+
import { InnerSchemaSetEditorState } from './element-editor-state/external-format/SchemaSetEditorState.js';
|
|
24
|
+
export var MODEL_IMPORT_NATIVE_INPUT_TYPE;
|
|
25
|
+
(function (MODEL_IMPORT_NATIVE_INPUT_TYPE) {
|
|
26
|
+
MODEL_IMPORT_NATIVE_INPUT_TYPE["ENTITIES"] = "ENTITIES";
|
|
27
|
+
MODEL_IMPORT_NATIVE_INPUT_TYPE["PURE_PROTOCOL"] = "PURE_PROTOCOL";
|
|
28
|
+
MODEL_IMPORT_NATIVE_INPUT_TYPE["PURE_GRAMMAR"] = "PURE_GRAMMAR";
|
|
29
|
+
})(MODEL_IMPORT_NATIVE_INPUT_TYPE = MODEL_IMPORT_NATIVE_INPUT_TYPE || (MODEL_IMPORT_NATIVE_INPUT_TYPE = {}));
|
|
30
|
+
export var MODEL_IMPORT_TYPE;
|
|
31
|
+
(function (MODEL_IMPORT_TYPE) {
|
|
32
|
+
MODEL_IMPORT_TYPE["NATIVE"] = "NATIVE";
|
|
33
|
+
MODEL_IMPORT_TYPE["EXTERNAL_FORMAT"] = "EXTERNAL_FORMAT";
|
|
34
|
+
MODEL_IMPORT_TYPE["EXTENSIONS"] = "EXTENSIONS";
|
|
35
|
+
})(MODEL_IMPORT_TYPE = MODEL_IMPORT_TYPE || (MODEL_IMPORT_TYPE = {}));
|
|
36
|
+
export class ModelImporterEditorState {
|
|
37
|
+
editorStore;
|
|
38
|
+
modelImporterState;
|
|
39
|
+
loadModelActionState = ActionState.create();
|
|
40
|
+
constructor(modelImporterState) {
|
|
41
|
+
this.editorStore = modelImporterState.editorStore;
|
|
42
|
+
this.modelImporterState = modelImporterState;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export class NativeModelImporterEditorState extends ModelImporterEditorState {
|
|
46
|
+
nativeType = MODEL_IMPORT_NATIVE_INPUT_TYPE.ENTITIES;
|
|
47
|
+
modelText;
|
|
48
|
+
loadCurrentProjectActionState = ActionState.create();
|
|
49
|
+
constructor(modelImporterState) {
|
|
50
|
+
super(modelImporterState);
|
|
51
|
+
this.modelText = this.getExampleEntitiesInputText();
|
|
52
|
+
makeObservable(this, {
|
|
53
|
+
nativeType: observable,
|
|
54
|
+
modelText: observable,
|
|
55
|
+
loadModelActionState: observable,
|
|
56
|
+
setModelText: action,
|
|
57
|
+
setNativeImportType: action,
|
|
58
|
+
isLoadingDisabled: computed,
|
|
59
|
+
loadModel: flow,
|
|
60
|
+
loadCurrentProjectEntities: flow,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
get label() {
|
|
64
|
+
return this.nativeType;
|
|
65
|
+
}
|
|
66
|
+
get allowHardReplace() {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
get isLoadingDisabled() {
|
|
70
|
+
return this.loadCurrentProjectActionState.isInProgress;
|
|
71
|
+
}
|
|
72
|
+
setModelText(val) {
|
|
73
|
+
this.modelText = val;
|
|
74
|
+
}
|
|
75
|
+
setNativeImportType(nativeImportType) {
|
|
76
|
+
if (this.nativeType !== nativeImportType) {
|
|
77
|
+
this.nativeType = nativeImportType;
|
|
78
|
+
this.modelText = this.getNativeImportExampleText(nativeImportType);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
getNativeImportExampleText(inputType) {
|
|
82
|
+
switch (inputType) {
|
|
83
|
+
case MODEL_IMPORT_NATIVE_INPUT_TYPE.PURE_PROTOCOL:
|
|
84
|
+
return this.getExamplePureProtocolInputText();
|
|
85
|
+
case MODEL_IMPORT_NATIVE_INPUT_TYPE.ENTITIES:
|
|
86
|
+
return this.getExampleEntitiesInputText();
|
|
87
|
+
case MODEL_IMPORT_NATIVE_INPUT_TYPE.PURE_GRAMMAR:
|
|
88
|
+
return this.getExamplePureGrammarText();
|
|
89
|
+
default:
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async loadEntites() {
|
|
94
|
+
switch (this.nativeType) {
|
|
95
|
+
case MODEL_IMPORT_NATIVE_INPUT_TYPE.PURE_PROTOCOL: {
|
|
96
|
+
return this.editorStore.graphManagerState.graphManager.pureProtocolTextToEntities(this.modelText);
|
|
97
|
+
}
|
|
98
|
+
case MODEL_IMPORT_NATIVE_INPUT_TYPE.ENTITIES: {
|
|
99
|
+
return JSON.parse(this.modelText);
|
|
100
|
+
}
|
|
101
|
+
case MODEL_IMPORT_NATIVE_INPUT_TYPE.PURE_GRAMMAR: {
|
|
102
|
+
return await this.editorStore.graphManagerState.graphManager.pureCodeToEntities(this.modelText);
|
|
103
|
+
}
|
|
104
|
+
default:
|
|
105
|
+
throw new UnsupportedOperationError(`Can't load model for input of type '${this.nativeType}'`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
*loadCurrentProjectEntities() {
|
|
109
|
+
this.loadCurrentProjectActionState.inProgress();
|
|
110
|
+
switch (this.nativeType) {
|
|
111
|
+
case MODEL_IMPORT_NATIVE_INPUT_TYPE.PURE_PROTOCOL: {
|
|
112
|
+
const graphEntities = this.editorStore.graphManagerState.graphBuildState
|
|
113
|
+
.hasSucceeded
|
|
114
|
+
? this.editorStore.graphManagerState.graph.allOwnElements.map((element) => this.editorStore.graphManagerState.graphManager.elementToEntity(element))
|
|
115
|
+
: this.editorStore.changeDetectionState
|
|
116
|
+
.workspaceLocalLatestRevisionState.entities;
|
|
117
|
+
this.modelText =
|
|
118
|
+
(yield this.editorStore.graphManagerState.graphManager.entitiesToPureProtocolText(graphEntities));
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
case MODEL_IMPORT_NATIVE_INPUT_TYPE.ENTITIES: {
|
|
122
|
+
const graphEntities = this.editorStore.graphManagerState.graphBuildState
|
|
123
|
+
.hasSucceeded
|
|
124
|
+
? this.editorStore.graphManagerState.graph.allOwnElements.map((element) => this.editorStore.graphManagerState.graphManager.elementToEntity(element))
|
|
125
|
+
: this.editorStore.changeDetectionState
|
|
126
|
+
.workspaceLocalLatestRevisionState.entities;
|
|
127
|
+
this.modelText = JSON.stringify(graphEntities, undefined, TAB_SIZE);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case MODEL_IMPORT_NATIVE_INPUT_TYPE.PURE_GRAMMAR: {
|
|
131
|
+
this.modelText =
|
|
132
|
+
(yield this.editorStore.graphManagerState.graphManager.graphToPureCode(this.editorStore.graphManagerState.graph));
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
default:
|
|
136
|
+
this.loadCurrentProjectActionState.fail();
|
|
137
|
+
throw new UnsupportedOperationError(`Can't load current project entities for input type of type '${this.nativeType}'`);
|
|
138
|
+
}
|
|
139
|
+
this.loadCurrentProjectActionState.complete();
|
|
140
|
+
}
|
|
141
|
+
getExampleEntitiesInputText() {
|
|
142
|
+
return `${JSON.stringify([
|
|
143
|
+
{
|
|
144
|
+
classifierPath: 'string',
|
|
145
|
+
content: {},
|
|
146
|
+
path: 'string',
|
|
147
|
+
},
|
|
148
|
+
], undefined, TAB_SIZE)}`;
|
|
149
|
+
}
|
|
150
|
+
getExamplePureProtocolInputText() {
|
|
151
|
+
return `${this.editorStore.graphManagerState.graphManager.getExamplePureProtocolText()}`;
|
|
152
|
+
}
|
|
153
|
+
getExamplePureGrammarText() {
|
|
154
|
+
return `###Pure\n Class model::A\n {\n\n}`;
|
|
155
|
+
}
|
|
156
|
+
*loadModel() {
|
|
157
|
+
try {
|
|
158
|
+
this.loadModelActionState.inProgress();
|
|
159
|
+
this.editorStore.setBlockingAlert({
|
|
160
|
+
message: 'Loading model...',
|
|
161
|
+
prompt: 'Please do not close the application',
|
|
162
|
+
showLoading: true,
|
|
163
|
+
});
|
|
164
|
+
const entities = (yield this.loadEntites());
|
|
165
|
+
const message = `loading entities from ${this.editorStore.applicationStore.config.appName} [${this.modelImporterState.replace ? `potentially affected ` : ''} ${entities.length} entities]`;
|
|
166
|
+
yield this.editorStore.sdlcServerClient.updateEntities(this.editorStore.sdlcState.activeProject.projectId, this.editorStore.sdlcState.activeWorkspace, { replace: this.modelImporterState.replace, entities, message });
|
|
167
|
+
this.editorStore.applicationStore.navigator.reload();
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
assertErrorThrown(error);
|
|
171
|
+
this.editorStore.applicationStore.log.error(LogEvent.create(LEGEND_STUDIO_APP_EVENT.MODEL_LOADER_FAILURE), error);
|
|
172
|
+
this.editorStore.applicationStore.notifyError(error);
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
this.loadModelActionState.complete();
|
|
176
|
+
this.editorStore.setBlockingAlert(undefined);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
export class ExtensionModelImporterEditorState extends ModelImporterEditorState {
|
|
181
|
+
extensionConfiguration;
|
|
182
|
+
constructor(extensionConfiguration, modelImporterState) {
|
|
183
|
+
super(modelImporterState);
|
|
184
|
+
this.extensionConfiguration = extensionConfiguration;
|
|
185
|
+
makeObservable(this, {
|
|
186
|
+
extensionConfiguration: observable,
|
|
187
|
+
modelImporterState: observable,
|
|
188
|
+
loadModelActionState: observable,
|
|
189
|
+
isLoadingDisabled: computed,
|
|
190
|
+
setExtension: action,
|
|
191
|
+
loadModel: flow,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
get label() {
|
|
195
|
+
return this.extensionConfiguration.label ?? this.extensionConfiguration.key;
|
|
196
|
+
}
|
|
197
|
+
get allowHardReplace() {
|
|
198
|
+
return Boolean(this.extensionConfiguration.allowHardReplace);
|
|
199
|
+
}
|
|
200
|
+
get isLoadingDisabled() {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
setExtension(extensionConfiguration) {
|
|
204
|
+
this.extensionConfiguration = extensionConfiguration;
|
|
205
|
+
}
|
|
206
|
+
*loadModel() {
|
|
207
|
+
this.loadModelActionState.inProgress();
|
|
208
|
+
try {
|
|
209
|
+
yield flowResult(this.extensionConfiguration.load(this.editorStore));
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
assertErrorThrown(error);
|
|
213
|
+
}
|
|
214
|
+
finally {
|
|
215
|
+
this.loadModelActionState.complete();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
const DEFAULT_SCHEMA_PACKAGE = '__internal__';
|
|
220
|
+
const DEFAULT_SCHEMA_NAME = 'MyShemaSet';
|
|
221
|
+
export class ExternalFormatModelImporterState extends ModelImporterEditorState {
|
|
222
|
+
schemaSet;
|
|
223
|
+
schemaSetEditorState;
|
|
224
|
+
description;
|
|
225
|
+
isolatedSchemaGraph;
|
|
226
|
+
constructor(description, modelImporterState) {
|
|
227
|
+
super(modelImporterState);
|
|
228
|
+
this.description = description;
|
|
229
|
+
this.schemaSet = new SchemaSet(DEFAULT_SCHEMA_NAME);
|
|
230
|
+
this.schemaSet.format = description.name;
|
|
231
|
+
observe_SchemaSet(this.schemaSet);
|
|
232
|
+
const emptyGraph = this.editorStore.graphManagerState.createEmptyGraph();
|
|
233
|
+
emptyGraph.addElement(this.schemaSet, DEFAULT_SCHEMA_PACKAGE);
|
|
234
|
+
this.isolatedSchemaGraph = emptyGraph;
|
|
235
|
+
this.schemaSetEditorState = new InnerSchemaSetEditorState(false, this.schemaSet, this.editorStore, this.isolatedSchemaGraph);
|
|
236
|
+
makeObservable(this, {
|
|
237
|
+
schemaSet: observable,
|
|
238
|
+
schemaSetEditorState: observable,
|
|
239
|
+
loadModelActionState: observable,
|
|
240
|
+
description: observable,
|
|
241
|
+
isolatedSchemaGraph: observable,
|
|
242
|
+
setExternalFormat: action,
|
|
243
|
+
setDescription: action,
|
|
244
|
+
isLoadingDisabled: computed,
|
|
245
|
+
loadModel: flow,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
get allowHardReplace() {
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
get label() {
|
|
252
|
+
return this.schemaSet.format;
|
|
253
|
+
}
|
|
254
|
+
get isLoadingDisabled() {
|
|
255
|
+
return (!this.schemaSetEditorState.schemaSetModelGenerationState.canGenerate ||
|
|
256
|
+
this.schemaSetEditorState.schemaSetModelGenerationState
|
|
257
|
+
.generatingModelsState.isInProgress ||
|
|
258
|
+
this.schemaSetEditorState.schemaSetModelGenerationState
|
|
259
|
+
.importGeneratedElementsState.isInProgress);
|
|
260
|
+
}
|
|
261
|
+
setDescription(val) {
|
|
262
|
+
this.description = val;
|
|
263
|
+
}
|
|
264
|
+
setExternalFormat(description) {
|
|
265
|
+
if (description !== this.description) {
|
|
266
|
+
this.setDescription(description);
|
|
267
|
+
externalFormat_schemaSet_setFormat(this.schemaSet, this.description.name);
|
|
268
|
+
externalFormat_schemaSet_setSchemas(this.schemaSet, []);
|
|
269
|
+
this.schemaSetEditorState.reset();
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
*loadModel() {
|
|
273
|
+
this.loadModelActionState.inProgress();
|
|
274
|
+
try {
|
|
275
|
+
this.loadModelActionState.inProgress();
|
|
276
|
+
this.editorStore.setBlockingAlert({
|
|
277
|
+
message: 'Loading model...',
|
|
278
|
+
prompt: 'Please do not close the application',
|
|
279
|
+
showLoading: true,
|
|
280
|
+
});
|
|
281
|
+
const modelgenerationstate = this.schemaSetEditorState.schemaSetModelGenerationState;
|
|
282
|
+
const entities = (yield flowResult(modelgenerationstate.getImportEntities()));
|
|
283
|
+
if (modelgenerationstate.targetBinding) {
|
|
284
|
+
const schemaEntity = (yield flowResult(this.editorStore.graphManagerState.graphManager.elementToEntity(this.schemaSet)));
|
|
285
|
+
entities.push(schemaEntity);
|
|
286
|
+
}
|
|
287
|
+
assertTrue(Boolean(entities.length), 'No entities to load');
|
|
288
|
+
const message = `loading entities from ${this.editorStore.applicationStore.config.appName} [${this.modelImporterState.replace ? `potentially affected ` : ''} ${entities.length} entities]`;
|
|
289
|
+
yield this.editorStore.sdlcServerClient.updateEntities(this.editorStore.sdlcState.activeProject.projectId, this.editorStore.sdlcState.activeWorkspace, { replace: this.modelImporterState.replace, entities, message });
|
|
290
|
+
this.editorStore.applicationStore.navigator.reload();
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
assertErrorThrown(error);
|
|
294
|
+
this.editorStore.applicationStore.notifyError(error);
|
|
295
|
+
}
|
|
296
|
+
finally {
|
|
297
|
+
this.loadModelActionState.complete();
|
|
298
|
+
this.editorStore.setBlockingAlert(undefined);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
export class ModelImporterState extends EditorState {
|
|
303
|
+
replace = true;
|
|
304
|
+
modelImportEditorState;
|
|
305
|
+
extensionConfigs = [];
|
|
306
|
+
constructor(editorStore) {
|
|
307
|
+
super(editorStore);
|
|
308
|
+
makeObservable(this, {
|
|
309
|
+
replace: observable,
|
|
310
|
+
modelImportEditorState: observable,
|
|
311
|
+
extensionConfigs: observable,
|
|
312
|
+
setReplaceFlag: action,
|
|
313
|
+
setModelImporterExtension: action,
|
|
314
|
+
setNativeImportType: action,
|
|
315
|
+
setExternalFormatImportFormat: action,
|
|
316
|
+
setImportEditorState: action,
|
|
317
|
+
});
|
|
318
|
+
this.modelImportEditorState = new NativeModelImporterEditorState(this);
|
|
319
|
+
this.extensionConfigs = this.editorStore.pluginManager
|
|
320
|
+
.getApplicationPlugins()
|
|
321
|
+
.flatMap((plugin) => plugin.getExtraModelImporterExtensionConfigurations?.() ?? [])
|
|
322
|
+
.filter(isNonNullable);
|
|
323
|
+
}
|
|
324
|
+
get headerName() {
|
|
325
|
+
return 'Model Importer';
|
|
326
|
+
}
|
|
327
|
+
setReplaceFlag(val) {
|
|
328
|
+
this.replace = val;
|
|
329
|
+
}
|
|
330
|
+
setImportEditorState(val) {
|
|
331
|
+
this.modelImportEditorState = val;
|
|
332
|
+
}
|
|
333
|
+
setNativeImportType(nativeImportType) {
|
|
334
|
+
const nativeEditorState = this.modelImportEditorState instanceof NativeModelImporterEditorState
|
|
335
|
+
? this.modelImportEditorState
|
|
336
|
+
: new NativeModelImporterEditorState(this);
|
|
337
|
+
nativeEditorState.setNativeImportType(nativeImportType);
|
|
338
|
+
this.setImportEditorState(nativeEditorState);
|
|
339
|
+
return nativeEditorState;
|
|
340
|
+
}
|
|
341
|
+
setExternalFormatImportFormat(externalFormat) {
|
|
342
|
+
const extensionEditorState = this.modelImportEditorState instanceof ExternalFormatModelImporterState
|
|
343
|
+
? this.modelImportEditorState
|
|
344
|
+
: new ExternalFormatModelImporterState(externalFormat, this);
|
|
345
|
+
extensionEditorState.setExternalFormat(externalFormat);
|
|
346
|
+
this.setImportEditorState(extensionEditorState);
|
|
347
|
+
return extensionEditorState;
|
|
348
|
+
}
|
|
349
|
+
setModelImporterExtension(extension) {
|
|
350
|
+
const externalEditorState = this.modelImportEditorState instanceof ExtensionModelImporterEditorState
|
|
351
|
+
? this.modelImportEditorState
|
|
352
|
+
: new ExtensionModelImporterEditorState(extension, this);
|
|
353
|
+
externalEditorState.setExtension(extension);
|
|
354
|
+
this.setImportEditorState(externalEditorState);
|
|
355
|
+
return externalEditorState;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
//# sourceMappingURL=ModelImporterState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelImporterState.js","sourceRoot":"","sources":["../../../src/stores/editor-state/ModelImporterState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,UAAU,EACV,MAAM,EACN,IAAI,EACJ,cAAc,EACd,QAAQ,EACR,UAAU,GACX,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAEL,iB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,IAAI,CAAC,sBAAsB;YAC7B,CAAC,CAAC,IAAI,gCAAgC,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QACjE,oBAAoB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;QACvD,IAAI,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;QAChD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IACD,yBAAyB,CACvB,SAA8C;QAE9C,MAAM,mBAAmB,GACvB,IAAI,CAAC,sBAAsB,YAAY,iCAAiC;YACtE,CAAC,CAAC,IAAI,CAAC,sBAAsB;YAC7B,CAAC,CAAC,IAAI,iCAAiC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC7D,mBAAmB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAC5C,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,CAAC;QAC/C,OAAO,mBAAmB,CAAC;IAC7B,CAAC;CACF"}
|
package/lib/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.d.ts
CHANGED
|
@@ -14,43 +14,66 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { type GeneratorFn, ActionState } from '@finos/legend-shared';
|
|
17
|
-
import { type GenerationProperty, type PackageableElement, type ExternalFormatDescription, CompilationError, ConfigurationProperty, ExternalFormatSchema as Schema, SchemaSet } from '@finos/legend-graph';
|
|
17
|
+
import { type GenerationProperty, type PackageableElement, type ExternalFormatDescription, type PureModel, CompilationError, ConfigurationProperty, ExternalFormatSchema as Schema, SchemaSet } from '@finos/legend-graph';
|
|
18
|
+
import type { Entity } from '@finos/legend-storage';
|
|
18
19
|
import type { EditorStore } from '../../../EditorStore.js';
|
|
19
20
|
import { ElementEditorState } from '../ElementEditorState.js';
|
|
20
21
|
export declare enum SCHEMA_SET_TAB_TYPE {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
SCHEMAS = "SCHEMAS",
|
|
23
|
+
GENERATE_MODEL = "GENERATE_MODEL"
|
|
23
24
|
}
|
|
24
25
|
export declare class SchemaSetModelGenerationState {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
readonly editorStore: EditorStore;
|
|
27
|
+
readonly schemaSet: SchemaSet;
|
|
28
|
+
generatingModelsState: ActionState;
|
|
29
|
+
importGeneratedElementsState: ActionState;
|
|
28
30
|
configurationProperties: ConfigurationProperty[];
|
|
29
31
|
generationValue: string;
|
|
30
|
-
|
|
32
|
+
targetBinding: string;
|
|
33
|
+
isolatedGraph: PureModel | undefined;
|
|
34
|
+
constructor(schemaSet: SchemaSet, editorStore: EditorStore, graph?: PureModel | undefined);
|
|
31
35
|
setConfigurationProperty(val: ConfigurationProperty[]): void;
|
|
32
|
-
get description(): ExternalFormatDescription;
|
|
36
|
+
get description(): ExternalFormatDescription | undefined;
|
|
33
37
|
get modelGenerationProperties(): GenerationProperty[];
|
|
38
|
+
get canGenerate(): boolean;
|
|
39
|
+
setTargetBindingPath(val: string): void;
|
|
34
40
|
getConfigValue(name: string): unknown | undefined;
|
|
35
41
|
getConfig(name: string): ConfigurationProperty | undefined;
|
|
36
42
|
setGenerationValue(val: string): void;
|
|
43
|
+
handleTargetBindingPathChange(): void;
|
|
37
44
|
updateGenerationParameters(generationProperty: GenerationProperty, newValue: unknown): void;
|
|
38
|
-
generateModel(): GeneratorFn<
|
|
39
|
-
|
|
45
|
+
generateModel(): GeneratorFn<boolean>;
|
|
46
|
+
importGeneratedModelsIntoGraph(): GeneratorFn<void>;
|
|
47
|
+
getImportEntities(): GeneratorFn<Entity[]>;
|
|
40
48
|
}
|
|
41
49
|
export declare class ImportSchemaContentState {
|
|
42
50
|
editorStore: EditorStore;
|
|
43
|
-
schemaSetEditorState: SchemaSetEditorState;
|
|
51
|
+
schemaSetEditorState: InnerSchemaSetEditorState | SchemaSetEditorState;
|
|
44
52
|
loadingSchemaContentState: ActionState;
|
|
45
53
|
files: File[] | undefined;
|
|
46
54
|
importSchemaModal: boolean;
|
|
47
|
-
constructor(schemaSetEditorState: SchemaSetEditorState, editorStore: EditorStore);
|
|
55
|
+
constructor(schemaSetEditorState: InnerSchemaSetEditorState | SchemaSetEditorState, editorStore: EditorStore);
|
|
48
56
|
setImportSchemaModal(val: boolean): void;
|
|
49
57
|
setFiles(files: File[] | undefined): void;
|
|
50
58
|
removeFile(file: File): void;
|
|
51
59
|
closeModal(): void;
|
|
52
60
|
importSchemas(files: File[]): GeneratorFn<void>;
|
|
53
61
|
}
|
|
62
|
+
export declare class InnerSchemaSetEditorState {
|
|
63
|
+
readonly editorStore: EditorStore;
|
|
64
|
+
isReadOnly: boolean;
|
|
65
|
+
schemaSet: SchemaSet;
|
|
66
|
+
currentSchema?: Schema | undefined;
|
|
67
|
+
selectedTab: SCHEMA_SET_TAB_TYPE;
|
|
68
|
+
schemaValidationError?: CompilationError;
|
|
69
|
+
importSchemaContentState: ImportSchemaContentState;
|
|
70
|
+
schemaSetModelGenerationState: SchemaSetModelGenerationState;
|
|
71
|
+
constructor(isReadOnly: boolean, schemaSet: SchemaSet, editorStore: EditorStore, graph: PureModel);
|
|
72
|
+
reset(): void;
|
|
73
|
+
setCurrentSchema(value: Schema | undefined): void;
|
|
74
|
+
setSelectedTab(tab: SCHEMA_SET_TAB_TYPE): void;
|
|
75
|
+
setSchemaValidationerror(error: CompilationError): void;
|
|
76
|
+
}
|
|
54
77
|
export declare class SchemaSetEditorState extends ElementEditorState {
|
|
55
78
|
currentSchema?: Schema | undefined;
|
|
56
79
|
selectedTab: SCHEMA_SET_TAB_TYPE;
|
package/lib/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaSetEditorState.d.ts","sourceRoot":"","sources":["../../../../../src/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EACL,KAAK,WAAW,EAQhB,WAAW,
|
|
1
|
+
{"version":3,"file":"SchemaSetEditorState.d.ts","sourceRoot":"","sources":["../../../../../src/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EACL,KAAK,WAAW,EAQhB,WAAW,EAIZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAEvB,KAAK,yBAAyB,EAC9B,KAAK,SAAS,EACd,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,IAAI,MAAM,EAC9B,SAAS,EAIV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D,oBAAY,mBAAmB;IAC7B,OAAO,YAAY;IACnB,cAAc,mBAAmB;CAClC;AAID,qBAAa,6BAA6B;IACxC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,qBAAqB,cAAwB;IAC7C,4BAA4B,cAAwB;IAEpD,uBAAuB,EAAE,qBAAqB,EAAE,CAAM;IACtD,eAAe,SAAM;IACrB,aAAa,SAAM;IACnB,aAAa,EAAE,SAAS,GAAG,SAAS,CAAC;gBAGnC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS;IAuB/B,wBAAwB,CAAC,GAAG,EAAE,qBAAqB,EAAE,GAAG,IAAI;IAI5D,IAAI,WAAW,IAAI,yBAAyB,GAAG,SAAS,CAIvD;IAED,IAAI,yBAAyB,IAAI,kBAAkB,EAAE,CAEpD;IAED,IAAI,WAAW,IAAI,OAAO,CAKzB;IAED,oBAAoB,CAAC,GAAG,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