diff --git a/CommonUI/src/Components/Tooltip/Toolip.tsx b/CommonUI/src/Components/Tooltip/Toolip.tsx index 196cfb62ce..2d7314e51d 100644 --- a/CommonUI/src/Components/Tooltip/Toolip.tsx +++ b/CommonUI/src/Components/Tooltip/Toolip.tsx @@ -10,6 +10,11 @@ export interface ComponentProps { const Tooltip: FunctionComponent = ( props: ComponentProps ): ReactElement => { + + if(!props.text){ + return props.children; + } + return ( {props.text}}> {props.children} diff --git a/CommonUI/src/Components/Workflow/Component.tsx b/CommonUI/src/Components/Workflow/Component.tsx index 1a0d101a6e..b4d86826b1 100644 --- a/CommonUI/src/Components/Workflow/Component.tsx +++ b/CommonUI/src/Components/Workflow/Component.tsx @@ -3,7 +3,8 @@ import React, { FunctionComponent, useState } from 'react'; import { Handle, Position, Connection } from 'reactflow'; import Icon, { ThickProp } from '../Icon/Icon'; import IconProp from 'Common/Types/Icon/IconProp'; -import ComponentMetadata, { ComponentType } from 'Common/Types/Workflow/Component'; +import ComponentMetadata, { ComponentType, Port } from 'Common/Types/Workflow/Component'; +import Tooltip from '../Tooltip/Toolip'; export enum NodeType { Node = 'Node', @@ -19,7 +20,7 @@ export interface NodeDataProp { onClick?: (node: NodeDataProp) => void | undefined; isPreview?: boolean | undefined; // is this used to show in the components modal? metadata: ComponentMetadata; - metadataId: string; + metadataId: string; internalId: string; } @@ -59,6 +60,39 @@ const Node: FunctionComponent = (props: ComponentProps) => { width: '0.75rem', }; + + const getPortPosition: Function = (portCount: number, totalPorts: number, isLabel: boolean | undefined): React.CSSProperties => { + if (portCount === 1 && totalPorts === 1) { + return {} + } + + if (portCount === 1 && totalPorts === 2) { + return { left: isLabel ? 70 : 80 } + } + + if (portCount === 2 && totalPorts === 2) { + return { left: isLabel ? 150 : 160 } + } + + if (portCount === 1 && totalPorts === 3) { + return { left: isLabel ? 70 : 80 } + } + + if (portCount === 2 && totalPorts === 3) { + return {} + } + + if (portCount === 3 && totalPorts === 3) { + return { left: isLabel ? 150 : 160 } + } + + + // default + return {}; + + + } + if (props.data.nodeType === NodeType.PlaceholderNode) { handleStyle = { background: '#cbd5e1', @@ -98,8 +132,9 @@ const Node: FunctionComponent = (props: ComponentProps) => { onMouseOut={() => { setIsHovering(false); }} - style={{...componentStyle, - height: props.data.id ? "12rem": "10rem", + style={{ + ...componentStyle, + height: props.data.id ? "12rem" : "10rem", }} onClick={() => { if (props.data.onClick) { @@ -179,13 +214,21 @@ const Node: FunctionComponent = (props: ComponentProps) => { {!props.data.isPreview && props.data.metadata.componentType !== ComponentType.Trigger && ( - { }} - isConnectable={true} - position={Position.Top} - style={handleStyle} - /> +
+ {props.data.metadata.inPorts && props.data.metadata.inPorts.length > 0 && props.data.metadata.inPorts.map((port: Port, i: number) => { + return ( { + + }} + isConnectable={true} + position={Position.Top} + style={{ ...handleStyle, ...getPortPosition(i + 1, props.data.metadata.inPorts.length) }} + />) + })} +
)}
= (props: ComponentProps) => { /> )}

= (props: ComponentProps) => { {!props.data.isPreview && props.data.nodeType !== NodeType.PlaceholderNode && ( - { }} - isConnectable={true} - position={Position.Bottom} - style={handleStyle} - /> + <> +

+ {props.data.metadata.outPorts && props.data.metadata.outPorts.length > 0 && props.data.metadata.outPorts.map((port: Port, i: number) => { + return ( { + + }} + isConnectable={true} + position={Position.Bottom} + style={{ ...handleStyle, ...getPortPosition(i + 1, props.data.metadata.outPorts.length) }} + />) + })} +
+
+ {props.data.metadata.outPorts && props.data.metadata.outPorts.length > 0 && props.data.metadata.outPorts.map((port: Port, i: number) => { + return (
{port.title}
) + })} +
+ )}
); diff --git a/StatusPage/src/Components/Monitor/MonitorOverview.tsx b/StatusPage/src/Components/Monitor/MonitorOverview.tsx index a98983ea42..da8f82b041 100644 --- a/StatusPage/src/Components/Monitor/MonitorOverview.tsx +++ b/StatusPage/src/Components/Monitor/MonitorOverview.tsx @@ -36,7 +36,7 @@ const MonitorOverview: FunctionComponent = ( {props.tooltip && (