@finos/legend-application-studio 22.1.5 → 22.1.6
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/DSL_ExternalFormat_LegendStudioApplicationPlugin.d.ts +3 -1
- package/lib/components/DSL_ExternalFormat_LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/components/DSL_ExternalFormat_LegendStudioApplicationPlugin.js +15 -3
- package/lib/components/DSL_ExternalFormat_LegendStudioApplicationPlugin.js.map +1 -1
- package/lib/components/editor/edit-panel/GrammarTextEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/GrammarTextEditor.js +8 -0
- package/lib/components/editor/edit-panel/GrammarTextEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_ExternalFormatConnectionEditor.d.ts +1 -0
- package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_ExternalFormatConnectionEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_ExternalFormatConnectionEditor.js +4 -0
- package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_ExternalFormatConnectionEditor.js.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.js +28 -23
- package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/DSL_Mapping_LegendStudioApplicationPlugin_Extension.d.ts +15 -1
- package/lib/stores/DSL_Mapping_LegendStudioApplicationPlugin_Extension.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.d.ts +14 -9
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +38 -19
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/package.json +4 -4
- package/src/components/DSL_ExternalFormat_LegendStudioApplicationPlugin.tsx +17 -3
- package/src/components/editor/edit-panel/GrammarTextEditor.tsx +14 -0
- package/src/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_ExternalFormatConnectionEditor.tsx +5 -0
- package/src/components/editor/side-bar/CreateNewElementModal.tsx +50 -43
- package/src/stores/DSL_Mapping_LegendStudioApplicationPlugin_Extension.ts +19 -1
- package/src/stores/editor/NewElementState.ts +57 -28
|
@@ -228,9 +228,16 @@ export abstract class NewConnectionValueDriver<T extends Connection> {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
abstract get isValid(): boolean;
|
|
231
|
+
abstract getConnectionType(): string;
|
|
231
232
|
abstract createConnection(store: Store): T;
|
|
232
233
|
}
|
|
233
234
|
|
|
235
|
+
export enum CONNECTION_TYPE {
|
|
236
|
+
PURE_MODEL_CONNECTION = 'MODEL_CONNECTION',
|
|
237
|
+
FLAT_DATA_CONNECTION = 'FLAT_DATA_CONNECTION',
|
|
238
|
+
RELATIONAL_CONNECTION = 'RELATIONAL_CONNECTION',
|
|
239
|
+
}
|
|
240
|
+
|
|
234
241
|
export class NewPureModelConnectionDriver extends NewConnectionValueDriver<PureModelConnection> {
|
|
235
242
|
class?: Class | undefined;
|
|
236
243
|
|
|
@@ -257,6 +264,10 @@ export class NewPureModelConnectionDriver extends NewConnectionValueDriver<PureM
|
|
|
257
264
|
return Boolean(this.class);
|
|
258
265
|
}
|
|
259
266
|
|
|
267
|
+
getConnectionType(): string {
|
|
268
|
+
return CONNECTION_TYPE.PURE_MODEL_CONNECTION;
|
|
269
|
+
}
|
|
270
|
+
|
|
260
271
|
createConnection(store: ModelStore): PureModelConnection {
|
|
261
272
|
return new JsonModelConnection(
|
|
262
273
|
PackageableElementExplicitReference.create(store),
|
|
@@ -280,6 +291,10 @@ export class NewFlatDataConnectionDriver extends NewConnectionValueDriver<FlatDa
|
|
|
280
291
|
return true;
|
|
281
292
|
}
|
|
282
293
|
|
|
294
|
+
getConnectionType(): string {
|
|
295
|
+
return CONNECTION_TYPE.FLAT_DATA_CONNECTION;
|
|
296
|
+
}
|
|
297
|
+
|
|
283
298
|
createConnection(store: FlatData): FlatDataConnection {
|
|
284
299
|
return new FlatDataConnection(
|
|
285
300
|
PackageableElementExplicitReference.create(store),
|
|
@@ -300,6 +315,10 @@ export class NewRelationalDatabaseConnectionDriver extends NewConnectionValueDri
|
|
|
300
315
|
return true;
|
|
301
316
|
}
|
|
302
317
|
|
|
318
|
+
getConnectionType(): string {
|
|
319
|
+
return CONNECTION_TYPE.RELATIONAL_CONNECTION;
|
|
320
|
+
}
|
|
321
|
+
|
|
303
322
|
createConnection(store: Store): RelationalDatabaseConnection {
|
|
304
323
|
let selectedStore: Database;
|
|
305
324
|
if (store instanceof Database) {
|
|
@@ -317,22 +336,8 @@ export class NewRelationalDatabaseConnectionDriver extends NewConnectionValueDri
|
|
|
317
336
|
}
|
|
318
337
|
}
|
|
319
338
|
|
|
320
|
-
export enum CONNECTION_TYPE {
|
|
321
|
-
RELATIONAL = 'RELATIONAL',
|
|
322
|
-
MODEL_CONNECTION = 'MODEL_CONNECTION',
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
const getConnectionType = (
|
|
326
|
-
val: NewConnectionValueDriver<Connection>,
|
|
327
|
-
): CONNECTION_TYPE => {
|
|
328
|
-
if (val instanceof NewPureModelConnectionDriver) {
|
|
329
|
-
return CONNECTION_TYPE.MODEL_CONNECTION;
|
|
330
|
-
}
|
|
331
|
-
return CONNECTION_TYPE.RELATIONAL;
|
|
332
|
-
};
|
|
333
|
-
|
|
334
339
|
export class NewPackageableConnectionDriver extends NewElementDriver<PackageableConnection> {
|
|
335
|
-
store
|
|
340
|
+
store: Store;
|
|
336
341
|
newConnectionValueDriver: NewConnectionValueDriver<Connection>;
|
|
337
342
|
|
|
338
343
|
constructor(editorStore: EditorStore) {
|
|
@@ -345,35 +350,59 @@ export class NewPackageableConnectionDriver extends NewElementDriver<Packageable
|
|
|
345
350
|
changeConnectionState: action,
|
|
346
351
|
isValid: computed,
|
|
347
352
|
});
|
|
348
|
-
|
|
353
|
+
this.store = ModelStore.INSTANCE;
|
|
349
354
|
this.newConnectionValueDriver =
|
|
350
|
-
this.getNewConnectionValueDriverBasedOnStore(
|
|
355
|
+
this.getNewConnectionValueDriverBasedOnStore(this.store);
|
|
351
356
|
}
|
|
352
357
|
|
|
353
|
-
geDriverConnectionType():
|
|
354
|
-
return
|
|
358
|
+
geDriverConnectionType(): string {
|
|
359
|
+
return this.newConnectionValueDriver.getConnectionType();
|
|
355
360
|
}
|
|
356
361
|
|
|
357
|
-
changeConnectionState(val:
|
|
362
|
+
changeConnectionState(val: string): void {
|
|
358
363
|
switch (val) {
|
|
359
|
-
case CONNECTION_TYPE.
|
|
364
|
+
case CONNECTION_TYPE.PURE_MODEL_CONNECTION:
|
|
360
365
|
this.newConnectionValueDriver = new NewPureModelConnectionDriver(
|
|
361
366
|
this.editorStore,
|
|
362
367
|
);
|
|
363
368
|
return;
|
|
364
|
-
case CONNECTION_TYPE.
|
|
369
|
+
case CONNECTION_TYPE.FLAT_DATA_CONNECTION:
|
|
370
|
+
this.newConnectionValueDriver = new NewFlatDataConnectionDriver(
|
|
371
|
+
this.editorStore,
|
|
372
|
+
);
|
|
373
|
+
return;
|
|
374
|
+
case CONNECTION_TYPE.RELATIONAL_CONNECTION:
|
|
365
375
|
this.newConnectionValueDriver =
|
|
366
376
|
new NewRelationalDatabaseConnectionDriver(this.editorStore);
|
|
367
377
|
return;
|
|
368
|
-
default:
|
|
369
|
-
|
|
378
|
+
default: {
|
|
379
|
+
const extraNewConnectionDriverCreators = this.editorStore.pluginManager
|
|
380
|
+
.getApplicationPlugins()
|
|
381
|
+
.flatMap(
|
|
382
|
+
(plugin) =>
|
|
383
|
+
(
|
|
384
|
+
plugin as DSL_Mapping_LegendStudioApplicationPlugin_Extension
|
|
385
|
+
).getExtraNewConnectionDriverCreators?.() ?? [],
|
|
386
|
+
);
|
|
387
|
+
for (const creator of extraNewConnectionDriverCreators) {
|
|
388
|
+
const driver = creator(this.editorStore, val);
|
|
389
|
+
if (driver) {
|
|
390
|
+
this.newConnectionValueDriver = driver;
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
throw new UnsupportedOperationError(
|
|
395
|
+
`Can't create new connection driver for type: no compatible creator available from plugins`,
|
|
396
|
+
val,
|
|
397
|
+
);
|
|
398
|
+
}
|
|
370
399
|
}
|
|
371
400
|
}
|
|
372
401
|
|
|
373
402
|
getNewConnectionValueDriverBasedOnStore(
|
|
374
|
-
store: Store
|
|
403
|
+
store: Store,
|
|
375
404
|
): NewConnectionValueDriver<Connection> {
|
|
376
|
-
if (store
|
|
405
|
+
if (store instanceof ModelStore) {
|
|
377
406
|
return new NewPureModelConnectionDriver(this.editorStore);
|
|
378
407
|
} else if (store instanceof FlatData) {
|
|
379
408
|
return new NewFlatDataConnectionDriver(this.editorStore);
|
|
@@ -400,7 +429,7 @@ export class NewPackageableConnectionDriver extends NewElementDriver<Packageable
|
|
|
400
429
|
);
|
|
401
430
|
}
|
|
402
431
|
|
|
403
|
-
setStore(store: Store
|
|
432
|
+
setStore(store: Store): void {
|
|
404
433
|
this.store = store;
|
|
405
434
|
this.newConnectionValueDriver =
|
|
406
435
|
this.getNewConnectionValueDriverBasedOnStore(store);
|
|
@@ -414,7 +443,7 @@ export class NewPackageableConnectionDriver extends NewElementDriver<Packageable
|
|
|
414
443
|
const connection = new PackageableConnection(name);
|
|
415
444
|
packageableConnection_setConnectionValue(
|
|
416
445
|
connection,
|
|
417
|
-
this.newConnectionValueDriver.createConnection(
|
|
446
|
+
this.newConnectionValueDriver.createConnection(this.store),
|
|
418
447
|
this.editorStore.changeDetectionState.observerContext,
|
|
419
448
|
); // default to model store
|
|
420
449
|
return connection;
|