@openchoreo/cell-diagram 1.2.0-rc.1
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/CHANGELOG.md +10 -0
- package/README.md +115 -0
- package/dist/Diagram.esm.js +55 -0
- package/dist/Diagram.esm.js.map +1 -0
- package/dist/components/Cell/CellLink/CellLinkFactory.esm.js +19 -0
- package/dist/components/Cell/CellLink/CellLinkFactory.esm.js.map +1 -0
- package/dist/components/Cell/CellLink/CellLinkModel.esm.js +59 -0
- package/dist/components/Cell/CellLink/CellLinkModel.esm.js.map +1 -0
- package/dist/components/Cell/CellLink/CellLinkWidget.esm.js +217 -0
- package/dist/components/Cell/CellLink/CellLinkWidget.esm.js.map +1 -0
- package/dist/components/Cell/CellNode/CellFactory.esm.js +19 -0
- package/dist/components/Cell/CellNode/CellFactory.esm.js.map +1 -0
- package/dist/components/Cell/CellNode/CellModel.esm.js +73 -0
- package/dist/components/Cell/CellNode/CellModel.esm.js.map +1 -0
- package/dist/components/Cell/CellNode/CellWidget.esm.js +166 -0
- package/dist/components/Cell/CellNode/CellWidget.esm.js.map +1 -0
- package/dist/components/Cell/CellNode/styles.esm.js +149 -0
- package/dist/components/Cell/CellNode/styles.esm.js.map +1 -0
- package/dist/components/Cell/CellPort/CellPortFactory.esm.js +17 -0
- package/dist/components/Cell/CellPort/CellPortFactory.esm.js.map +1 -0
- package/dist/components/Cell/CellPort/CellPortModel.esm.js +18 -0
- package/dist/components/Cell/CellPort/CellPortModel.esm.js.map +1 -0
- package/dist/components/Cell/CellPort/CellPortWidget.esm.js +24 -0
- package/dist/components/Cell/CellPort/CellPortWidget.esm.js.map +1 -0
- package/dist/components/Cell/CellPort/styles.esm.js +13 -0
- package/dist/components/Cell/CellPort/styles.esm.js.map +1 -0
- package/dist/components/Cell/EmptyNode/EmptyFactory.esm.js +20 -0
- package/dist/components/Cell/EmptyNode/EmptyFactory.esm.js.map +1 -0
- package/dist/components/Cell/EmptyNode/EmptyModel.esm.js +25 -0
- package/dist/components/Cell/EmptyNode/EmptyModel.esm.js.map +1 -0
- package/dist/components/Cell/EmptyNode/EmptyWidget.esm.js +52 -0
- package/dist/components/Cell/EmptyNode/EmptyWidget.esm.js.map +1 -0
- package/dist/components/Cell/EmptyNode/styles.esm.js +12 -0
- package/dist/components/Cell/EmptyNode/styles.esm.js.map +1 -0
- package/dist/components/Cell/cell-util.esm.js +110 -0
- package/dist/components/Cell/cell-util.esm.js.map +1 -0
- package/dist/components/Component/ComponentLink/ComponentLinkFactory.esm.js +19 -0
- package/dist/components/Component/ComponentLink/ComponentLinkFactory.esm.js.map +1 -0
- package/dist/components/Component/ComponentLink/ComponentLinkModel.esm.js +20 -0
- package/dist/components/Component/ComponentLink/ComponentLinkModel.esm.js.map +1 -0
- package/dist/components/Component/ComponentLink/ComponentLinkWidget.esm.js +205 -0
- package/dist/components/Component/ComponentLink/ComponentLinkWidget.esm.js.map +1 -0
- package/dist/components/Component/ComponentNode/ComponentFactory.esm.js +20 -0
- package/dist/components/Component/ComponentNode/ComponentFactory.esm.js.map +1 -0
- package/dist/components/Component/ComponentNode/ComponentHead/ComponentHead.esm.js +97 -0
- package/dist/components/Component/ComponentNode/ComponentHead/ComponentHead.esm.js.map +1 -0
- package/dist/components/Component/ComponentNode/ComponentModel.esm.js +26 -0
- package/dist/components/Component/ComponentNode/ComponentModel.esm.js.map +1 -0
- package/dist/components/Component/ComponentNode/ComponentWidget.esm.js +158 -0
- package/dist/components/Component/ComponentNode/ComponentWidget.esm.js.map +1 -0
- package/dist/components/Component/ComponentNode/styles.esm.js +102 -0
- package/dist/components/Component/ComponentNode/styles.esm.js.map +1 -0
- package/dist/components/Component/ComponentPort/ComponentPortFactory.esm.js +17 -0
- package/dist/components/Component/ComponentPort/ComponentPortFactory.esm.js.map +1 -0
- package/dist/components/Component/ComponentPort/ComponentPortModel.esm.js +18 -0
- package/dist/components/Component/ComponentPort/ComponentPortModel.esm.js.map +1 -0
- package/dist/components/Component/ComponentPort/ComponentPortWidget.esm.js +24 -0
- package/dist/components/Component/ComponentPort/ComponentPortWidget.esm.js.map +1 -0
- package/dist/components/Component/ComponentPort/styles.esm.js +16 -0
- package/dist/components/Component/ComponentPort/styles.esm.js.map +1 -0
- package/dist/components/Component/component-node-util.esm.js +15 -0
- package/dist/components/Component/component-node-util.esm.js.map +1 -0
- package/dist/components/Connection/ConnectionNode/ConnectionFactory.esm.js +20 -0
- package/dist/components/Connection/ConnectionNode/ConnectionFactory.esm.js.map +1 -0
- package/dist/components/Connection/ConnectionNode/ConnectionHead/ConnectionHead.esm.js +68 -0
- package/dist/components/Connection/ConnectionNode/ConnectionHead/ConnectionHead.esm.js.map +1 -0
- package/dist/components/Connection/ConnectionNode/ConnectionModel.esm.js +29 -0
- package/dist/components/Connection/ConnectionNode/ConnectionModel.esm.js.map +1 -0
- package/dist/components/Connection/ConnectionNode/ConnectionWidget.esm.js +51 -0
- package/dist/components/Connection/ConnectionNode/ConnectionWidget.esm.js.map +1 -0
- package/dist/components/Connection/ConnectionNode/styles.esm.js +64 -0
- package/dist/components/Connection/ConnectionNode/styles.esm.js.map +1 -0
- package/dist/components/Connection/ConnectionPort/ConnectionPortFactory.esm.js +17 -0
- package/dist/components/Connection/ConnectionPort/ConnectionPortFactory.esm.js.map +1 -0
- package/dist/components/Connection/ConnectionPort/ConnectionPortModel.esm.js +18 -0
- package/dist/components/Connection/ConnectionPort/ConnectionPortModel.esm.js.map +1 -0
- package/dist/components/Connection/ConnectionPort/ConnectionPortWidget.esm.js +24 -0
- package/dist/components/Connection/ConnectionPort/ConnectionPortWidget.esm.js.map +1 -0
- package/dist/components/Connection/ConnectionPort/styles.esm.js +13 -0
- package/dist/components/Connection/ConnectionPort/styles.esm.js.map +1 -0
- package/dist/components/Connection/connection-node-util.esm.js +12 -0
- package/dist/components/Connection/connection-node-util.esm.js.map +1 -0
- package/dist/components/Controls/ControlButtons/ControlButton.esm.js +54 -0
- package/dist/components/Controls/ControlButtons/ControlButton.esm.js.map +1 -0
- package/dist/components/Controls/ControlButtons/style.esm.js +19 -0
- package/dist/components/Controls/ControlButtons/style.esm.js.map +1 -0
- package/dist/components/Controls/DiagramControls.esm.js +88 -0
- package/dist/components/Controls/DiagramControls.esm.js.map +1 -0
- package/dist/components/Controls/DiagramLayers.esm.js +166 -0
- package/dist/components/Controls/DiagramLayers.esm.js.map +1 -0
- package/dist/components/Controls/DiagramLegend.esm.js +242 -0
- package/dist/components/Controls/DiagramLegend.esm.js.map +1 -0
- package/dist/components/Controls/LayerButton.esm.js +96 -0
- package/dist/components/Controls/LayerButton.esm.js.map +1 -0
- package/dist/components/DiagramContext/DiagramContext.esm.js +47 -0
- package/dist/components/DiagramContext/DiagramContext.esm.js.map +1 -0
- package/dist/components/External/ExternalLink/ExternalLinkFactory.esm.js +19 -0
- package/dist/components/External/ExternalLink/ExternalLinkFactory.esm.js.map +1 -0
- package/dist/components/External/ExternalLink/ExternalLinkModel.esm.js +112 -0
- package/dist/components/External/ExternalLink/ExternalLinkModel.esm.js.map +1 -0
- package/dist/components/External/ExternalLink/ExternalLinkWidget.esm.js +68 -0
- package/dist/components/External/ExternalLink/ExternalLinkWidget.esm.js.map +1 -0
- package/dist/components/External/ExternalNode/ExternalFactory.esm.js +20 -0
- package/dist/components/External/ExternalNode/ExternalFactory.esm.js.map +1 -0
- package/dist/components/External/ExternalNode/ExternalModel.esm.js +20 -0
- package/dist/components/External/ExternalNode/ExternalModel.esm.js.map +1 -0
- package/dist/components/External/ExternalNode/ExternalWidget.esm.js +40 -0
- package/dist/components/External/ExternalNode/ExternalWidget.esm.js.map +1 -0
- package/dist/components/External/ExternalNode/styles.esm.js +9 -0
- package/dist/components/External/ExternalNode/styles.esm.js.map +1 -0
- package/dist/components/External/external-node-util.esm.js +12 -0
- package/dist/components/External/external-node-util.esm.js.map +1 -0
- package/dist/components/Header/Header.esm.js +17 -0
- package/dist/components/Header/Header.esm.js.map +1 -0
- package/dist/components/MoreVertMenu/MoreVertMenu.esm.js +81 -0
- package/dist/components/MoreVertMenu/MoreVertMenu.esm.js.map +1 -0
- package/dist/components/ObservationLabel/ObservationLabel.esm.js +102 -0
- package/dist/components/ObservationLabel/ObservationLabel.esm.js.map +1 -0
- package/dist/components/OverlayLoader/OverlayLayerFactory.esm.js +19 -0
- package/dist/components/OverlayLoader/OverlayLayerFactory.esm.js.map +1 -0
- package/dist/components/OverlayLoader/OverlayLayerModel.esm.js +15 -0
- package/dist/components/OverlayLoader/OverlayLayerModel.esm.js.map +1 -0
- package/dist/components/OverlayLoader/OverlayLayerWidget.esm.js +28 -0
- package/dist/components/OverlayLoader/OverlayLayerWidget.esm.js.map +1 -0
- package/dist/components/Project/AdvancedLink/AdvancedLinkFactory.esm.js +69 -0
- package/dist/components/Project/AdvancedLink/AdvancedLinkFactory.esm.js.map +1 -0
- package/dist/components/Project/AdvancedLink/AdvancedLinkModel.esm.js +162 -0
- package/dist/components/Project/AdvancedLink/AdvancedLinkModel.esm.js.map +1 -0
- package/dist/components/Project/AdvancedLink/AdvancedLinkPointWidget.esm.js +45 -0
- package/dist/components/Project/AdvancedLink/AdvancedLinkPointWidget.esm.js.map +1 -0
- package/dist/components/Project/AdvancedLink/AdvancedLinkSegmentWidget.esm.js +46 -0
- package/dist/components/Project/AdvancedLink/AdvancedLinkSegmentWidget.esm.js.map +1 -0
- package/dist/components/Project/AdvancedLink/AdvancedLinkWidget.esm.js +149 -0
- package/dist/components/Project/AdvancedLink/AdvancedLinkWidget.esm.js.map +1 -0
- package/dist/components/Project/ProjectLink/ProjectLinkFactory.esm.js +20 -0
- package/dist/components/Project/ProjectLink/ProjectLinkFactory.esm.js.map +1 -0
- package/dist/components/Project/ProjectLink/ProjectLinkModel.esm.js +20 -0
- package/dist/components/Project/ProjectLink/ProjectLinkModel.esm.js.map +1 -0
- package/dist/components/Project/ProjectLink/ProjectLinkWidget.esm.js +94 -0
- package/dist/components/Project/ProjectLink/ProjectLinkWidget.esm.js.map +1 -0
- package/dist/components/Project/ProjectNode/ProjectFactory.esm.js +20 -0
- package/dist/components/Project/ProjectNode/ProjectFactory.esm.js.map +1 -0
- package/dist/components/Project/ProjectNode/ProjectHeadWidget/ProjectHeadWidget.esm.js +68 -0
- package/dist/components/Project/ProjectNode/ProjectHeadWidget/ProjectHeadWidget.esm.js.map +1 -0
- package/dist/components/Project/ProjectNode/ProjectModel.esm.js +56 -0
- package/dist/components/Project/ProjectNode/ProjectModel.esm.js.map +1 -0
- package/dist/components/Project/ProjectNode/ProjectWidget.esm.js +111 -0
- package/dist/components/Project/ProjectNode/ProjectWidget.esm.js.map +1 -0
- package/dist/components/Project/ProjectNode/styles.esm.js +66 -0
- package/dist/components/Project/ProjectNode/styles.esm.js.map +1 -0
- package/dist/components/Project/ProjectPort/ProjectPortFactory.esm.js +17 -0
- package/dist/components/Project/ProjectPort/ProjectPortFactory.esm.js.map +1 -0
- package/dist/components/Project/ProjectPort/ProjectPortModel.esm.js +18 -0
- package/dist/components/Project/ProjectPort/ProjectPortModel.esm.js.map +1 -0
- package/dist/components/Project/ProjectPort/ProjectPortWidget.esm.js +26 -0
- package/dist/components/Project/ProjectPort/ProjectPortWidget.esm.js.map +1 -0
- package/dist/components/Project/ProjectPort/styles.esm.js +38 -0
- package/dist/components/Project/ProjectPort/styles.esm.js.map +1 -0
- package/dist/components/PromptScreen/PromptScreen.esm.js +30 -0
- package/dist/components/PromptScreen/PromptScreen.esm.js.map +1 -0
- package/dist/components/SharedLink/SharedLink.esm.js +175 -0
- package/dist/components/SharedLink/SharedLink.esm.js.map +1 -0
- package/dist/components/SharedNode/SharedNode.esm.js +44 -0
- package/dist/components/SharedNode/SharedNode.esm.js.map +1 -0
- package/dist/components/TooltipLabel/TooltipLabel.esm.js +22 -0
- package/dist/components/TooltipLabel/TooltipLabel.esm.js.map +1 -0
- package/dist/diagrams/OrgDiagram.esm.js +176 -0
- package/dist/diagrams/OrgDiagram.esm.js.map +1 -0
- package/dist/diagrams/ProjectDiagram.esm.js +251 -0
- package/dist/diagrams/ProjectDiagram.esm.js.map +1 -0
- package/dist/hooks/useActiveLayers.esm.js +27 -0
- package/dist/hooks/useActiveLayers.esm.js.map +1 -0
- package/dist/index.d.ts +407 -0
- package/dist/index.esm.js +4 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/renderDiagram.esm.js +11 -0
- package/dist/renderDiagram.esm.js.map +1 -0
- package/dist/resources/Dagre/DagreEngine.esm.js +178 -0
- package/dist/resources/Dagre/DagreEngine.esm.js.map +1 -0
- package/dist/resources/assets/font/Gilmer-Bold.ttf +0 -0
- package/dist/resources/assets/font/Gilmer-Bold.woff +0 -0
- package/dist/resources/assets/font/Gilmer-Bold.woff2 +0 -0
- package/dist/resources/assets/font/Gilmer-Medium.ttf +0 -0
- package/dist/resources/assets/font/Gilmer-Medium.woff +0 -0
- package/dist/resources/assets/font/Gilmer-Medium.woff2 +0 -0
- package/dist/resources/assets/font/Gilmer-Regular.ttf +0 -0
- package/dist/resources/assets/font/Gilmer-Regular.woff +0 -0
- package/dist/resources/assets/font/Gilmer-Regular.woff2 +0 -0
- package/dist/resources/assets/font/fonts.esm.js +57 -0
- package/dist/resources/assets/font/fonts.esm.js.map +1 -0
- package/dist/resources/assets/icons/AddCheckIcon.esm.js +22 -0
- package/dist/resources/assets/icons/AddCheckIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/AddIcon.esm.js +16 -0
- package/dist/resources/assets/icons/AddIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/CodeIcon.esm.js +26 -0
- package/dist/resources/assets/icons/CodeIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/ConnectionIcon.esm.js +22 -0
- package/dist/resources/assets/icons/ConnectionIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/DatabaseIcon.esm.js +23 -0
- package/dist/resources/assets/icons/DatabaseIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/DebugIcon.esm.js +25 -0
- package/dist/resources/assets/icons/DebugIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/DiagramIcon.esm.js +22 -0
- package/dist/resources/assets/icons/DiagramIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/DiffIcon.esm.js +22 -0
- package/dist/resources/assets/icons/DiffIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/EventIcon.esm.js +22 -0
- package/dist/resources/assets/icons/EventIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/ExternalConsumerIcon.esm.js +36 -0
- package/dist/resources/assets/icons/ExternalConsumerIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/FitScreenIcon.esm.js +22 -0
- package/dist/resources/assets/icons/FitScreenIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/FullScreenIcon.esm.js +22 -0
- package/dist/resources/assets/icons/FullScreenIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/GatewayIcon.esm.js +22 -0
- package/dist/resources/assets/icons/GatewayIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/InfoIcon.esm.js +22 -0
- package/dist/resources/assets/icons/InfoIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/LayersIcon.esm.js +28 -0
- package/dist/resources/assets/icons/LayersIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/ManualTaskIcon.esm.js +22 -0
- package/dist/resources/assets/icons/ManualTaskIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/MoreVertIcon.esm.js +18 -0
- package/dist/resources/assets/icons/MoreVertIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/ObservationIcon.esm.js +22 -0
- package/dist/resources/assets/icons/ObservationIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/ProxyIcon.esm.js +22 -0
- package/dist/resources/assets/icons/ProxyIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/RefreshIcon.esm.js +22 -0
- package/dist/resources/assets/icons/RefreshIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/RemoveIcon.esm.js +16 -0
- package/dist/resources/assets/icons/RemoveIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/ScheduledTaskIcon.esm.js +22 -0
- package/dist/resources/assets/icons/ScheduledTaskIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/ServiceIcon.esm.js +24 -0
- package/dist/resources/assets/icons/ServiceIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/SettingsIcon.esm.js +38 -0
- package/dist/resources/assets/icons/SettingsIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/WarningIcon.esm.js +32 -0
- package/dist/resources/assets/icons/WarningIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/WebAppIcon.esm.js +45 -0
- package/dist/resources/assets/icons/WebAppIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/WebhookIcon.esm.js +22 -0
- package/dist/resources/assets/icons/WebhookIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/index.esm.js +38 -0
- package/dist/resources/assets/icons/index.esm.js.map +1 -0
- package/dist/resources/assets/icons/lang/BallerinaIcon.esm.js +24 -0
- package/dist/resources/assets/icons/lang/BallerinaIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/lang/DockerIcon.esm.js +24 -0
- package/dist/resources/assets/icons/lang/DockerIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/lang/GoIcon.esm.js +24 -0
- package/dist/resources/assets/icons/lang/GoIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/lang/JavaIcon.esm.js +54 -0
- package/dist/resources/assets/icons/lang/JavaIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/lang/MIIcon.esm.js +75 -0
- package/dist/resources/assets/icons/lang/MIIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/lang/NodeJsIcon.esm.js +33 -0
- package/dist/resources/assets/icons/lang/NodeJsIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/lang/PhpIcon.esm.js +74 -0
- package/dist/resources/assets/icons/lang/PhpIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/lang/PythonIcon.esm.js +67 -0
- package/dist/resources/assets/icons/lang/PythonIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/lang/RubyIcon.esm.js +26 -0
- package/dist/resources/assets/icons/lang/RubyIcon.esm.js.map +1 -0
- package/dist/resources/assets/icons/lang/RustIcon.esm.js +46 -0
- package/dist/resources/assets/icons/lang/RustIcon.esm.js.map +1 -0
- package/dist/resources/constants.esm.js +44 -0
- package/dist/resources/constants.esm.js.map +1 -0
- package/dist/theme/CellDiagramThemeProvider.esm.js +37 -0
- package/dist/theme/CellDiagramThemeProvider.esm.js.map +1 -0
- package/dist/theme/ThemeContext.esm.js +14 -0
- package/dist/theme/ThemeContext.esm.js.map +1 -0
- package/dist/theme/colors.esm.js +50 -0
- package/dist/theme/colors.esm.js.map +1 -0
- package/dist/types.esm.js +30 -0
- package/dist/types.esm.js.map +1 -0
- package/dist/utils/CanvasStyles.esm.js +67 -0
- package/dist/utils/CanvasStyles.esm.js.map +1 -0
- package/dist/utils/diagramUtils.esm.js +151 -0
- package/dist/utils/diagramUtils.esm.js.map +1 -0
- package/dist/utils/orgUtils.esm.js +119 -0
- package/dist/utils/orgUtils.esm.js.map +1 -0
- package/dist/utils/projectUtils.esm.js +969 -0
- package/dist/utils/projectUtils.esm.js.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1,969 @@
|
|
|
1
|
+
import { DiagramModel, PortModelAlignment } from '@projectstorm/react-diagrams';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import '@projectstorm/react-canvas-core';
|
|
4
|
+
import { COMPONENT_NODE, CONNECTION_NODE, MAIN_CELL, CIRCLE_WIDTH, LINE_MIN_WIDTH, DIAGRAM_END, DOT_WIDTH, BORDER_NODE, BORDER_GAP, MAIN_CELL_DEFAULT_HEIGHT } from '../resources/constants.esm.js';
|
|
5
|
+
import 'gsap';
|
|
6
|
+
import { CellBounds } from '../components/Cell/CellNode/CellModel.esm.js';
|
|
7
|
+
import '@projectstorm/react-diagrams-core';
|
|
8
|
+
import '@projectstorm/geometry';
|
|
9
|
+
import '@projectstorm/react-diagrams-defaults';
|
|
10
|
+
import { ConnectionType, ComponentType } from '../types.esm.js';
|
|
11
|
+
import { getEmptyNodeName, getNodePortId, getCellLinkName, getCellPortMetadata } from '../components/Cell/cell-util.esm.js';
|
|
12
|
+
import { ConnectionModel, Orientation } from '../components/Connection/ConnectionNode/ConnectionModel.esm.js';
|
|
13
|
+
import { getComponentName, getComponentNameById, getComponentLinkName } from '../components/Component/component-node-util.esm.js';
|
|
14
|
+
import { getConnectionNameById } from '../components/Connection/connection-node-util.esm.js';
|
|
15
|
+
import { getExternalLinkName, getExternalNodeName } from '../components/External/external-node-util.esm.js';
|
|
16
|
+
import { DagreEngine } from '../resources/Dagre/DagreEngine.esm.js';
|
|
17
|
+
import 'react';
|
|
18
|
+
import '@mui/material/Fade';
|
|
19
|
+
import '@mui/material/Box';
|
|
20
|
+
import '@mui/material/Tooltip';
|
|
21
|
+
import '@mui/icons-material/OpenInNewRounded';
|
|
22
|
+
import '../components/Project/ProjectNode/styles.esm.js';
|
|
23
|
+
import '../components/Project/ProjectPort/styles.esm.js';
|
|
24
|
+
import '../components/Cell/CellNode/styles.esm.js';
|
|
25
|
+
import '../components/DiagramContext/DiagramContext.esm.js';
|
|
26
|
+
import '../theme/ThemeContext.esm.js';
|
|
27
|
+
import '../theme/CellDiagramThemeProvider.esm.js';
|
|
28
|
+
import '../components/SharedLink/SharedLink.esm.js';
|
|
29
|
+
import '../components/Project/AdvancedLink/AdvancedLinkFactory.esm.js';
|
|
30
|
+
import { ComponentModel } from '../components/Component/ComponentNode/ComponentModel.esm.js';
|
|
31
|
+
import '../components/Component/ComponentNode/styles.esm.js';
|
|
32
|
+
import '../components/MoreVertMenu/MoreVertMenu.esm.js';
|
|
33
|
+
import { ComponentLinkModel } from '../components/Component/ComponentLink/ComponentLinkModel.esm.js';
|
|
34
|
+
import '../components/ObservationLabel/ObservationLabel.esm.js';
|
|
35
|
+
import '../components/TooltipLabel/TooltipLabel.esm.js';
|
|
36
|
+
import '@mui/material/Popper';
|
|
37
|
+
import '../components/Connection/ConnectionNode/styles.esm.js';
|
|
38
|
+
import { CellLinkModel } from '../components/Cell/CellLink/CellLinkModel.esm.js';
|
|
39
|
+
import { EmptyModel } from '../components/Cell/EmptyNode/EmptyModel.esm.js';
|
|
40
|
+
import '../components/Cell/EmptyNode/styles.esm.js';
|
|
41
|
+
import { ExternalModel } from '../components/External/ExternalNode/ExternalModel.esm.js';
|
|
42
|
+
import '../components/External/ExternalNode/styles.esm.js';
|
|
43
|
+
import { ExternalLinkModel } from '../components/External/ExternalLink/ExternalLinkModel.esm.js';
|
|
44
|
+
import '../components/OverlayLoader/OverlayLayerWidget.esm.js';
|
|
45
|
+
import '../components/PromptScreen/PromptScreen.esm.js';
|
|
46
|
+
import '../components/Header/Header.esm.js';
|
|
47
|
+
import '../components/Controls/DiagramControls.esm.js';
|
|
48
|
+
|
|
49
|
+
function getDiagramDataFromProject(project) {
|
|
50
|
+
const componentNodes = generateComponentNodes(project);
|
|
51
|
+
const connectorNodes = generateConnectorNodes(project);
|
|
52
|
+
const connectionNodes = generateConnectionNodes(project);
|
|
53
|
+
const externalNodes = generateExternalNodes();
|
|
54
|
+
const emptyNodes = generateEmptyNodes(project.name, [
|
|
55
|
+
...connectionNodes.values(),
|
|
56
|
+
...connectorNodes.values()
|
|
57
|
+
]);
|
|
58
|
+
const gateways = getCellGateways(project);
|
|
59
|
+
const observationSummary = getObservationSummary(project);
|
|
60
|
+
const componentLinks = generateComponentLinks(project, componentNodes);
|
|
61
|
+
const cellLinks = generateCellLinks(
|
|
62
|
+
project,
|
|
63
|
+
emptyNodes,
|
|
64
|
+
componentNodes
|
|
65
|
+
);
|
|
66
|
+
const connectorLinks = generateConnectorLinks(
|
|
67
|
+
emptyNodes,
|
|
68
|
+
connectorNodes
|
|
69
|
+
);
|
|
70
|
+
const connectionLinks = generateConnectionLinks(emptyNodes, connectionNodes);
|
|
71
|
+
const externalLinks = generateExternalLinks(
|
|
72
|
+
emptyNodes,
|
|
73
|
+
externalNodes,
|
|
74
|
+
gateways
|
|
75
|
+
);
|
|
76
|
+
const externalConnectionLinks = generateExternalConnectionLinks(project, componentNodes, connectionNodes);
|
|
77
|
+
return {
|
|
78
|
+
nodes: {
|
|
79
|
+
componentNodes,
|
|
80
|
+
connectionNodes,
|
|
81
|
+
connectorNodes,
|
|
82
|
+
externalNodes,
|
|
83
|
+
emptyNodes
|
|
84
|
+
},
|
|
85
|
+
links: {
|
|
86
|
+
componentLinks,
|
|
87
|
+
cellLinks,
|
|
88
|
+
connectorLinks,
|
|
89
|
+
connectionLinks,
|
|
90
|
+
externalLinks,
|
|
91
|
+
externalConnectionLinks
|
|
92
|
+
},
|
|
93
|
+
gateways,
|
|
94
|
+
observationSummary
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function getComponentDiagramWidth(models) {
|
|
98
|
+
const tempModel = new DiagramModel();
|
|
99
|
+
tempModel.addAll(
|
|
100
|
+
...models.nodes.componentNodes.values(),
|
|
101
|
+
...models.links.componentLinks.values(),
|
|
102
|
+
...models.nodes.emptyNodes.values(),
|
|
103
|
+
...models.links.cellLinks.values()
|
|
104
|
+
);
|
|
105
|
+
const dagreEngine = new DagreEngine({
|
|
106
|
+
graph: {
|
|
107
|
+
rankdir: "LR",
|
|
108
|
+
ranksep: 200,
|
|
109
|
+
edgesep: 100,
|
|
110
|
+
nodesep: 150,
|
|
111
|
+
ranker: "tight-tree"
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
dagreEngine.redistribute(tempModel);
|
|
115
|
+
return calculateCellWidth(tempModel);
|
|
116
|
+
}
|
|
117
|
+
function getComponentDiagramBoundaries(model) {
|
|
118
|
+
let minX = DIAGRAM_END;
|
|
119
|
+
let minY = DIAGRAM_END;
|
|
120
|
+
let maxX = 0;
|
|
121
|
+
let maxY = 0;
|
|
122
|
+
model.getNodes().forEach((node) => {
|
|
123
|
+
if (!isRenderInsideCell(node)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const nodePosition = node.getPosition().clone();
|
|
127
|
+
minX = Math.min(minX, nodePosition.x);
|
|
128
|
+
minY = Math.min(minY, nodePosition.y);
|
|
129
|
+
maxX = Math.max(maxX, nodePosition.x + node.width);
|
|
130
|
+
maxY = Math.max(maxY, nodePosition.y + node.height);
|
|
131
|
+
});
|
|
132
|
+
return { maxX, minX, maxY, minY };
|
|
133
|
+
}
|
|
134
|
+
function calculateCellWidth(model) {
|
|
135
|
+
const { maxX, minX, maxY, minY } = getComponentDiagramBoundaries(model);
|
|
136
|
+
const layoutWidth = Math.max(
|
|
137
|
+
maxX - minX,
|
|
138
|
+
maxY - minY,
|
|
139
|
+
MAIN_CELL_DEFAULT_HEIGHT
|
|
140
|
+
);
|
|
141
|
+
const cellWidth = layoutWidth * 3 / 2;
|
|
142
|
+
return cellWidth;
|
|
143
|
+
}
|
|
144
|
+
function manualDistribute(model) {
|
|
145
|
+
const { maxX, minX, maxY, minY } = getComponentDiagramBoundaries(model);
|
|
146
|
+
const layoutCenterX = (maxX + minX) / 2;
|
|
147
|
+
const layoutCenterY = (maxY + minY) / 2;
|
|
148
|
+
const cellNode = model.getNode(MAIN_CELL);
|
|
149
|
+
if (!cellNode) {
|
|
150
|
+
return model;
|
|
151
|
+
}
|
|
152
|
+
const cellWidth = cellNode.width;
|
|
153
|
+
const cellNodePosition = cellNode.getPosition().clone();
|
|
154
|
+
cellNodePosition.x = layoutCenterX - cellWidth / 2;
|
|
155
|
+
cellNodePosition.y = layoutCenterY - cellWidth / 2;
|
|
156
|
+
cellNode.setPosition(cellNodePosition);
|
|
157
|
+
updateBoundNodePositions(cellNode, model);
|
|
158
|
+
return model;
|
|
159
|
+
}
|
|
160
|
+
function updateBoundNodePositions(cellNode, model) {
|
|
161
|
+
const externalLinkOffset = Math.max(100, cellNode.width / 10);
|
|
162
|
+
let nextConnectorNodeOffset = externalLinkOffset;
|
|
163
|
+
let externalConsumerOffset = 0;
|
|
164
|
+
model.getNodes().forEach((node) => {
|
|
165
|
+
if (node instanceof ComponentModel && node.isExternalConsumer()) {
|
|
166
|
+
const cellPosition = cellNode.getPosition();
|
|
167
|
+
node.setPosition(
|
|
168
|
+
cellPosition.x - 200 - externalConsumerOffset,
|
|
169
|
+
cellPosition.y - 200
|
|
170
|
+
);
|
|
171
|
+
externalConsumerOffset += node.width + 50;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
for (const key in cellNode.getPorts()) {
|
|
175
|
+
if (Object.prototype.hasOwnProperty.call(cellNode.getPorts(), key)) {
|
|
176
|
+
const port = cellNode.getPorts()[key];
|
|
177
|
+
const { bound, align, args } = getCellPortMetadata(port.getID());
|
|
178
|
+
if (!bound || !align) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const connectionId = args?.length > 0 ? args[0] : void 0;
|
|
182
|
+
if (bound === CellBounds.SouthBound && align === PortModelAlignment.BOTTOM) {
|
|
183
|
+
const portPosition = port.getPosition().clone();
|
|
184
|
+
const connectionNode = model.getNode(
|
|
185
|
+
getConnectionNameById(connectionId)
|
|
186
|
+
);
|
|
187
|
+
const defaultNodeWidth = CIRCLE_WIDTH + 24;
|
|
188
|
+
if (connectionNode) {
|
|
189
|
+
portPosition.x = portPosition.x - connectionNode.width / 2;
|
|
190
|
+
portPosition.y = portPosition.y + nextConnectorNodeOffset;
|
|
191
|
+
connectionNode.setPosition(portPosition);
|
|
192
|
+
if (nextConnectorNodeOffset === externalLinkOffset && connectionNode.width > defaultNodeWidth) {
|
|
193
|
+
nextConnectorNodeOffset = externalLinkOffset + connectionNode.height;
|
|
194
|
+
} else {
|
|
195
|
+
nextConnectorNodeOffset = externalLinkOffset;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (connectionId && bound === CellBounds.SouthBound && align === PortModelAlignment.TOP) {
|
|
200
|
+
const portPosition = port.getPosition().clone();
|
|
201
|
+
model.getNode(getEmptyNodeName(CellBounds.SouthBound, connectionId)).setPosition(portPosition);
|
|
202
|
+
}
|
|
203
|
+
if (connectionId && bound === CellBounds.EastBound && align === PortModelAlignment.RIGHT) {
|
|
204
|
+
const portPosition = port.getPosition().clone();
|
|
205
|
+
const connectionNode = model.getNode(
|
|
206
|
+
getConnectionNameById(connectionId)
|
|
207
|
+
);
|
|
208
|
+
if (connectionNode) {
|
|
209
|
+
portPosition.x = portPosition.x + externalLinkOffset;
|
|
210
|
+
portPosition.y = portPosition.y - connectionNode.height / 2 + 7.5;
|
|
211
|
+
connectionNode.setPosition(portPosition);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (connectionId && bound === CellBounds.EastBound && align === PortModelAlignment.LEFT) {
|
|
215
|
+
const portPosition = port.getPosition().clone();
|
|
216
|
+
model.getNode(getEmptyNodeName(CellBounds.EastBound, connectionId)).setPosition(portPosition);
|
|
217
|
+
}
|
|
218
|
+
if (bound === CellBounds.WestBound && align === PortModelAlignment.LEFT) {
|
|
219
|
+
const nodePosition = port.getPosition().clone();
|
|
220
|
+
nodePosition.x = nodePosition.x - LINE_MIN_WIDTH * 2;
|
|
221
|
+
model.getNode(getEmptyNodeName(CellBounds.WestBound)).setPosition(nodePosition);
|
|
222
|
+
const portPosition = port.getPosition().clone();
|
|
223
|
+
portPosition.x = portPosition.x - externalLinkOffset;
|
|
224
|
+
model.getNode(getExternalNodeName(bound))?.setPosition(portPosition);
|
|
225
|
+
}
|
|
226
|
+
if (bound === CellBounds.NorthBound && align === PortModelAlignment.TOP) {
|
|
227
|
+
const nodePosition = port.getPosition().clone();
|
|
228
|
+
nodePosition.y = nodePosition.y - LINE_MIN_WIDTH * 2;
|
|
229
|
+
model.getNode(getEmptyNodeName(CellBounds.NorthBound)).setPosition(nodePosition);
|
|
230
|
+
const portPosition = port.getPosition().clone();
|
|
231
|
+
portPosition.y = portPosition.y - externalLinkOffset;
|
|
232
|
+
model.getNode(getExternalNodeName(bound))?.setPosition(portPosition);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const cellPositionNorth = cellNode.getPosition().clone();
|
|
237
|
+
cellPositionNorth.y = cellPositionNorth.y - (externalLinkOffset + CIRCLE_WIDTH / 2) - BORDER_GAP;
|
|
238
|
+
model.getNode(getEmptyNodeName(CellBounds.NorthBound, BORDER_NODE))?.setPosition(cellPositionNorth.clone());
|
|
239
|
+
const cellPositionSouth = cellNode.getPosition().clone();
|
|
240
|
+
cellPositionSouth.y = cellPositionSouth.y + (cellNode.width - CIRCLE_WIDTH) + BORDER_GAP;
|
|
241
|
+
model.getNode(getEmptyNodeName(CellBounds.SouthBound, BORDER_NODE))?.setPosition(cellPositionSouth.clone());
|
|
242
|
+
}
|
|
243
|
+
function isRenderInsideCell(node) {
|
|
244
|
+
return node.getType() === COMPONENT_NODE && !node.isExternalConsumer() || node.getType() === CONNECTION_NODE && isConnectorConnection(node.connection) && !!node.connection.onPlatform;
|
|
245
|
+
}
|
|
246
|
+
function generateComponentNodes(project) {
|
|
247
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
248
|
+
project.components?.forEach((component, _key) => {
|
|
249
|
+
const componentNode = new ComponentModel(component);
|
|
250
|
+
nodes.set(componentNode.getID(), componentNode);
|
|
251
|
+
component.connections?.forEach((connection) => {
|
|
252
|
+
if (isConnectorConnection(connection) && connection.onPlatform) {
|
|
253
|
+
const connectionNode = new ConnectionModel(connection);
|
|
254
|
+
nodes.set(connectionNode.getID(), connectionNode);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
project.configurations?.forEach((connection, _key) => {
|
|
259
|
+
if (isConnectorConnection(connection) && connection.onPlatform) {
|
|
260
|
+
const connectionNode = new ConnectionModel(connection);
|
|
261
|
+
nodes.set(connectionNode.getID(), connectionNode);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
return nodes;
|
|
265
|
+
}
|
|
266
|
+
function generateConnectionNodes(project) {
|
|
267
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
268
|
+
project.components?.forEach((component, _key) => {
|
|
269
|
+
component.connections?.forEach((connection) => {
|
|
270
|
+
if (isExternalConnection(project.id, connection, true)) {
|
|
271
|
+
const connectionNode = new ConnectionModel(
|
|
272
|
+
connection,
|
|
273
|
+
Orientation.HORIZONTAL
|
|
274
|
+
);
|
|
275
|
+
nodes.set(connectionNode.getID(), connectionNode);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
return nodes;
|
|
280
|
+
}
|
|
281
|
+
function generateConnectorNodes(project) {
|
|
282
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
283
|
+
project.components?.forEach((component, _key) => {
|
|
284
|
+
component.connections?.forEach((connection) => {
|
|
285
|
+
if (isConnectorConnection(connection) && !connection.onPlatform) {
|
|
286
|
+
const connectionNode = new ConnectionModel(connection);
|
|
287
|
+
nodes.set(connectionNode.getID(), connectionNode);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
project.configurations?.forEach((connection, _key) => {
|
|
292
|
+
if (isConnectorConnection(connection) && !connection.onPlatform) {
|
|
293
|
+
const connectionNode = new ConnectionModel(connection);
|
|
294
|
+
nodes.set(connectionNode.getID(), connectionNode);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
return nodes;
|
|
298
|
+
}
|
|
299
|
+
function generateExternalNodes() {
|
|
300
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
301
|
+
const northBoundExternalNode = new ExternalModel(CellBounds.NorthBound);
|
|
302
|
+
nodes.set(northBoundExternalNode.getID(), northBoundExternalNode);
|
|
303
|
+
const westBoundExternalNode = new ExternalModel(CellBounds.WestBound);
|
|
304
|
+
nodes.set(westBoundExternalNode.getID(), westBoundExternalNode);
|
|
305
|
+
return nodes;
|
|
306
|
+
}
|
|
307
|
+
function generateEmptyNodes(projectId, connectionNodes) {
|
|
308
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
309
|
+
const northBoundEmptyNode = new EmptyModel(
|
|
310
|
+
CellBounds.NorthBound,
|
|
311
|
+
CIRCLE_WIDTH + LINE_MIN_WIDTH * 4
|
|
312
|
+
);
|
|
313
|
+
northBoundEmptyNode.setPosition(0, DIAGRAM_END * -1);
|
|
314
|
+
nodes.set(northBoundEmptyNode.getID(), northBoundEmptyNode);
|
|
315
|
+
const westBoundEmptyNode = new EmptyModel(
|
|
316
|
+
CellBounds.WestBound,
|
|
317
|
+
CIRCLE_WIDTH + LINE_MIN_WIDTH * 4
|
|
318
|
+
);
|
|
319
|
+
westBoundEmptyNode.setPosition(DIAGRAM_END * -1, 0);
|
|
320
|
+
nodes.set(westBoundEmptyNode.getID(), westBoundEmptyNode);
|
|
321
|
+
let count = 0;
|
|
322
|
+
connectionNodes.forEach((connectionNode, _key) => {
|
|
323
|
+
if (isConnectorConnection(connectionNode.connection)) {
|
|
324
|
+
const connectionEmptyNode = new EmptyModel(
|
|
325
|
+
CellBounds.SouthBound,
|
|
326
|
+
DOT_WIDTH,
|
|
327
|
+
connectionNode.connection.id
|
|
328
|
+
);
|
|
329
|
+
connectionEmptyNode.setPosition(count++ * 30, DIAGRAM_END);
|
|
330
|
+
nodes.set(connectionEmptyNode.getID(), connectionEmptyNode);
|
|
331
|
+
} else if (isExternalConnection(projectId, connectionNode.connection, true)) {
|
|
332
|
+
const connectionEmptyNode = new EmptyModel(
|
|
333
|
+
CellBounds.EastBound,
|
|
334
|
+
DOT_WIDTH,
|
|
335
|
+
connectionNode.connection.id
|
|
336
|
+
);
|
|
337
|
+
connectionEmptyNode.setPosition(DIAGRAM_END, count++ * 30);
|
|
338
|
+
nodes.set(connectionEmptyNode.getID(), connectionEmptyNode);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
const northBoundBorderEmptyNode = new EmptyModel(
|
|
342
|
+
CellBounds.NorthBound,
|
|
343
|
+
CIRCLE_WIDTH,
|
|
344
|
+
BORDER_NODE
|
|
345
|
+
);
|
|
346
|
+
nodes.set(northBoundBorderEmptyNode.getID(), northBoundBorderEmptyNode);
|
|
347
|
+
const southBoundBorderEmptyNode = new EmptyModel(
|
|
348
|
+
CellBounds.SouthBound,
|
|
349
|
+
CIRCLE_WIDTH,
|
|
350
|
+
BORDER_NODE
|
|
351
|
+
);
|
|
352
|
+
nodes.set(southBoundBorderEmptyNode.getID(), southBoundBorderEmptyNode);
|
|
353
|
+
return nodes;
|
|
354
|
+
}
|
|
355
|
+
function getCellGateways(project) {
|
|
356
|
+
const gateways = {
|
|
357
|
+
internet: false,
|
|
358
|
+
intranet: false
|
|
359
|
+
};
|
|
360
|
+
project.components?.forEach((component, _key) => {
|
|
361
|
+
for (const serviceId in component.services) {
|
|
362
|
+
if (Object.prototype.hasOwnProperty.call(component.services, serviceId)) {
|
|
363
|
+
const service = component.services[serviceId];
|
|
364
|
+
if (service.deploymentMetadata?.gateways.internet.isExposed) {
|
|
365
|
+
gateways.internet = true;
|
|
366
|
+
}
|
|
367
|
+
if (service.deploymentMetadata?.gateways.intranet.isExposed) {
|
|
368
|
+
gateways.intranet = true;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
return gateways;
|
|
374
|
+
}
|
|
375
|
+
function getObservationSummary(project) {
|
|
376
|
+
let maxRequestCount = 0;
|
|
377
|
+
const calculateRequestCount = (observations) => {
|
|
378
|
+
if (observations && observations.length > 0) {
|
|
379
|
+
const requestCount = observations.reduce(
|
|
380
|
+
(acc, obs) => acc + obs.requestCount,
|
|
381
|
+
0
|
|
382
|
+
);
|
|
383
|
+
if (requestCount > maxRequestCount) {
|
|
384
|
+
maxRequestCount = requestCount;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
project.components?.forEach((component, _key) => {
|
|
389
|
+
for (const serviceId in component.services) {
|
|
390
|
+
if (Object.prototype.hasOwnProperty.call(component.services, serviceId)) {
|
|
391
|
+
const service = component.services[serviceId];
|
|
392
|
+
calculateRequestCount(
|
|
393
|
+
service.deploymentMetadata?.gateways.internet.observations
|
|
394
|
+
);
|
|
395
|
+
calculateRequestCount(
|
|
396
|
+
service.deploymentMetadata?.gateways.intranet.observations
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
if (component.connections.length > 0) {
|
|
401
|
+
component.connections.forEach((connection) => {
|
|
402
|
+
calculateRequestCount(connection.observations);
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
return { requestCount: { max: maxRequestCount, min: 0 } };
|
|
407
|
+
}
|
|
408
|
+
function generateComponentLinks(project, nodes) {
|
|
409
|
+
const links = /* @__PURE__ */ new Map();
|
|
410
|
+
project.components?.forEach((component, _key) => {
|
|
411
|
+
if (component.type === ComponentType.EXTERNAL_CONSUMER) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const componentId = getComponentName(component);
|
|
415
|
+
const callingComponent = nodes.get(
|
|
416
|
+
componentId
|
|
417
|
+
);
|
|
418
|
+
component.connections.forEach((connection) => {
|
|
419
|
+
const connectionMetadata = getConnectionMetadata(connection);
|
|
420
|
+
if (connectionMetadata && !isConnectorConnection(connection) && isInternalComponent(project.id, connection)) {
|
|
421
|
+
const associatedComponent = nodes.get(
|
|
422
|
+
getComponentNameById(
|
|
423
|
+
connectionMetadata.component
|
|
424
|
+
)
|
|
425
|
+
);
|
|
426
|
+
if (callingComponent && associatedComponent) {
|
|
427
|
+
const sourcePort = callingComponent.getPort(`right-${callingComponent.getID()}`);
|
|
428
|
+
const targetPort = associatedComponent.getPort(`left-${associatedComponent.getID()}`);
|
|
429
|
+
if (sourcePort && targetPort) {
|
|
430
|
+
const linkId = getComponentLinkName(
|
|
431
|
+
sourcePort.getID(),
|
|
432
|
+
targetPort.getID()
|
|
433
|
+
);
|
|
434
|
+
const link = new ComponentLinkModel(linkId);
|
|
435
|
+
links.set(
|
|
436
|
+
linkId,
|
|
437
|
+
createLinks(sourcePort, targetPort, link)
|
|
438
|
+
);
|
|
439
|
+
link.setSourceNode(callingComponent.getID());
|
|
440
|
+
link.setTargetNode(associatedComponent.getID());
|
|
441
|
+
if (connection.observations && connection.observations.length > 0) {
|
|
442
|
+
link.setObservations(
|
|
443
|
+
connection.observations,
|
|
444
|
+
connection.observationOnly
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
if (connection.tooltip) {
|
|
448
|
+
link.setTooltip(connection.tooltip);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
if (isConnectorConnection(connection) && connection.onPlatform) {
|
|
454
|
+
const associatedComponent = nodes.get(
|
|
455
|
+
getConnectionNameById(connection.id)
|
|
456
|
+
);
|
|
457
|
+
if (callingComponent && associatedComponent) {
|
|
458
|
+
const sourcePort = callingComponent.getPort(`bottom-${callingComponent.getID()}`);
|
|
459
|
+
const targetPort = associatedComponent.getPort(`top-${associatedComponent.getID()}`);
|
|
460
|
+
if (sourcePort && targetPort) {
|
|
461
|
+
const linkId = getComponentLinkName(
|
|
462
|
+
sourcePort.getID(),
|
|
463
|
+
targetPort.getID()
|
|
464
|
+
);
|
|
465
|
+
const link = new ComponentLinkModel(linkId);
|
|
466
|
+
links.set(
|
|
467
|
+
linkId,
|
|
468
|
+
createLinks(sourcePort, targetPort, link)
|
|
469
|
+
);
|
|
470
|
+
link.setSourceNode(callingComponent.getID());
|
|
471
|
+
link.setTargetNode(associatedComponent.getID());
|
|
472
|
+
if (connection.observations && connection.observations.length > 0) {
|
|
473
|
+
link.setObservations(
|
|
474
|
+
connection.observations,
|
|
475
|
+
connection.observationOnly
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
if (connection.tooltip) {
|
|
479
|
+
link.setTooltip(connection.tooltip);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
});
|
|
486
|
+
return links;
|
|
487
|
+
}
|
|
488
|
+
function generateConnectorLinks(emptyNodes, connectorNodes) {
|
|
489
|
+
const links = /* @__PURE__ */ new Map();
|
|
490
|
+
connectorNodes?.forEach((connectionNode, _key) => {
|
|
491
|
+
const southBoundEmptyNode = emptyNodes.get(
|
|
492
|
+
getEmptyNodeName(CellBounds.SouthBound, connectionNode.connection.id)
|
|
493
|
+
);
|
|
494
|
+
if (!southBoundEmptyNode) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
const sourcePort = southBoundEmptyNode.getPort(
|
|
498
|
+
getNodePortId(southBoundEmptyNode.getID(), PortModelAlignment.BOTTOM)
|
|
499
|
+
);
|
|
500
|
+
const targetPort = connectionNode.getPort(
|
|
501
|
+
`top-${connectionNode.getID()}`
|
|
502
|
+
);
|
|
503
|
+
if (sourcePort && targetPort) {
|
|
504
|
+
const linkId = getExternalLinkName(
|
|
505
|
+
sourcePort.getID(),
|
|
506
|
+
targetPort.getID()
|
|
507
|
+
);
|
|
508
|
+
const link = new ExternalLinkModel(linkId);
|
|
509
|
+
links.set(
|
|
510
|
+
linkId,
|
|
511
|
+
createLinks(sourcePort, targetPort, link)
|
|
512
|
+
);
|
|
513
|
+
link.setSourceNode(southBoundEmptyNode.getID());
|
|
514
|
+
link.setTargetNode(connectionNode.getID());
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
return links;
|
|
518
|
+
}
|
|
519
|
+
function generateConnectionLinks(emptyNodes, connectionNodes) {
|
|
520
|
+
const links = /* @__PURE__ */ new Map();
|
|
521
|
+
connectionNodes?.forEach((connectionNode, _key) => {
|
|
522
|
+
const eastboundEmptyNode = emptyNodes.get(
|
|
523
|
+
getEmptyNodeName(CellBounds.EastBound, connectionNode.connection.id)
|
|
524
|
+
);
|
|
525
|
+
if (!eastboundEmptyNode) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
const sourcePort = eastboundEmptyNode.getPort(
|
|
529
|
+
getNodePortId(eastboundEmptyNode.getID(), PortModelAlignment.RIGHT)
|
|
530
|
+
);
|
|
531
|
+
const targetPort = connectionNode.getPort(
|
|
532
|
+
`left-${connectionNode.getID()}`
|
|
533
|
+
);
|
|
534
|
+
if (sourcePort && targetPort) {
|
|
535
|
+
const linkId = getExternalLinkName(
|
|
536
|
+
sourcePort.getID(),
|
|
537
|
+
targetPort.getID()
|
|
538
|
+
);
|
|
539
|
+
const link = new ExternalLinkModel(linkId);
|
|
540
|
+
links.set(
|
|
541
|
+
linkId,
|
|
542
|
+
createLinks(sourcePort, targetPort, link)
|
|
543
|
+
);
|
|
544
|
+
link.setSourceNode(eastboundEmptyNode.getID());
|
|
545
|
+
link.setTargetNode(connectionNode.getID());
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
return links;
|
|
549
|
+
}
|
|
550
|
+
function generateCellLinks(project, emptyNodes, nodes) {
|
|
551
|
+
const links = /* @__PURE__ */ new Map();
|
|
552
|
+
project.components?.forEach((component, _key) => {
|
|
553
|
+
const componentId = getComponentName(component);
|
|
554
|
+
const targetComponent = nodes.get(
|
|
555
|
+
componentId
|
|
556
|
+
);
|
|
557
|
+
if (targetComponent) {
|
|
558
|
+
let isExposed = false;
|
|
559
|
+
let tooltip = "";
|
|
560
|
+
const observations = [];
|
|
561
|
+
let observationOnly = false;
|
|
562
|
+
for (const serviceId in component.services) {
|
|
563
|
+
if (Object.prototype.hasOwnProperty.call(component.services, serviceId)) {
|
|
564
|
+
const service = component.services[serviceId];
|
|
565
|
+
const internet = service.deploymentMetadata?.gateways.internet;
|
|
566
|
+
isExposed = isExposed || !!internet?.isExposed;
|
|
567
|
+
if (internet?.observations && internet.observations.length > 0) {
|
|
568
|
+
observations.push(
|
|
569
|
+
...internet.observations.map((obs) => {
|
|
570
|
+
if (service.label) {
|
|
571
|
+
obs.label = service.label;
|
|
572
|
+
}
|
|
573
|
+
return obs;
|
|
574
|
+
})
|
|
575
|
+
);
|
|
576
|
+
observationOnly = observationOnly || !!internet?.observationOnly;
|
|
577
|
+
}
|
|
578
|
+
tooltip = internet?.tooltip ?? "";
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
const northBoundEmptyNode = emptyNodes.get(
|
|
582
|
+
getEmptyNodeName(CellBounds.NorthBound)
|
|
583
|
+
);
|
|
584
|
+
if (isExposed && northBoundEmptyNode) {
|
|
585
|
+
const sourcePort = northBoundEmptyNode.getPort(
|
|
586
|
+
getNodePortId(northBoundEmptyNode.getID(), PortModelAlignment.BOTTOM)
|
|
587
|
+
);
|
|
588
|
+
const targetPort = targetComponent.getPort(
|
|
589
|
+
`top-${targetComponent.getID()}`
|
|
590
|
+
);
|
|
591
|
+
if (sourcePort && targetPort) {
|
|
592
|
+
const linkId = getCellLinkName(
|
|
593
|
+
sourcePort.getID(),
|
|
594
|
+
targetPort.getID()
|
|
595
|
+
);
|
|
596
|
+
const link = new CellLinkModel(linkId);
|
|
597
|
+
links.set(
|
|
598
|
+
linkId,
|
|
599
|
+
createLinks(sourcePort, targetPort, link)
|
|
600
|
+
);
|
|
601
|
+
link.setSourceNode(northBoundEmptyNode.getID());
|
|
602
|
+
link.setTargetNode(targetComponent.getID());
|
|
603
|
+
if (observations?.length > 0) {
|
|
604
|
+
link.setObservations(observations, observationOnly);
|
|
605
|
+
}
|
|
606
|
+
if (tooltip) {
|
|
607
|
+
link.setTooltip(tooltip);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (targetComponent) {
|
|
613
|
+
let isExposed = false;
|
|
614
|
+
let tooltip = "";
|
|
615
|
+
const observations = [];
|
|
616
|
+
let observationOnly = false;
|
|
617
|
+
for (const serviceId in component.services) {
|
|
618
|
+
if (Object.prototype.hasOwnProperty.call(component.services, serviceId)) {
|
|
619
|
+
const service = component.services[serviceId];
|
|
620
|
+
const intranet = service.deploymentMetadata?.gateways.intranet;
|
|
621
|
+
isExposed = isExposed || !!intranet?.isExposed;
|
|
622
|
+
if (intranet?.observations && intranet.observations.length > 0) {
|
|
623
|
+
observations.push(...intranet.observations);
|
|
624
|
+
}
|
|
625
|
+
observationOnly = observationOnly || !!intranet?.observationOnly;
|
|
626
|
+
tooltip = intranet?.tooltip ?? "";
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
const northBoundEmptyNode = emptyNodes.get(
|
|
630
|
+
getEmptyNodeName(CellBounds.WestBound)
|
|
631
|
+
);
|
|
632
|
+
if (isExposed && northBoundEmptyNode) {
|
|
633
|
+
const sourcePort = northBoundEmptyNode.getPort(
|
|
634
|
+
getNodePortId(northBoundEmptyNode.getID(), PortModelAlignment.RIGHT)
|
|
635
|
+
);
|
|
636
|
+
const targetPort = targetComponent.getPort(
|
|
637
|
+
`left-${targetComponent.getID()}`
|
|
638
|
+
);
|
|
639
|
+
if (sourcePort && targetPort) {
|
|
640
|
+
const linkId = getCellLinkName(
|
|
641
|
+
sourcePort.getID(),
|
|
642
|
+
targetPort.getID()
|
|
643
|
+
);
|
|
644
|
+
const link = new CellLinkModel(linkId);
|
|
645
|
+
links.set(
|
|
646
|
+
linkId,
|
|
647
|
+
createLinks(sourcePort, targetPort, link)
|
|
648
|
+
);
|
|
649
|
+
link.setSourceNode(northBoundEmptyNode.getID());
|
|
650
|
+
link.setTargetNode(targetComponent.getID());
|
|
651
|
+
if (observations.length > 0) {
|
|
652
|
+
link.setObservations(observations, observationOnly);
|
|
653
|
+
}
|
|
654
|
+
if (tooltip) {
|
|
655
|
+
link.setTooltip(tooltip);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
component.connections.forEach((connection) => {
|
|
661
|
+
if (isConnectorConnection(connection)) {
|
|
662
|
+
const southBoundEmptyNode = emptyNodes.get(
|
|
663
|
+
getEmptyNodeName(CellBounds.SouthBound, connection.id)
|
|
664
|
+
);
|
|
665
|
+
if (targetComponent && southBoundEmptyNode) {
|
|
666
|
+
const sourcePort = targetComponent.getPort(
|
|
667
|
+
`bottom-${targetComponent.getID()}`
|
|
668
|
+
);
|
|
669
|
+
const targetPort = southBoundEmptyNode.getPort(
|
|
670
|
+
getNodePortId(southBoundEmptyNode.getID(), PortModelAlignment.TOP)
|
|
671
|
+
);
|
|
672
|
+
if (sourcePort && targetPort) {
|
|
673
|
+
const linkId = getCellLinkName(
|
|
674
|
+
sourcePort.getID(),
|
|
675
|
+
targetPort.getID()
|
|
676
|
+
);
|
|
677
|
+
const link = new CellLinkModel(linkId);
|
|
678
|
+
links.set(
|
|
679
|
+
linkId,
|
|
680
|
+
createLinks(sourcePort, targetPort, link)
|
|
681
|
+
);
|
|
682
|
+
link.setSourceNode(targetComponent.getID());
|
|
683
|
+
link.setTargetNode(southBoundEmptyNode.getID());
|
|
684
|
+
if (connection.observations && connection.observations.length > 0) {
|
|
685
|
+
link.setObservations(
|
|
686
|
+
connection.observations,
|
|
687
|
+
connection.observationOnly
|
|
688
|
+
);
|
|
689
|
+
}
|
|
690
|
+
if (connection.tooltip) {
|
|
691
|
+
link.setTooltip(connection.tooltip);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
} else if (isExternalConnection(project.id, connection, true)) {
|
|
696
|
+
if (targetComponent && targetComponent.isExternalConsumer()) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
const eastBoundEmptyNode = emptyNodes.get(
|
|
700
|
+
getEmptyNodeName(CellBounds.EastBound, connection.id)
|
|
701
|
+
);
|
|
702
|
+
if (targetComponent && eastBoundEmptyNode) {
|
|
703
|
+
const sourcePort = targetComponent.getPort(
|
|
704
|
+
`right-${targetComponent.getID()}`
|
|
705
|
+
);
|
|
706
|
+
const targetPort = eastBoundEmptyNode.getPort(
|
|
707
|
+
getNodePortId(eastBoundEmptyNode.getID(), PortModelAlignment.LEFT)
|
|
708
|
+
);
|
|
709
|
+
if (sourcePort && targetPort) {
|
|
710
|
+
const linkId = getCellLinkName(
|
|
711
|
+
sourcePort.getID(),
|
|
712
|
+
targetPort.getID()
|
|
713
|
+
);
|
|
714
|
+
const link = new CellLinkModel(linkId);
|
|
715
|
+
links.set(
|
|
716
|
+
linkId,
|
|
717
|
+
createLinks(sourcePort, targetPort, link)
|
|
718
|
+
);
|
|
719
|
+
link.setSourceNode(targetComponent.getID());
|
|
720
|
+
link.setTargetNode(eastBoundEmptyNode.getID());
|
|
721
|
+
if (connection.observations && connection.observations.length > 0) {
|
|
722
|
+
link.setObservations(
|
|
723
|
+
connection.observations,
|
|
724
|
+
connection.observationOnly
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
if (connection.tooltip) {
|
|
728
|
+
link.setTooltip(connection.tooltip);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
if (targetComponent && targetComponent.isExternalConsumer()) {
|
|
735
|
+
for (const connection of component.connections) {
|
|
736
|
+
let targetEmptyNode = null;
|
|
737
|
+
let targetBound = null;
|
|
738
|
+
let destinationComponentNode = null;
|
|
739
|
+
const metadata = getConnectionMetadata(connection);
|
|
740
|
+
for (const cmp of project.components) {
|
|
741
|
+
if (cmp.id === metadata.component) {
|
|
742
|
+
destinationComponentNode = nodes.get(
|
|
743
|
+
getComponentName(cmp)
|
|
744
|
+
);
|
|
745
|
+
const services = Object.values(cmp.services);
|
|
746
|
+
targetBound = CellBounds.WestBound;
|
|
747
|
+
for (const service of services) {
|
|
748
|
+
if (service.deploymentMetadata?.gateways.internet.isExposed) {
|
|
749
|
+
targetBound = CellBounds.NorthBound;
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
if (targetBound) {
|
|
756
|
+
targetEmptyNode = emptyNodes.get(getEmptyNodeName(targetBound)) ?? null;
|
|
757
|
+
}
|
|
758
|
+
if (targetEmptyNode) {
|
|
759
|
+
const sourcePort = targetComponent.getPort(
|
|
760
|
+
`bottom-${targetComponent.getID()}`
|
|
761
|
+
);
|
|
762
|
+
const targetPort = targetEmptyNode.getPort(
|
|
763
|
+
getNodePortId(
|
|
764
|
+
targetEmptyNode.getID(),
|
|
765
|
+
targetBound === CellBounds.NorthBound ? PortModelAlignment.TOP : PortModelAlignment.LEFT
|
|
766
|
+
)
|
|
767
|
+
);
|
|
768
|
+
if (sourcePort && targetPort) {
|
|
769
|
+
const linkId = getCellLinkName(
|
|
770
|
+
sourcePort.getID(),
|
|
771
|
+
targetPort.getID()
|
|
772
|
+
);
|
|
773
|
+
const link = new CellLinkModel(linkId);
|
|
774
|
+
link.setSourceNode(targetComponent.getID());
|
|
775
|
+
link.setTargetNode(targetEmptyNode.getID());
|
|
776
|
+
link.setIsExternalConsumerLink(true);
|
|
777
|
+
link.setDestinationNode(destinationComponentNode);
|
|
778
|
+
links.set(
|
|
779
|
+
linkId,
|
|
780
|
+
createLinks(sourcePort, targetPort, link)
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
return links;
|
|
788
|
+
}
|
|
789
|
+
function generateExternalLinks(emptyNodes, externalNodes, gateways) {
|
|
790
|
+
const links = /* @__PURE__ */ new Map();
|
|
791
|
+
const eastBoundEmptyNode = emptyNodes.get(
|
|
792
|
+
getEmptyNodeName(CellBounds.EastBound)
|
|
793
|
+
);
|
|
794
|
+
if (eastBoundEmptyNode) {
|
|
795
|
+
const eastBoundLink = createExternalLink(
|
|
796
|
+
eastBoundEmptyNode,
|
|
797
|
+
externalNodes,
|
|
798
|
+
CellBounds.EastBound,
|
|
799
|
+
PortModelAlignment.RIGHT
|
|
800
|
+
);
|
|
801
|
+
if (eastBoundLink) {
|
|
802
|
+
links.set(eastBoundLink.getID(), eastBoundLink);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
const northBoundEmptyNode = emptyNodes.get(
|
|
806
|
+
getEmptyNodeName(CellBounds.NorthBound)
|
|
807
|
+
);
|
|
808
|
+
if (northBoundEmptyNode && gateways.internet) {
|
|
809
|
+
const northBoundLink = createExternalLink(
|
|
810
|
+
northBoundEmptyNode,
|
|
811
|
+
externalNodes,
|
|
812
|
+
CellBounds.NorthBound,
|
|
813
|
+
PortModelAlignment.TOP,
|
|
814
|
+
true
|
|
815
|
+
);
|
|
816
|
+
if (northBoundLink) {
|
|
817
|
+
links.set(northBoundLink.getID(), northBoundLink);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
const westBoundEmptyNode = emptyNodes.get(
|
|
821
|
+
getEmptyNodeName(CellBounds.WestBound)
|
|
822
|
+
);
|
|
823
|
+
if (westBoundEmptyNode && gateways.intranet) {
|
|
824
|
+
const westBoundLink = createExternalLink(
|
|
825
|
+
westBoundEmptyNode,
|
|
826
|
+
externalNodes,
|
|
827
|
+
CellBounds.WestBound,
|
|
828
|
+
PortModelAlignment.LEFT,
|
|
829
|
+
true
|
|
830
|
+
);
|
|
831
|
+
if (westBoundLink) {
|
|
832
|
+
links.set(westBoundLink.getID(), westBoundLink);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
return links;
|
|
836
|
+
}
|
|
837
|
+
function generateExternalConnectionLinks(project, nodes, connectionNodes) {
|
|
838
|
+
const links = /* @__PURE__ */ new Map();
|
|
839
|
+
project.components?.forEach((component, _key) => {
|
|
840
|
+
const componentId = getComponentName(component);
|
|
841
|
+
const targetComponent = nodes.get(
|
|
842
|
+
componentId
|
|
843
|
+
);
|
|
844
|
+
component.connections.forEach((connection) => {
|
|
845
|
+
if (isExternalConnection(project.id, connection, true) && targetComponent && targetComponent.isExternalConsumer()) {
|
|
846
|
+
const connectionNode = connectionNodes.get(
|
|
847
|
+
getConnectionNameById(connection.id)
|
|
848
|
+
);
|
|
849
|
+
if (targetComponent && connectionNode) {
|
|
850
|
+
const sourcePort = targetComponent.getPort(
|
|
851
|
+
`right-${targetComponent.getID()}`
|
|
852
|
+
);
|
|
853
|
+
const targetPort = connectionNode.getPort(
|
|
854
|
+
getNodePortId(connectionNode.getID(), PortModelAlignment.LEFT)
|
|
855
|
+
);
|
|
856
|
+
if (sourcePort && targetPort) {
|
|
857
|
+
const linkId = getCellLinkName(
|
|
858
|
+
sourcePort.getID(),
|
|
859
|
+
targetPort.getID()
|
|
860
|
+
);
|
|
861
|
+
const link = new ExternalLinkModel(linkId, true);
|
|
862
|
+
links.set(
|
|
863
|
+
linkId,
|
|
864
|
+
createLinks(sourcePort, targetPort, link)
|
|
865
|
+
);
|
|
866
|
+
link.setSourceNode(targetComponent.getID());
|
|
867
|
+
link.setTargetNode(connectionNode.getID());
|
|
868
|
+
if (connection.observations && connection.observations.length > 0) {
|
|
869
|
+
link.setObservations(
|
|
870
|
+
connection.observations,
|
|
871
|
+
connection.observationOnly
|
|
872
|
+
);
|
|
873
|
+
}
|
|
874
|
+
if (connection.tooltip) {
|
|
875
|
+
link.setTooltip(connection.tooltip);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
});
|
|
882
|
+
return links;
|
|
883
|
+
}
|
|
884
|
+
function createLinks(sourcePort, targetPort, link) {
|
|
885
|
+
link.setSourcePort(sourcePort);
|
|
886
|
+
link.setTargetPort(targetPort);
|
|
887
|
+
sourcePort.addLink(link);
|
|
888
|
+
return link;
|
|
889
|
+
}
|
|
890
|
+
function createExternalLink(emptyNode, externalNodes, bounds, alignment, switchArrow = false) {
|
|
891
|
+
const sourcePort = emptyNode.getPort(
|
|
892
|
+
getNodePortId(emptyNode.getID(), alignment)
|
|
893
|
+
);
|
|
894
|
+
const targetNode = externalNodes.get(getExternalNodeName(bounds));
|
|
895
|
+
const targetPort = targetNode?.getPort(
|
|
896
|
+
`${getOppositeAlignment(alignment)}-${targetNode.getID()}`
|
|
897
|
+
);
|
|
898
|
+
if (sourcePort && targetNode && targetPort) {
|
|
899
|
+
const linkId = getExternalLinkName(sourcePort.getID(), targetPort.getID());
|
|
900
|
+
const link = new ExternalLinkModel(linkId);
|
|
901
|
+
if (switchArrow) {
|
|
902
|
+
link.setSourceNode(targetNode.getID());
|
|
903
|
+
link.setTargetNode(emptyNode.getID());
|
|
904
|
+
return createLinks(targetPort, sourcePort, link);
|
|
905
|
+
}
|
|
906
|
+
link.setSourceNode(emptyNode.getID());
|
|
907
|
+
link.setTargetNode(targetNode.getID());
|
|
908
|
+
return createLinks(sourcePort, targetPort, link);
|
|
909
|
+
}
|
|
910
|
+
return void 0;
|
|
911
|
+
}
|
|
912
|
+
function getOppositeAlignment(alignment) {
|
|
913
|
+
switch (alignment) {
|
|
914
|
+
case PortModelAlignment.LEFT:
|
|
915
|
+
return PortModelAlignment.RIGHT;
|
|
916
|
+
case PortModelAlignment.RIGHT:
|
|
917
|
+
return PortModelAlignment.LEFT;
|
|
918
|
+
case PortModelAlignment.TOP:
|
|
919
|
+
return PortModelAlignment.BOTTOM;
|
|
920
|
+
case PortModelAlignment.BOTTOM:
|
|
921
|
+
return PortModelAlignment.TOP;
|
|
922
|
+
default:
|
|
923
|
+
return alignment;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
function getConnectionMetadata(connection) {
|
|
927
|
+
const ids = connection.id.split(":");
|
|
928
|
+
if (ids.length === 3) {
|
|
929
|
+
return {
|
|
930
|
+
type: connection.type,
|
|
931
|
+
organization: ids[0],
|
|
932
|
+
project: ids[1],
|
|
933
|
+
component: ids[2]
|
|
934
|
+
};
|
|
935
|
+
} else if (ids.length === 4) {
|
|
936
|
+
return {
|
|
937
|
+
type: connection.type,
|
|
938
|
+
organization: ids[0],
|
|
939
|
+
project: ids[1],
|
|
940
|
+
component: ids[2],
|
|
941
|
+
service: ids[3]
|
|
942
|
+
};
|
|
943
|
+
} else if (isConnectorConnection(connection) && ids.length === 2) {
|
|
944
|
+
return {
|
|
945
|
+
type: connection.type,
|
|
946
|
+
organization: ids[0],
|
|
947
|
+
package: ids[1]
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
return null;
|
|
951
|
+
}
|
|
952
|
+
function isInternalComponent(projectId, connection) {
|
|
953
|
+
const metadata = getConnectionMetadata(connection);
|
|
954
|
+
return !!metadata && metadata.project === projectId;
|
|
955
|
+
}
|
|
956
|
+
function isExternalConnection(projectId, connection, skipPlatform) {
|
|
957
|
+
const metadata = getConnectionMetadata(connection);
|
|
958
|
+
return Boolean(
|
|
959
|
+
(!isConnectorConnection(connection) || !connection.type) && // Some connections doesn't have connection type
|
|
960
|
+
(skipPlatform) && // Skip platform fields for some connections
|
|
961
|
+
metadata && metadata.project !== projectId
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
function isConnectorConnection(connection) {
|
|
965
|
+
return connection.type === ConnectionType.Connector || connection.type === ConnectionType.Datastore;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
export { calculateCellWidth, getComponentDiagramBoundaries, getComponentDiagramWidth, getConnectionMetadata, getDiagramDataFromProject, isConnectorConnection, isExternalConnection, isInternalComponent, isRenderInsideCell, manualDistribute, updateBoundNodePositions };
|
|
969
|
+
//# sourceMappingURL=projectUtils.esm.js.map
|