mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Address review feedback.
This commit is contained in:
parent
e8fe6fe33c
commit
fc32cf026f
@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -58,7 +58,7 @@ class Lookup extends React.Component {
|
||||
<div className="pf-c-form-control">{this.wrapTags(this.props.data)}</div>
|
||||
<Modal
|
||||
className="awx-c-modal"
|
||||
title={`Select ${this.props.lookup_header}`}
|
||||
title={`Select ${this.props.lookupHeader}`}
|
||||
isOpen={isModalOpen}
|
||||
onClose={this.handleModalToggle}
|
||||
>
|
||||
|
||||
@ -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 {
|
||||
</FormGroup>
|
||||
<FormGroup label="Instance Groups" fieldId="simple-form-instance-groups">
|
||||
<Lookup
|
||||
lookup_header="Instance Groups"
|
||||
lookupHeader="Instance Groups"
|
||||
lookupChange={this.onLookupChange}
|
||||
data={results}
|
||||
/>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user