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

View File

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

View File

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