@finos/legend-application-studio 28.19.35 → 28.19.36
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/dataProduct/DataProductEditor.d.ts +13 -2
- package/lib/components/editor/editor-group/dataProduct/DataProductEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js +104 -20
- package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.js +15 -2
- package/lib/components/editor/side-bar/CreateNewElementModal.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/editor/NewElementState.d.ts +6 -2
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +25 -12
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +25 -1
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +98 -4
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -1
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts +14 -1
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js +42 -2
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js.map +1 -1
- package/package.json +9 -9
- package/src/components/editor/editor-group/dataProduct/DataProductEditor.tsx +357 -41
- package/src/components/editor/side-bar/CreateNewElementModal.tsx +33 -0
- package/src/stores/editor/NewElementState.ts +25 -12
- package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +162 -3
- package/src/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.ts +90 -5
package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts
CHANGED
@@ -32,6 +32,20 @@ import {
|
|
32
32
|
type Stereotype,
|
33
33
|
getStereotype,
|
34
34
|
type StereotypeReference,
|
35
|
+
ModelAccessPointGroup,
|
36
|
+
PackageableRuntime,
|
37
|
+
Association,
|
38
|
+
Class,
|
39
|
+
Enumeration,
|
40
|
+
Package,
|
41
|
+
observe_DataProductRuntimeInfo,
|
42
|
+
PackageableElementExplicitReference,
|
43
|
+
DataProductRuntimeInfo,
|
44
|
+
type DataProductElement,
|
45
|
+
type Mapping,
|
46
|
+
observe_DataProductElementScope,
|
47
|
+
DataProductElementScope,
|
48
|
+
validate_PureExecutionMapping,
|
35
49
|
} from '@finos/legend-graph';
|
36
50
|
import type { EditorStore } from '../../../EditorStore.js';
|
37
51
|
import { ElementEditorState } from '../ElementEditorState.js';
|
@@ -57,6 +71,7 @@ import {
|
|
57
71
|
uuid,
|
58
72
|
swapEntry,
|
59
73
|
returnUndefOnError,
|
74
|
+
deepEqual,
|
60
75
|
} from '@finos/legend-shared';
|
61
76
|
import {
|
62
77
|
accessPointGroup_swapAccessPoints,
|
@@ -65,6 +80,13 @@ import {
|
|
65
80
|
dataProduct_deleteAccessPoint,
|
66
81
|
dataProduct_deleteAccessPointGroup,
|
67
82
|
dataProduct_swapAccessPointGroups,
|
83
|
+
modelAccessPointGroup_addCompatibleRuntime,
|
84
|
+
modelAccessPointGroup_addElement,
|
85
|
+
modelAccessPointGroup_removeCompatibleRuntime,
|
86
|
+
modelAccessPointGroup_removeElement,
|
87
|
+
modelAccessPointGroup_setDefaultRuntime,
|
88
|
+
modelAccessPointGroup_setElementExclude,
|
89
|
+
modelAccessPointGroup_setMapping,
|
68
90
|
} from '../../../../graph-modifier/DSL_DataProduct_GraphModifierHelper.js';
|
69
91
|
import { LambdaEditorState } from '@finos/legend-query-builder';
|
70
92
|
import {
|
@@ -280,6 +302,16 @@ export class AccessPointGroupState {
|
|
280
302
|
return undefined;
|
281
303
|
}
|
282
304
|
|
305
|
+
hasErrors(): boolean {
|
306
|
+
return (
|
307
|
+
this.accessPointStates.length === 0 ||
|
308
|
+
this.value.id === '' ||
|
309
|
+
Boolean(
|
310
|
+
this.accessPointStates.find((apState) => apState.accessPoint.id === ''),
|
311
|
+
)
|
312
|
+
);
|
313
|
+
}
|
314
|
+
|
283
315
|
deleteAccessPoint(val: AccessPointState): void {
|
284
316
|
const state = this.accessPointStates.find((a) => a === val);
|
285
317
|
deleteEntry(this.accessPointStates, state);
|
@@ -313,6 +345,122 @@ export class AccessPointGroupState {
|
|
313
345
|
}
|
314
346
|
}
|
315
347
|
|
348
|
+
export class ModelAccessPointGroupState extends AccessPointGroupState {
|
349
|
+
declare value: ModelAccessPointGroup;
|
350
|
+
showNewModal = false;
|
351
|
+
|
352
|
+
constructor(val: ModelAccessPointGroup, editorState: DataProductEditorState) {
|
353
|
+
super(val, editorState);
|
354
|
+
this.value = val;
|
355
|
+
}
|
356
|
+
|
357
|
+
setMapping(mapping: Mapping): void {
|
358
|
+
modelAccessPointGroup_setMapping(
|
359
|
+
this.value,
|
360
|
+
PackageableElementExplicitReference.create(mapping),
|
361
|
+
);
|
362
|
+
}
|
363
|
+
|
364
|
+
setDefaultRuntime(runtime: DataProductRuntimeInfo) {
|
365
|
+
modelAccessPointGroup_setDefaultRuntime(this.value, runtime);
|
366
|
+
}
|
367
|
+
|
368
|
+
addCompatibleRuntime(runtime: PackageableRuntime): void {
|
369
|
+
const newRuntime = observe_DataProductRuntimeInfo(
|
370
|
+
new DataProductRuntimeInfo(),
|
371
|
+
);
|
372
|
+
newRuntime.id = runtime.name;
|
373
|
+
newRuntime.runtime = PackageableElementExplicitReference.create(runtime);
|
374
|
+
modelAccessPointGroup_addCompatibleRuntime(this.value, newRuntime);
|
375
|
+
|
376
|
+
if (deepEqual(this.value.defaultRuntime, new DataProductRuntimeInfo())) {
|
377
|
+
this.setDefaultRuntime(newRuntime);
|
378
|
+
}
|
379
|
+
}
|
380
|
+
|
381
|
+
removeCompatibleRuntime(runtime: DataProductRuntimeInfo): void {
|
382
|
+
modelAccessPointGroup_removeCompatibleRuntime(this.value, runtime);
|
383
|
+
if (runtime === this.value.defaultRuntime) {
|
384
|
+
if (!this.value.compatibleRuntimes.length) {
|
385
|
+
this.setDefaultRuntime(new DataProductRuntimeInfo());
|
386
|
+
} else if (this.value.compatibleRuntimes[0]) {
|
387
|
+
this.setDefaultRuntime(this.value.compatibleRuntimes[0]);
|
388
|
+
}
|
389
|
+
}
|
390
|
+
}
|
391
|
+
|
392
|
+
addFeaturedElement(element: DataProductElement): void {
|
393
|
+
const elementPointer = observe_DataProductElementScope(
|
394
|
+
new DataProductElementScope(),
|
395
|
+
);
|
396
|
+
elementPointer.element =
|
397
|
+
PackageableElementExplicitReference.create(element);
|
398
|
+
modelAccessPointGroup_addElement(this.value, elementPointer);
|
399
|
+
}
|
400
|
+
|
401
|
+
removeFeaturedElement(element: DataProductElementScope): void {
|
402
|
+
modelAccessPointGroup_removeElement(this.value, element);
|
403
|
+
}
|
404
|
+
|
405
|
+
excludeFeaturedElement(
|
406
|
+
element: DataProductElementScope,
|
407
|
+
value: boolean,
|
408
|
+
): void {
|
409
|
+
modelAccessPointGroup_setElementExclude(element, value);
|
410
|
+
}
|
411
|
+
|
412
|
+
override hasErrors(): boolean {
|
413
|
+
return Boolean(
|
414
|
+
super.hasErrors() ||
|
415
|
+
!validate_PureExecutionMapping(this.value.mapping.value) ||
|
416
|
+
!deepEqual(this.value.defaultRuntime, new DataProductRuntimeInfo()),
|
417
|
+
);
|
418
|
+
}
|
419
|
+
|
420
|
+
getCompatibleRuntimeOptions(): {
|
421
|
+
label: string;
|
422
|
+
value: PackageableRuntime;
|
423
|
+
}[] {
|
424
|
+
const currentRuntimes = this.value.compatibleRuntimes.map(
|
425
|
+
(runtimePointer) => runtimePointer.runtime.value,
|
426
|
+
);
|
427
|
+
return this.state.editorStore.graphManagerState.graph.allOwnElements
|
428
|
+
.filter(
|
429
|
+
(element): element is PackageableRuntime =>
|
430
|
+
element instanceof PackageableRuntime,
|
431
|
+
)
|
432
|
+
.filter((runtime) => !currentRuntimes.includes(runtime))
|
433
|
+
.map((runtime) => ({
|
434
|
+
label: runtime.path,
|
435
|
+
value: runtime,
|
436
|
+
}));
|
437
|
+
}
|
438
|
+
|
439
|
+
isValidDataProductElement(
|
440
|
+
element: PackageableElement,
|
441
|
+
): element is DataProductElement {
|
442
|
+
return (
|
443
|
+
element instanceof Package ||
|
444
|
+
element instanceof Class ||
|
445
|
+
element instanceof Enumeration ||
|
446
|
+
element instanceof Association
|
447
|
+
);
|
448
|
+
}
|
449
|
+
|
450
|
+
getFeaturedElementOptions(): { label: string; value: DataProductElement }[] {
|
451
|
+
const currentElements = this.value.featuredElements.map(
|
452
|
+
(elementPointer) => elementPointer.element.value,
|
453
|
+
);
|
454
|
+
return this.state.editorStore.graphManagerState.graph.allOwnElements
|
455
|
+
.filter((element) => this.isValidDataProductElement(element))
|
456
|
+
.filter((element) => !currentElements.includes(element))
|
457
|
+
.map((element) => ({
|
458
|
+
label: element.path,
|
459
|
+
value: element,
|
460
|
+
}));
|
461
|
+
}
|
462
|
+
}
|
463
|
+
|
316
464
|
const createEditorInitialConfiguration = (): EditorInitialConfiguration => {
|
317
465
|
const config = new EditorInitialConfiguration();
|
318
466
|
const ingest = new DataProductElementEditorInitialConfiguration();
|
@@ -343,6 +491,7 @@ export class DataProductEditorState extends ElementEditorState {
|
|
343
491
|
deployResponse: AdhocDataProductDeployResponse | undefined;
|
344
492
|
selectedGroupState: AccessPointGroupState | undefined;
|
345
493
|
selectedTab: DATA_PRODUCT_TAB;
|
494
|
+
modelledDataProduct = false;
|
346
495
|
|
347
496
|
constructor(
|
348
497
|
editorStore: EditorStore,
|
@@ -356,6 +505,7 @@ export class DataProductEditorState extends ElementEditorState {
|
|
356
505
|
accessPointGroupStates: observable,
|
357
506
|
isConvertingTransformLambdaObjects: observable,
|
358
507
|
selectedTab: observable,
|
508
|
+
modelledDataProduct: observable,
|
359
509
|
setSelectedTab: action,
|
360
510
|
addGroupState: action,
|
361
511
|
deleteGroupState: action,
|
@@ -371,9 +521,18 @@ export class DataProductEditorState extends ElementEditorState {
|
|
371
521
|
swapAccessPointGroups: action,
|
372
522
|
});
|
373
523
|
|
374
|
-
this.accessPointGroupStates = this.product.accessPointGroups.map(
|
375
|
-
(e
|
376
|
-
|
524
|
+
this.accessPointGroupStates = this.product.accessPointGroups.map((e) => {
|
525
|
+
if (e instanceof ModelAccessPointGroup) {
|
526
|
+
this.modelledDataProduct = true;
|
527
|
+
return new ModelAccessPointGroupState(e, this);
|
528
|
+
} else if (e instanceof AccessPointGroup) {
|
529
|
+
return new AccessPointGroupState(e, this);
|
530
|
+
} else {
|
531
|
+
throw new Error(
|
532
|
+
`Can't build access point group state for unsupported access point group type: ${e}`,
|
533
|
+
);
|
534
|
+
}
|
535
|
+
});
|
377
536
|
|
378
537
|
this.selectedGroupState = this.accessPointGroupStates[0];
|
379
538
|
|
@@ -23,11 +23,17 @@ import {
|
|
23
23
|
type LakehouseAccessPoint,
|
24
24
|
DataProductLink,
|
25
25
|
observe_AccessPoint,
|
26
|
-
observe_AccessPointGroup,
|
27
26
|
observe_Email,
|
28
27
|
observe_SupportInfo,
|
29
28
|
observer_DataProductLink,
|
30
29
|
SupportInfo,
|
30
|
+
type ModelAccessPointGroup,
|
31
|
+
type DataProductRuntimeInfo,
|
32
|
+
type PackageableElementReference,
|
33
|
+
type Mapping,
|
34
|
+
type DataProductDiagram,
|
35
|
+
type DataProductElementScope,
|
36
|
+
observe_APG,
|
31
37
|
} from '@finos/legend-graph';
|
32
38
|
import { addUniqueEntry, deleteEntry, swapEntry } from '@finos/legend-shared';
|
33
39
|
import { action } from 'mobx';
|
@@ -68,6 +74,87 @@ export const accessPointGroup_setName = action(
|
|
68
74
|
},
|
69
75
|
);
|
70
76
|
|
77
|
+
export const modelAccessPointGroup_setDefaultRuntime = action(
|
78
|
+
(group: ModelAccessPointGroup, runtime: DataProductRuntimeInfo) => {
|
79
|
+
group.defaultRuntime = runtime;
|
80
|
+
},
|
81
|
+
);
|
82
|
+
|
83
|
+
export const modelAccessPointGroup_setMapping = action(
|
84
|
+
(
|
85
|
+
group: ModelAccessPointGroup,
|
86
|
+
mapping: PackageableElementReference<Mapping>,
|
87
|
+
) => {
|
88
|
+
group.mapping = mapping;
|
89
|
+
},
|
90
|
+
);
|
91
|
+
|
92
|
+
export const modelAccessPointGroup_addCompatibleRuntime = action(
|
93
|
+
(group: ModelAccessPointGroup, runtime: DataProductRuntimeInfo) => {
|
94
|
+
addUniqueEntry(group.compatibleRuntimes, runtime);
|
95
|
+
},
|
96
|
+
);
|
97
|
+
|
98
|
+
export const modelAccessPointGroup_removeCompatibleRuntime = action(
|
99
|
+
(group: ModelAccessPointGroup, runtime: DataProductRuntimeInfo): void => {
|
100
|
+
deleteEntry(group.compatibleRuntimes, runtime);
|
101
|
+
},
|
102
|
+
);
|
103
|
+
|
104
|
+
export const modelAccessPointGroup_addElement = action(
|
105
|
+
(group: ModelAccessPointGroup, element: DataProductElementScope): void => {
|
106
|
+
addUniqueEntry(group.featuredElements, element);
|
107
|
+
},
|
108
|
+
);
|
109
|
+
|
110
|
+
export const modelAccessPointGroup_removeElement = action(
|
111
|
+
(group: ModelAccessPointGroup, element: DataProductElementScope): void => {
|
112
|
+
deleteEntry(group.featuredElements, element);
|
113
|
+
},
|
114
|
+
);
|
115
|
+
|
116
|
+
export const modelAccessPointGroup_setElementExclude = action(
|
117
|
+
(element: DataProductElementScope, exclude: boolean): void => {
|
118
|
+
element.exclude = exclude;
|
119
|
+
},
|
120
|
+
);
|
121
|
+
|
122
|
+
export const modelAccessPointGroup_addDiagram = action(
|
123
|
+
(group: ModelAccessPointGroup, diagram: DataProductDiagram): void => {
|
124
|
+
addUniqueEntry(group.diagrams, diagram);
|
125
|
+
},
|
126
|
+
);
|
127
|
+
|
128
|
+
export const modelAccessPointGroup_removeDiagram = action(
|
129
|
+
(group: ModelAccessPointGroup, diagram: DataProductDiagram): void => {
|
130
|
+
deleteEntry(group.diagrams, diagram);
|
131
|
+
},
|
132
|
+
);
|
133
|
+
|
134
|
+
export const dataProductDiagram_setTitle = action(
|
135
|
+
(diagram: DataProductDiagram, title: string): void => {
|
136
|
+
diagram.title = title;
|
137
|
+
},
|
138
|
+
);
|
139
|
+
|
140
|
+
export const dataProductDiagram_setDescription = action(
|
141
|
+
(diagram: DataProductDiagram, desc: string | undefined): void => {
|
142
|
+
diagram.description = desc;
|
143
|
+
},
|
144
|
+
);
|
145
|
+
|
146
|
+
export const runtimeInfo_setId = action(
|
147
|
+
(runtimeInfo: DataProductRuntimeInfo, id: string): void => {
|
148
|
+
runtimeInfo.id = id;
|
149
|
+
},
|
150
|
+
);
|
151
|
+
|
152
|
+
export const runtimeInfo_setDescription = action(
|
153
|
+
(runtimeInfo: DataProductRuntimeInfo, desc: string | undefined): void => {
|
154
|
+
runtimeInfo.description = desc;
|
155
|
+
},
|
156
|
+
);
|
157
|
+
|
71
158
|
export const accessPointGroup_swapAccessPoints = action(
|
72
159
|
(
|
73
160
|
group: AccessPointGroup,
|
@@ -80,10 +167,8 @@ export const accessPointGroup_swapAccessPoints = action(
|
|
80
167
|
|
81
168
|
export const dataProduct_addAccessPointGroup = action(
|
82
169
|
(product: DataProduct, accessPointGroup: AccessPointGroup) => {
|
83
|
-
|
84
|
-
|
85
|
-
observe_AccessPointGroup(accessPointGroup),
|
86
|
-
);
|
170
|
+
const observedApg = observe_APG(accessPointGroup);
|
171
|
+
addUniqueEntry(product.accessPointGroups, observedApg);
|
87
172
|
},
|
88
173
|
);
|
89
174
|
|