@finos/legend-application-studio 28.21.32 → 28.21.34
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 +1 -12
- package/lib/components/editor/editor-group/dataProduct/DataProductEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js +3 -86
- package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +1 -22
- 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 +3 -109
- 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 +1 -8
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js +0 -21
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js.map +1 -1
- package/package.json +12 -12
- package/src/components/editor/editor-group/dataProduct/DataProductEditor.tsx +0 -282
- package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +1 -162
- package/src/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.ts +0 -44
|
@@ -86,7 +86,6 @@ import {
|
|
|
86
86
|
type ChangeEventHandler,
|
|
87
87
|
useCallback,
|
|
88
88
|
useEffect,
|
|
89
|
-
useLayoutEffect,
|
|
90
89
|
useMemo,
|
|
91
90
|
useRef,
|
|
92
91
|
useState,
|
|
@@ -114,15 +113,12 @@ import { DataProductTestableEditor } from './testable/DataProductTestableEditor.
|
|
|
114
113
|
import { CODE_EDITOR_LANGUAGE } from '@finos/legend-code-editor';
|
|
115
114
|
import { CodeEditor } from '@finos/legend-lego/code-editor';
|
|
116
115
|
import {
|
|
117
|
-
type DataProductElement,
|
|
118
|
-
type DataProductElementScope,
|
|
119
116
|
type Expertise,
|
|
120
117
|
type GraphManagerState,
|
|
121
118
|
type LakehouseAccessPoint,
|
|
122
119
|
type Mapping,
|
|
123
120
|
type PackageableElement,
|
|
124
121
|
type DataProduct,
|
|
125
|
-
type DataProductDiagram,
|
|
126
122
|
DataProductEmbeddedImageIcon,
|
|
127
123
|
DataProductLibraryIcon,
|
|
128
124
|
Email,
|
|
@@ -174,8 +170,6 @@ import {
|
|
|
174
170
|
dataProduct_setOperationalMetadataIfAbsent,
|
|
175
171
|
operationalMetadata_deleteCoverageRegion,
|
|
176
172
|
operationalMetadata_addCoverageRegion,
|
|
177
|
-
dataProductDiagram_setTitle,
|
|
178
|
-
dataProductDiagram_setDescription,
|
|
179
173
|
operationalMetadata_setUpdateFrequency,
|
|
180
174
|
dataProduct_setOwner,
|
|
181
175
|
appDirOwner_setProduction,
|
|
@@ -1383,277 +1377,6 @@ const AccessPointGroupPublicToggle = observer(
|
|
|
1383
1377
|
},
|
|
1384
1378
|
);
|
|
1385
1379
|
|
|
1386
|
-
export const CompatibleDiagramsEditor = observer(
|
|
1387
|
-
(props: { groupState: ModelAccessPointGroupState }) => {
|
|
1388
|
-
const { groupState } = props;
|
|
1389
|
-
const group = groupState.value;
|
|
1390
|
-
|
|
1391
|
-
const handleDiagramTitleChange = (
|
|
1392
|
-
diagram: DataProductDiagram,
|
|
1393
|
-
value: string | undefined,
|
|
1394
|
-
): void => {
|
|
1395
|
-
dataProductDiagram_setTitle(diagram, value ?? '');
|
|
1396
|
-
};
|
|
1397
|
-
|
|
1398
|
-
const handleDiagramDescriptionChange = (
|
|
1399
|
-
diagram: DataProductDiagram,
|
|
1400
|
-
value: string | undefined,
|
|
1401
|
-
): void => {
|
|
1402
|
-
dataProductDiagram_setDescription(diagram, value);
|
|
1403
|
-
};
|
|
1404
|
-
|
|
1405
|
-
const handleAddDiagram = (option: {
|
|
1406
|
-
label: string;
|
|
1407
|
-
value: PackageableElement;
|
|
1408
|
-
}): void => {
|
|
1409
|
-
groupState.addDiagram(option);
|
|
1410
|
-
};
|
|
1411
|
-
|
|
1412
|
-
const handleRemoveDiagram = (diagram: DataProductDiagram): void => {
|
|
1413
|
-
groupState.handleRemoveDiagram(diagram);
|
|
1414
|
-
};
|
|
1415
|
-
|
|
1416
|
-
// ListEditor component renderers
|
|
1417
|
-
const DiagramComponent = observer(
|
|
1418
|
-
(diagramComponentProps: {
|
|
1419
|
-
item: DataProductDiagram;
|
|
1420
|
-
}): React.ReactElement => {
|
|
1421
|
-
const { item } = diagramComponentProps;
|
|
1422
|
-
|
|
1423
|
-
return (
|
|
1424
|
-
<>
|
|
1425
|
-
<div className="panel__content__form__section__list__item__content">
|
|
1426
|
-
<div className="panel__content__form__section__header__label">
|
|
1427
|
-
Diagram
|
|
1428
|
-
</div>
|
|
1429
|
-
<div className="panel__content__form__section__list__item__content__title">
|
|
1430
|
-
{item.diagram.name}
|
|
1431
|
-
</div>
|
|
1432
|
-
</div>
|
|
1433
|
-
<div className="panel__content__form__section__list__item__form">
|
|
1434
|
-
<PanelFormTextField
|
|
1435
|
-
name="Title"
|
|
1436
|
-
value={item.title}
|
|
1437
|
-
update={(value) => handleDiagramTitleChange(item, value)}
|
|
1438
|
-
placeholder="Enter title"
|
|
1439
|
-
className="dataSpace-editor__general__diagrams__title"
|
|
1440
|
-
/>
|
|
1441
|
-
<PanelFormTextField
|
|
1442
|
-
name="Description"
|
|
1443
|
-
value={item.description ?? ''}
|
|
1444
|
-
update={(value) => handleDiagramDescriptionChange(item, value)}
|
|
1445
|
-
placeholder="Enter description"
|
|
1446
|
-
className="dataSpace-editor__general__diagrams__description"
|
|
1447
|
-
/>
|
|
1448
|
-
</div>
|
|
1449
|
-
</>
|
|
1450
|
-
);
|
|
1451
|
-
},
|
|
1452
|
-
);
|
|
1453
|
-
|
|
1454
|
-
const hasMappingSet = group.mapping.value.path !== '';
|
|
1455
|
-
const noDiagramsInProject =
|
|
1456
|
-
groupState.getCompatibleDiagramOptions().length === 0 &&
|
|
1457
|
-
group.diagrams.length === 0;
|
|
1458
|
-
const [isGenerating, setIsGenerating] = useState(false);
|
|
1459
|
-
const [isAddingDiagram, setIsAddingDiagram] = useState(false);
|
|
1460
|
-
|
|
1461
|
-
const handleGenerateFromMapping = (): void => {
|
|
1462
|
-
setIsGenerating(true);
|
|
1463
|
-
flowResult(groupState.generateDiagramFromMapping())
|
|
1464
|
-
.catch(
|
|
1465
|
-
groupState.state.editorStore.applicationStore.alertUnhandledError,
|
|
1466
|
-
)
|
|
1467
|
-
.finally(() => setIsGenerating(false));
|
|
1468
|
-
};
|
|
1469
|
-
|
|
1470
|
-
const NewDiagramComponent = observer(
|
|
1471
|
-
(newDiagramProps: {
|
|
1472
|
-
onFinishEditing: () => void;
|
|
1473
|
-
}): React.ReactElement => {
|
|
1474
|
-
const { onFinishEditing } = newDiagramProps;
|
|
1475
|
-
|
|
1476
|
-
useLayoutEffect(() => {
|
|
1477
|
-
setIsAddingDiagram(true);
|
|
1478
|
-
return () => setIsAddingDiagram(false);
|
|
1479
|
-
}, []);
|
|
1480
|
-
|
|
1481
|
-
return (
|
|
1482
|
-
<>
|
|
1483
|
-
<div className="panel__content__form__section__list__new-item__input">
|
|
1484
|
-
<CustomSelectorInput
|
|
1485
|
-
options={groupState.getCompatibleDiagramOptions()}
|
|
1486
|
-
onChange={(event: {
|
|
1487
|
-
label: string;
|
|
1488
|
-
value: PackageableElement;
|
|
1489
|
-
}) => {
|
|
1490
|
-
onFinishEditing();
|
|
1491
|
-
handleAddDiagram(event);
|
|
1492
|
-
}}
|
|
1493
|
-
placeholder="Select a diagram to add..."
|
|
1494
|
-
darkMode={
|
|
1495
|
-
!groupState.state.editorStore.applicationStore.layoutService
|
|
1496
|
-
.TEMPORARY__isLightColorThemeEnabled
|
|
1497
|
-
}
|
|
1498
|
-
/>
|
|
1499
|
-
</div>
|
|
1500
|
-
{noDiagramsInProject &&
|
|
1501
|
-
hasMappingSet &&
|
|
1502
|
-
!groupState.state.isReadOnly && (
|
|
1503
|
-
<button
|
|
1504
|
-
className="panel__content__form__section__list__new-item__cancel-btn btn btn--dark"
|
|
1505
|
-
disabled={isGenerating}
|
|
1506
|
-
onClick={() => {
|
|
1507
|
-
onFinishEditing();
|
|
1508
|
-
handleGenerateFromMapping();
|
|
1509
|
-
}}
|
|
1510
|
-
title="Auto-generate a diagram from the mapping"
|
|
1511
|
-
tabIndex={-1}
|
|
1512
|
-
>
|
|
1513
|
-
{isGenerating ? 'Generating...' : 'Generate from Mapping'}
|
|
1514
|
-
</button>
|
|
1515
|
-
)}
|
|
1516
|
-
</>
|
|
1517
|
-
);
|
|
1518
|
-
},
|
|
1519
|
-
);
|
|
1520
|
-
|
|
1521
|
-
return (
|
|
1522
|
-
<div className="data-product-editor__diagrams-section">
|
|
1523
|
-
<ListEditor
|
|
1524
|
-
title="Diagrams"
|
|
1525
|
-
prompt="Add diagrams to include in this Data Product. Diagrams are required to showcase and explain your curated data models"
|
|
1526
|
-
items={group.diagrams}
|
|
1527
|
-
keySelector={(element: DataProductDiagram) => element.diagram.name}
|
|
1528
|
-
ItemComponent={DiagramComponent}
|
|
1529
|
-
NewItemComponent={NewDiagramComponent}
|
|
1530
|
-
handleRemoveItem={handleRemoveDiagram}
|
|
1531
|
-
isReadOnly={groupState.state.isReadOnly}
|
|
1532
|
-
emptyMessage="⚠ No Diagrams specified. Add at least one diagram to this Data Product."
|
|
1533
|
-
emptyClassName="data-product-editor__empty-diagram"
|
|
1534
|
-
/>
|
|
1535
|
-
{noDiagramsInProject &&
|
|
1536
|
-
!isAddingDiagram &&
|
|
1537
|
-
hasMappingSet &&
|
|
1538
|
-
!groupState.state.isReadOnly && (
|
|
1539
|
-
<div className="data-product-editor__generate-diagram-btn">
|
|
1540
|
-
<button
|
|
1541
|
-
className="panel__content__form__section__list__new-item__add-btn btn btn--dark"
|
|
1542
|
-
disabled={isGenerating}
|
|
1543
|
-
onClick={handleGenerateFromMapping}
|
|
1544
|
-
title="Generate a Diagram from the Mapping"
|
|
1545
|
-
tabIndex={-1}
|
|
1546
|
-
>
|
|
1547
|
-
{isGenerating ? 'Generating...' : 'Generate from Mapping'}
|
|
1548
|
-
</button>
|
|
1549
|
-
</div>
|
|
1550
|
-
)}
|
|
1551
|
-
</div>
|
|
1552
|
-
);
|
|
1553
|
-
},
|
|
1554
|
-
);
|
|
1555
|
-
|
|
1556
|
-
export const FeaturedElementsEditor = observer(
|
|
1557
|
-
(props: { groupState: ModelAccessPointGroupState; isReadOnly: boolean }) => {
|
|
1558
|
-
const { groupState, isReadOnly } = props;
|
|
1559
|
-
const group = groupState.value;
|
|
1560
|
-
|
|
1561
|
-
// Event handlers
|
|
1562
|
-
const handleAddElement = (option: {
|
|
1563
|
-
label: string;
|
|
1564
|
-
value: DataProductElement;
|
|
1565
|
-
}): void => {
|
|
1566
|
-
if (typeof option.value === 'object') {
|
|
1567
|
-
groupState.addFeaturedElement(option.value);
|
|
1568
|
-
}
|
|
1569
|
-
};
|
|
1570
|
-
|
|
1571
|
-
const handleRemoveElement = (element: DataProductElementScope): void => {
|
|
1572
|
-
groupState.removeFeaturedElement(element);
|
|
1573
|
-
};
|
|
1574
|
-
|
|
1575
|
-
const handleElementExcludeChange = (
|
|
1576
|
-
element: DataProductElementScope,
|
|
1577
|
-
event: React.ChangeEvent<HTMLInputElement>,
|
|
1578
|
-
): void => {
|
|
1579
|
-
groupState.excludeFeaturedElement(element, event.target.checked);
|
|
1580
|
-
};
|
|
1581
|
-
|
|
1582
|
-
// ListEditor component renderers
|
|
1583
|
-
const ElementComponent = observer(
|
|
1584
|
-
(elementComponentProps: {
|
|
1585
|
-
item: DataProductElementScope;
|
|
1586
|
-
}): React.ReactElement => {
|
|
1587
|
-
const { item } = elementComponentProps;
|
|
1588
|
-
|
|
1589
|
-
return (
|
|
1590
|
-
<div className="data-product-editor__element-item">
|
|
1591
|
-
<div className="panel__content__form__section__list__item__content__label">
|
|
1592
|
-
{item.element.value.path}
|
|
1593
|
-
</div>
|
|
1594
|
-
<div className="panel__content__form__section__list__item__content__actions">
|
|
1595
|
-
<div className="panel__content__form__section__list__item__content__actions-exclude">
|
|
1596
|
-
<Checkbox
|
|
1597
|
-
disabled={isReadOnly}
|
|
1598
|
-
checked={item.exclude ?? false}
|
|
1599
|
-
onChange={(event) => handleElementExcludeChange(item, event)}
|
|
1600
|
-
size="small"
|
|
1601
|
-
className="panel__content__form__section__list__item__content__actions-exclude__btn"
|
|
1602
|
-
/>
|
|
1603
|
-
<span className="panel__content__form__section__list__item__content__actions__label">
|
|
1604
|
-
Exclude
|
|
1605
|
-
</span>
|
|
1606
|
-
</div>
|
|
1607
|
-
</div>
|
|
1608
|
-
</div>
|
|
1609
|
-
);
|
|
1610
|
-
},
|
|
1611
|
-
);
|
|
1612
|
-
|
|
1613
|
-
const NewElementComponent = observer(
|
|
1614
|
-
(newElementProps: { onFinishEditing: () => void }) => {
|
|
1615
|
-
const { onFinishEditing } = newElementProps;
|
|
1616
|
-
|
|
1617
|
-
return (
|
|
1618
|
-
<div className="panel__content__form__section__list__new-item__input">
|
|
1619
|
-
<CustomSelectorInput
|
|
1620
|
-
options={groupState.getFeaturedElementOptions()}
|
|
1621
|
-
onChange={(event: {
|
|
1622
|
-
label: string;
|
|
1623
|
-
value: DataProductElement;
|
|
1624
|
-
}) => {
|
|
1625
|
-
onFinishEditing();
|
|
1626
|
-
handleAddElement(event);
|
|
1627
|
-
}}
|
|
1628
|
-
placeholder="Select an element to add..."
|
|
1629
|
-
darkMode={
|
|
1630
|
-
!groupState.state.editorStore.applicationStore.layoutService
|
|
1631
|
-
.TEMPORARY__isLightColorThemeEnabled
|
|
1632
|
-
}
|
|
1633
|
-
/>
|
|
1634
|
-
</div>
|
|
1635
|
-
);
|
|
1636
|
-
},
|
|
1637
|
-
);
|
|
1638
|
-
|
|
1639
|
-
return (
|
|
1640
|
-
<ListEditor
|
|
1641
|
-
title="Featured Elements"
|
|
1642
|
-
prompt="Add classes and associations to display under Models Documentation. Use the exclude checkbox to exclude certain elements from this Data Product entirely."
|
|
1643
|
-
items={group.featuredElements}
|
|
1644
|
-
keySelector={(element: DataProductElementScope) =>
|
|
1645
|
-
element.element.value.path
|
|
1646
|
-
}
|
|
1647
|
-
ItemComponent={ElementComponent}
|
|
1648
|
-
NewItemComponent={NewElementComponent}
|
|
1649
|
-
handleRemoveItem={handleRemoveElement}
|
|
1650
|
-
isReadOnly={isReadOnly}
|
|
1651
|
-
emptyMessage="No elements specified"
|
|
1652
|
-
/>
|
|
1653
|
-
);
|
|
1654
|
-
},
|
|
1655
|
-
);
|
|
1656
|
-
|
|
1657
1380
|
const ModelAccessPointGroupEditor = observer(
|
|
1658
1381
|
(props: { groupState: ModelAccessPointGroupState; isReadOnly: boolean }) => {
|
|
1659
1382
|
const { groupState, isReadOnly } = props;
|
|
@@ -1718,11 +1441,6 @@ const ModelAccessPointGroupEditor = observer(
|
|
|
1718
1441
|
<LongArrowRightIcon />
|
|
1719
1442
|
</button>
|
|
1720
1443
|
</div>
|
|
1721
|
-
<FeaturedElementsEditor
|
|
1722
|
-
groupState={groupState}
|
|
1723
|
-
isReadOnly={isReadOnly}
|
|
1724
|
-
/>
|
|
1725
|
-
<CompatibleDiagramsEditor groupState={groupState} />
|
|
1726
1444
|
</div>
|
|
1727
1445
|
);
|
|
1728
1446
|
},
|
package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts
CHANGED
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
type AppDirNode,
|
|
19
19
|
type ArtifactGenerationExtensionResult,
|
|
20
20
|
type BatchLambdasRelationTypeResult,
|
|
21
|
-
type DataProductElement,
|
|
22
21
|
type IngestDefinition,
|
|
23
22
|
type Mapping,
|
|
24
23
|
type PackageableElement,
|
|
@@ -33,15 +32,10 @@ import {
|
|
|
33
32
|
AccessPoint,
|
|
34
33
|
AccessPointGroup,
|
|
35
34
|
AppDirOwner,
|
|
36
|
-
Association,
|
|
37
|
-
Class,
|
|
38
35
|
CodeCompletionResult,
|
|
39
36
|
DataElement,
|
|
40
37
|
DataElementReference,
|
|
41
38
|
DataProduct,
|
|
42
|
-
DataProductDiagram,
|
|
43
|
-
DataProductElementScope,
|
|
44
|
-
Enumeration,
|
|
45
39
|
Expertise,
|
|
46
40
|
getStereotype,
|
|
47
41
|
GRAPH_MANAGER_EVENT,
|
|
@@ -50,11 +44,8 @@ import {
|
|
|
50
44
|
LakehouseTargetEnv,
|
|
51
45
|
LAMBDA_PIPE,
|
|
52
46
|
ModelAccessPointGroup,
|
|
53
|
-
observe_DataProductDiagram,
|
|
54
|
-
observe_DataProductElementScope,
|
|
55
47
|
observe_RelationElement,
|
|
56
48
|
observe_RelationElementsData,
|
|
57
|
-
Package,
|
|
58
49
|
PackageableElementExplicitReference,
|
|
59
50
|
ParserError,
|
|
60
51
|
RelationElement,
|
|
@@ -97,11 +88,6 @@ import {
|
|
|
97
88
|
dataProduct_deleteAccessPointGroup,
|
|
98
89
|
dataProduct_setSupportInfoIfAbsent,
|
|
99
90
|
dataProduct_swapAccessPointGroups,
|
|
100
|
-
modelAccessPointGroup_addDiagram,
|
|
101
|
-
modelAccessPointGroup_addElement,
|
|
102
|
-
modelAccessPointGroup_removeDiagram,
|
|
103
|
-
modelAccessPointGroup_removeElement,
|
|
104
|
-
modelAccessPointGroup_setElementExclude,
|
|
105
91
|
modelAccessPointGroup_setMapping,
|
|
106
92
|
supportInfo_addExpertise,
|
|
107
93
|
} from '../../../../graph-modifier/DSL_DataProduct_GraphModifierHelper.js';
|
|
@@ -116,9 +102,7 @@ import type {
|
|
|
116
102
|
AdhocDataProductDeployResponse,
|
|
117
103
|
LakehouseIngestionManager,
|
|
118
104
|
} from '@finos/legend-server-lakehouse';
|
|
119
|
-
import { Diagram } from '@finos/legend-extension-dsl-diagram';
|
|
120
105
|
import { LegendStudioTelemetryHelper } from '../../../../../__lib__/LegendStudioTelemetryHelper.js';
|
|
121
|
-
import { onGeneratingDiagramFromMapping } from '../mapping/MappingEditorState.js';
|
|
122
106
|
|
|
123
107
|
export enum DATA_PRODUCT_TAB {
|
|
124
108
|
HOME = 'Home',
|
|
@@ -764,16 +748,11 @@ export class AccessPointGroupState {
|
|
|
764
748
|
export class ModelAccessPointGroupState extends AccessPointGroupState {
|
|
765
749
|
declare value: ModelAccessPointGroup;
|
|
766
750
|
readonly editorState: DataProductEditorState;
|
|
767
|
-
showNewModal = false;
|
|
768
751
|
|
|
769
752
|
constructor(val: ModelAccessPointGroup, editorState: DataProductEditorState) {
|
|
770
753
|
super(val, editorState);
|
|
771
754
|
this.value = val;
|
|
772
755
|
this.editorState = editorState;
|
|
773
|
-
|
|
774
|
-
makeObservable(this, {
|
|
775
|
-
generateDiagramFromMapping: flow,
|
|
776
|
-
});
|
|
777
756
|
}
|
|
778
757
|
|
|
779
758
|
override hasErrors(): boolean {
|
|
@@ -781,8 +760,7 @@ export class ModelAccessPointGroupState extends AccessPointGroupState {
|
|
|
781
760
|
this.value.id === '' ||
|
|
782
761
|
!this.value.description ||
|
|
783
762
|
!this.value.title ||
|
|
784
|
-
this.value.mapping.value.path === ''
|
|
785
|
-
this.value.diagrams.length === 0
|
|
763
|
+
this.value.mapping.value.path === ''
|
|
786
764
|
);
|
|
787
765
|
}
|
|
788
766
|
|
|
@@ -792,145 +770,6 @@ export class ModelAccessPointGroupState extends AccessPointGroupState {
|
|
|
792
770
|
PackageableElementExplicitReference.create(mapping),
|
|
793
771
|
);
|
|
794
772
|
}
|
|
795
|
-
|
|
796
|
-
getCompatibleDiagramOptions(): {
|
|
797
|
-
label: string;
|
|
798
|
-
value: PackageableElement;
|
|
799
|
-
}[] {
|
|
800
|
-
const currentDiagrams = this.value.diagrams.map(
|
|
801
|
-
(diagram) => diagram.diagram,
|
|
802
|
-
);
|
|
803
|
-
|
|
804
|
-
return this.state.editorStore.graphManagerState.graph.allOwnElements
|
|
805
|
-
.filter((element): element is Diagram => element instanceof Diagram)
|
|
806
|
-
.filter((diagram) => !currentDiagrams.includes(diagram))
|
|
807
|
-
.map((diagram) => ({
|
|
808
|
-
label: diagram.path,
|
|
809
|
-
value: diagram,
|
|
810
|
-
}));
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
collectFeaturedClasses = (
|
|
814
|
-
element: PackageableElement,
|
|
815
|
-
excludedPaths: string[],
|
|
816
|
-
elements: Set<Class>,
|
|
817
|
-
): void => {
|
|
818
|
-
if (excludedPaths.includes(element.path)) {
|
|
819
|
-
return;
|
|
820
|
-
}
|
|
821
|
-
if (element instanceof Class) {
|
|
822
|
-
elements.add(element);
|
|
823
|
-
} else if (element instanceof Package) {
|
|
824
|
-
this.collectClassesFromPackage(element, excludedPaths, elements);
|
|
825
|
-
}
|
|
826
|
-
};
|
|
827
|
-
|
|
828
|
-
collectClassesFromPackage = (
|
|
829
|
-
element: Package,
|
|
830
|
-
excludedPaths: string[],
|
|
831
|
-
elements: Set<Class>,
|
|
832
|
-
): void => {
|
|
833
|
-
element.children.forEach((child) => {
|
|
834
|
-
if (excludedPaths.includes(child.path)) {
|
|
835
|
-
return;
|
|
836
|
-
}
|
|
837
|
-
if (child instanceof Class) {
|
|
838
|
-
elements.add(child);
|
|
839
|
-
} else if (child instanceof Package) {
|
|
840
|
-
this.collectClassesFromPackage(child, excludedPaths, elements);
|
|
841
|
-
}
|
|
842
|
-
});
|
|
843
|
-
};
|
|
844
|
-
|
|
845
|
-
addDiagram = (option: { label: string; value: PackageableElement }): void => {
|
|
846
|
-
const diagramValue = option.value;
|
|
847
|
-
const newDiagram = observe_DataProductDiagram(new DataProductDiagram());
|
|
848
|
-
newDiagram.title = diagramValue.name;
|
|
849
|
-
newDiagram.diagram = diagramValue;
|
|
850
|
-
modelAccessPointGroup_addDiagram(this.value, newDiagram);
|
|
851
|
-
};
|
|
852
|
-
|
|
853
|
-
handleRemoveDiagram = (diagram: DataProductDiagram): void => {
|
|
854
|
-
modelAccessPointGroup_removeDiagram(this.value, diagram);
|
|
855
|
-
};
|
|
856
|
-
|
|
857
|
-
*generateDiagramFromMapping(): GeneratorFn<void> {
|
|
858
|
-
const mapping = this.value.mapping.value;
|
|
859
|
-
if (mapping.path === '') {
|
|
860
|
-
return;
|
|
861
|
-
}
|
|
862
|
-
let featuredClasses: Class[] | undefined = undefined;
|
|
863
|
-
if (this.value.featuredElements.length > 0) {
|
|
864
|
-
const includes = this.value.featuredElements
|
|
865
|
-
.filter((el) => el.exclude === undefined || el.exclude === false)
|
|
866
|
-
.map((el) => el.element.value);
|
|
867
|
-
const excludedPaths = this.value.featuredElements
|
|
868
|
-
.filter((el) => el.exclude !== undefined && el.exclude === true)
|
|
869
|
-
.map((el) => el.element.value.path);
|
|
870
|
-
const elements = new Set<Class>();
|
|
871
|
-
includes.forEach((element) => {
|
|
872
|
-
this.collectFeaturedClasses(element, excludedPaths, elements);
|
|
873
|
-
});
|
|
874
|
-
featuredClasses = Array.from(elements);
|
|
875
|
-
}
|
|
876
|
-
const diagram = (yield flowResult(
|
|
877
|
-
onGeneratingDiagramFromMapping(
|
|
878
|
-
mapping,
|
|
879
|
-
this.state.editorStore,
|
|
880
|
-
featuredClasses,
|
|
881
|
-
),
|
|
882
|
-
)) as Diagram | undefined;
|
|
883
|
-
if (diagram) {
|
|
884
|
-
const newDiagram = observe_DataProductDiagram(new DataProductDiagram());
|
|
885
|
-
newDiagram.title = diagram.name;
|
|
886
|
-
newDiagram.diagram = diagram;
|
|
887
|
-
modelAccessPointGroup_addDiagram(this.value, newDiagram);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
addFeaturedElement(element: DataProductElement): void {
|
|
892
|
-
const elementPointer = observe_DataProductElementScope(
|
|
893
|
-
new DataProductElementScope(),
|
|
894
|
-
);
|
|
895
|
-
elementPointer.element =
|
|
896
|
-
PackageableElementExplicitReference.create(element);
|
|
897
|
-
modelAccessPointGroup_addElement(this.value, elementPointer);
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
removeFeaturedElement(element: DataProductElementScope): void {
|
|
901
|
-
modelAccessPointGroup_removeElement(this.value, element);
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
excludeFeaturedElement(
|
|
905
|
-
element: DataProductElementScope,
|
|
906
|
-
value: boolean,
|
|
907
|
-
): void {
|
|
908
|
-
modelAccessPointGroup_setElementExclude(element, value);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
isValidDataProductElement(
|
|
912
|
-
element: PackageableElement,
|
|
913
|
-
): element is DataProductElement {
|
|
914
|
-
return (
|
|
915
|
-
element instanceof Package ||
|
|
916
|
-
element instanceof Class ||
|
|
917
|
-
element instanceof Enumeration ||
|
|
918
|
-
element instanceof Association
|
|
919
|
-
);
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
getFeaturedElementOptions(): { label: string; value: DataProductElement }[] {
|
|
923
|
-
const currentElements = this.value.featuredElements.map(
|
|
924
|
-
(elementPointer) => elementPointer.element.value,
|
|
925
|
-
);
|
|
926
|
-
return this.state.editorStore.graphManagerState.graph.allOwnElements
|
|
927
|
-
.filter((element) => this.isValidDataProductElement(element))
|
|
928
|
-
.filter((element) => !currentElements.includes(element))
|
|
929
|
-
.map((element) => ({
|
|
930
|
-
label: element.path,
|
|
931
|
-
value: element,
|
|
932
|
-
}));
|
|
933
|
-
}
|
|
934
773
|
}
|
|
935
774
|
|
|
936
775
|
const createEditorInitialConfiguration = (): EditorInitialConfiguration => {
|
|
@@ -32,8 +32,6 @@ import {
|
|
|
32
32
|
type PackageableElementReference,
|
|
33
33
|
type Mapping,
|
|
34
34
|
type ModelAccessPointGroup,
|
|
35
|
-
type DataProductDiagram,
|
|
36
|
-
type DataProductElementScope,
|
|
37
35
|
observe_APG,
|
|
38
36
|
type DataProductType,
|
|
39
37
|
type ExternalDataProductType,
|
|
@@ -113,48 +111,6 @@ export const modelAccessPointGroup_setMapping = action(
|
|
|
113
111
|
},
|
|
114
112
|
);
|
|
115
113
|
|
|
116
|
-
export const modelAccessPointGroup_addElement = action(
|
|
117
|
-
(group: ModelAccessPointGroup, element: DataProductElementScope): void => {
|
|
118
|
-
addUniqueEntry(group.featuredElements, element);
|
|
119
|
-
},
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
export const modelAccessPointGroup_removeElement = action(
|
|
123
|
-
(group: ModelAccessPointGroup, element: DataProductElementScope): void => {
|
|
124
|
-
deleteEntry(group.featuredElements, element);
|
|
125
|
-
},
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
export const modelAccessPointGroup_setElementExclude = action(
|
|
129
|
-
(element: DataProductElementScope, exclude: boolean): void => {
|
|
130
|
-
element.exclude = exclude;
|
|
131
|
-
},
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
export const modelAccessPointGroup_addDiagram = action(
|
|
135
|
-
(group: ModelAccessPointGroup, diagram: DataProductDiagram): void => {
|
|
136
|
-
addUniqueEntry(group.diagrams, diagram);
|
|
137
|
-
},
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
export const modelAccessPointGroup_removeDiagram = action(
|
|
141
|
-
(group: ModelAccessPointGroup, diagram: DataProductDiagram): void => {
|
|
142
|
-
deleteEntry(group.diagrams, diagram);
|
|
143
|
-
},
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
export const dataProductDiagram_setTitle = action(
|
|
147
|
-
(diagram: DataProductDiagram, title: string): void => {
|
|
148
|
-
diagram.title = title;
|
|
149
|
-
},
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
export const dataProductDiagram_setDescription = action(
|
|
153
|
-
(diagram: DataProductDiagram, desc: string | undefined): void => {
|
|
154
|
-
diagram.description = desc;
|
|
155
|
-
},
|
|
156
|
-
);
|
|
157
|
-
|
|
158
114
|
export const runtimeInfo_setId = action(
|
|
159
115
|
(runtimeInfo: DataProductRuntimeInfo, id: string): void => {
|
|
160
116
|
runtimeInfo.id = id;
|