diff --git a/src/api.js b/src/api.js index a88b9cf532..ce915bd136 100644 --- a/src/api.js +++ b/src/api.js @@ -74,13 +74,8 @@ class APIClient { return this.http.get(API_INSTANCE_GROUPS); } - createInstanceGroups (url, selected) { - if (selected.length > 0) { - selected.forEach(select => { - this.http.post(url, { id: select.id }); - }); - } - return false; + createInstanceGroups (url, id) { + return this.http.post(url, { id }); } } diff --git a/src/components/About.jsx b/src/components/About.jsx index 4155eb1866..0e8a07f09e 100644 --- a/src/components/About.jsx +++ b/src/components/About.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { I18n } from '@lingui/react'; import { Trans, t } from '@lingui/macro'; import { @@ -87,9 +86,4 @@ class About extends React.Component { } } -About.contextTypes = { - ansible_version: PropTypes.string, - version: PropTypes.string, -}; - export default About; diff --git a/src/components/Lookup/Lookup.jsx b/src/components/Lookup/Lookup.jsx index f5caf047d4..1f81d632f3 100644 --- a/src/components/Lookup/Lookup.jsx +++ b/src/components/Lookup/Lookup.jsx @@ -58,7 +58,7 @@ class Lookup extends React.Component {
{this.wrapTags(this.props.data)}
diff --git a/src/pages/Organizations/screens/OrganizationAdd.jsx b/src/pages/Organizations/screens/OrganizationAdd.jsx index e61c3aa1a5..e13b6df20e 100644 --- a/src/pages/Organizations/screens/OrganizationAdd.jsx +++ b/src/pages/Organizations/screens/OrganizationAdd.jsx @@ -79,8 +79,12 @@ class OrganizationAdd extends React.Component { const url = response.related.instance_groups; const selected = this.state.results.filter(group => group.isChecked); try { - await api.createInstanceGroups(url, selected); - this.resetForm(); + if (selected.length > 0) { + selected.forEach( async (select) => { + await api.createInstanceGroups(url, select.id); + }); + this.resetForm(); + } } catch (err) { this.setState({ createInstanceGroupsError: err }) } finally { @@ -112,7 +116,7 @@ class OrganizationAdd extends React.Component { const { api } = this.props; try { const { data } = await api.getInstanceGroups(); - this.format(data); + const results = this.format(data); this.setState({ results }); } catch (error) { this.setState({ getInstanceGroupsError: error }) @@ -159,7 +163,7 @@ class OrganizationAdd extends React.Component {