diff --git a/src/components/AnsibleSelect/AnsibleSelect.jsx b/src/components/AnsibleSelect/AnsibleSelect.jsx index 3c3c3914ca..807bd9b73f 100644 --- a/src/components/AnsibleSelect/AnsibleSelect.jsx +++ b/src/components/AnsibleSelect/AnsibleSelect.jsx @@ -2,7 +2,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - FormGroup, Select, SelectOption, } from '@patternfly/react-core'; @@ -13,19 +12,6 @@ class AnsibleSelect extends React.Component { this.onSelectChange = this.onSelectChange.bind(this); } - state = { - count: 1, - } - - static getDerivedStateFromProps (nexProps) { - if (nexProps.data) { - return { - count: nexProps.data.length, - }; - } - return null; - } - onSelectChange (val, event) { const { onChange, name } = this.props; event.target.name = name; @@ -33,23 +19,14 @@ class AnsibleSelect extends React.Component { } render () { - const { count } = this.state; - const { label = '', value, data, name, defaultSelected } = this.props; - let elem; - if (count > 1) { - elem = ( - - - - ); - } else { - elem = null; - } - return elem; + const { label, value, data, defaultSelected } = this.props; + return ( + + ); } } @@ -57,14 +34,13 @@ AnsibleSelect.defaultProps = { data: [], label: 'Ansible Select', defaultSelected: null, - name: null, }; AnsibleSelect.propTypes = { data: PropTypes.arrayOf(PropTypes.string), defaultSelected: PropTypes.string, label: PropTypes.string, - name: PropTypes.string, + name: PropTypes.string.isRequired, onChange: PropTypes.func.isRequired, value: PropTypes.string.isRequired, }; diff --git a/src/pages/Organizations/screens/OrganizationAdd.jsx b/src/pages/Organizations/screens/OrganizationAdd.jsx index cd0c6f772c..a42a381857 100644 --- a/src/pages/Organizations/screens/OrganizationAdd.jsx +++ b/src/pages/Organizations/screens/OrganizationAdd.jsx @@ -137,14 +137,18 @@ class OrganizationAdd extends React.Component { {({ custom_virtualenvs }) => ( - + custom_virtualenvs && custom_virtualenvs.length > 1 && ( + + + + ) )}