diff --git a/awx/ui_next/.eslintrc b/awx/ui_next/.eslintrc index c464701811..f82900134e 100644 --- a/awx/ui_next/.eslintrc +++ b/awx/ui_next/.eslintrc @@ -79,7 +79,7 @@ "theme", "gridColumns" ], - "ignore": ["Ansible", "Tower", "JSON", "YAML", "lg", "START"], + "ignore": ["Ansible", "Tower", "JSON", "YAML", "lg"], "ignoreComponent": [ "code", "Omit", 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/components/Workflow/WorkflowStartNode.test.jsx b/awx/ui_next/src/components/Workflow/WorkflowStartNode.test.jsx index 5f5284e176..78cf3756dc 100644 --- a/awx/ui_next/src/components/Workflow/WorkflowStartNode.test.jsx +++ b/awx/ui_next/src/components/Workflow/WorkflowStartNode.test.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { mount } from 'enzyme'; +import { mountWithContexts } from '../../../testUtils/enzymeHelpers'; import { WorkflowStateContext } from '../../contexts/Workflow'; import WorkflowStartNode from './WorkflowStartNode'; @@ -12,7 +12,7 @@ const nodePositions = { describe('WorkflowStartNode', () => { test('mounts successfully', () => { - const wrapper = mount( + const wrapper = mountWithContexts( { expect(wrapper).toHaveLength(1); }); test('tooltip shown on hover', () => { - const wrapper = mount( + const wrapper = mountWithContexts( 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); };