From 510b4197ac43645599aa7f3129ae24694000ab0b Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 17 Feb 2021 14:35:50 -0500 Subject: [PATCH] Mark start node for translation --- .../components/Workflow/WorkflowStartNode.jsx | 40 ++++++++++++------- .../VisualizerGraph.jsx | 14 +++---- .../VisualizerLink.jsx | 3 +- 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/awx/ui_next/src/components/Workflow/WorkflowStartNode.jsx b/awx/ui_next/src/components/Workflow/WorkflowStartNode.jsx index 7735d6c98d..23dbc06481 100644 --- a/awx/ui_next/src/components/Workflow/WorkflowStartNode.jsx +++ b/awx/ui_next/src/components/Workflow/WorkflowStartNode.jsx @@ -8,7 +8,6 @@ import { WorkflowDispatchContext, WorkflowStateContext, } from '../../contexts/Workflow'; -import { constants as wfConstants } from './WorkflowUtils'; import WorkflowActionTooltip from './WorkflowActionTooltip'; import WorkflowActionTooltipItem from './WorkflowActionTooltipItem'; @@ -16,8 +15,25 @@ const StartG = styled.g` pointer-events: ${props => (props.ignorePointerEvents ? 'none' : 'auto')}; `; +const StartForeignObject = styled.foreignObject` + overflow: visible; +`; + +const StartDiv = styled.div` + background-color: #0279bc; + color: white; + width: max-content; + min-width: 80px; + height: 40px; + border-radius: 0.35em; + text-align: center; + line-height: 40px; + padding: 0px 10px; +`; + function WorkflowStartNode({ i18n, onUpdateHelpText, showActionTooltip }) { const ref = useRef(null); + const startNodeRef = useRef(null); const [hovering, setHovering] = useState(false); const dispatch = useContext(WorkflowDispatchContext); const { addingLink, nodePositions } = useContext(WorkflowStateContext); @@ -36,18 +52,14 @@ function WorkflowStartNode({ i18n, onUpdateHelpText, showActionTooltip }) { ref={ref} transform={`translate(${nodePositions[1].x},0)`} > - - {/* TODO: We need to be able to handle translated text here */} - - START - + style={{ overflow: 'visible' }} + > + {i18n._(t`START`)} + {showActionTooltip && hovering && ( , ]} - pointX={wfConstants.rootW} - pointY={wfConstants.rootH / 2 + 10} + pointX={startNodeRef.current.offsetWidth} + pointY={startNodeRef.current.offsetHeight / 2 + 10} /> )} diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerGraph.jsx b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerGraph.jsx index 8f07f037b9..877979e711 100644 --- a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerGraph.jsx +++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerGraph.jsx @@ -250,7 +250,7 @@ function VisualizerGraph({ i18n, readOnly }) { {nodePositions && [ - , links.map(link => { if ( nodePositions[link.source.id] && @@ -307,6 +301,12 @@ function VisualizerGraph({ i18n, readOnly }) { } return null; }), + , ]} {addingLink && ( { - ref.current.parentNode.appendChild(ref.current); + const startNode = document.getElementById('node-1'); + ref.current.parentNode.insertBefore(ref.current, startNode); setHovering(true); };