diff --git a/__tests__/components/Lookup.test.jsx b/__tests__/components/Lookup.test.jsx
index bec3e1369a..5b1d5233cf 100644
--- a/__tests__/components/Lookup.test.jsx
+++ b/__tests__/components/Lookup.test.jsx
@@ -13,7 +13,7 @@ describe('', () => {
name="fooBar"
value={mockData}
onLookupSave={() => { }}
- getEndpoint={() => { }}
+ getItems={() => { }}
/>
);
@@ -26,7 +26,7 @@ describe('', () => {
name="fooBar"
value={mockData}
onLookupSave={() => { }}
- getEndpoint={() => ({ data: { results: [{ name: 'test instance', id: 1 }] } })}
+ getItems={() => ({ data: { results: [{ name: 'test instance', id: 1 }] } })}
/>
).find('Lookup');
@@ -46,7 +46,7 @@ describe('', () => {
name="fooBar"
value={mockSelected}
onLookupSave={() => { }}
- getEndpoint={() => { }}
+ getItems={() => { }}
/>
).find('Lookup');
@@ -71,7 +71,7 @@ describe('', () => {
name="fooBar"
value={mockSelected}
onLookupSave={() => { }}
- getEndpoint={() => ({ data: { results: [{ name: 'test instance', id: 1 }] } })}
+ getItems={() => ({ data: { results: [{ name: 'test instance', id: 1 }] } })}
/>
);
@@ -93,7 +93,7 @@ describe('', () => {
name="fooBar"
value={mockData}
onLookupSave={() => { }}
- getEndpoint={() => { }}
+ getItems={() => { }}
/>
);
@@ -154,7 +154,7 @@ describe('', () => {
name="fooBar"
value={mockData}
onLookupSave={onLookupSaveFn}
- getEndpoint={() => { }}
+ getItems={() => { }}
/>
).find('Lookup');
diff --git a/src/components/Lookup/Lookup.jsx b/src/components/Lookup/Lookup.jsx
index 6a1c8962ad..bfa2c1e656 100644
--- a/src/components/Lookup/Lookup.jsx
+++ b/src/components/Lookup/Lookup.jsx
@@ -50,13 +50,13 @@ class Lookup extends React.Component {
}
async getData (queryParams) {
- const { getEndpoint } = this.props;
+ const { getItems } = this.props;
const { page } = queryParams;
this.setState({ error: false });
try {
- const { data } = await getEndpoint(queryParams);
+ const { data } = await getItems(queryParams);
const { results, count } = data;
const stateToUpdate = {
@@ -150,7 +150,7 @@ class Lookup extends React.Component {
]}
>
- {(results.length === 0) && (
+ {(results.length === 0) ? (
@@ -160,7 +160,7 @@ class Lookup extends React.Component {
{`Please add ${lookupHeader.toLowerCase()} to populate this list`}
- ) || (
+ ) : (
{results.map(i => (
diff --git a/src/pages/Organizations/screens/OrganizationAdd.jsx b/src/pages/Organizations/screens/OrganizationAdd.jsx
index fda1b0fe3f..6a8ad53559 100644
--- a/src/pages/Organizations/screens/OrganizationAdd.jsx
+++ b/src/pages/Organizations/screens/OrganizationAdd.jsx
@@ -16,14 +16,6 @@ import Lookup from '../../../components/Lookup';
import AnsibleSelect from '../../../components/AnsibleSelect';
import FormActionGroup from '../../../components/FormActionGroup';
-const initialFormState = {
- name: '',
- description: '',
- custom_virtualenv: '',
- instanceGroups: [],
- error: '',
-};
-
class OrganizationAdd extends React.Component {
constructor (props) {
super(props);
@@ -34,9 +26,15 @@ class OrganizationAdd extends React.Component {
this.onSubmit = this.onSubmit.bind(this);
this.onCancel = this.onCancel.bind(this);
this.onSuccess = this.onSuccess.bind(this);
- }
- state = initialFormState;
+ this.state = {
+ name: '',
+ description: '',
+ custom_virtualenv: '',
+ instanceGroups: [],
+ error: '',
+ };
+ }
onFieldChange (val, evt) {
this.setState({ [evt.target.name]: val || evt.target.value });
@@ -132,7 +130,7 @@ class OrganizationAdd extends React.Component {
name="instanceGroups"
value={instanceGroups}
onLookupSave={this.onLookupSave}
- getEndpoint={this.getInstanceGroups}
+ getItems={this.getInstanceGroups}
/>