@finos/legend-application-studio 28.19.14 → 28.19.15

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.
Files changed (37) hide show
  1. package/lib/__lib__/LegendStudioTesting.d.ts +2 -1
  2. package/lib/__lib__/LegendStudioTesting.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioTesting.js +1 -0
  4. package/lib/__lib__/LegendStudioTesting.js.map +1 -1
  5. package/lib/application/LegendStudioApplicationConfig.d.ts +13 -0
  6. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  7. package/lib/application/LegendStudioApplicationConfig.js +22 -0
  8. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  9. package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.d.ts +8 -2
  10. package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.d.ts.map +1 -1
  11. package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.js +379 -253
  12. package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.js.map +1 -1
  13. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  14. package/lib/components/editor/side-bar/CreateNewElementModal.js +1 -2
  15. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  16. package/lib/index.css +2 -2
  17. package/lib/index.css.map +1 -1
  18. package/lib/package.json +1 -1
  19. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  20. package/lib/stores/editor/NewElementState.js +6 -3
  21. package/lib/stores/editor/NewElementState.js.map +1 -1
  22. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +20 -9
  23. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -1
  24. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +72 -24
  25. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -1
  26. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts +4 -1
  27. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts.map +1 -1
  28. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js +10 -1
  29. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js.map +1 -1
  30. package/package.json +6 -6
  31. package/src/__lib__/LegendStudioTesting.ts +1 -0
  32. package/src/application/LegendStudioApplicationConfig.ts +33 -0
  33. package/src/components/editor/editor-group/dataProduct/DataPoductEditor.tsx +971 -745
  34. package/src/components/editor/side-bar/CreateNewElementModal.tsx +0 -15
  35. package/src/stores/editor/NewElementState.ts +8 -1
  36. package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +122 -26
  37. package/src/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.ts +28 -2
