1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

improve org form input ids

This commit is contained in:
Keith Grant 2019-04-03 09:13:26 -04:00
parent 3f2cc53992
commit 0c63a57418
3 changed files with 14 additions and 6 deletions

View File

@ -157,7 +157,7 @@ class Lookup extends React.Component {
sortedColumnKey,
sortOrder
} = this.state;
const { lookupHeader = 'items', value, columns } = this.props;
const { id, lookupHeader = 'items', value, columns } = this.props;
const chips = value ? (
<div className="pf-c-chip-group">
@ -173,7 +173,12 @@ class Lookup extends React.Component {
<I18n>
{({ i18n }) => (
<div className="pf-c-input-group awx-lookup">
<Button className="pf-c-input-group__text" aria-label="search" id="search" onClick={this.handleModalToggle}>
<Button
className="pf-c-input-group__text"
aria-label="search"
id={id}
onClick={this.handleModalToggle}
>
<SearchIcon />
</Button>
<div className="pf-c-form-control">{chips}</div>
@ -248,6 +253,7 @@ class Lookup extends React.Component {
}
Lookup.propTypes = {
id: PropTypes.string,
getItems: PropTypes.func.isRequired,
lookupHeader: PropTypes.string,
name: PropTypes.string,
@ -256,6 +262,7 @@ Lookup.propTypes = {
};
Lookup.defaultProps = {
id: 'lookup-search',
lookupHeader: 'items',
name: null,
};

View File

@ -49,9 +49,10 @@ class InstanceGroupsLookup extends React.Component {
}
</Fragment>
)}
fieldId="add-org-form-instance-groups"
fieldId="org-instance-groups"
>
<Lookup
id="org-instance-groups"
lookupHeader={i18n._(t`Instance Groups`)}
name="instanceGroups"
value={value}

View File

@ -99,7 +99,7 @@ class OrganizationForm extends Component {
<Form autoComplete="off" onSubmit={formik.handleSubmit}>
<FormRow>
<FormField
id="edit-org-form-name"
id="org-name"
name="name"
type="text"
label={i18n._(t`Name`)}
@ -107,7 +107,7 @@ class OrganizationForm extends Component {
isRequired
/>
<FormField
id="edit-org-form-description"
id="org-description"
name="description"
type="text"
label={i18n._(t`Description`)}
@ -119,7 +119,7 @@ class OrganizationForm extends Component {
name="custom_virtualenv"
render={({ field }) => (
<FormGroup
fieldId="edit-org-custom-virtualenv"
fieldId="org-custom-virtualenv"
label={i18n._(t`Ansible Environment`)}
>
<AnsibleSelect