diff --git a/build/app/view/netcreate/components/AutoComplete.jsx b/build/app/view/netcreate/components/AutoComplete.jsx index 04a1f1fa6..94cc614f6 100644 --- a/build/app/view/netcreate/components/AutoComplete.jsx +++ b/build/app/view/netcreate/components/AutoComplete.jsx @@ -336,6 +336,9 @@ class AutoComplete extends UNISYS.Component { Check to see if it references a valid node, if so, select it /*/ onBlur (value) { // User selected an existing node in the suggestion list + // or User clicked on d3 graph + // or User clicked outside of field + if (DBG) console.log('AutoComplete.onBlur',value); this.AppCall('SOURCE_SEARCH_AND_SELECT', { searchString: this.state.value } ); } @@ -364,7 +367,7 @@ class AutoComplete extends UNISYS.Component { /*/ render () { const { value, suggestions } = this.state; const inputProps = { - placeholder : "Type node name...", + placeholder : this.props.placeholder || 'Type node name...', value : value, onChange : this.onInputChange, onBlur : this.onBlur diff --git a/build/app/view/netcreate/components/EdgeEditor.jsx b/build/app/view/netcreate/components/EdgeEditor.jsx index fe3f7ca66..b69b85aee 100644 --- a/build/app/view/netcreate/components/EdgeEditor.jsx +++ b/build/app/view/netcreate/components/EdgeEditor.jsx @@ -232,7 +232,8 @@ class EdgeEditor extends UNISYS.Component { sourceIsEditable:false, // Source ndoe field is only editable when source is not parent hasValidSource: false, // Used by SwapSourceAndTarget and the Change Source button targetIsEditable:false, // Target ndoe field is only editable when target is not parent - hasValidTarget: false // Used by SwapSourceAndTarget and the Change Target button + hasValidTarget: false, // Used by SwapSourceAndTarget and the Change Target button + placeholder: undefined }; /// Initialize UNISYS DATA LINK for REACT @@ -653,22 +654,26 @@ class EdgeEditor extends UNISYS.Component { /*/ onChangeSource () { this.setState({ sourceIsEditable: true, - hasValidSource: false + hasValidSource: false, + placeholder: this.state.sourceNode.label }); this.AppCall('AUTOCOMPLETE_SELECT',{id:'edge'+this.props.edgeID+'source'}); // Whenever we set the autocomplete to source, we have to update the label - this.AppCall('SOURCE_SEARCH', { searchString: this.state.sourceNode.label }); + // Clear the AutoComplete field so that onBlur does not select the same node + this.AppCall('SOURCE_SEARCH', { searchString: '' }); } /// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*/ /*/ onChangeTarget () { this.setState({ targetIsEditable: true, - hasValidTarget: false + hasValidTarget: false, + placeholder: this.state.targetNode.label }); this.AppCall('AUTOCOMPLETE_SELECT',{id:'edge'+this.props.edgeID+'target'}); // Whenever we set the autocomplete to target, we have to update the label - this.AppCall('SOURCE_SEARCH', { searchString: this.state.targetNode.label }); + // Clear the AutoComplete field so that onBlur does not select the same node + this.AppCall('SOURCE_SEARCH', { searchString: '' }); } /// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*/ @@ -753,7 +758,10 @@ class EdgeEditor extends UNISYS.Component { /*/ render () { const { edgeID, parentNodeLabel } = this.props; const { formData, sourceNode, targetNode, edgePrompts } = this.state; - const me = this node; + const me = this node; + // special override to allow editing an edge that has the same parent node for both source and target + let sameSourceAndTarget = (sourceNode.label === this.props.parentNodeLabel) && + (targetNode.label === this.props.parentNodeLabel); return (