@finos/legend-application-studio 28.18.94 → 28.18.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/editor/editor-group/ModelImporter.d.ts.map +1 -1
- package/lib/components/editor/editor-group/ModelImporter.js +6 -2
- package/lib/components/editor/editor-group/ModelImporter.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +3 -3
- package/lib/stores/editor/editor-state/ModelImporterState.d.ts +14 -1
- package/lib/stores/editor/editor-state/ModelImporterState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/ModelImporterState.js +83 -1
- package/lib/stores/editor/editor-state/ModelImporterState.js.map +1 -1
- package/package.json +16 -16
- package/src/components/editor/editor-group/ModelImporter.tsx +36 -0
- package/src/stores/editor/editor-state/ModelImporterState.ts +141 -1
@@ -22,6 +22,7 @@ import {
|
|
22
22
|
MODEL_IMPORT_NATIVE_INPUT_TYPE,
|
23
23
|
NativeModelImporterEditorState,
|
24
24
|
ExternalFormatModelImporterState,
|
25
|
+
ExecuteInputDebugModelImporterEditorState,
|
25
26
|
} from '../../../stores/editor/editor-state/ModelImporterState.js';
|
26
27
|
import { prettyCONSTName } from '@finos/legend-shared';
|
27
28
|
import {
|
@@ -220,6 +221,33 @@ export const ModelImporter = observer(() => {
|
|
220
221
|
externalFormatState={modelImportEditorState}
|
221
222
|
/>
|
222
223
|
);
|
224
|
+
} else if (
|
225
|
+
modelImportEditorState instanceof
|
226
|
+
ExecuteInputDebugModelImporterEditorState
|
227
|
+
) {
|
228
|
+
return (
|
229
|
+
<PanelContent className="model-loader__editor">
|
230
|
+
<div className="model-loader__debugger__function-path">
|
231
|
+
<div className="model-loader__debugger__function-path__label">
|
232
|
+
Debug Executable:
|
233
|
+
</div>
|
234
|
+
<input
|
235
|
+
className="panel__content__form__section__input"
|
236
|
+
value={modelImportEditorState.executablePath}
|
237
|
+
onChange={(event) =>
|
238
|
+
modelImportEditorState.setExecutablePath(event.target.value)
|
239
|
+
}
|
240
|
+
/>
|
241
|
+
</div>
|
242
|
+
<div className="model-loader__debugger__execute-input">
|
243
|
+
<CodeEditor
|
244
|
+
language={CODE_EDITOR_LANGUAGE.JSON}
|
245
|
+
inputValue={modelImportEditorState.executeInput}
|
246
|
+
updateInput={(val) => modelImportEditorState.setExecuteInput(val)}
|
247
|
+
/>
|
248
|
+
</div>
|
249
|
+
</PanelContent>
|
250
|
+
);
|
223
251
|
}
|
224
252
|
return null;
|
225
253
|
};
|
@@ -248,6 +276,14 @@ export const ModelImporter = observer(() => {
|
|
248
276
|
{prettyCONSTName(inputType)}
|
249
277
|
</MenuContentItem>
|
250
278
|
))}
|
279
|
+
<MenuContentItem
|
280
|
+
className="model-loader__header__configs__type-option__group__option"
|
281
|
+
onClick={() =>
|
282
|
+
modelImporterState.setExecuteInputDebugModelImporter()
|
283
|
+
}
|
284
|
+
>
|
285
|
+
{`Execute Input (DEBUG)`}
|
286
|
+
</MenuContentItem>
|
251
287
|
</div>
|
252
288
|
</div>
|
253
289
|
{Boolean(externalFormatDescriptions.length) && (
|
@@ -34,7 +34,7 @@ import {
|
|
34
34
|
} from '@finos/legend-shared';
|
35
35
|
import { LEGEND_STUDIO_APP_EVENT } from '../../../__lib__/LegendStudioEvent.js';
|
36
36
|
import type { EditorStore } from '../EditorStore.js';
|
37
|
-
import type
|
37
|
+
import { generateGAVCoordinates, type Entity } from '@finos/legend-storage';
|
38
38
|
import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
|
39
39
|
import type {
|
40
40
|
ModelImporterExtensionConfiguration,
|
@@ -42,6 +42,8 @@ import type {
|
|
42
42
|
} from '../../LegendStudioApplicationPlugin.js';
|
43
43
|
import {
|
44
44
|
type ExternalFormatDescription,
|
45
|
+
GraphEntities,
|
46
|
+
LegendSDLC,
|
45
47
|
type PureModel,
|
46
48
|
SchemaSet,
|
47
49
|
observe_SchemaSet,
|
@@ -51,6 +53,11 @@ import {
|
|
51
53
|
externalFormat_schemaSet_setSchemas,
|
52
54
|
} from '../../graph-modifier/DSL_ExternalFormat_GraphModifierHelper.js';
|
53
55
|
import { InnerSchemaSetEditorState } from './element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.js';
|
56
|
+
import {
|
57
|
+
ProjectDependency,
|
58
|
+
UpdateProjectConfigurationCommand,
|
59
|
+
} from '@finos/legend-server-sdlc';
|
60
|
+
import { generateEditorRoute } from '../../../__lib__/LegendStudioNavigation.js';
|
54
61
|
|
55
62
|
export enum MODEL_IMPORT_NATIVE_INPUT_TYPE {
|
56
63
|
ENTITIES = 'ENTITIES',
|
@@ -279,6 +286,130 @@ export class NativeModelImporterEditorState extends ModelImporterEditorState {
|
|
279
286
|
}
|
280
287
|
}
|
281
288
|
|
289
|
+
export class ExecuteInputDebugModelImporterEditorState extends ModelImporterEditorState {
|
290
|
+
executeInput = '{}';
|
291
|
+
executablePath = 'test::Debugger';
|
292
|
+
readonly loadState = ActionState.create();
|
293
|
+
|
294
|
+
constructor(modelImporterState: ModelImporterState) {
|
295
|
+
super(modelImporterState);
|
296
|
+
|
297
|
+
makeObservable(this, {
|
298
|
+
executeInput: observable,
|
299
|
+
setExecuteInput: action,
|
300
|
+
|
301
|
+
executablePath: observable,
|
302
|
+
setExecutablePath: action,
|
303
|
+
});
|
304
|
+
}
|
305
|
+
|
306
|
+
get label(): string {
|
307
|
+
return `Execute Input [DEBUG]`;
|
308
|
+
}
|
309
|
+
|
310
|
+
get allowHardReplace(): boolean {
|
311
|
+
return false;
|
312
|
+
}
|
313
|
+
|
314
|
+
get isLoadingDisabled(): boolean {
|
315
|
+
return this.loadState.isInProgress;
|
316
|
+
}
|
317
|
+
|
318
|
+
setExecuteInput(val: string): void {
|
319
|
+
this.executeInput = val;
|
320
|
+
}
|
321
|
+
|
322
|
+
setExecutablePath(val: string): void {
|
323
|
+
this.executablePath = val;
|
324
|
+
}
|
325
|
+
|
326
|
+
async loadModel(): Promise<void> {
|
327
|
+
this.loadModelActionState.inProgress();
|
328
|
+
try {
|
329
|
+
this.editorStore.applicationStore.alertService.setBlockingAlert({
|
330
|
+
message: 'Loading model...',
|
331
|
+
prompt: 'Please do not close the application',
|
332
|
+
showLoading: true,
|
333
|
+
});
|
334
|
+
const result =
|
335
|
+
await this.editorStore.graphManagerState.graphManager.analyzeExecuteInput(
|
336
|
+
JSON.parse(this.executeInput),
|
337
|
+
this.executablePath,
|
338
|
+
);
|
339
|
+
let entities: Entity[] = [];
|
340
|
+
let dependencies: ProjectDependency[] = [];
|
341
|
+
if (result.origin instanceof GraphEntities) {
|
342
|
+
entities = [...result.origin.entities, ...result.entities];
|
343
|
+
} else if (result.origin instanceof LegendSDLC) {
|
344
|
+
entities = [...result.entities];
|
345
|
+
dependencies = [
|
346
|
+
new ProjectDependency(
|
347
|
+
generateGAVCoordinates(
|
348
|
+
result.origin.groupId,
|
349
|
+
result.origin.artifactId,
|
350
|
+
undefined,
|
351
|
+
),
|
352
|
+
result.origin.versionId,
|
353
|
+
),
|
354
|
+
];
|
355
|
+
}
|
356
|
+
const message = `loading entities from ${
|
357
|
+
this.editorStore.applicationStore.config.appName
|
358
|
+
} [${this.modelImporterState.replace ? `potentially affected ` : ''} ${
|
359
|
+
entities.length
|
360
|
+
} entities]`;
|
361
|
+
await this.editorStore.sdlcServerClient.updateEntities(
|
362
|
+
this.editorStore.sdlcState.activeProject.projectId,
|
363
|
+
this.editorStore.sdlcState.activeWorkspace,
|
364
|
+
{ replace: this.modelImporterState.replace, entities, message },
|
365
|
+
);
|
366
|
+
|
367
|
+
const currentProjectConfiguration =
|
368
|
+
this.editorStore.projectConfigurationEditorState.originalConfig;
|
369
|
+
const updateProjectConfigurationCommand =
|
370
|
+
new UpdateProjectConfigurationCommand(
|
371
|
+
currentProjectConfiguration.groupId,
|
372
|
+
currentProjectConfiguration.artifactId,
|
373
|
+
currentProjectConfiguration.projectStructureVersion,
|
374
|
+
`update project configuration from ${this.editorStore.applicationStore.config.appName}`,
|
375
|
+
);
|
376
|
+
updateProjectConfigurationCommand.projectDependenciesToAdd = dependencies;
|
377
|
+
updateProjectConfigurationCommand.projectDependenciesToRemove =
|
378
|
+
currentProjectConfiguration.projectDependencies;
|
379
|
+
await flowResult(
|
380
|
+
this.editorStore.projectConfigurationEditorState.updateProjectConfiguration(
|
381
|
+
updateProjectConfigurationCommand,
|
382
|
+
),
|
383
|
+
);
|
384
|
+
// open the debugger element
|
385
|
+
this.editorStore.applicationStore.navigationService.navigator.goToLocation(
|
386
|
+
generateEditorRoute(
|
387
|
+
this.editorStore.sdlcState.activeProject.projectId,
|
388
|
+
undefined,
|
389
|
+
this.editorStore.sdlcState.activeWorkspace.workspaceId,
|
390
|
+
this.editorStore.sdlcState.activeWorkspace.workspaceType,
|
391
|
+
this.executablePath,
|
392
|
+
),
|
393
|
+
{
|
394
|
+
ignoreBlocking: true,
|
395
|
+
},
|
396
|
+
);
|
397
|
+
} catch (error) {
|
398
|
+
assertErrorThrown(error);
|
399
|
+
this.editorStore.applicationStore.logService.error(
|
400
|
+
LogEvent.create(LEGEND_STUDIO_APP_EVENT.MODEL_LOADER_FAILURE),
|
401
|
+
error,
|
402
|
+
);
|
403
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
404
|
+
} finally {
|
405
|
+
this.loadModelActionState.complete();
|
406
|
+
this.editorStore.applicationStore.alertService.setBlockingAlert(
|
407
|
+
undefined,
|
408
|
+
);
|
409
|
+
}
|
410
|
+
}
|
411
|
+
}
|
412
|
+
|
282
413
|
export abstract class ExtensionModelImportRendererState {
|
283
414
|
importerState: ModelImporterState;
|
284
415
|
|
@@ -541,4 +672,13 @@ export class ModelImporterState extends EditorState {
|
|
541
672
|
return modelImporterEditorState;
|
542
673
|
}
|
543
674
|
}
|
675
|
+
|
676
|
+
setExecuteInputDebugModelImporter() {
|
677
|
+
const executeInputDebugModelImporterEditorState =
|
678
|
+
this.modelImportEditorState instanceof
|
679
|
+
ExecuteInputDebugModelImporterEditorState
|
680
|
+
? this.modelImportEditorState
|
681
|
+
: new ExecuteInputDebugModelImporterEditorState(this);
|
682
|
+
this.setImportEditorState(executeInputDebugModelImporterEditorState);
|
683
|
+
}
|
544
684
|
}
|