@@ -488,9 +488,6 @@ const NewLakehouseDataProductEditor = observer(() => {
488
488
  const handleTitleChange: React.ChangeEventHandler<HTMLInputElement> = (
489
489
  event,
490
490
  ) => newProductDriver.setTitle(event.target.value);
491
- const handleDescriptionChange: React.ChangeEventHandler<HTMLInputElement> = (
492
- event,
493
- ) => newProductDriver.setDescription(event.target.value);
494
491
  return (
495
492
  <>
496
493
  <div className="panel__content__form__section__header__label">Title</div>
@@ -503,18 +500,6 @@ const NewLakehouseDataProductEditor = observer(() => {
503
500
  placeholder={`Choose a title for this Data Product to display in Marketplace`}
504
501
  />
505
502
  </div>
506
- <div className="panel__content__form__section__header__label">
507
- Description
508
- </div>
509
- <div className="explorer__new-element-modal__driver">
510
- <input
511
- className="input--dark explorer__new-element-modal__name-input"
512
- spellCheck={false}
513
- value={newProductDriver.description}
514
- onChange={handleDescriptionChange}
515
- placeholder={`Provide a meaningful description for this Data Product`}
516
- />
517
- </div>
518
503
  </>
519
504
  );
520
505
  });
@@ -86,6 +86,7 @@ import {
86
86
  DataProduct,
87
87
  LakehouseRuntime,
88
88
  type Runtime,
89
+ AccessPointGroup,
89
90
  } from '@finos/legend-graph';
90
91
  import type { DSL_Mapping_LegendStudioApplicationPlugin_Extension } from '../extensions/DSL_Mapping_LegendStudioApplicationPlugin_Extension.js';
91
92
  import {
@@ -111,6 +112,7 @@ import {
111
112
  import { EmbeddedDataType } from './editor-state/ExternalFormatState.js';
112
113
  import { createEmbeddedData } from './editor-state/element-editor-state/data/EmbeddedDataState.js';
113
114
  import {
115
+ dataProduct_addAccessPointGroup,
114
116
  dataProduct_setDescription,
115
117
  dataProduct_setTitle,
116
118
  } from '../graph-modifier/DSL_DataProduct_GraphModifierHelper.js';
@@ -528,7 +530,7 @@ export class NewLakehouseDataProductDriver extends NewElementDriver<DataProduct>
528
530
  }
529
531
 
530
532
  override get isValid(): boolean {
531
- return Boolean(this.title && this.description);
533
+ return Boolean(this.title);
532
534
  }
533
535
 
534
536
  setTitle(val: string) {
@@ -541,6 +543,11 @@ export class NewLakehouseDataProductDriver extends NewElementDriver<DataProduct>
541
543
  const dataProduct = new DataProduct(name);
542
544
  dataProduct_setTitle(dataProduct, this.title);
543
545
  dataProduct_setDescription(dataProduct, this.description);
546
+
547
+ const defaultGroup = new AccessPointGroup();
548
+ defaultGroup.id = 'default';
549
+ dataProduct_addAccessPointGroup(dataProduct, defaultGroup);
550
+
544
551
  return dataProduct;
545
552
  }
546
553
  }
@@ -19,7 +19,7 @@ import {
19
19
  LakehouseAccessPoint,
20
20
  type PackageableElement,
21
21
  type IngestDefinition,
22
- type AccessPoint,
22
+ AccessPoint,
23
23
  stub_RawLambda,
24
24
  LakehouseTargetEnv,
25
25
  LAMBDA_PIPE,
@@ -29,6 +29,9 @@ import {
29
29
  isStubbed_RawLambda,
30
30
  AccessPointGroup,
31
31
  CodeCompletionResult,
32
+ type Stereotype,
33
+ getStereotype,
34
+ type StereotypeReference,
32
35
  } from '@finos/legend-graph';
33
36
  import type { EditorStore } from '../../../EditorStore.js';
34
37
  import { ElementEditorState } from '../ElementEditorState.js';
@@ -52,12 +55,16 @@ import {
52
55
  guaranteeNonNullable,
53
56
  assertTrue,
54
57
  uuid,
58
+ swapEntry,
59
+ returnUndefOnError,
55
60
  } from '@finos/legend-shared';
56
61
  import {
62
+ accessPointGroup_swapAccessPoints,
57
63
  dataProduct_addAccessPoint,
58
64
  dataProduct_addAccessPointGroup,
59
65
  dataProduct_deleteAccessPoint,
60
66
  dataProduct_deleteAccessPointGroup,
67
+ dataProduct_swapAccessPointGroups,
61
68
  } from '../../../../graph-modifier/DSL_DataProduct_GraphModifierHelper.js';
62
69
  import { LambdaEditorState } from '@finos/legend-query-builder';
63
70
  import {
@@ -70,13 +77,30 @@ import type {
70
77
  LakehouseIngestionManager,
71
78
  } from '@finos/legend-server-lakehouse';
72
79
 
80
+ export enum DATA_PRODUCT_TAB {
81
+ HOME = 'Home',
82
+ SUPPORT = 'Support',
83
+ APG = 'APG',
84
+ }
85
+
73
86
  export class AccessPointState {
74
- readonly state: AccessPointGroupState;
87
+ readonly uuid = uuid();
88
+ state: AccessPointGroupState;
75
89
  accessPoint: AccessPoint;
76
90
 
77
91
  constructor(val: AccessPoint, editorState: AccessPointGroupState) {
78
92
  this.accessPoint = val;
79
93
  this.state = editorState;
94
+
95
+ makeObservable(this, {
96
+ state: observable,
97
+ accessPoint: observable,
98
+ changeGroupState: action,
99
+ });
100
+ }
101
+
102
+ changeGroupState(newGroup: AccessPointGroupState): void {
103
+ this.state = newGroup;
80
104
  }
81
105
  }
82
106
 
@@ -208,24 +232,65 @@ export class AccessPointGroupState {
208
232
  this.accessPointStates = val.accessPoints.map((e) =>
209
233
  this.buildAccessPointState(e),
210
234
  );
235
+
211
236
  makeObservable(this, {
212
237
  value: observable,
213
238
  accessPointStates: observable,
214
239
  addAccessPoint: action,
215
240
  deleteAccessPoint: action,
241
+ swapAccessPoints: action,
242
+ containsPublicStereotype: computed,
216
243
  });
217
244
  }
218
245
 
246
+ get containsPublicStereotype(): StereotypeReference | undefined {
247
+ return this.value.stereotypes.find(
248
+ (stereotype) => stereotype.value === this.publicStereotype,
249
+ );
250
+ }
251
+
252
+ get publicStereotype(): Stereotype | undefined {
253
+ const publicStereotype =
254
+ this.state.editorStore.applicationStore.config.options.dataProductConfig
255
+ ?.publicStereotype;
256
+
257
+ if (publicStereotype) {
258
+ return returnUndefOnError(() =>
259
+ getStereotype(
260
+ this.state.editorStore.graphManagerState.graph.getProfile(
261
+ publicStereotype.profile,
262
+ ),
263
+ publicStereotype.stereotype,
264
+ ),
265
+ );
266
+ }
267
+
268
+ return undefined;
269
+ }
270
+
219
271
  deleteAccessPoint(val: AccessPointState): void {
220
272
  const state = this.accessPointStates.find((a) => a === val);
221
273
  deleteEntry(this.accessPointStates, state);
222
274
  dataProduct_deleteAccessPoint(this.value, val.accessPoint);
223
275
  }
224
276
 
225
- addAccessPoint(point: AccessPoint): void {
226
- const accessPointState = this.buildAccessPointState(point);
277
+ addAccessPoint(point: AccessPoint | AccessPointState): void {
278
+ const accessPointState =
279
+ point instanceof AccessPoint ? this.buildAccessPointState(point) : point;
227
280
  addUniqueEntry(this.accessPointStates, accessPointState);
228
- dataProduct_addAccessPoint(this.value, point);
281
+ dataProduct_addAccessPoint(this.value, accessPointState.accessPoint);
282
+ }
283
+
284
+ swapAccessPoints(
285
+ sourceAccessPoint: AccessPointState,
286
+ targetAccessPoint: AccessPointState,
287
+ ): void {
288
+ swapEntry(this.accessPointStates, sourceAccessPoint, targetAccessPoint);
289
+ accessPointGroup_swapAccessPoints(
290
+ this.value,
291
+ sourceAccessPoint.accessPoint,
292
+ targetAccessPoint.accessPoint,
293
+ );
229
294
  }
230
295
 
231
296
  buildAccessPointState(val: AccessPoint): AccessPointState {
@@ -259,14 +324,13 @@ export const generateUrlToDeployOnOpen = (
259
324
  };
260
325
 
261
326
  export class DataProductEditorState extends ElementEditorState {
262
- accessPointModal = false;
263
- accessPointGroupModal = false;
264
327
  deploymentState = ActionState.create();
265
328
  accessPointGroupStates: AccessPointGroupState[] = [];
266
329
  isConvertingTransformLambdaObjects = false;
267
330
  deployOnOpen = false;
268
331
  deployResponse: AdhocDataProductDeployResponse | undefined;
269
- editingGroupState: AccessPointGroupState | undefined;
332
+ selectedGroupState: AccessPointGroupState | undefined;
333
+ selectedTab: DATA_PRODUCT_TAB;
270
334
 
271
335
  constructor(
272
336
  editorStore: EditorStore,
@@ -277,29 +341,35 @@ export class DataProductEditorState extends ElementEditorState {
277
341
 
278
342
  makeObservable(this, {
279
343
  product: computed,
280
- accessPointModal: observable,
281
- accessPointGroupModal: observable,
282
344
  accessPointGroupStates: observable,
283
345
  isConvertingTransformLambdaObjects: observable,
346
+ selectedTab: observable,
347
+ setSelectedTab: action,
348
+ addGroupState: action,
349
+ deleteGroupState: action,
284
350
  deploy: flow,
285
351
  deployOnOpen: observable,
286
352
  deployResponse: observable,
287
353
  setDeployOnOpen: action,
288
354
  setDeployResponse: action,
289
- setAccessPointModal: action,
290
- setAccessPointGroupModal: action,
291
355
  addAccessPoint: action,
292
356
  convertAccessPointsFuncObjects: flow,
293
- editingGroupState: observable,
294
- setEditingGroupState: action,
357
+ selectedGroupState: observable,
358
+ setSelectedGroupState: action,
359
+ swapAccessPointGroups: action,
295
360
  });
361
+
296
362
  this.accessPointGroupStates = this.product.accessPointGroups.map(
297
363
  (e) => new AccessPointGroupState(e, this),
298
364
  );
365
+
366
+ this.selectedGroupState = this.accessPointGroupStates[0];
367
+
299
368
  const elementConfig = config?.elementEditorConfiguration;
300
369
  if (elementConfig instanceof DataProductElementEditorInitialConfiguration) {
301
370
  this.deployOnOpen = elementConfig.deployOnOpen ?? false;
302
371
  }
372
+ this.selectedTab = DATA_PRODUCT_TAB.HOME;
303
373
  }
304
374
 
305
375
  setDeployOnOpen(value: boolean): void {
@@ -312,6 +382,33 @@ export class DataProductEditorState extends ElementEditorState {
312
382
  this.deployResponse = response;
313
383
  }
314
384
 
385
+ setSelectedTab(value: DATA_PRODUCT_TAB): void {
386
+ this.selectedTab = value;
387
+ }
388
+
389
+ addGroupState(value: AccessPointGroupState): void {
390
+ this.accessPointGroupStates.push(value);
391
+ }
392
+
393
+ deleteGroupState(value: AccessPointGroupState): void {
394
+ deleteEntry(
395
+ this.accessPointGroupStates,
396
+ this.accessPointGroupStates.find((a) => a === value),
397
+ );
398
+ }
399
+
400
+ swapAccessPointGroups(
401
+ sourceGroup: AccessPointGroupState,
402
+ targetGroup: AccessPointGroupState,
403
+ ): void {
404
+ swapEntry(this.accessPointGroupStates, sourceGroup, targetGroup);
405
+ dataProduct_swapAccessPointGroups(
406
+ this.product,
407
+ sourceGroup.value,
408
+ targetGroup.value,
409
+ );
410
+ }
411
+
315
412
  *convertAccessPointsFuncObjects(): GeneratorFn<void> {
316
413
  const lambdas = new Map<string, RawLambda>();
317
414
  const index = new Map<string, LakehouseAccessPointState>();
@@ -350,16 +447,8 @@ export class DataProductEditorState extends ElementEditorState {
350
447
  }
351
448
  }
352
449
 
353
- setAccessPointModal(val: boolean): void {
354
- this.accessPointModal = val;
355
- }
356
-
357
- setEditingGroupState(val: AccessPointGroupState | undefined): void {
358
- this.editingGroupState = val;
359
- }
360
-
361
- setAccessPointGroupModal(val: boolean): void {
362
- this.accessPointGroupModal = val;
450
+ setSelectedGroupState(val: AccessPointGroupState | undefined): void {
451
+ this.selectedGroupState = val;
363
452
  }
364
453
 
365
454
  addAccessPoint(
@@ -393,13 +482,20 @@ export class DataProductEditorState extends ElementEditorState {
393
482
  group.id = id;
394
483
  group.description = description;
395
484
  dataProduct_addAccessPointGroup(this.product, group);
396
- return new AccessPointGroupState(group, this);
485
+ const newGroupState = new AccessPointGroupState(group, this);
486
+ this.addGroupState(newGroupState);
487
+ return newGroupState;
397
488
  }
398
489
 
399
490
  deleteAccessPointGroup(val: AccessPointGroupState): void {
400
491
  const state = this.accessPointGroupStates.find((a) => a === val);
401
492
  runInAction(() => {
402
- deleteEntry(this.accessPointGroupStates, state);
493
+ if (state) {
494
+ this.deleteGroupState(state);
495
+ if (state === this.selectedGroupState) {
496
+ this.setSelectedGroupState(this.accessPointGroupStates[0]);
497
+ }
498
+ }
403
499
  dataProduct_deleteAccessPointGroup(this.product, val.value);
404
500
  });
405
501
  }
@@ -24,9 +24,9 @@ import {
24
24
  observe_SupportInfo,
25
25
  observe_Email,
26
26
  SupportInfo,
27
+ type LakehouseAccessPoint,
27
28
  } from '@finos/legend-graph';
28
- import { addUniqueEntry, deleteEntry } from '@finos/legend-shared';
29
-
29
+ import { addUniqueEntry, deleteEntry, swapEntry } from '@finos/legend-shared';
30
30
  import { action } from 'mobx';
31
31
 
32
32
  export const dataProduct_deleteAccessPoint = action(
@@ -41,6 +41,12 @@ export const dataProduct_addAccessPoint = action(
41
41
  },
42
42
  );
43
43
 
44
+ export const accessPoint_setClassification = action(
45
+ (accessPoint: LakehouseAccessPoint, classification: string | undefined) => {
46
+ accessPoint.classification = classification;
47
+ },
48
+ );
49
+
44
50
  export const accessPointGroup_setDescription = action(
45
51
  (group: AccessPointGroup, description: string) => {
46
52
  group.description = description;
@@ -53,6 +59,16 @@ export const accessPointGroup_setName = action(
53
59
  },
54
60
  );
55
61
 
62
+ export const accessPointGroup_swapAccessPoints = action(
63
+ (
64
+ group: AccessPointGroup,
65
+ sourceAp: AccessPoint,
66
+ targetAp: AccessPoint,
67
+ ): void => {
68
+ swapEntry(group.accessPoints, sourceAp, targetAp);
69
+ },
70
+ );
71
+
56
72
  export const dataProduct_addAccessPointGroup = action(
57
73
  (product: DataProduct, accessPointGroup: AccessPointGroup) => {
58
74
  addUniqueEntry(
@@ -68,6 +84,16 @@ export const dataProduct_deleteAccessPointGroup = action(
68
84
  },
69
85
  );
70
86
 
87
+ export const dataProduct_swapAccessPointGroups = action(
88
+ (
89
+ product: DataProduct,
90
+ sourceGroup: AccessPointGroup,
91
+ targetGroup: AccessPointGroup,
92
+ ): void => {
93
+ swapEntry(product.accessPointGroups, sourceGroup, targetGroup);
94
+ },
95
+ );
96
+
71
97
  export const dataProduct_setTitle = action(
72
98
  (product: DataProduct, title: string) => {
73
99
  product.title = title;