diff --git a/src/components/forms/Fields/ExpandingTextField.js b/src/components/forms/Fields/ExpandingTextField.js index 0139cebdf..ac836f7d6 100644 --- a/src/components/forms/Fields/ExpandingTextField.js +++ b/src/components/forms/Fields/ExpandingTextField.js @@ -14,7 +14,9 @@ class ExpandingTextField extends Component { componentDidMount() { const { input: { value } } = this.props; - const initialValue = Array.isArray(value) ? value.concat(['']) : ['']; + const initialValue = Array.isArray(value) + ? value.concat(['']) + : [value, '']; this.setState({ texts: initialValue }); } @@ -41,6 +43,8 @@ class ExpandingTextField extends Component { } }; + isReference = () => {}; + render() { const { label = '', diff --git a/src/components/forms/Fields/PipelineVariablesField.js b/src/components/forms/Fields/PipelineVariablesField.js index 3f1b4dc86..5ba6c26d9 100644 --- a/src/components/forms/Fields/PipelineVariablesField.js +++ b/src/components/forms/Fields/PipelineVariablesField.js @@ -11,8 +11,13 @@ import { } from '../Fields'; import ResourceRenderer from '../../helpers/ResourceRenderer'; -const isArray = (type = '') => - typeof type === 'string' && type.indexOf('[]') === type.length - 2; +const isArray = (firstValue, type = '') => + firstValue.length > 0 && + firstValue[0] !== '$' && + typeof type === 'string' && + type.indexOf('[]') === type.length - 2; + +const firstValue = value => (Array.isArray(value) ? value[0] : value); const PipelineVariablesField = ({ input, @@ -63,7 +68,11 @@ const PipelineVariablesField = ({ } diff --git a/src/components/forms/Fields/PortField.js b/src/components/forms/Fields/PortField.js index 65faca674..4e221b6f7 100644 --- a/src/components/forms/Fields/PortField.js +++ b/src/components/forms/Fields/PortField.js @@ -17,7 +17,6 @@ const getLabelStyle = portType => (isArrayType(portType) ? 'primary' : 'info'); const PortField = ({ input, meta: { touched, error }, - type = 'text', label, portType, ...props @@ -35,7 +34,7 @@ const PortField = ({ {portType} - + {error && {' '}{touched @@ -48,7 +47,6 @@ const PortField = ({ ; PortField.propTypes = { - type: PropTypes.string, input: PropTypes.shape({ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired }).isRequired, diff --git a/src/components/forms/Fields/TextField.js b/src/components/forms/Fields/TextField.js index 214bce006..145e2ea31 100644 --- a/src/components/forms/Fields/TextField.js +++ b/src/components/forms/Fields/TextField.js @@ -10,7 +10,7 @@ import { } from 'react-bootstrap'; const TextField = ({ - input, + input: { value, ...input }, meta: { touched, error }, type = 'text', label, @@ -23,7 +23,12 @@ const TextField = ({ {label} - + {error && {' '}{touched @@ -38,7 +43,11 @@ const TextField = ({ TextField.propTypes = { type: PropTypes.string, input: PropTypes.shape({ - value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired + value: PropTypes.oneOfType([ + PropTypes.array, + PropTypes.string, + PropTypes.number + ]).isRequired }).isRequired, meta: PropTypes.shape({ touched: PropTypes.bool,